diff --git a/Demos/1050_pydemo23.txt b/Demos/1050_pydemo23.txt new file mode 100644 index 00000000..8ee57950 --- /dev/null +++ b/Demos/1050_pydemo23.txt @@ -0,0 +1,427 @@ +program PyDemo2; + +//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas +//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine +//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine + +//interface + +{uses + Classes, SysUtils, + Windows, Messages, Graphics, Controls, Forms, Dialogs, + StdCtrls, ComCtrls, ExtCtrls, + PythonEngine, Vcl.PythonGUIInputOutput; } + +type + TForm1 = TForm; + var + PythonEngine1: TPythonEngine; + PythonModule1: TPythonModule; + PythonType1: TPythonType ; + aMemo2: TMemo; + Panel1: TPanel; + Button1: TButton; + Splitter1: TSplitter; + Button2: TButton; + Button3: TButton; + OpenDialog1: TOpenDialog; + SaveDialog1: TSaveDialog; + PythonGUIInputOutput1: TPythonGUIInputOutput; + aMemo1: TMemo; + procedure TForm1Button1Click(Sender: TObject); forward; + procedure TForm1Button2Click(Sender: TObject); forward; + procedure TForm1Button3Click(Sender: TObject); forward; + //private + { D�clarations priv�es } + //public + { D�clarations publiques } + //end; + +const PYDLLNAME = 'python36_.dll'; + PSCRIPTNAME = 'initpy.py'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYSCRIPT = 'C:\maXbox\mX47464\maxbox4\1046_openweather.py'; + PYSCRIPT2 = 'C:\maXbox\mX47464\maxbox4\mygauss.py'; + LB = CR+LF; + + +const PyModule = + 'def printData(data): '+#13#10+ + ' return data+data+"/n"'; + +const PYCMD = 'print("this is box")'+LB+ + 'import sys'+LB+ + 'f=open(r"C:\maXbox\mX47464\maxbox4\pytest2.txt","w")'+LB+ + 'f.write("Hello PyWorld_mX4, \n")'+LB+ + 'f.write("This data will be written on the file.")'+LB+ + 'f.close()'; + +var + Form1: TForm1; + +//implementation + +//{$R *.DFM} + +procedure TForm1Button1Click(Sender: TObject); +var + //aResult : PPyObject; + codstr: TStrings; +begin + codstr:= TStringlist.create; + with PythonEngine1 do begin + //UseLastKnownVersion := true; + //AutoFinalize:= False; + //dllpath:= PyHOME; + //dllname:= PYDLLNAME; + try + //unloadDLL; + loadDLL; + //unloadDLL; + //openDLL(Pyhome+pydllname) + writeln('IsHandleValid_after: '+botostr(IsHandleValid)); + except + writeln('dll EXCEPT '+ExceptionToString(ExceptionType,ExceptionParam)); + //free; + finally + free; + end; + // DllPath := '/usr/lib/x86_64-linux-gnu'; + // DllName := 'libpython3.9.so.1.0'; + {Result := EvalStrings( Memo1.Lines ); + if Assigned(Result) then + begin + ShowMessage(Format('Eval: %s',[PyObjectAsString(Result)])); + Py_DECREF(Result); + end + else } + // ShowMessage('Could not evaluate the script'); + // Or you could simply use: + //Writeln('Eval: ' + EvalStringsAsStr( aMemo1.Lines ) ); + codstr.text:= '2+3'; + writeln(botostr(CheckEvalSyntax(codstr.text))); + //Writeln('Eval: ' + EvalStringsAsStr(codstr)); + //free; + end; + codstr.Free; +end; + +procedure TForm1CreatePythonComponents; +begin + {if cbPyVersions.ItemIndex <0 then begin + ShowMessage('No Python version is selected'); + Exit; + end;} + + // Destroy P4D components + { + FreeAndNil(PythonEngine1); + FreeAndNil(PythonType1); + FreeAndNil(PythonModule1); } + if assigned(PythonEngine1) then PythonEngine1.free; + if assigned(PythonModule1) then PythonModule1.free; + if assigned(PythonType1) then PythonType1.free; + + { TPythonEngine } + PythonEngine1 := TPythonEngine.Create(Self); + //writeln('mapdll EXCEPT '+ExceptionToString(ExceptionType,ExceptionParam)); + PythonEngine1.pythonhome:= PYHOME; + PythonEngine1.dllpath:= PyHOME; + PythonEngine1.dllname:= PYDLLNAME; + //PyVersions[cbPyVersions.ItemIndex].AssignTo(PythonEngine1); + + PythonEngine1.IO := PythonGUIInputOutput1; + + { TPythonModule } + PythonModule1 := TPythonModule.Create(Self); + + //PythonModule1.Name := 'PythonModule1'; + PythonModule1.Engine := PythonEngine1; + PythonModule1.ModuleName := 'spam'; + with PythonModule1.Errors.Add do begin + Name := 'PointError'; + ErrorType := etClass; + end; + with PythonModule1.Errors.Add do begin + Name := 'EBadPoint'; + ErrorType := etClass; + ParentClass.Name := 'PointError'; + end; + + { TPythonType } + PythonType1 := TPythonType.Create; + + PythonType1.Name := 'PythonType1'; + PythonType1.Engine := PythonEngine1; + //PythonType1.OnInitialization := PythonType1Initialization; + PythonType1.TypeName := 'Point'; + PythonType1.Prefix := 'Create'; + PythonType1.Services.Basic := [pbsRepr,pbsStr,pbsGetAttrO,pbsSetAttrO]; + //PythonType1.TypeFlags := + //[tpfHaveGetCharBuffer,tpfHaveSequenceIn,tpfHaveInplaceOps, + // [tpfHaveRichCompare,tpfHaveWeakRefs,tpfHaveIter,tpfHaveClass,tpfBaseType]; + PythonType1.Module := PythonModule1; + try + PythonEngine1.LoadDll; + except + writeln('mapdll EXCEPT '+ExceptionToString(ExceptionType,ExceptionParam)); + end; + PythonEngine1.free; +end; + + +procedure TForm1Button2Click(Sender: TObject); +begin + with OpenDialog1 do + begin + if Execute then + aMemo1.Lines.LoadFromFile( FileName ); + end; //} +end; + +procedure TForm1Button3Click(Sender: TObject); +begin + with SaveDialog1 do + begin + if Execute then + aMemo1.Lines.SaveToFile( FileName ); + end; +end; + +procedure createPYEngine; +begin + +//object PythonEngine1: TPythonEngine + PythonGUIInputOutput1:= TPythonGUIInputOutput.create(nil) + PythonEngine1:= TPythonEngine.create(nil) + + PythonEngine1.IO := PythonGUIInputOutput1 + OpenDialog1:= TOpenDialog.create(self); + with opendialog1 do begin + DefaultExt := '*.py' + Filter := 'Python files|*.py|Text files|*.txt|All files|*.*' + //Left = 176 + end; + {object SaveDialog1: TSaveDialog + DefaultExt = '*.py' + Filter = 'Python files|*.py|Text files|*.txt|All files|*.*' + Left = 208 + end } + //PythonGUIInputOutput1:= TPythonGUIInputOutput.create(self) + with PythonGUIInputOutput1 do begin + UnicodeIO:= False + RawOutput:= False + Output:= Memo2 + //Left = 64 + end; + end; + +var myloadscript, myloadscript2: string; + PyForm: TForm; pyMemo: TMemo; + +//C:\Users\Max\AppData\Local\Programs\Python\Python37\ +// 55.150 kB +//C:\Users\max\AppData\Local\Programs\Python\Python36-32 + +{ +procedure TDynamicDll.LoadDll; +begin + OpenDll( DllName ); +end; } + +{On 64-bit Windows the 32-bit python27.dll is really in C:\Windows\sysWOW64. But if you try opening the C:\Windows\system32\python27.dll in a 32-bit process, it'll open just fine. If I'm not mistaken, WOW stands for Woodoo Of Windows. ;-) � + +Exception: : SRE module mismatch. +Make sure you do not have any mismatch between Python interpreter version used (like 3.7) and the 're' python module (like 3.6.1). + + The resolution of DLLs has changed in Python 3.8 for Windows. + + New in version 3.8: Previous versions of CPython would resolve DLLs using the default behavior for the current process. This led to inconsistencies, such as only sometimes searching PATH or the current working directory, and OS functions such as AddDllDirectory having no effect. +} + +Procedure PYLaz_P4D_Demo; +//https://wiki.freepascal.org/Python4Delphi +var eng : TPythonEngine; + Out1: TPythonGUIInputOutput; +begin + eng := TPythonEngine.Create(Nil); + Out1:= TPythonGUIInputOutput.create(nil) + Out1.output:= pyMemo; //debugout.output; //memo2; + Out1.RawOutput:= False; + Out1.UnicodeIO:= False; + Out1.maxlines:= 20; + Out1.writeline('draw the line'); + //eng.free; + //eng.LoadDll; + //eng.dllpath:= 'C:\Users\max\AppData\Local\Programs\Python\Python36_32'; + eng.pythonhome:= 'C:\Users\max\AppData\Local\Programs\Python\Python36_32'; + eng.dllpath:= 'C:\maXbox\EKON24' + eng.dllname:= 'python37.dll'; + eng.AutoLoad:= false; + //eng.UnloadDll; + //eng.loaddll; + try + eng.openDLL('C:\maXbox\EKON24\python37.dll'); + writeln('dllname '+eng.dllname) + writeln('dllpath '+eng.dllpath) + writeln('is x64 '+botostr(Isx64('C:\maXbox\EKON24\python37.dll'))); + writeln('is x64 '+botostr(Isx64('C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'))); + eng.IO:= Out1; + if eng.IsHandleValid then begin + writeln('DLLhandle: '+botostr(eng.IsHandleValid)) + WriteLn('evens: '+ eng.EvalStringAsStr('[x*2 for x in range(10)]')); + WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])')); + writeln('syncheck '+ + botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])'))); + eng.ExecString('print("powers:",[x**2 for x in range(10)])'); + eng.ExecString(PYCMD); + writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(myloadscript))); + writeln('ExecSynCheck2 '+ + botostr(eng.CheckExecSyntax(filetostring(PYSCRIPT2)))); + eng.ExecString(filetostring(PYSCRIPT2)); + WriteLn('workdir: '+ eng.EvalStr('__import__("os").getcwd()')); + WriteLn('sysdir: '+ eng.EvalStr('__import__("sys").path')); + //WriteLn('pathlib: '+eng.EvalStr('__import__("pathlib").Path(__file__).parent.absolute')); + //from pathlib import Path - print(Path.cwd()) + //WriteLn('oslib: '+eng.EvalStr('__import__("pathlib").os')); + + //eval('exec("import uuid") or str(uuid.uuid4())') + + //WriteLn('exec: '+eng.EvalStr('exec("import numpy as np")')); + WriteLn('exec as eval: '+eng.EvalStr('exec("import os as o")')); + Println('exec: '+eng.EvalStr('o.getcwd()')); + //WriteLn('exec: '+eng.EvalStr('dir(o)')) + + //WriteLn('exec as eval: '+eng.EvalStr('exec("import numpy as np")')); + //WriteLn('exec as eval: '+eng.EvalStr('exec("import pandas as pd")')); + // WriteLn('exec as eval: '+eng.EvalStr('exec("import sklearn")')); + // WriteLn('eval: '+eng.EvalStr('sklearn.__version__')); + + writeln('uuid: '+eng.evalstr('exec("import uuid") or str(uuid.uuid4())')); + eng.ExecString('import math'); + WriteLn('evalexec: '+eng.EvalStr('dir(math)')); + + + //"exec('import whatever_you_want')" + + pymemo.update; + end + else writeln('invalid library handle! '+Getlasterrortext); + writeln('PythonOK '+botostr(PythonOK)); + //out1.free; + //pyImport(PyModule); + except + eng.raiseError; + writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam)); + //eng.error + finally + eng.free; + end; + //eng.free; +end; + +//https://stackoverflow.com/questions/67759582/find-correct-python4delphi-tpythonengine-parameters + +{$DEFINE MSWINDOWS} + +procedure TPythonEngineConfigSetPythonengineValues(PythonEngine + : TPythonEngine); +var + FPyVersions: TPythonVersions; + var self: TPythonEngine; +begin + /// + /// convert this https://github.com/pyscripter/python4delphi/wiki/FindingPython + /// into a small automatic setting of parameter + /// + + PythonEngine.UseLastKnownVersion := Self.UseLastKnownVersion; + if Self.UseLastKnownVersion then + begin +{$IFDEF MSWINDOWS} + FPyVersions := GetRegisteredPythonVersions; + FPyVersions[0].AssignTo(PythonEngine); +{$ENDIF} +{$IFDEF LINUX} + /// not supported on LINUX + /// https://en.delphipraxis.net/topic/4700-getregisteredpythonversions-for-linux/ +{$ENDIF} + end + else + //var self: TPythonEngine; + begin + self:= TPythonEngine(PythonEngine); + PythonEngine.APIVersion := self.APIVersion ; + PythonEngine.DllName := Self.DllName; + PythonEngine.DllPath := Self.DllPath; + PythonEngine.AutoFinalize := Self.AutoFinalize; + PythonEngine.AutoLoad := Self.AutoLoad; + PythonEngine.AutoUnload := Self.AutoUnload; + PythonEngine.RedirectIO := Self.RedirectIO; + PythonEngine.UseWindowsConsole := Self.UseWindowsConsole; + PythonEngine.RegVersion := Self.RegVersion; + end; +end; + + var OriginalOwner: TPythonEngine; + + +begin //@main + + { createPYEngine; + TForm1Button1Click(self)} + + //TForm1CreatePythonComponents; + {OriginalOwner := GetPythonEngine; //.Owner; + GetPythonEngine.Free; + TPythonEngine.Create(OriginalOwner); } + //GetPythonEngine.Free; + {writeln('PythonOK '+botostr(PythonOK)); + try + pyImport(PYSCRIPT) + except + writeln('ImportEXCEPT '+ExceptionToString(ExceptionType,ExceptionParam)); + end; } + + //PythonEngine1.Free; + + myloadscript:= filetostring(PYSCRIPT); + myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(300,200, clgreen, 'PyFrm4D'); + pyMemo:= TMemo.create(PyForm); + pyMemo.parent:= PyForm + PyForm.show; + + PYLaz_P4D_Demo; + + //PyForm.show; + +End. +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. + +Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before. + +Ref: + +-------------------------------------------------------- +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. +PascalScript maXbox4 - RemObjects & SynEdit + +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. + +dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E. +TRUE +Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD. + +mapdll EXCEPT Exception: There is already one instance of TPythonEngine running. +PythonOK TRUE +ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC. + mX4 executed: 26/07/2021 13:30:51 Runtime: 0:0:2.48 Memload: 71% use \ No newline at end of file diff --git a/Demos/1050_pydemo_5_powerliners23.txt b/Demos/1050_pydemo_5_powerliners23.txt new file mode 100644 index 00000000..f5100efe --- /dev/null +++ b/Demos/1050_pydemo_5_powerliners23.txt @@ -0,0 +1,292 @@ +Program PyDemo5_Eval_Exec5_Powerliners23; + +//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas +//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine +//https://thepythonguru.com/python-builtin-functions/eval/ +//https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/ +//https://stackoverflow.com/questions/359498/how-can-i-unload-a-dll-using-ctypes-in-python +//https://levelup.gitconnected.com/5-powerful-python-one-liners-you-should-know-469b9c4737c7 + +//interface - customize your PY environment first +{uses + Classes, SysUtils, + Windows, Messages, Graphics, Controls, Forms, Dialogs, + StdCtrls, ComCtrls, ExtCtrls, + PythonEngine, Vcl.PythonGUIInputOutput, PythonVersions.pas ; } + +{procedure PyFinalize(); + external + 'Py_Finalize@C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll stdcall'; } +//Note: modify PYHOME and PYDLL : + +const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py'; + LB = CR+LF; + +const PyModule = + 'def printData(data): '+#13#10+ + ' return data+data+"/n"'; + +const PYCMD = 'print("this is box")'+LB+ + 'import sys'+LB+ + 'f=open(r"1050pytest21_5powers.txt","w")'+LB+ + 'f.write("Hello PyWorld_mX47580, \n")'+LB+ + 'f.write("This data will be written on the file.")'+LB+ + 'f.close()'; + +var myloadscript: string; + PyForm: TForm; pyMemo: TMemo; + avar: string; pyval: variant; pyint: integer; + +Procedure PYLaz_P4D_Demo2; +//https://wiki.freepascal.org/Python4Delphi +var eng : TPythonEngine; + Out1: TPythonGUIInputOutput; + pystrings: TStrings; +begin + eng:= TPythonEngine.Create(Nil); + Out1:= TPythonGUIInputOutput.create(nil) + Out1.output:= pyMemo; //debugout.output; or memo2; + Out1.RawOutput:= False; + Out1.UnicodeIO:= False; + Out1.maxlines:= 20; + out1.displaystring('this string thing draw the line') + + writeln(botostr(Isx64(PYDLL))); + //writeln(botostr(Isx64(pydllpath2))); + //eng.dllpath:= exepath; + //eng.dllname:='python37.dll'; + eng.pythonhome:= PYHOME; + try + //pymod.InitializeForNewInterpreter; //} + //pymod.engine:= eng; + eng.opendll(PYDLL) + //eng.loadDLL; + eng.IO:= Out1; + eng.AutoFinalize:= True; + //eng.AutoUnload:= false; + writeln(eng.dllname); + //pymod.engine:= eng; + if eng.IsHandleValid then begin + writeln('DLLhandle: '+botostr(eng.IsHandleValid)) + WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]')); + WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])')); + WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])')); + WriteLn('mathstr: '+ eng.EvalStr('"py " * 7')); + //WriteLn('builtins: '+ eng.EvalStr('dir(__builtins__)')); + WriteLn('upperstr: '+ eng.EvalStr('"hello again".upper()')); + pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("os").getcwd()')); + writeln('syncheck '+ + botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])'))); + + WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))')); + WriteLn('powerline2: '+ + eng.EvalStr('list(map(float,["1",2,"3.0",4.0,"5",6]))')); + eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))'); + WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)')); + + eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]'); + eng.Execstring('transpose_A = [list(i) for i in zip(*A)]'); + WriteLn('powerline4: '+ eng.EvalStr('transpose_A')); + + //We can use dictionary comprehension to swap key-value pairs. + eng.Execstring('staff={"Data Scientist":"John","Django Developer":"Max"}'); + WriteLn('powerline5: '+ eng.EvalStr('{i:j for j, i in staff.items()}')); + eng.ExecString('print("powers:",[x**2 for x in range(10)])'); + writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(PYCMD))); + eng.ExecString(PYCMD); + + { pystrings:= TStringlist.create; + pystrings.add('import matplotlib.pyplot as plt') + pystrings.add('import numpy as np') + pystrings.add('np.arange(5, 24, 3)') + pystrings.add('fig, ax = plt.subplots(dpi=153)') + pystrings.add('plt.plot([1,2,3,4,5,6], [1,2,3,4,9,5], "go")') + pystrings.add('plt.show()') + eng.ExecStrings4(pystrings); + pystrings.free; } + + (* eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "sympy"])') + eng.ExecString('from sympy import *'); + eng.ExecString('from sympy.plotting import plot'); + writeln(eng.EvalStr('list(primerange(7, 150))')); + writeln(eng.EvalStr('sum(list(primerange(0, 100)))')); + writeln(eng.EvalStr('(list(primerange(0, 101)))')); + writeln(eng.EvalStr('len(list(primerange(0, 101)))')); + //https://www.tutorialspoint.com/sympy/sympy_solvers.htm + avar:= '-2'; + eng.ExecString('x=Symbol("x")'); + eng.ExecString('x,y=symbols("x y")'); + writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)')); + writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)')); + writeln(eng.EvalStr('solveset(exp(x),x)')); + println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))')); + *) + + //eng.ExecString('plot(x**'+avar+', line_color="red")'); + //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))'); + { + eng.ExecString('from sympy.plotting import plot3d'); + eng.ExecString('x,y=symbols("x y") '); + eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); } + + WriteLn('powerline6: '+ eng.EvalStr('len(str(2**4096))')); + pymemo.lines.add('Decimal: '+ + eng.EvalStr('__import__("decimal").Decimal((0,(3,1,4),-2))')); + pymemo.lines.add('Decimal: '+ + eng.EvalStr('__import__("decimal").Decimal(0.1)')); + //eng.ExecString('from spacy import *'); + + pyval:= VarPythonEval('sum([x for x in range(201)])'); + //writeln('evalvar '+botostr(VarIsPythonList(pyval))); + writeln('evalvar '+botostr(VarIsnumeric(pyval))); + pyval:= NewPythonDict; + writeln(botostr(VarIsPython( pyval))); + pyval := (VarPythonEval('2 ** 3')); + { eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "langdetect"])') + eng.ExecString('from langdetect import detect'); + println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")')); + } + pymemo.update; + end + else writeln('invalid library handle! '+Getlasterrortext); + println('PythonOK: '+botostr(PythonOK)); + except + eng.raiseError; + writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam)); + //PyErr Exception: Access violation at address 50F49DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000022. + finally + //eng.close + eng.unloaddll; + //PyFinalize(); + eng.free; + //PyFinalize(); + end; + out1.free; + //pyImport(PyModule); +end; + +begin //@main + //PythonEngine1.Free; + //myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(300,200, clgreen,'PyFrm4D'); + pyMemo:= TMemo.create(PyForm); + pyMemo.parent:= PyForm + PyForm.show; + + PYLaz_P4D_Demo2; + + //register_PYthonGUI; +End. +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + +doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191 + +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. +Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before. + +Evil eval() + +You should never pass untrusted source to the eval() directly. As it is quite easy for the malicious user to wreak havoc on your system. For example, the following code can be used to delete all the files from the system. + +1 >>> +2 eval('os.system("RM -RF /")') # command is deliberately capitalized +3 >>> + + +Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download +-------------------------------------------------------- +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. +PascalScript maXbox4 - RemObjects & SynEdit + +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. + +dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E. +TRUE +Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD. + +mapdll EXCEPT Exception: There is already one instance of TPythonEngine running. +PythonOK TRUE +ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC. + mX4 executed: 26/07/2021 13:30:51 Runtime: 0:0:2.48 Memload: 71% use + +Example 3: Python multithreading + +All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program. + + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) + +t1.start() +t2.start() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demos/1052_OoMiscpas2PyHTTPSServer2LAB.txt b/Demos/1052_OoMiscpas2PyHTTPSServer2LAB.txt new file mode 100644 index 00000000..45987406 --- /dev/null +++ b/Demos/1052_OoMiscpas2PyHTTPSServer2LAB.txt @@ -0,0 +1,4472 @@ +//program OOMISCPAS; +//https://raw.githubusercontent.com/TurboPack/AsyncPro/master/source/OoMisc.pas +(***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is TurboPower Async Professional + * + * The Initial Developer of the Original Code is + * TurboPower Software + * + * Portions created by the Initial Developer are Copyright (C) 1991-2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Sulaiman Mah + * Sean B. Durkin + * Sebastian Zierer + * + * ***** END LICENSE BLOCK ***** *) + +{*********************************************************} +{* OOMISC.PAS 5.00 *} +{*********************************************************} +{* Miscellaneous supporting methods and types *} +{*********************************************************} + +{ + OOMisc is our catch-all unit for supporting methods and definitions. + OOMisc is used by almost all APRO units, and is automatically included + in the uses clause when an APRO component is dropped on a form. + The APRO base classes are defined here also. + A bit of APRO trivia: OOMisc stands for "Object Oriented Miscellaneous", + and was introduced in the early DOS days. +} + +{Global defines potentially affecting this unit} +//{$I AWDEFINE.INC} + +unit OoMisc_mX4_Python_LAB; + {-Unit for miscellaneous routines, INCOMPLETE!} + +interface + +{uses + Windows, + Classes, + Controls, + ShellAPI, + OleCtrls, + Forms, + Graphics, + MMSystem, + SysUtils, + Messages; } + +const + ApVersionStr = 'v5.00'; + {$IFDEF Apax} + ApaxVersionStr = 'v1.14'; // SWB + {$ENDIF} + + { Product name} + ApdProductName = 'Async Professional'; + ApdShortProductName = 'APRO'; + + ApdVendor = 'TurboPower Software Company'; + ApdVendorURL = 'http://www.turbopower.com/'; + + { Version numbers } + ApdXSLImplementation = 0.0; + ApdXMLSpecification = '1.0'; + + fsPathName = 255; + fsDirectory = 255; + fsFileName = 255; + fsExtension = 255; + fsName = 255; + + {shareable reading file mode} + ApdShareFileRead = $40; + +const + { Printer driver consts } + ApdDefFileName = 'C:\DEFAULT.APF'; + ApdPipeTimeout = 5000; { ms } + ApdPipeName = '\\.\pipe\ApFaxCnv'; + ApdSemaphoreName = 'ApFaxCnvSem'; + ApdRegKey = '\SOFTWARE\TurboPower\ApFaxCnv\Settings'; + ApdIniFileName = 'APFPDENG.INI'; + ApdIniSection = 'Settings'; + ApdIniKey = 'AutoExec'; + ApdDef32PrinterName = 'APF Fax Printer'; + ApdDef16PrinterName = 'Print To Fax'; + ApdDefPrinterPort = 'PRINTFAX'; + + ApdDefaultTerminalName = ''; + ApdNoTerminalName = ''; + + + {Event codes: (inbound)} + eNull = 0; + eStartDoc = 1; + eEndDoc = 2; + + {Event codes: (outbound)} + eSetFileName = 3; + +type + TPipeEvent = record + Event : Byte; + Data : ShortString; + end; + { XML definitions } + aDOMString = WideString; +type + aCharSet = set of AnsiChar; + + TPassString = string; //[255]; + TApdHwnd = HWND; + + + {Standard event timer record structure used by all timing routines} + EventTimer = record + StartTicks : Integer; {Tick count when timer was initialized} + ExpireTicks : Integer; {Tick count when timer will expire} + end; + +{$IFNDEF PRNDRV} {!!.06} +type{ moved from AdTapi.pas } {!!.06} + { TAPI device config record, opaque and undefined by definition } {!!.06} + //PTapiConfigRec = ^TTapiConfigRec; {!!.06} + TTapiConfigRec = record {!!.06} + DataSize : Cardinal; {!!.06} + Data : array[0..1023] of Byte; {!!.06} + end; + +{ moved from AdRasUtl.pas } {!!.06} +const {RasMaximum buffer sizes} {!!.06} + RasMaxDomain = 15; {!!.06} + RasMaxPassword = 256; {!!.06} + RasMaxUserName = 256; {!!.06} + RasMaxEntryName = 256; {!!.06} + RasMaxPhoneBook = 256; {!!.06} + RasMaxError = 256; {!!.06} + RasMaxEntries = 64; {!!.06} + RasMaxDeviceName = 128; {!!.06} + RasMaxDeviceType = 16; {!!.06} + RasMaxPhoneNumber = 128; {!!.06} + RasMaxCallBackNum = 128; {!!.06} + RasMaxAreaCode = 10; {!!.06} + RasMaxPadType = 32; {!!.06} + RasMaxX25Address = 200; {!!.06} + RasMaxIPAddress = 15; {!!.06} + RasMaxIPXAddress = 21; {!!.06} + RasMaxFacilities = 200; {!!.06} + RasMaxUserData = 200; {!!.06} + +type { moved from AdRasUtl.pas } {!!.06} + {RAS IP address - "a.b.c.d"} {!!.06} + //PRasIPAddr = ^TRasIPAddr; {!!.06} + TRasIPAddr = record {!!.06} + a : byte; {!!.06} + b : byte; {!!.06} + c : byte; {!!.06} + d : byte; {!!.06} + end; {!!.06} + +type { moved from AdRasUtl.pas } {!!.06} + {RAS phonebook entry properties} {!!.06} + {!!.06} {Renamed fields to sync with underlying RASENTRY structure } + { dwOptions -> dwfOptions, dwAlternatesOffset -> dwAlternateOffset, } + { dwNetProtocols -> dwfNetProtocols } + //PRasEntry = ^TRasEntry; {!!.06} + TRasEntry = record {!!.06} + dwSize : DWord; {!!.06} + dwfOptions : DWord; {!!.06} + dwCountryID : DWord; {!!.06} + dwCountryCode : DWord; {!!.06} + szAreaCode : array[0..RasMaxAreaCode] of char; {!!.06} // tchar + szLocalPhoneNumber : array[0..RasMaxPhoneNumber] of char; {!!.06} // tchar + dwAlternateOffset : DWord; {!!.06} + IPAddr : TRasIPAddr; {!!.06} + IPAddrDns : TRasIPAddr; {!!.06} + IPAddrDnsAlt : TRasIPAddr; {!!.06} + IPAddrWins : TRasIPAddr; {!!.06} + IPAddrWinsAlt : TRasIPAddr; {!!.06} + dwFrameSize : DWord; {!!.06} + dwfNetProtocols : DWord; {!!.06} + dwFramingProtocol : DWord; {!!.06} + szScript : array[0..Max_PATH-1] of char; {!!.06} // --SZ TCHAR in ras.h, so use char here + szAutodialDll : array[0..Max_PATH-1] of char; {!!.06} + szAutodialFunc : array[0..Max_PATH-1] of char; {!!.06} + szDeviceType : array[0..RasMaxDeviceType] of char; {!!.06} + szDeviceName : array[0..RasMaxDeviceName] of char; {!!.06} + szX25PadType : array[0..RasMaxPadType] of char; {!!.06} + szX25Address : array[0..RasMaxX25Address] of char; {!!.06} + szX25Facilities : array[0..RasMaxFacilities] of char; {!!.06} + szX25UserData : array[0..RasMaxUserData] of char; {!!.06} + dwChannels : DWord; {!!.06} + dwReserved1 : DWord; {!!.06} + dwReserved2 : DWord; {!!.06} + end; {!!.06} + +const {RASENTRY 'dwfOptions' bit flags} {!!.06} + RASEO_UseCountryAndAreaCodes = $00000001; {!!.06} + RASEO_SpecificIpAddr = $00000002; {!!.06} + RASEO_SpecificNameServers = $00000004; {!!.06} + RASEO_IpHeaderCompression = $00000008; {!!.06} + RASEO_RemoteDefaultGateway = $00000010; {!!.06} + RASEO_DisableLcpExtensions = $00000020; {!!.06} + RASEO_TerminalBeforeDial = $00000040; {!!.06} + RASEO_TerminalAfterDial = $00000080; {!!.06} + RASEO_ModemLights = $00000100; {!!.06} + RASEO_SwCompression = $00000200; {!!.06} + RASEO_RequireEncryptedPw = $00000400; {!!.06} + RASEO_RequireMsEncryptedPw = $00000800; {!!.06} + RASEO_RequireDataEncryption = $00001000; {!!.06} + RASEO_NetworkLogon = $00002000; {!!.06} + RASEO_UseLogonCredentials = $00004000; {!!.06} + RASEO_PromoteAlternates = $00008000; {!!.06} + RASEO_SecureLocalFiles = $00010000; {!!.06} + RASEO_RequireEAP = $00020000; {!!.06} + RASEO_RequirePAP = $00040000; {!!.06} + RASEO_RequireSPAP = $00080000; {!!.06} + RASEO_Custom = $00100000; {!!.06} + RASEO_PreviewPhoneNumber = $00200000; {!!.06} + RASEO_SharedPhoneNumbers = $00800000; {!!.06} + RASEO_PreviewUserPw = $01000000; {!!.06} + RASEO_PreviewDomain = $02000000; {!!.06} + RASEO_ShowDialingProgress = $04000000; {!!.06} + RASEO_RequireCHAP = $08000000; {!!.06} + RASEO_RequireMsCHAP = $10000000; {!!.06} + RASEO_RequireMsCHAP2 = $20000000; {!!.06} + RASEO_RequireW95MSCHAP = $40000000; {!!.06} + RASEO_CustomScript = $80000000; {!!.06} + + {RASENTRY 'dwfNetProtocols' bit flags} {!!.06} + RASNP_NetBEUI = $00000001; {!!.06} + RASNP_Ipx = $00000002; {!!.06} + RASNP_Ip = $00000004; {!!.06} + + {RASENTRY 'dwFramingProtocols' bit flags} {!!.06} + RASFP_Ppp = $00000001; {!!.06} + RASFP_Slip = $00000002; {!!.06} + RASFP_Ras = $00000004; {!!.06} + + {RASENTRY 'szDeviceType' default strings} {!!.06} + RASDT_Modem = 'modem'; {!!.06} + RASDT_Isdn = 'isdn'; {!!.06} + RASDT_X25 = 'x25'; {!!.06} + RASDT_Vpn = 'vpn'; {!!.06} + RASDT_Pad = 'pad'; {!!.06} + RASDT_Generic = 'GENERIC'; {!!.06} + RASDT_Serial = 'SERIAL'; {!!.06} + RASDT_FrameRelay = 'FRAMERELAY'; {!!.06} + RASDT_Atm = 'ATM'; {!!.06} + RASDT_Sonet = 'SONET'; {!!.06} + RASDT_SW56 = 'SW56'; {!!.06} + RASDT_Irda = 'IRDA'; {!!.06} + RASDT_Parallel = 'PARALLEL'; {!!.06} + +type + //PRasStatistics = ^TRasStatistics; {!!.06} + TRasStatistics = record {!!.06} + dwSize : DWORD; {!!.06} + dwBytesXmited : DWORD; {!!.06} + dwBytesRcved : DWORD; {!!.06} + dwFramesXmited : DWORD; {!!.06} + dwFramesRcved : DWORD; {!!.06} + dwCrcErr : DWORD; {!!.06} + dwTimeoutErr : DWORD; {!!.06} + dwAlignmentErr : DWORD; {!!.06} + dwHardwareOverrunErr : DWORD; {!!.06} + dwFramingErr : DWORD; {!!.06} + dwBufferOverrunErr : DWORD; {!!.06} + dwCompressionRatioIn : DWORD; {!!.06} + dwCompressionRatioOut : DWORD; {!!.06} + dwBps : DWORD; {!!.06} + dwConnectDuration : DWORD; {!!.06} + end; {!!.06} +{$ENDIF} {!!.06} +const + {Compile-time configurations} + MaxComHandles = 50; {Max comm ports open at once} + DispatchBufferSize = 8192; {Size of each port's dispatch buffer} + MaxMessageLen = 80; {All error and status strings less than 80} + + {For skipping line parameter changes} + DontChangeBaud = 0; + DontChangeParity = SpaceParity + 1; + DontChangeDatabits = 9; + DontChangeStopbits = TwoStopbits + 1; + + {Modem status trigger options} + msCTSDelta = $0010; + msDSRDelta = $0020; + msRingDelta = $0004; + msDCDDelta = $0080; + + {Line status trigger options} + lsOverrun = $0001; + lsParity = $0002; + lsFraming = $0004; + lsBreak = $0008; + + {Line and driver errors} + leNoError = 0; {No error, ordinal value matches ecOK} + leBuffer = 1; {Buffer overrun in COMM.DRV} + leOverrun = 2; {UART receiver overrun} + leParity = 3; {UART receiver parity error} + leFraming = 4; {UART receiver framing error} + leCTSTO = 5; {Transmit timeout waiting for CTS} + leDSRTO = 6; {Transmit timeout waiting for DSR} + leDCDTO = 7; {Transmit timeout waiting for RLSD} + leTxFull = 8; {Transmit queue is full} + leBreak = 9; {Break condition received} + leIOError = 10; {Windows error. LastWinError contains the error code.} + + {Status trigger subtypes} + stNotActive = 0; {not active} + stModem = 1; {Trigger on modem status change} + stLine = 2; {Trigger on line status change} + stOutBuffFree = 3; {Trigger on outbuff free level} + stOutBuffUsed = 4; {Trigger on outbuff used level} + stOutSent = 5; {Trigger on any PutXxx call} + + {Next file method} + nfNone = 0; {No next file method specified} + nfMask = 1; {Use built-in next file mask method} + nfList = 2; {Use built-in next file list method} + + {Action to take if incoming file exists} + wfcWriteNone = 0; {No option set yet} + wfcWriteFail = 1; {Fail the open attempt} + wfcWriteRename = 2; {Rename the incoming file} + wfcWriteAnyway = 3; {Overwrite the existing file} + wfcWriteResume = 4; {Resume an interrupted receive} + + {Ascii CR/LF translation options} + aatNone = 0; {No CR/LF translations} + atStrip = 1; {Strip CRs or LFs} + atAddCRBefore = 2; {Add CR before each LF} + atAddLFAfter = 3; {Add LF after each CR} + //atEOFMarker : Ansichar = ^Z; {Add constant for standard EOF } + + {Protocol status start/end flags} + apFirstCall = $01; {Indicates the first call to status} + apLastCall = $02; {Indicates the last call to status} + + {For specifying log file calls} + lfReceiveStart = 0; {Receive starting} + lfReceiveOk = 1; {File received ok} + lfReceiveFail = 2; {File receive failed} + lfReceiveSkip = 3; {File was rejected by receiver} + lfTransmitStart = 4; {Transmit starting} + lfTransmitOk = 5; {File was transmitted ok} + lfTransmitFail = 6; {File transmit failed} + lfTransmitSkip = 7; {File was skipped, rejected by receiver} + +type + {Convenient types used by protocols} + TNameCharArray = array[0..fsFileName ] of AnsiChar; //SZ used by protocols --> Ansi + TExtCharArray = array[0..fsExtension] of AnsiChar; + TPathCharArray = array[0..fsPathName ] of Char; + TPathCharArrayA = array[0..fsPathName ] of AnsiChar; //SZ FIXME can this be changed to Char?? + TDirCharArray = array[0..fsDirectory] of AnsiChar; + TChar20Array = array[0..20] of AnsiChar; + aTCharArray = array[0..255] of AnsiChar; + + {For generic buffer typecasts} + //PByteBuffer = ^TByteBuffer; + TByteBuffer = array[1..65535] of Byte; + + {Port characteristic constants} + //aTDatabits = 5..DontChangeDatabits; + //TStopbits = 1..DontChangeStopbits; + + {NotifyProc type, same as a window procedure} + TApdNotifyProc = procedure(Msg, wParam : Cardinal; + lParam : Integer); + TApdNotifyEvent = procedure(Msg, wParam : Cardinal; + lParam : Integer); // of object; +const + {Avoid requiring WIN31} + ev_CTSS = $0400; {CTS state} + ev_DSRS = $0800; {DSR state} + ev_RLSDS = $1000; {RLSD state} + ev_RingTe = $2000; {Ring trailing edge indicator} + +const + {MSRShadow register from COMM.DRV} + MsrShadowOfs = 35; {Offset of MSRShadow from EventWord} + +const + {Modem status bit masks} + DeltaCTSMask = $01; {CTS changed since last read} + DeltaDSRMask = $02; {DSR changed since last read} + DeltaRIMask = $04; {RI changed since last read} + DeltaDCDMask = $08; {DCD changed since last read} + CTSMask = $10; {Clear to send} + DSRMask = $20; {Data set ready} + RIMask = $40; {Ring indicator} + DCDMask = $80; {Data carrier detect} + +const + {Message base} + apw_First = $7E00; {Sets base for all APW messages} + +const + {Custom message types} + apw_TriggerAvail = apw_First+1; {Trigger for any data avail} + apw_TriggerData = apw_First+2; {Trigger data} + apw_TriggerTimer = apw_First+3; {Trigger timer} + apw_TriggerStatus = apw_First+4; {Status change (modem, line, buffer)} + apw_FromYmodem = apw_First+5; {Tells Xmodem it was called from Ymodem} + apw_PortOpen = apw_First+8; {Apro, tell users port open} + apw_PortClose = apw_First+9; {Apro, tell users port closed} + apw_ClosePending = apw_First+10; {Apro, tell ourself that the port was closed} + +const + {Protocol message types} + apw_ProtocolCancel = apw_First+20; {To protocol - chk for protcl abort} + apw_ProtocolStatus = apw_First+21; {From protocol - update status display} + apw_ProtocolLog = apw_First+22; {From protocol - LogFile message} + apw_ProtocolNextFile = apw_First+23; {From protocol - return next file} + apw_ProtocolAcceptFile = apw_First+24; {From protocol - accept file} + apw_ProtocolFinish = apw_First+25; {From protocol - protocol is finished} + apw_ProtocolResume = apw_First+26; {From protocol - resume request} + apw_ProtocolError = apw_First+27; {From protocol - error during protocol} + apw_ProtocolAbort = apw_First+28; {To protocol - abort the transfer} + +const + {Modem message types} + apw_AutoAnswer = apw_First+40; {To modem, enter AutoAnswer} + apw_CancelCall = apw_First+41; {To modem, cancel the call} + apw_StartDial = apw_First+42; {To modem, start the process} + + {deprecated modem message types, note that some conflict with new messages} + apw_ModemOk = apw_First+40; {From modem - got OK response} + apw_ModemConnect = apw_First+41; {From modem - got CONNECT response} + apw_ModemBusy = apw_First+42; {From modem - got BUSY response} + apw_ModemVoice = apw_First+43; {From modem - got VOICE response} + apw_ModemNoCarrier = apw_First+44; {From modem - got NO CARRIER response} + apw_ModemNoDialTone = apw_First+45; {From modem - got NO DIALTONE response} + apw_ModemError = apw_First+46; {From modem - got ERROR response} + apw_GotLineSpeed = apw_First+47; {From modem - got connect speed} + apw_GotErrCorrection = apw_First+48; {From modem - got EC response} + apw_GotDataCompression = apw_First+49; {From modem - got compression response} + apw_CmdTimeout = apw_First+50; {From modem - command timed out} + apw_DialTimeout = apw_First+51; {From modem - dial timed out} + apw_AnswerTimeout = apw_First+52; {From modem - answer timed out} + apw_DialCount = apw_First+53; {From modem - dial still in progress} + apw_AnswerCount = apw_First+54; {From modem - answer still in progress} + apw_ModemRing = apw_First+55; {From modem - phone rang} + apw_ModemIsConnected = apw_First+56; {From modem - connection completed} + apw_ConnectFailed = apw_First+57; {From modem - connection failed} + apw_CommandProcessed = apw_First+58; {From modem - finished command} + +const + {Terminal message types} + apw_TermStart = apw_First+60; {To terminal - start} + apw_TermStop = apw_First+61; {To terminal - stop} + apw_TermSetCom = apw_First+62; {To terminal - set com handle} + apw_TermRelCom = apw_First+63; {To terminal - release com handle} + apw_TermSetEmuPtr = apw_First+64; {To terminal - set emulator pointer} + apw_TermSetEmuProc = apw_First+65; {To terminal - set emulator proc} + apw_TermClear = apw_First+66; {To terminal - clear window} + apw_TermBuffer = apw_First+67; {To terminal - alloc new buffers} + apw_TermColors = apw_First+68; {To terminal - set new colors} + apw_TermToggleScroll = apw_First+69; {To terminal - toggle scrollback} + apw_TermCapture = apw_First+70; {To terminal - set capture mode} + apw_TermStuff = apw_First+71; {To terminal - stuff data} + apw_TermPaint = apw_First+72; {To terminal - update screen} + apw_TermSetWndProc = apw_First+73; {To terminal - set window proc} + apw_TermColorsH = apw_First+74; {To terminal - set highlight colors} + apw_TermSave = apw_First+75; {To terminal - save/restore} + apw_TermColorMap = apw_First+76; {To terminal - get/set color map} + apw_TermForceSize = apw_First+77; {To terminal - force new size} + apw_TermFontSize = apw_First+78; {To terminal - get font size} + +const + apw_TermStatus = apw_First+80; {From terminal - show status} + apw_TermBPlusStart = apw_First+81; {From terminal - B+ is starting} + apw_TermError = apw_First+82; {From terminal - error} + apw_CursorPosReport = apw_First+83; {From terminal - Cursor Pos Report} + +const + apw_FaxCvtStatus = apw_First+90; {From fax converter - show status} + apw_FaxUnpStatus = apw_First+91; {From fax unpacker - show status} + apw_FaxOutput = apw_First+92; {From fax unpacker - output line} + +const + apw_ViewSetFile = apw_First+100; {To fax viewer - change file name} + apw_ViewSetFG = apw_First+101; {To fax viewer - set foreground color} + apw_ViewSetBG = apw_First+102; {To fax viewer - set background color} + apw_ViewSetScale = apw_First+103; {To fax viewer - set scale factors} + apw_ViewSetScroll = apw_First+104; {To fax viewer - set scroll increments} + apw_ViewSelectAll = apw_First+105; {To fax viewer - select entire image} + apw_ViewSelect = apw_First+106; {To fax viewer - select image rect} + apw_ViewCopy = apw_First+107; {To fax viewer - copy data to cboard} + apw_ViewSetWndProc = apw_First+108; {To fax viewer - set window procedure} + apw_ViewSetWhitespace = apw_First+109; {To fax viewer - set whitespace comp} + apw_ViewGetBitmap = apw_First+110; {To fax viewer - get memory bmp} + apw_ViewGetNumPages = apw_First+111; {To fax viewer - get num pages} + apw_ViewStartUpdate = apw_First+112; {To fax viewer - start scale update} + apw_ViewEndUpdate = apw_First+113; {To fax viewer - end scale upate} + apw_ViewGotoPage = apw_First+114; {To fax viewer - go to a page} + apw_ViewGetCurPage = apw_First+115; {To fax viewer - get current page #} + apw_ViewSetDesignMode = apw_First+116; {To fax viewer - indicate in design} + apw_ViewSetRotation = apw_First+117; {To fax viewer - set rotation} + apw_ViewSetAutoScale = apw_First+118; {To fax viewer - auto scaling} + apw_ViewNotifyPage = apw_First+119; {To fax viewer - notify of page chg} + apw_ViewGetPageDim = apw_First+120; {To fax viewer - get pg dimensions} + apw_ViewSetLoadWholeFax= apw_First+121; {To fax viewer - set load whole fax} + apw_ViewSetBusyCursor = apw_First+122; {To fax viewer - set cursor for busy} + apw_ViewerError = apw_First+123; {Fax viewer error report} + apw_ViewGetPageFlags = apw_First+124; {To fax viewer - get pg flags} + apw_ViewGetFileName = apw_First+125; {To fax viewer - get file name} + +const + apw_TermBlinkTimeChange = apw_First+130; {set new blink time} + apw_TermPersistentMarkChange = apw_First+131; {set persistent blocks} + apw_TermSetKeyEmuPtr = apw_First+132; {set Key Emulator pointer } + apw_TermSetKeyEmuProc = apw_First+133; {set Key Emulator proc } + apw_TermSetHalfDuplex = apw_First+134; {set Duplex mode} + apw_TermGetBuffPtr = apw_First+135; {get a pointer to term buffer} + apw_TermGetClientLine = apw_First+136; {get the first client line in buffer} + apw_TermWaitForPort = apw_First+137; {wait for the port to open}{!!.03} + apw_TermNeedsUpdate = apw_First+138; {update needed} {!!.05} + +const + apw_PrintDriverJobCreated = apw_First+140; {printer driver created fax job} + apw_BeginDoc = apw_First+141; {printer driver starts printing} + apw_EndDoc = apw_First+142; {printer driver has finished printing} + apw_AddPrim = apw_First+143; {internal FaxSrvx sample message} + apw_EndPage = apw_First+144; {printer driver EndOfPage/idShell} + +const + apw_FaxCancel = apw_First+160; {To fax - cancel the session} + apw_FaxNextfile = apw_First+161; {From fax - return next fax to send} + apw_FaxStatus = apw_First+162; {From fax - show the fax status} + apw_FaxLog = apw_First+163; {From fax - log the fax start/stop} + apw_FaxName = apw_First+164; {From fax - name the incoming fax} + apw_FaxAccept = apw_First+165; {From fax - accept this fax?} + apw_FaxError = apw_First+166; {From fax - session had error} + apw_FaxFinish = apw_First+167; {From fax - session finished} + +const + apw_TapiWaveMessage = apw_First+180; {Tapi wave event message} + apw_TapiEventMessage = apw_First+181; {Tapi general event message} + apw_VoIPEventMessage = apw_First+182; {AdVoIP general event message} + apw_VoIPNotifyMessage = apw_First+183; {AdVoIP internal notification message} + +const + apw_StateDeactivate = apw_First+190; {State deactivation message } + apw_StateChange = apw_First+191; {from State to StateMachine } + +const + apw_SapiTrain = apw_First+192; {Sapi training requested} + apw_SapiPhoneCallBack = apw_First+193; {Sapi AskFor phrase return} + apw_SapiInfoPhrase = apw_First+194; {Sapi TAPI connection status} + +const + apw_PgrStatusEvent = apw_First+200; {Pager status event} + +const + {Window class names} + DispatcherClassName = 'awDispatch'; + ProtocolClassName = 'awProtocol'; + TerminalClassName = 'awTerminal'; + MessageHandlerClassName = 'awMsgHandler'; + FaxViewerClassName = 'awViewer'; + FaxViewerClassNameDesign = 'dcViewer'; + TerminalClassNameDesign = 'dcTerminal'; + FaxHandlerClassName = 'awFaxHandler'; + +const + {Error groups} + egDos = -0; {DOS, DOS critical and file I/O} + egGeneral = -1; {General errors} + egOpenComm = -2; {OpenComm errors} + egSerialIO = -3; {Errors during serial I/O processing} + egModem = -4; {Errors during modem processing} + egTrigger = -5; {Error setting up triggers} + egProtocol = -6; {Errors that apply to one or more protocols} + egINI = -7; {INI database errors} + egFax = -8; {FAX errors} + egAdWinsock = 9; {APro specific Winsock errors} + egWinsock = 10; {Winsock errors} + egWinsockEx = 11; {Additional Winsock errors} + egTapi = -13; {TAPI errors} + +const + { Below are all error codes used by APRO -- resource IDs are Abs(ErrorCode) } + { The corresponding strings can be found in APW.STR and AdExcept.inc. If } + { you are adding strings, it's best to go there first to 'stake a claim' on } + { an appropriate range of IDs -- since constants for some status strings } + { are found in the applicable component's unit instead of here... } + + {No error} + aecOK = 0; {Okay} + +const + {egDOS} + ecFileNotFound = -2; {File not found} + ecPathNotFound = -3; {Path not found} + ecTooManyFiles = -4; {Too many open files} + ecAccessDenied = -5; {File access denied} + ecInvalidHandle = -6; {Invalid file handle} + ecOutOfMemory = -8; {Insufficient memory} + ecInvalidDrive = -15; {Invalid drive} + ecNoMoreFiles = -18; {No more files} + ecDiskRead = -100; {Attempt to read beyond end of file} + ecDiskFull = -101; {Disk is full} + ecNotAssigned = -102; {File not Assign-ed} + ecNotOpen = -103; {File not open} + ecNotOpenInput = -104; {File not open for input} + ecNotOpenOutput = -105; {File not open for output} + ecWriteProtected = -150; {Disk is write-protected} + ecUnknownUnit = -151; {Unknown disk unit} + ecDriveNotReady = -152; {Drive is not ready} + ecUnknownCommand = -153; {Unknown command} + ecCrcError = -154; {Data error} + ecBadStructLen = -155; {Bad request structure length} + ecSeekError = -156; {Seek error} + ecUnknownMedia = -157; {Unknown media type} + ecSectorNotFound = -158; {Disk sector not found} + ecOutOfPaper = -159; {Printer is out of paper} + ecDeviceWrite = -160; {Device write error} + ecDeviceRead = -161; {Device read error} + ecHardwareFailure = -162; {General failure} + +const + {egGeneral} + ecBadHandle = -1001; {Bad handle passed to com function} + ecBadArgument = -1002; {Bad argument passed to function} + ecGotQuitMsg = -1003; {Yielding routine got WM_QUIT message} + ecBufferTooBig = -1004; {Terminal buffer size too big} + ecPortNotAssigned = -1005; {ComPort component not assigned} + ecInternal = -1006; {Internal INIDB errors} + ecModemNotAssigned = -1007; {Modem component not assigned} + ecPhonebookNotAssigned = -1008; {Phonebook component not assgnd} + ecCannotUseWithWinSock = -1009; {Component not compatible with WinSock} + +const + {egOpenComm} + ecBadId = -2001; {ie_BadId - bad or unsupported ID} + ecBaudRate = -2002; {ie_Baudrate - unsupported baud rate} + ecByteSize = -2003; {ie_Bytesize - invalid byte size} + ecDefault = -2004; {ie_Default - error in default parameters} + ecHardware = -2005; {ie_Hardware - hardware not present} + ecMemory = -2006; {ie_Memory - unable to allocate queues} + ecCommNotOpen = -2007; {ie_NOpen - device not open} + ecAlreadyOpen = -2008; {ie_Open - device already open} + ecNoHandles = -2009; {No more handles, can't open port} + ecNoTimers = -2010; {No timers available} + ecNoPortSelected = -2011; {No port selected (attempt to open com0)} + ecNotOpenedByTapi = -2012; {Comport was not opened by Tapi} + +const + {egSerialIO} + ecNullApi = -3001; {No device layer specified} + ecNotSupported = -3002; {Function not supported by driver} + ecRegisterHandlerFailed = -3003; {EnableCommNotification failed} + ecPutBlockFail = -3004; {Failed to put entire block} + ecGetBlockFail = -3005; {Failed to get entire block} + ecOutputBufferTooSmall = -3006; {Output buffer too small for block} + ecBufferIsEmpty = -3007; {Buffer is empty} + ecTracingNotEnabled = -3008; {Tracing not enabled} + ecLoggingNotEnabled = -3009; {Logging not enabled} + ecBaseAddressNotSet = -3010; {Base addr not found, RS485 mode} + +const + {Modem/Pager} + ecModemNotStarted = -4001; {StartModem has not been called} + ecModemBusy = -4002; {Modem is busy elsewhere} + ecModemNotDialing = -4003; {Modem is not currently dialing} + ecNotDialing = -4004; {TModemDialer is not dialing} + ecAlreadyDialing = -4005; {TModemdialer is already dialing} + ecModemNotResponding = -4006; {No response from modem} + ecModemRejectedCommand = -4007; {Bad command sent to modem} + ecModemStatusMismatch = -4008; {Wrong modem status requested} + + ecDeviceNotSelected = -4009; { Um, the modem wan't selected } + ecModemDetectedBusy = -4010; { Modem detected busy signal } + ecModemNoDialtone = -4011; { No dialtone detected } + ecModemNoCarrier = -4012; { No carrier from modem } + ecModemNoAnswer = -4013; { Modem returned No Answer response } + + { Pager } + ecInitFail = -4014; { Modem initialization failure } + ecLoginFail = -4015; { Login Failure } + ecMinorSrvErr = -4016; { SNPP - Minor Server Error } + ecFatalSrvErr = -4017; { SNPP - Fatal Server Error } + +const + {LibModem} + ecModemNotFound = -4020; { Modem not found in modemcap } + ecInvalidFile = -4021; { a modemcap file is invalid } + +const {RAS connection status codes} + csOpenPort = 4500; + csPortOpened = 4501; + csConnectDevice = 4502; + csDeviceConnected = 4503; + csAllDevicesConnected = 4504; + csAuthenticate = 4505; + csAuthNotify = 4506; + csAuthRetry = 4507; + csAuthCallback = 4508; + csAuthChangePassword = 4509; + csAuthProject = 4510; + csAuthLinkSpeed = 4511; + csAuthAck = 4512; + csReAuthenticate = 4513; + csAuthenticated = 4514; + csPrepareForCallback = 4515; + csWaitForModemReset = 4516; + csWaitForCallback = 4517; + csProjected = 4518; + + csStartAuthentication = 4519; + csCallbackComplete = 4520; + csLogonNetwork = 4521; + csSubEntryConnected = 4522; + csSubEntryDisconnected = 4523; + csRasInteractive = 4550; + csRasRetryAuthentication = 4551; + csRasCallbackSetByCaller = 4552; + csRasPasswordExpired = 4553; + csRasDeviceConnected = 4599; + csRasBaseEnd = csSubEntryDisconnected; + csRasPaused = $1000; + csInteractive = csRasPaused; + csRetryAuthentication = csRasPaused + 1; + csCallbackSetByCaller = csRasPaused + 2; + csPasswordExpired = csRasPaused + 3; + csRasPausedEnd = csRasPaused + 3; + + csRasConnected = $2000; + csRasDisconnected = csRasConnected + 1; + + { Protocols } + { If strings are added -- apStatusMsg needs to be changed in AWABSPCL.PAS } + +const + psOK = 4700; {Protocol is ok} + psProtocolHandshake = 4701; {Protocol handshaking in progress} + psInvalidDate = 4702; {Bad date/time stamp received and ignored} + psFileRejected = 4703; {Incoming file was rejected} + psFileRenamed = 4704; {Incoming file was renamed} + psSkipFile = 4705; {Incoming file was skipped} + psFileDoesntExist = 4706; {Incoming file doesn't exist locally, skipped} + psCantWriteFile = 4707; {Incoming file skipped due to Zmodem options} + psTimeout = 4708; {Timed out waiting for something} + psBlockCheckError = 4709; {Bad checksum or CRC} + psLongPacket = 4710; {Block too long} + psDuplicateBlock = 4711; {Duplicate block received and ignored} + psProtocolError = 4712; {Error in protocol} + psCancelRequested = 4713; {Cancel requested} + psEndFile = 4714; {At end of file} + psResumeBad = 4715; {B+ host refused resume request} + psSequenceError = 4716; {Block was out of sequence} + psAbortNoCarrier = 4717; {Aborting on carrier loss} + psAbort = 4730; {Session aborted} + +const + {Specific to certain protocols} + psGotCrcE = 4718; {Got CrcE packet (Zmodem)} + psGotCrcG = 4719; {Got CrcG packet (Zmodem)} + psGotCrcW = 4720; {Got CrcW packet (Zmodem)} + psGotCrcQ = 4721; {Got CrcQ packet (Zmodem)} + psTryResume = 4722; {B+ is trying to resume a download} + psHostResume = 4723; {B+ host is resuming} + psWaitAck = 4724; {Waiting for B+ ack (internal)} + +const + {Internal} + psNoHeader = 4725; {Protocol is waiting for header (internal)} + psGotHeader = 4726; {Protocol has header (internal)} + psGotData = 4727; {Protocol has data packet (internal)} + psNoData = 4728; {Protocol doesn't have data packet yet (internal)} + + { Constants for fax strings } + { If strings are added -- afStatusMsg needs to be changed in AWABSFAX.PAS } +const + {Fax progress codes, sending} + fpInitModem = 4801; {Initializing modem for fax processing} + fpDialing = 4802; {Dialing} + fpBusyWait = 4803; {Busy, FaxTransmit is waiting} + fpSendPage = 4804; {Sending document page data} + fpSendPageStatus = 4805; {Send EOP} + fpPageError = 4806; {Error sending page} + fpPageOK = 4807; {Page accepted by remote} + fpConnecting = 4808; {Send call handoff connecting} + +const + {Fax progress codes, receiving} + fpWaiting = 4820; {Waiting for incoming call} + fpNoConnect = 4821; {No connect on this call} + fpAnswer = 4822; {Answering incoming call} + fpIncoming = 4823; {Incoming call validated as fax} + fpGetPage = 4824; {Getting page data} + fpGetPageResult = 4825; {Getting end-of-page signal} + fpCheckMorePages = 4826; {getting end-of-document status} + fpGetHangup = 4827; {Get hangup command} + fpGotHangup = 4828; {Got Class 2 FHNG code} + +const + {Fax server codes } + fpSwitchModes = 4830; {Switching from send/recv or recv/send} + fpMonitorEnabled = 4831; {Monitoring for incoming faxes} + fpMonitorDisabled = 4832; {Not monitoring for incoming faxes} + +const + {Fax progress codes, common} + fpSessionParams = 4840; {Getting connection params} + fpGotRemoteID = 4841; {got called-station ID} + fpCancel = 4842; {User abort} + fpFinished = 4843; {Finished with this fax} + +const + {Trigger errors} + ecNoMoreTriggers = -5001; {No more trigger slots} + ecTriggerTooLong = -5002; {Data trigger too long} + ecBadTriggerHandle = -5003; {Bad trigger handle} + +const + {Packet errors} + ecStartStringEmpty = -5501; {Start string is empty} + ecPacketTooSmall = -5502; {Packet size cannot be smaller than start string} + ecNoEndCharCount = -5503; {CharCount packets must have an end-condition} + ecEmptyEndString = -5504; {End string is empty} + ecZeroSizePacket = -5505; {Packet size cannot be zero} + ecPacketTooLong = -5506; {Packet too long} + +const + {Protocol errors} + ecBadFileList = -6001; {Bad format in file list} + ecNoSearchMask = -6002; {No search mask specified during transmit} + ecNoMatchingFiles = -6003; {No files matched search mask} + ecDirNotFound = -6004; {Directory in search mask doesn't exist} + ecCancelRequested = -6005; {Cancel requested} + aecTimeout = -6006; {Fatal time out} + ecProtocolError = -6007; {Unrecoverable event during protocol} + ecTooManyErrors = -6008; {Too many errors during protocol} + ecSequenceError = -6009; {Block sequence error in Xmodem} + ecNoFilename = -6010; {No filename specified in protocol receive} + ecFileRejected = -6011; {File was rejected} + ecCantWriteFile = -6012; {Cant write file} + ecTableFull = -6013; {Kermit window table is full, fatal error} + ecAbortNoCarrier = -6014; {Aborting due to carrier loss} + ecBadProtocolFunction = -6015; {Function not support by protocol} + ecProtocolAbort = -6016; {Session aborted} + +const + {INI database} + ecKeyTooLong = -7001; {Key string too long} + ecDataTooLarge = -7002; {Data string too long} + ecNoFieldsDefined = -7003; {No fields defined in database} + ecIniWrite = -7004; {Generic INI file write error} + ecIniRead = -7005; {Generic INI file read error} + ecNoIndexKey = -7006; {No index defined for database} + ecRecordExists = -7007; {Record already exists} + ecRecordNotFound = -7008; {Record not found in database} + ecMustHaveIdxVal = -7009; {Invalid index key name} + ecDatabaseFull = -7010; {Maximum database records (999) reached} + ecDatabaseEmpty = -7011; {No records in database} + ecDatabaseNotPrepared = -7012; {iPrepareIniDatabase not called} + ecBadFieldList = -7013; {Bad field list in INIDB} + ecBadFieldForIndex = -7014; {Bad field for index in INIDB} + +const {!!.04} + {State Machine} {!!.04} + ecNoStateMachine = -7500; {No state machine} {!!.04} + ecNoStartState = -7501; {StartState not set} {!!.04} + ecNoSapiEngine = -7502; {SAPI Engine not set} {!!.04} + +const + ecFaxBadFormat = -8001; {File is not an APF file} + ecBadGraphicsFormat = -8002; {Unsupported graphics file format} + ecConvertAbort = -8003; {User aborted fax conversion} + ecUnpackAbort = -8004; {User aborted fax unpack} + ecCantMakeBitmap = -8005; {CreateBitmapIndirect API failure} + ecNoImageLoaded = -8050; {no image loaded into viewer} + ecNoImageBlockMarked = -8051; {no block of image marked} + ecFontFileNotFound = -8052; {APFAX.FNT not found, or resource bad} + ecInvalidPageNumber = -8053; {Invalid page number specified for fax} + ecBmpTooBig = -8054; {BMP size exceeds Windows' maxheight of 32767} + ecEnhFontTooBig = -8055; {Font selected for enh text converter too large} + +const + ecFaxBadMachine = -8060; {Fax incompatible with remote fax} + ecFaxBadModemResult = -8061; {Bad response from modem} + ecFaxTrainError = -8062; {Modems failed to train} + ecFaxInitError = -8063; {Error while initializing modem} + ecFaxBusy = -8064; {Called fax number was busy} + ecFaxVoiceCall = -8065; {Called fax number answered with voice} + ecFaxDataCall = -8066; {Incoming data call} + ecFaxNoDialTone = -8067; {No dial tone} + ecFaxNoCarrier = -8068; {Failed to connect to remote fax} + ecFaxSessionError = -8069; {Fax failed in mid-session} + ecFaxPageError = -8070; {Fax failed at page end} + ecFaxGDIPrintError = -8071; {NextBand GDI error in fax print driver} + ecFaxMixedResolution = -8072; {Multiple resolutions in one session} + ecFaxConverterInitFail = -8073; {Initialization of fax converter failed} + ecNoAnswer = -8074; {Remote fax did not answer} + ecAlreadyMonitored = -8075; {MonitorDir already being used} + ecFaxMCFNoAnswer = -8076; {Remote disconnected after last page}{!!.06} + +const + ecUniAlreadyInstalled = -8080; {Unidrv support files already installed} + ecUniCannotGetSysDir = -8081; {Cannot determine windows system dir} + ecUniCannotGetWinDir = -8082; {Cannot determine windows dir} + ecUniUnknownLayout = -8083; {Cannot determine setup file layout} + ecUniCannotInstallFile = -8085; {Cannot install Unidrv files to system dir} + ecRasDDNotInstalled = -8086; {Cannot install RASDD files } {!!.05} + ecDrvCopyError = -8087; {Error copying printer driver} + ecCannotAddPrinter = -8088; {32-bit AddPrinter call failed} + ecDrvBadResources = -8089; {Bad/missing resources in driver} + ecDrvDriverNotFound = -8090; {Driver file not found} + ecUniCannotGetPrinterDriverDir + = -8091; {Cannot determine Win NT printer driver dir} + ecInstallDriverFailed = -8092; {AddPrinterDriver API failed} + + { TApdGSMPhone error codes } +const + ecSMSBusy = -8100; {Busy with another command} + ecSMSTimedOut = -8101; {Timed out, no response back} + ecSMSTooLong = -8102; {SMS message too long} + ecSMSUnknownStatus = -8103; {Status unknown} + ecSMSInvalidNumber = -8138; {Invalid Number or Network out of order} {!!.06} + ecMEFailure = -8300; {Mobile Equipment Failure} + ecServiceRes = -8301; {SMS service of ME reserved} + ecBadOperation = -8302; {Operation not allowed} + ecUnsupported = -8303; {Operation not supported} + ecInvalidPDU = -8304; {Invalid PDU mode parameter} + ecInvalidText = -8305; {Invalid Text mode parameter} + ecSIMInsert = -8310; {SIM card not inserted} + ecSIMPin = -8311; {SIM PIN required} + ecSIMPH = -8312; {PH-SIM PIN required} + ecSIMFailure = -8313; {SIM failure} + ecSIMBusy = -8314; {SIM busy} + ecSIMWrong = -8315; {SIM wrong} + ecSIMPUK = -8316; {SIM PUK required} + ecSIMPIN2 = -8317; {SIM PIN2 required} + ecSIMPUK2 = -8318; {SIM PUK2 required} + ecMemFail = -8320; {Memory failure} + ecInvalidMemIndex = -8321; {Invalid memory index} + ecMemFull = -8322; {Memory full} + ecSMSCAddUnknown = -8330; {SMS Center Address unknown} + ecNoNetwork = -8331; {No network service} + ecNetworkTimeout = -8332; {Network timeout} + ecCNMAAck = -8340; {No +CNMA acknowledgement expected} + aecUnknown = -8500; {Unknown error} + + +const + ecADWSERROR = 9001; + ecADWSLOADERROR = 9002; + ecADWSVERSIONERROR = 9003; + ecADWSNOTINIT = 9004; + ecADWSINVPORT = 9005; + ecADWSCANTCHANGE = 9006; + ecADWSCANTRESOLVE = 9007; + + { All Windows Sockets error constants are biased by 10000 from the "normal" } + wsaBaseErr = 10000; + + { Windows Sockets definitions of regular Microsoft C error constants } + wsaEIntr = 10004; + wsaEBadF = 10009; + wsaEAcces = 10013; + wsaEFault = 10014; + wsaEInVal = 10022; + wsaEMFile = 10024; + + { Windows Sockets definitions of regular Berkeley error constants } + wsaEWouldBlock = 10035; + wsaEInProgress = 10036; + wsaEAlReady = 10037; + wsaENotSock = 10038; + wsaEDestAddrReq = 10039; + wsaEMsgSize = 10040; + wsaEPrototype = 10041; + wsaENoProtoOpt = 10042; + wsaEProtoNoSupport = 10043; + wsaESocktNoSupport = 10044; + wsaEOpNotSupp = 10045; + wsaEPfNoSupport = 10046; + wsaEAfNoSupport = 10047; + wsaEAddrInUse = 10048; + wsaEAddrNotAvail = 10049; + wsaENetDown = 10050; + wsaENetUnreach = 10051; + wsaENetReset = 10052; + wsaEConnAborted = 10053; + wsaEConnReset = 10054; + wsaENoBufs = 10055; + wsaEIsConn = 10056; + wsaENotConn = 10057; + wsaEShutDown = 10058; + wsaETooManyRefs = 10059; + wsaETimedOut = 10060; + wsaEConnRefused = 10061; + wsaELoop = 10062; + wsaENameTooLong = 10063; + wsaEHostDown = 10064; + wsaEHostUnreach = 10065; + wsaENotEmpty = 10066; + wsaEProcLim = 10067; + wsaEUsers = 10068; + wsaEDQuot = 10069; + wsaEStale = 10070; + wsaERemote = 10071; + wsaEDiscOn = 10101; + + { Extended Windows Sockets error constant definitions } + + wsaSysNotReady = 10091; + wsaVerNotSupported = 10092; + wsaNotInitialised = 10093; + + { Error return codes from gethostbyname() and gethostbyaddr() (when using the } + { resolver). Note that these errors are retrieved via wsaGetLastError() and } + { must therefore follow the rules for avoiding clashes with error numbers from } + { specific implementations or language run-time systems. For this reason the } + { codes are based at 10000+1001. Note also that [wsa]No_Address is defined } + { only for compatibility purposes. } + { Authoritative Answer: Host not found } + wsaHost_Not_Found = 11001; + Host_Not_Found = wsaHost_Not_Found; + + { Non-Authoritative: Host not found, or ServerFAIL } + wsaTry_Again = 11002; + Try_Again = wsaTry_Again; + + { Non recoverable errors, FORMERR, REFUSED, NotIMP } + wsaNo_Recovery = 11003; + No_Recovery = wsaNo_Recovery; + + { Valid name, no data record of requested type } + wsaNo_Data = 11004; + No_Data = wsaNo_Data; + + { no address, look for MX record } + wsaNo_Address = wsaNo_Data; + No_Address = wsaNo_Address; + + { The string resource range 13500 - 13800 is used for TAPI } + { status messages, which do not require constants here } + +const + {Adjusted TAPI error codes} + ecAllocated = -13801; + ecBadDeviceID = -13802; + ecBearerModeUnavail = -13803; + ecCallUnavail = -13805; + ecCompletionOverrun = -13806; + ecConferenceFull = -13807; + ecDialBilling = -13808; + ecDialDialtone = -13809; + ecDialPrompt = -13810; + ecDialQuiet = -13811; + ecIncompatibleApiVersion = -13812; + ecIncompatibleExtVersion = -13813; + ecIniFileCorrupt = -13814; + ecInUse = -13815; + ecInvalAddress = -13816; + ecInvalAddressID = -13817; + ecInvalAddressMode = -13818; + ecInvalAddressState = -13819; + ecInvalAppHandle = -13820; + ecInvalAppName = -13821; + ecInvalBearerMode = -13822; + ecInvalCallComplMode = -13823; + ecInvalCallHandle = -13824; + ecInvalCallParams = -13825; + ecInvalCallPrivilege = -13826; + ecInvalCallSelect = -13827; + ecInvalCallState = -13828; + ecInvalCallStatelist = -13829; + ecInvalCard = -13830; + ecInvalCompletionID = -13831; + ecInvalConfCallHandle = -13832; + ecInvalConsultCallHandle = -13833; + ecInvalCountryCode = -13834; + ecInvalDeviceClass = -13835; + ecInvalDeviceHandle = -13836; + ecInvalDialParams = -13837; + ecInvalDigitList = -13838; + ecInvalDigitMode = -13839; + ecInvalDigits = -13840; + ecInvalExtVersion = -13841; + ecInvalGroupID = -13842; + ecInvalLineHandle = -13843; + ecInvalLineState = -13844; + ecInvalLocation = -13845; + ecInvalMediaList = -13846; + ecInvalMediaMode = -13847; + ecInvalMessageID = -13848; + ecInvalParam = -13850; + ecInvalParkID = -13851; + ecInvalParkMode = -13852; + ecInvalPointer = -13853; + ecInvalPrivSelect = -13854; + ecInvalRate = -13855; + ecInvalRequestMode = -13856; + ecInvalTerminalID = -13857; + ecInvalTerminalMode = -13858; + ecInvalTimeout = -13859; + ecInvalTone = -13860; + ecInvalToneList = -13861; + ecInvalToneMode = -13862; + ecInvalTransferMode = -13863; + ecLineMapperFailed = -13864; + ecNoConference = -13865; + ecNoDevice = -13866; + ecNoDriver = -13867; + ecNoMem = -13868; + ecNoRequest = -13869; + ecNotOwner = -13870; + ecNotRegistered = -13871; + ecOperationFailed = -13872; + ecOperationUnavail = -13873; + ecRateUnavail = -13874; + ecResourceUnavail = -13875; + ecRequestOverrun = -13876; + ecStructureTooSmall = -13877; + ecTargetNotFound = -13878; + ecTargetSelf = -13879; + ecUninitialized = -13880; + ecUserUserInfoTooBig = -13881; + ecReinit = -13882; + ecAddressBlocked = -13883; + ecBillingRejected = -13884; + ecInvalFeature = -13885; + ecNoMultipleInstance = -13886; + +const + {Apro encounters a few of its own TAPI errors, place these error + codes after the native TAPI error codes, but leave a little bit + of room for expansion of the TAPI error codes.} + ecTapiBusy = -13928; + ecTapiNotSet = -13929; + ecTapiNoSelect = -13930; + ecTapiLoadFail = -13931; + ecTapiGetAddrFail = -13932; + ecTapiUnexpected = -13934; + ecTapiVoiceNotSupported = -13935; + ecTapiWaveFail = -13936; + ecTapiCIDBlocked = -13937; + ecTapiCIDOutOfArea = -13938; + ecTapiWaveFormatError = -13939; + ecTapiWaveReadError = -13940; + ecTapiWaveBadFormat = -13941; + ecTapiTranslateFail = -13942; + ecTapiWaveDeviceInUse = -13943; + ecTapiWaveFileExists = -13944; + ecTapiWaveNoData = -13945; + + ecVoIPNotSupported = -13950; { TAPI3/H.323 not found } + ecVoIPCallBusy = -13951; { remote was busy } + ecVoIPBadAddress = -13952; { destination address bad } + ecVoIPNoAnswer = -13953; { remote did not answer } + ecVoIPCancelled = -13954; { cancelled } + ecVoIPRejected = -13955; { remote rejected the call } + ecVoIPFailed = -13956; { general failure } + ecVoIPTapi3NotInstalled = -13957; { ITTapi interface failure } {!!.01} + ecVoIPH323NotFound = -13958; { H.323 line not found } {!!.01} + ecVoIPTapi3EventFailure = -13959; { event notify failure } {!!.01} + + {RAS error codes} + ecRasLoadFail = -13980; + +const + {Convenient character constants (and aliases)} + cNul = #0; + cSoh = #1; + cStx = #2; + cEtx = #3; + cEot = #4; + cEnq = #5; + cAck = #6; + cBel = #7; + cBS = #8; + aacTab = #9; + acLF = #10; + cVT = #11; + cFF = #12; + acCR = #13; + cSO = #14; + cSI = #15; + cDle = #16; + cDC1 = #17; cXon = #17; + cDC2 = #18; + cDC3 = #19; cXoff = #19; + cDC4 = #20; + cNak = #21; + cSyn = #22; + cEtb = #23; + cCan = #24; + cEM = #25; + cSub = #26; + cEsc = #27; + cFS = #28; + cGS = #29; + cRS = #30; + cUS = #31; + +type + {Protocol status information record} + TProtocolInfo = record + piProtocolType : Cardinal; + piBlockErrors : Cardinal; + piTotalErrors : Cardinal; + piBlockSize : Cardinal; + piBlockNum : Cardinal; + piFileSize : Integer; + piBytesTransferred : Integer; + piBytesRemaining : Integer; + piInitFilePos : Integer; + piElapsedTicks : Integer; + piFlags : Integer; + piBlockCheck : Cardinal; + piFileName : TPathCharArrayA; + piError : Integer; + piStatus : Cardinal; + end; + +const + {Port options} + poUseEventWord = $04; {Set to use the event word} + + { APRO-specific flags used in InitPort} + ipAssertDTR = $00000001; + ipAssertRTS = $00000002; + ipAutoDTR = $00000010; + ipAutoRTS = $00000020; + + {Hardware flow control options} + hfUseDTR = $01; {Use DTR for receive flow control} + hfUseRTS = $02; {Use RTS for receive flow control} + hfRequireDSR = $04; {Require DSR before transmitting} + hfRequireCTS = $08; {Require CTS before transmitting} + + {Software flow control options} + sfTransmitFlow = $01; {Honor received Xon/Xoffs} + sfReceiveFlow = $02; {Send Xon/Xoff as required} + + {Define bits for TDCB Flags field} + adcb_Binary = $0001; + dcb_Parity = $0002; + adcb_OutxCTSFlow = $0004; + adcb_OutxDSRFlow = $0008; + dcb_DTRBit1 = $0010; + dcb_DTRBit2 = $0020; + dcb_DsrSensitivity = $0040; + adcb_TxContinueOnXoff = $0080; + adcb_OutX = $0100; + adcb_InX = $0200; + adcb_ErrorChar = $0400; + dcb_Null = $0800; + dcb_RTSBit1 = $1000; + dcb_RTSBit2 = $2000; + adcb_AbortOnError = $4000; + + dcb_DTR_CONTROL_ENABLE = dcb_DTRBit1; + dcb_DTR_CONTROL_HANDSHAKE = dcb_DTRBit2; + dcb_RTS_CONTROL_ENABLE = dcb_RTSBit1; + dcb_RTS_CONTROL_HANDSHAKE = dcb_RTSBit2; + dcb_RTS_CONTROL_TOGGLE = (dcb_RTSBit1 + dcb_RTSBit2); + + {For reporting flow states, note: no receive hardware flow status is provided} + fsOff = 1; {No flow control is in use} + fsOn = 2; {Flow control is but not transmit blocked} + fsDsrHold = 3; {Flow control is on and transmit blocked by low DSR} + fsCtsHold = 4; {Flow control is on and transmit blocked by low CTS} + fsDcdHold = 5; {Flow control is on and transmit blocked by low DCD} + fsXOutHold = 6; {Flow control is on and transmit blocked by Xoff} + fsXInHold = 7; {Flow control is on and receive blocked by Xoff} + fsXBothHold= 8; {Flow control is on and both are blocked by Xoff} + +const + {Emulator commands} + eNone = 0; {No command, ignore this char} + eChar = 1; {No command, process the char} + eGotoXY = 2; {X} {Absolute goto cursor position call} + eUp = 3; {X} {Cursor up} + eDown = 4; {X} {Cursor down} + eRight = 5; {X} {Cursor right} + eLeft = 6; {X} {Cursor left} + eClearBelow = 7; {R} {Clear screen below cursor} + eClearAbove = 8; {R} {Clear screen above cursor} + eClearScreen = 9; {R} {Clear entire screen} + eClearEndofLine = 10;{R} {Clear from cursor to end of line} + eClearStartOfLine= 11;{R} {Clear from cursor to the start of line} + eClearLine = 12;{R} {Clear entire line that cursor is on} + eSetMode = 13;{X} {Set video mode} + eSetBackground = 14; {Set background attribute} + eSetForeground = 15; {Set foreground attribute} + eSetAttribute = 16;{X} {Set video attribute (foreground and background)} + eSaveCursorPos = 17; {Save cursor position} + eRestoreCursorPos= 18; {Restore cursor position} + eDeviceStatusReport = 19;{X}{Report device status or cursor position} + eString = 20; {Pascal style string} + eHT = 21; {Horizontal Tab Character} + eError = 255; {indicates a parser error} + + eAPC { } = 30; {Application programming command} + eCBT {X} = 31; {Cursor backward tabulation} + eCCH { } = 32; {Cancel character} + eCHA {X} = 33; {Cursor horizontal absolute} + eCHT {X} = 34; {Cursor horizontal tabulation} + eCNL {X} = 35; {Cursor next line} + eCPL {X} = 36; {Cursor preceding line} + eCPR {X} = 37; {Cursor position report} + eCRM {.} = 38; {Control representation mode} + eCTC {X} = 39; {Cursor tabulation control} + eCUB {X} = eLeft; {Cursor backward} + eCUD {X} = eDown; {Cursor down} + eCUF {X} = eRight; {Cursor forward} + aeCUP {X} = eGotoXY; {Cursor position} + eCUU {X} = eUp; {Cursor up} + eCVT {X} = 40; {Cursor vertical tabulation} + eDA {X} = 41; {Device attributes} + eDAQ { } = 42; {Define area qualification} + eDCH {X} = 43; {Delete character} + eDCS { } = 44; {Device control string} + eDL {X} = 45; {Delete line} + eDMI { } = 46; {Disable manual input} + eDSR {X} = eDeviceStatusReport;{Device status report} + eEA { } = 47; {Erase in area} + eEBM { } = 48; {Editing boundry mode} + eECH {X} = 49; {Erase character} + eED {X} = 50; {Erase in Display} + eEF { } = 51; {Erase in field} + eEL {X} = 52; {Erase in line} + eEMI { } = 53; {Enable manual input} + eEPA { } = 54; {End of protected mode} + eERM { } = 55; {Erasure mode} + eESA { } = 56; {End of selected area} + eFEAM { } = 57; {Format effector action mode} + eFETM { } = 58; {Format effector transfer mode} + eFNT { } = 59; {Font selection} + eGATM { } = 60; {Guarded area transfer mode} + eGSM { } = 61; {Graphics size modification} + eGSS { } = 62; {Graphics size selection} + eHEM { } = 63; {Horizontal editing mode} + eHPA {X} = eCHA; {Horizontal position absolute} + eHPR {X} = eCUF; {Horizontal position relative} + eHTJ {X} = 64; {Horizontal tab with justification} + eHTS {X} = 65; {Horizontal tabulation set} + eHVP {X} = eCUP; {Horizontal and vertical position} + eICH {X} = 66; {Insert character} + eIL {X} = 67; {Insert line} + eIND {X} = eCUD; {Index} + eINT { } = 68; {Interrupt} + eIRM {.} = 69; {Inseration-Replacement mode} + eJFY { } = 70; {Justify} + eKAM {.} = 71; {Keyboard action mode} + eLNM {.} = 72; {Line feed new line mode} + eMATM { } = 73; {Multiple area transfer mode} + eMC {.} = 74; {Media copy} + eMW {.} = 75; {Message waiting} + eNEL {X} = 76; {Next line} + eNP {.} = 77; {Next page} + eOSC { } = 78; {Operating system command} + ePLD { } = 79; {Partial line down} + ePLU { } = 80; {Partial line up} + ePM { } = 81; {Privacy message} + ePP {.} = 82; {Preceding page} + ePU1 { } = 83; {Private use 1} + ePU2 { } = 84; {Private use 2} + ePUM { } = 85; {Positioning unit mode} + eQUAD { } = 86; {Quad} + eREP { } = 87; {Repeat} + eRI {X} = 88; {Reverse index} + eRIS {.} = 89; {Reset to initial state} + eRM {.} = 90; {Reset mode} + eSATM { } = 91; {Selected area transfer mode} + eSD { } = 92; {Scroll down} + eSEM { } = 93; {selected editing extent mode} + eSGR {X} = eSetAttribute;{Select graphics rendition} + eSL { } = 94; {Scroll left} + eSM {.} = eSetMode;{Set Mode} + eSPA { } = 95; {Start of protected area} + eSPI { } = 96; {Spacing increment} + eSR { } = 97; {Scroll right} + eSRM { } = 98; {Send-Receive mode} + eSRTM { } = 99; {Status report transfer mode} + eSS2 { } = 100; {Single shift 2} + eSS3 { } = 101; {Single shift 3} + eSSA { } = 102; {Start of selected area} + eST { } = 103; {String terminator} + eSTS { } = 104; {Set transmit state} + eSU { } = 105; {Scroll up} + eTBC {X} = 106; {Tabulation clear} + eTSM { } = 107; {Tabulation stop mode} + eTSS { } = 108; {Thin space specification} + eTTM { } = 109; {Transfer termination mode} + eVEM { } = 110; {Vertical editing mode} + eVPA {X} = 111; {Vertical position absolute} + eVPR {X} = eCUD; {Vertical position relative} + eVTS {X} = 112; {vertical tabulation set} + eDECSTBM = 113; {dec private-set Top/Bottom margin} + + eENQ {X} = 114; {enquiry request} + eBEL {X} = 115; {sound bell} + eBS {X} = 116; {backspace} + eLF {X} = 117; {line feed command} + eCR {X} = 118; {carriage return} + eSO {X} = 119; {invoke G1 charset} + eSI {X} = 120; {invoke G0 charset} + eIND2 {X} = 121; {corrected eIND (<> eCUD, eDown) new term only} + eDECALN = 122; {DEC PRIVATE-screen alignment display} + eDECDHL = 123; {DEC PRIVATE-Double height line} + eDECDWL = 124; {DEC PRIVATE-Double width line} + eDECLL = 125; {DEC PRIVATE-load LEDs} + eDECREQTPARM = 126; {DEC PRIVATE-request terminal parameters} + eDECSWL = 127; {DEC PRIVATE-single width line} + eDECTST = 128; {DEC PRIVATE-Invoke confidence test} + eDECSCS = 129; {DEC PRIVATE-select charset} + + {Extended attributes} + eattrBlink = $01; + eattrInverse = $02; + eattrIntense = $04; + eattrInvisible = $08; + eattrUnderline = $10; + + {ANSI color constants} + emBlack = 0; + emRed = 1; + emGreen = 2; + emYellow = 3; + emBlue = 4; + emMagenta = 5; + emCyan = 6; + emWhite = 7; + emBlackBold = 8; + emRedBold = 9; + emGreenBold = 10; + emYellowBold = 11; + emBlueBold = 12; + emMagentaBold = 13; + emCyanBold = 14; + emWhiteBold = 15; + + {AnsiEmulator option flags} + teMapVT100 = $0001; + + {Misc} + MaxParams = 5; {Maximum parameters for our interpreter} + MaxQueue = 20; {Maximum characters in queue} + MaxOther = 11; {Maximum other data} + MaxParamLength = 5; {Maximum parameter length for interpreter} + KeyMappingLen = 20; {Maximum length of a keymapping} + +type + {AnsiEmulator's parser states} + TAnsiParser = (GotNone, GotEscape, GotBracket, GotSemiColon, GotParam, + GotCommand, GotControlSeqIntro, GotLeftBrace, GotRightBrace, + GotSpace, GotQuestionMark, GotQuestionParam); + + {Array used for internal queue} + TApQueue = Array[1..MaxQueue] of AnsiChar; // SWB + + {Emulator for PC ANSI codes} + //PAnsiEmulator = ^TAnsiEmulator; + TAnsiEmulator = record + emuType : Cardinal; { Emulator Type } + emuFlags : Cardinal; + emuFirst : Bool; {True if first time thru} + emuAttr : Byte; + emuIndex : Cardinal; {Index into rcvd byte array} + emuParamIndex : Cardinal; {Parameter index} + emuQueue : TApQueue; {Queue of recvd bytes} // SWB + emuParamStr : array[1..MaxParams] of string; //[MaxParamLength]; + emuParamInt : array[1..MaxParams] of Integer; + emuParserState : TAnsiParser; {Current state} + emuOther : _Pointer; + end; + +const + {Terminal window Cardinal} + gwl_Terminal = 0; + + {Terminal options} + tws_WantTab = $0001; {Process tabs internally} + tws_IntHeight = $0002; {Integral height} + tws_IntWidth = $0004; {Integral width} + tws_AutoHScroll = $0008; {Add/remove horiz scroll automatically} + tws_AutoVScroll = $0010; {Add/remove vert scroll automatically} + +type + {For general typecasting} + LH = record + L,H : Word; + end; + + {IniDBase (deprecated) consts and types} +const + MaxDBRecs = 999; {Maximum number of database records} + MaxNameLen = 21; {Maximum length of a profile string key} + MaxIndexLen = 31; {Maximum length of an index string} + NonValue = '#'; {Value of DB fields SPECIFICALLY left blank} + dbIndex = 'Index'; {Item index section heading} + dbDefaults = 'Defaults'; {Default value section heading} + dbNumEntries = '_Entries'; {Number of entries key name} + dbBogus = 'None'; {Bogus key name for creating sections} + +type + //PIniDatabaseKey = ^TIniDatabaseKey; + TIniDatabaseKey = record + //KeyName : PAnsiChar; + DataSize : Cardinal; + StrType : Bool; + Index : Bool; + //Next : PIniDatabaseKey; + end; + + //PIniDatabase = ^TIniDatabase; + TIniDatabase = record + //FName : PAnsiChar; + //DictionaryHead : PIniDatabaseKey; + //DictionaryTail : PIniDatabaseKey; + NumRecords : Integer; + RecordSize : Cardinal; + DefaultRecord : _Pointer; + Prepared : Bool; + end; + +const + ApdMaxTags = 5; {Maximum number of err corr or data comp tags} + ApdTagSepChar = ','; {Character that separates tags in a profile string} + +const + ApdModemNameLen = 31; {Length of a modem name string} + ApdCmdLen = 41; {Maximum length of a modem command} + ApdRspLen = 21; {Maximum length of a modem response} + ApdTagLen = 21; {Maximum length of a tag string} + ApdTagProfLen = 105; {Maximum length of a tag profile string} + ApdBoolLen = 5; {Maximum length of a boolean string} + ApdBaudLen = 7; {Maximum length of a baud rate string} + ApdConfigLen = 255; {Maximum length of a configuration string} + +type + {where these same variables are declared as Strings.} + TModemNameZ = array[0..ApdModemNameLen] of AnsiChar; //SZ: must probably be Ansi + TCmdStringZ = array[0..ApdCmdLen] of AnsiChar; + TRspStringZ = array[0..ApdRspLen] of AnsiChar; + TTagStringZ = array[0..ApdTagLen] of AnsiChar; + TTagProfStringZ = array[0..ApdTagProfLen] of AnsiChar; + TConfigStringZ = array[0..ApdConfigLen] of AnsiChar; + TBoolStrZ = array[0..ApdBoolLen] of AnsiChar; + TBaudStrZ = array[0..ApdBaudLen] of AnsiChar; + + TTagArrayZ = array[1..ApdMaxTags] of TTagStringZ; + + //PModemBaseData = ^TModemBaseData; + TModemBaseData = record + Name : TModemNameZ; + InitCmd : TCmdStringZ; + DialCmd : TCmdStringZ; + DialTerm : TCmdStringZ; + DialCancel : TCmdStringZ; + HangupCmd : TCmdStringZ; + ConfigCmd : TConfigStringZ; + AnswerCmd : TCmdStringZ; + OkMsg : TRspStringZ; + ConnectMsg : TRspStringZ; + BusyMsg : TRspStringZ; + VoiceMsg : TRspStringZ; + NoCarrierMsg : TRspStringZ; + NoDialToneMsg : TRspStringZ; + ErrorMsg : TRspStringZ; + RingMsg : TRspStringZ; + end; + + //PModemData = ^TModemData; + TModemData = record + Data : TModemBaseData; + NumErrors : Cardinal; + Errors : TTagArrayZ; + NumComps : Cardinal; + Compression : TTagArrayZ; + LockDTE : Bool; + DefBaud : Integer; + end; + + //PModemXFer = ^TModemXFer; + TModemXFer = record + Data : TModemBaseData; + Errors : TTagProfStringZ; + Compress : TTagProfStringZ; + LockDTE : TBoolStrZ; + DefBaud : TBaudStrZ; + end; + + //PModemDatabase = ^TModemDatabase; + TModemDatabase = record + DB : {P}TIniDatabase; + end; + + +const + {keyboard shift state masks} + ksControl = $02; + ksAlt = $04; + ksShift = $08; + + {keyboard toggle state masks} + tsCapital = $02; + tsNumlock = $04; + tsScroll = $08; + + {keyboard INI file constants} + ApdKeyMapNameLen = 30; {Length of a KeyMap name string} + ApdMaxKeyMaps = 100; {Maximum possible key mapping per type} + + ApdKeyIndexName = 'EMULATOR'; + ApdKeyIndexMaxLen = 120; + +type + TKeyMapName = array[0..ApdKeyMapNameLen] of AnsiChar; + TKeyMapping = array[0..KeyMappingLen] of Ansichar; + TKeyMappingStr = string; //[KeyMappingLen]; + + + //PKeyMapXFerRec = ^TKeyMapXFerRec; + TKeyMapXFerRec = record + Name : TKeyMapName; + Keys : array[1..ApdMaxKeyMaps] of TKeyMapping; + end; + + //PVKeyMapRec = ^TVKeyMapRec; + TVKEyMapRec = record + KeyCode : Cardinal; + ShiftState: Cardinal; + Mapping : TKeyMappingStr; + end; + + //PKeyEmulator = ^TKeyEmulator; + TKeyEmulator = record + kbKeyFileName : PChar; { current file name } + kbKeyName : TKeyMapName; { current key index name } + kbProcessAll : Bool; + kbProcessExt : Bool; + kbKeyNameList : array[0..ApdKeyIndexMaxLen] of Ansichar; + kbKeyMap : array[1..ApdMaxKeyMaps] of TVKeyMapRec; + kbKeyDataBase : TIniDataBase; { pointer to the INI data base file } + end; + +const + {---- Option codes for protocols ----} + apIncludeDirectory = $0001; {Set to include directory in file names} + apHonorDirectory = $0002; {Set to honor directory in file names} + apRTSLowForWrite = $0004; {Set to lower RTS during disk writes} + apAbortNoCarrier = $0008; {Set to abort protocol on DCD loss} + apKermitLongPackets = $0010; {Set to support long packets} + apKermitSWC = $0020; {Set to support SWC} + apZmodem8K = $0040; {Set to support 8K blocks} + apBP2KTransmit = $0080; {Set to support 2K transmit blocks} + apAsciiSuppressCtrlZ = $0100; {Set to stop transmitting on ^Z} + + {---- Default options for protocols ----} + DefProtocolOptions = 0; + BadProtocolOptions = apKermitLongPackets+apKermitSWC+apZmodem8K; + + {Block check codes} + abcNone = 0; {No block checking} + bcChecksum1 = 1; {Basic checksum} + bcChecksum2 = 2; {Two byte checksum} + bcCrc16 = 3; {16 bit Crc} + bcCrc32 = 4; {32 bit Crc} + bcCrcK = 5; {Kermit style Crc} + + {Convenient blockcheck string constants} + bcsNone = 'No check'; + bcsChecksum1 = 'Checksum'; + bcsChecksum2 = 'Checksum2'; + bcsCrc16 = 'Crc16'; + bcsCrc32 = 'Crc32'; + bcsCrck = 'CrcKermit'; + + {Constants for supported protocol types} + NoProtocol = 0; + Xmodem = 1; + XmodemCRC = 2; + Xmodem1K = 3; + Xmodem1KG = 4; + Ymodem = 5; + YmodemG = 6; + Zmodem = 7; + Kermit = 8; + Ascii = 9; + BPlus = 10; + + {Zmodem attention string length} + MaxAttentionLen = 32; + + {Zmodem file management options} + zfWriteNewerLonger = 1; {Transfer if new, newer or longer} + zfWriteCrc = 2; {Not supported, same as WriteNewer} + zfWriteAppend = 3; {Transfer if new, append if exists} + zfWriteClobber = 4; {Transfer regardless} + zfWriteNewer = 5; {Transfer if new or newer} + zfWriteDifferent = 6; {Transfer if new or diff dates/lens} + zfWriteProtect = 7; {Transfer only if new} + + {Convenient protocol string constants} + var ProtocolString : array[NoProtocol..BPlus] of array[0..9] of AnsiChar; + {= ( + 'None', 'Xmodem', 'XmodemCRC', 'Xmodem1K', 'Xmodem1KG', + 'Ymodem', 'YmodemG', 'Zmodem', 'Kermit', 'Ascii', 'B+'); } + +type + {For holding lists of files to transmit} + //PFileList = ^TFileList; + TFileList = array[0..65535-1] of Char; + +{Fax conversion} + +const + rw1728 = 1; {standard width} + rw2048 = 2; {extra wide} + + {Fax pixel widths} + StandardWidth = 1728; {Standard width in pixels} + WideWidth = 2048; {Allowed higher resolution} + + {Option flags for FAX page header} + ffHighRes = $0001; {Image stored in high-res mode} + ffHighWidth = $0002; {Image uses option high-width mode} + ffLengthWords = $0004; {Set if raster lines include length Cardinal} + + {Options for fax conversion} + fcDoubleWidth = $0001; {Double the horizontal width in std res} + fcHalfHeight = $0002; {Halve the vertical height in std res} + fcCenterImage = $0004; {Center graphics images horizontally} + fcYield = $0008; {Have the converter yield while converting} + fcYieldOften = $0010; {Increases the number of yields} + + {Flags passed to status function} + csStarting = $0001; + csEnding = $0002; + + {Font handles, same value as bytes-per-char} + SmallFont = 16; + StandardFont = 48; + + {Maximum number of tree records} + MaxTreeRec = 306; + + {Max size of decompress buffer} + MaxData = 4096; + + {Text conversion limits} + MaxLineLen = 144; + + {encoding/decoding table limits} + MaxCodeTable = 63; + MaxMUCodeTable = 39; + + {default extensions} + DefTextExt = 'TXT'; + DefTiffExt = 'TIF'; + DefPcxExt = 'PCX'; + DefDcxExt = 'DCX'; + DefBmpExt = 'BMP'; + DefApfExt = 'APF'; + +type + {Compression code tables} + TCodeRec = record + Code : Word; + Sig : Word; + end; + + TTermCodeArray = array[0..MaxCodeTable] of TCodeRec; + TMakeUpCodeArray = array[0..MaxMUCodeTable] of TCodeRec; + + //PBufferedOutputFile = ^TBufferedOutputFile; + TBufferedOutputFile = record + BufPos : Word; + //Buffer : PByteArray; + OutFile : File; + end; + + {For storing station IDs} + Str20 = string; //[20]; + + {Stores information about our fonts} + TFontRecord = record + Bytes : Byte; {# of bytes per char in font} + PWidth : Byte; {width of font in pixels} + Width : Byte; {width of font in bytes (e.g. 16-pixel-wide = 2)} + Height : Byte; {height of font in raster lines} + end; + + {Fax file signature array} + TSigArray = Array[0..5] of AnsiChar; + +var + {Default fax file signature, first 6 chars in an APF} + DefAPFSig : TSigArray; // = 'APF10'#26; + +type + {APRO fax file header record} + TFaxHeaderRec = record + Signature : TSigArray; {APRO FAX signature} + FDateTime : Integer; {Date and time in DOS format} + SenderID : Str20; {Station ID of sender} + Filler : Byte; {Alignment byte, unused} + PageCount : Word; {Number of pages in this file} + PageOfs : Integer; {Offset in file of first page} + Padding : Array[39..64] of Byte; {Expansion room} + end; + + {APRO fax page header record} + TPageHeaderRec = record + ImgLength : Integer; {Bytes of image data in this page} + ImgFlags : Word; {Image flags for width, res, etc} + Padding : Array[7..16] of Byte; {Expansion room} + end; + + {APRO fax server job header} + TFaxJobHeaderRec = record + ID : Integer; {APRO fax job signature} + Status : Byte; {0=none sent, 1=some sent, 2=all sent, 3=paused} + JobName : Str20; {Friendly name of fax job} + Sender : String; //[40]; {Name of sender (same as HeaderSender)} + SchedDT : TDateTime; {TDateTime the first job should be sent} + NumJobs : Byte; {Number of FaxJobInfoRecs for this job} + NextJob : Byte; {The index of the next FaxJobInfo to send} + CoverOfs : Integer; {Offset in file of text CoverFile data} + FaxHdrOfs: Integer; {Offset in file of TFaxHeaderRec} + Padding : Array[86..128] of Byte; {Expansion room} + end; + + {APRO fax server job recipient record } + TFaxRecipientRec = record + Status : Byte; {0=not sent, 1=sending, 2=sent, 3=paused} + JobID : Byte; {Unique ID for this job} + SchedDT : TDateTime; {TDateTime this job should be sent} + AttemptNum : Byte; {Retry number for this recipient} + LastResult : Word; {Last ErrorCode for this fax} + PhoneNumber : String;//[50]; {Phone number to dial for this job} + HeaderLine : String;//[100]; {Header line} + HeaderRecipient: String;//[30]; {Recipient's name} + HeaderTitle : String;//[30]; {Title of fax} + Padding : Array[228..256] of Byte;{Expansion room} + end; + + {Pcx header} + TPcxPalArray = Array[0..47] of Byte; + TPcxHeaderRec = record + Mfgr : Byte; + Ver : Byte; + Encoding : Byte; + BitsPixel : Byte; + XMin : Word; + YMin : Word; + XMax : Word; + YMax : Word; + HRes : Word; + VRes : Word; + Palette : TPcxPalArray; + Reserved : Byte; + Planes : Byte; + BytesLine : Word; + PalType : Word; + Filler : Array[1..58] of Byte; {pad to 128 bytes} + end; + + TDcxOfsArray = array[1..1024] of Integer; + + //PDcxHeaderRec = ^TDcxHeaderRec; + TDcxHeaderRec = record + ID : Integer; + Offsets : TDcxOfsArray; + end; + + TTreeRec = record + Next0 : Integer; + Next1 : Integer; + end; + TTreeArray = array[0..MaxTreeRec] of TTreeRec; + //PTreeArray = ^TTreeArray; + + {$IFNDEF DrvInst} + //PAbsFaxCvt = ^TAbsFaxCvt; + + {callback function to open a converter input file} + (* TOpenFileCallback = function(Cvt : PAbsFaxCvt; FileName : string) : Integer; + + {callback function to close a converter input file} + TCloseFileCallback = procedure(Cvt : PAbsFaxCvt); + + {callback function converters use to get input raster} + TGetLineCallback = function(Cvt : PAbsFaxCvt; var Data; var Len : Integer; + var EndOfPage, MorePages : Bool) : Integer; + + {callback function converters use to output data} + TPutLineCallback = function(Cvt : PAbsFaxCvt; var Data; Len : Integer; + EndOfPage, MorePages : Bool) : Integer; + + + {callback function for status information} + TCvtStatusCallback = function(Cvt : PAbsFaxCvt; StatFlags : Word; + BytesRead, BytesToRead : Integer) : Bool; + + *) + + {base converter data} + TAbsFaxCvt = record + UseHighRes : Bool; {TRUE if for high-res mode} + DoubleWidth : Bool; {TRUE do double each pixel} + HalfHeight : Bool; {TRUE to discard each raster line} + Flags : Cardinal; {Options flags} + ByteOfs : Cardinal; {Byte offset in buffer} + BitOfs : Cardinal; {Bit offset in buffer} + ResWidth : Cardinal; {Width of current resolution in pels} + LeftMargin : Cardinal; {Left margin in pels} + TopMargin : Cardinal; {Top margin in pels} + CurrPage : Cardinal; {Current page being processed} + CurrLine : Cardinal; {Number of text/raster lines cvted} + LastPage : Cardinal; {Last page number used in file cvt} + CurPagePos : Integer; {file offset of current page} + CenterOfs : Cardinal; {Offset of center of bitmap} + UserData : _Pointer; {Data needed by higher level cvters} + OtherData : _Pointer; {Other, miscellaneous data} + BytesRead : Integer; + BytesToRead : Integer; + //DataLine : PByteArray; {Buffered line of compressed data} + //TmpBuffer : PByteArray; {Temp compression buffer} + //GetLine : TGetLineCallback; {Callback function to get a raster line} + //OpenCall : TOpenFileCallback; {To open the input file, if any} + //CloseCall : TCloseFileCallback; {To close the input file, if any} + //StatusFunc : TCvtStatusCallback; {Callback for status display} + StatusWnd : HWnd; {Handle of window receiving status msgs} + DefExt : string; // array[0..3] of AnsiChar; + InFileName : string; // array[0..255] of AnsiChar; + OutFileName : string; // array[0..255] of AnsiChar; + StationID : AnsiString; //array[0..20] of AnsiChar; + MainHeader : TFaxHeaderRec; {main header of fax output file} + PageHeader : TPageHeaderRec; {header for current output page} + //OutFile : PBufferedOutputFile;{Output file} + PadPage : Bool; {True to pad text conversion to full page}{!!.04} + {$IFNDEF PrnDrv} + InBitmap : {Graphics.}TBitmap; + {$ENDIF} + end; + +{$IFNDEF PrnDrv} + +type + { moved from AdWUtil } {!!.06} + SunB = record {!!.06} + s_b1, s_b2, s_b3, s_b4 : AnsiChar; {!!.06} + end; {!!.06} + { moved from AdWUtil } {!!.06} + SunW = record {!!.06} + s_w1, s_w2 : Word; {!!.06} + end; {!!.06} + + { moved from AdWnPort and AdWUtil } {!!.06} + //PInAddr = ^TInAddr; {!!.06} + (* aTInAddr = record {!!.06} + case Integer of {!!.06} + 0 : (S_un_b : SunB); {!!.06} + 1 : (S_un_w : SunW); {!!.06} + 2 : (S_addr : Integer); {!!.06} + end; *) {!!.06} + + { XML support } +//const + {The following constants are the tokens needed to parse an XML + document. The tokens are stored in UCS-4 format to reduce the + number of conversions needed by the filter.} +(* Xpc_BracketAngleLeft : array[0..0] of Integer = (60); {<} + Xpc_BracketAngleRight : array[0..0] of Integer = (62); {>} + Xpc_BracketSquareLeft : array[0..0] of Integer = (91); {[} + Xpc_BracketSquareRight : array[0..0] of Integer = (93); {]} + Xpc_CDATAStart : + array[0..5] of Integer = (67, 68, 65, 84, 65, 91); {CDATA[} + Xpc_CharacterRef : array[0..0] of Integer = (35); {#} + Xpc_CharacterRefHex : array[0..0] of Integer = (120); {x} + Xpc_CommentEnd : array[0..2] of Integer = (45, 45, 62); {-->} + Xpc_CommentStart : array[0..3] of Integer = (60, 33, 45, 45); { + + + +
PROGRAM SEPDemo_App_mX4_PythonTemplate_URLLib_ISBN_Agent_PyPas;
+//https://pythonprogramming.net/urllib-tutorial-python-3/
+//https://gist.github.com/AO8/faa3f52d3d5eac63820cfa7ec2b24aa7
+{Purpose: validate an ISBN with Pascal and get Info with Python}
+
+//<Constant declarations> 
+//Please check providers list below: ['mymemory', 'microsoft', 'deepl', 'libre'].
+{TYPE 
+<Type declarations>} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+      PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; 
+      PYDLL64  = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; 
+
+Var 
+//<Variable declarations>
+  i: integer; eng: TPythonEngine;
+
+//<FUNCTION>
+//<PROCEDURE> 
+//Generate public key and private key
+
+Const PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+              
+Const PYTURTLE = 'from turtle import *      '+LF+
+                 'color("red", "yellow")    '+LF+
+                 's = Screen()              '+LF+
+                 's.setup(700,500)          '+LF+
+                 's.bgcolor("black")        '+LF+
+                 '#speed(5)                  '+LF+
+                 'begin_fill()              '+LF+
+                 'while True:               '+LF+
+                 '    forward(250)          '+LF+
+                 '    left(170)             '+LF+
+                 '    if abs(pos()) < 1:    '+LF+
+                 '         break            '+LF+
+                 'end_fill()                '+LF+
+                 'done()                    '; 
+
+//https://gist.github.com/AO8/faa3f52d3d5eac63820cfa7ec2b24aa7                 
+Const ISBNAGENT = 
+  //'while True: '+LF+
+  'import urllib.request, json, textwrap' +LF+
+  'base_api_link="https://www.googleapis.com/books/v1/volumes?q=isbn:"   '+LF+
+  'user_input = ("3935042469").strip()                                   '+LF+
+
+  'with urllib.request.urlopen(base_api_link + user_input) as f:         '+LF+
+  '    text = f.read()                                                   '+LF+
+
+  'decoded_text = text.decode("utf-8")                                   '+LF+
+  'obj = json.loads(decoded_text) # deserializes decoded_textto Py object'+LF+
+  'volume_info = obj["items"][0]                                         '+LF+
+  'authors = obj["items"][0]["volumeInfo"]["authors"]                    '+LF+
+
+  '# displays title, summary, author, domain, page count and language    '+LF+
+  'print("\nTitle:", volume_info["volumeInfo"]["title"])                 '+LF+
+  'print("\nSummary:\n")                                                 '+LF+
+  'print(textwrap.fill(volume_info["saleInfo"]["country"],width=65))     '+LF+
+  'print("\nAuthor(s):", ",".join(authors))                              '+LF+
+  'print("\nPublic Domain:", volume_info["accessInfo"]["publicDomain"])  '+LF+
+  'print("\nPage count:", volume_info["volumeInfo"]["pageCount"])        '+LF+
+  'print("\nLanguage:", volume_info["volumeInfo"]["language"])           '+LF+
+  'print("\n***")                                                        ';
+     
+Const ISBNAGENT2 = 
+  //'while True: '+LF+
+  'import urllib.request, json, textwrap' +LF+
+  'pls = []                                                             '+LF+
+  'base_api_link="https://www.googleapis.com/books/v1/volumes?q=isbn:"   '+LF+
+  'user_input = ("3935042469").strip()                                   '+LF+
+
+  'with urllib.request.urlopen(base_api_link + user_input) as f:         '+LF+
+  '    text = f.read()                                                   '+LF+
+
+  'decoded_text = text.decode("utf-8")                                   '+LF+
+  'obj = json.loads(decoded_text) # deserializes decoded_textto Py object'+LF+
+  'volume_info = obj["items"][0]                                         '+LF+
+  'authors = obj["items"][0]["volumeInfo"]["authors"]                    '+LF+
+
+  '# displays title, summary, author, domain, page count and language     '+LF+
+  'pls.append("\nTitle:"+ volume_info["volumeInfo"]["title"])            '+LF+
+  'pls.append("\nSummary:\n")                                            '+LF+
+  'pls.append(textwrap.fill(volume_info["saleInfo"]["country"],width=65))'+LF+
+  'pls.append("\nAuthor(s):"+ ",".join(authors))                         '+LF+
+  'pls.append("\nPubDom:"+str(volume_info["accessInfo"]["publicDomain"]))'+LF+
+  'pls.append("\nPagecount:"+str(volume_info["volumeInfo"]["pageCount"]))'+LF+
+  'pls.append("\nLanguage:"+volume_info["volumeInfo"]["language"])      '+LF+//*)
+  'pls.append("\n***************")                                      ';
+                 
+Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+
+                    '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; 
+
+Const WEBURL= 'https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469'; 
+
+Const REXDEF= 'def striphtml(data):      '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+               
+function ValidISBN_10(const aISBN: string): boolean;
+var
+  hNumber,
+  hCheckDigit: string;
+  hCheckValue,
+  hCheckSum,
+  Err: integer;
+  i,Cnt: Word;
+begin
+  Result := false;
+  hCheckDigit := Copy(aISBN, Length(aISBN), 1);
+  {Get rest of ISBN, minus check digit and its hyphen}
+  hNumber := Copy(aISBN, 1, Length(aISBN) - 2);
+  {Length of ISBN remainder must be 11 and check digit
+   between 9 and 9 or X}
+  if (Length(hNumber)=11)and(Pos(hCheckDigit,
+      '0123456789X') > 0) then begin
+    {Get numeric value for check digit}
+    if (hCheckDigit = 'X') then
+      hCheckSum := 10
+    else
+      Val(hCheckDigit, hCheckSum, Err);
+      {Iterate through ISBN remainder, applying decode
+      algorithm}
+    Cnt := 1;
+    for i := 1 to 12 do begin
+      {Act only if current character is between "0" and "9"
+      to exclude hyphens}
+      if (Pos(hNumber[i], '0123456789') > 0) then begin
+        Val(hNumber[i], hCheckValue, Err);
+        {Algorithm for each character in ISBN remainder, Cnt
+        is the nth character so processed}
+        hCheckSum := hCheckSum + hCheckValue * (11 - Cnt);
+        Inc(Cnt);
+      end;
+    end;
+    {Verify final value is evenly divisible by 11}
+    if (hCheckSum mod 11 = 0) then
+      Result := true
+    else
+      Result := false;
+  end;
+end;    
+
+{Funktion validiert ISBN-13
+Gültig ab 1.1.2007
+Wenn streng = True, wird die Voranstellung von 'ISBN ' und die korrekte
+Verwendung der Bindestriche verlangt}
+function ValidISBN_13(const s: string; streng: Boolean): Boolean;
+var
+  i, x, n: Integer;
+  tmp: string;
+begin
+  Result:= True;
+  writeln(s[9])
+  if (not streng) or ((Copy(s, 1, 5) = 'ISBN ') and (Length(s) = 22)
+    and (s[9] = '-') and (s[21] = '-')) then begin
+    for i:= 1 to Length(s) do
+      if s[i] in StrToCharSet(DIGISET) then //['0'..'9'] then
+        tmp:= tmp + s[i]
+      else
+        if streng then
+          if (s[i] = '-') then
+            Inc(n)
+          else if (i > 5) then
+            Result:= False;
+    if (Result) and ((not streng) or (n = 4)) then begin
+      if Length(tmp) = 13 then begin
+        for i:= 1 to 12 do
+          if i div 2 = i/2 then
+            x:= x + StrToInt(tmp[i]) * 3
+          else
+            x:= x + StrToInt(tmp[i]);
+        if StrToInt(tmp[13]) > ((10 - (x mod 10)) mod 10) then  //> <
+          Result := False;
+      end else
+        Result:= False;
+    end else
+      Result:= False;
+  end else
+    Result:= False;
+end; 
+
+{procedure InitSockets;
+var Data: WSAData;
+begin
+  WSAStartup( MakeWord(1,1), Data);  //Das wäre dann Version 1.1
+end;}               
+                         
+Begin  //@Main
+//<Executable statements>
+
+//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469
+{ ISBN-10 ? : 3935042469
+  ISBN-13 ? : 978-3935042468} 
+
+  writeln(botostr(ValidISBN_13('ISBN 978-3-9350-4246-8', True)));
+  writeln(botostr(IsValidISBN2('3935042469')));
+  
+  writeln(botostr(ValidISBN_13('ISBN 978-3-7657-2780-1', True))); //True back
+  writeln(botostr(ValidISBN_13('ISBN 978-3-7657-2780-1', False))); //True back  
+  writeln(botostr(IsValidISBN('9783765727801')));
+  writeln(botostr(IsValidISBN('3765727806')));    //ISBN 13<-->10 converters
+  writeln(botostr(IsValidISBN2('3765727806'))); //--
+
+  //writeln(botostr(ValidISBN_13('9783765727801', false)));
+  
+  eng:= TPythonEngine.Create(Nil);
+  eng.pythonhome:= PYHOME32;
+  eng.opendll(PYDLL32)
+  //eng.IO:= pyMemo;
+  try
+    eng.Execstring('import base64'+LF+'import urllib.parse');
+    eng.Execstring('import urllib.request'+LF+'import os,re,textwrap,json');
+    eng.Execstring(REXDEF);
+ 
+    eng.Execstring('url = "https://www.google.com/search"'+LF+
+                   'url2= "https://www.google.com/search?q=python+maxbox"'+LF+
+                   'url3= "'+WEBURL+'"'+LF+
+                   'values = {"q" : "python programming tutorials"}'+LF+
+                   'uheaders = {}');
+                              
+    eng.Execstring('data = urllib.parse.urlencode(values)'+LF+
+                   'data = data.encode("utf-8") # data should be bytes'+LF+
+                   'uheaders["User-Agent"] = "'+USERAGENT+'"'+LF+
+                // 'req= urllib.request.Request(url,data,headers=uheaders)'+LF+
+                   'req = urllib.request.Request(url3, headers= uheaders)'+LF+
+                   'resp = urllib.request.urlopen(req)'); 
+                     
+    println(eng.evalStr('striphtml(str(resp.read()))'));  
+    
+    {first integration with internal script/invoke}
+    eng.Execstring(ISBNAGENT2);
+    println(eng.evalStr('pls')); 
+    println(StringReplace(eng.evalStr('pls'),'\n',#13#10,[rfReplaceAll]));
+       
+    {second integration with external script/shell}
+    //saveString(exepath+'py_isbnagent.py', ISBNAGENT);
+    //writeln(getDosOutput('py '+exepath+'py_isbnagent.py', exePath));          
+
+//Turns out that Google will return a 405, method not allowed. Google is not happy with request!
+//Exception: <class 'urllib.error.HTTPError'>: HTTP Error 429: Too Many Requests.
+                                         
+  except
+    eng.raiseError;
+  finally
+    eng.Free;
+    //aPythonVersion.Free;
+  end;    
+  //maXcalcF('2^64 /(60*60*24*365)')  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+
+Ref code:  
+Patterns konkret.
+ISBN-13: 9783935042468
+ISBN-10: 3935042469
+Author: Kleiner, Max
+Binding: Paperback
+Publisher: Software + Support
+Published: September 2003
+
+https://mymemory.translated.net/doc/spec.php
+Hello PyWorld_, 
+This data will be written on the file.
+Hola PyWorld_,&#10; Estos datos se escribirán en el archivo.
+
+MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN  02
+ HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+ 
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+ \ No newline at end of file diff --git a/Demos/pydemo10.txt b/Demos/pydemo10.txt new file mode 100644 index 00000000..0dd725b1 --- /dev/null +++ b/Demos/pydemo10.txt @@ -0,0 +1,281 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_URLLib_ISBN_Agent_PyPas; +//https://pythonprogramming.net/urllib-tutorial-python-3/ +//https://gist.github.com/AO8/faa3f52d3d5eac63820cfa7ec2b24aa7 +{Purpose: validate an ISBN with Pascal and get Info with Python} + +// +//Please check providers list below: ['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE +} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; + PYDLL64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// +// +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const PYTURTLE = 'from turtle import * '+LF+ + 'color("red", "yellow") '+LF+ + 's = Screen() '+LF+ + 's.setup(700,500) '+LF+ + 's.bgcolor("black") '+LF+ + '#speed(5) '+LF+ + 'begin_fill() '+LF+ + 'while True: '+LF+ + ' forward(250) '+LF+ + ' left(170) '+LF+ + ' if abs(pos()) < 1: '+LF+ + ' break '+LF+ + 'end_fill() '+LF+ + 'done() '; + +//https://gist.github.com/AO8/faa3f52d3d5eac63820cfa7ec2b24aa7 +Const ISBNAGENT = + //'while True: '+LF+ + 'import urllib.request, json, textwrap' +LF+ + 'base_api_link="https://www.googleapis.com/books/v1/volumes?q=isbn:" '+LF+ + 'user_input = ("3935042469").strip() '+LF+ + + 'with urllib.request.urlopen(base_api_link + user_input) as f: '+LF+ + ' text = f.read() '+LF+ + + 'decoded_text = text.decode("utf-8") '+LF+ + 'obj = json.loads(decoded_text) # deserializes decoded_textto Py object'+LF+ + 'volume_info = obj["items"][0] '+LF+ + 'authors = obj["items"][0]["volumeInfo"]["authors"] '+LF+ + + '# displays title, summary, author, domain, page count and language '+LF+ + 'print("\nTitle:", volume_info["volumeInfo"]["title"]) '+LF+ + 'print("\nSummary:\n") '+LF+ + 'print(textwrap.fill(volume_info["saleInfo"]["country"],width=65)) '+LF+ + 'print("\nAuthor(s):", ",".join(authors)) '+LF+ + 'print("\nPublic Domain:", volume_info["accessInfo"]["publicDomain"]) '+LF+ + 'print("\nPage count:", volume_info["volumeInfo"]["pageCount"]) '+LF+ + 'print("\nLanguage:", volume_info["volumeInfo"]["language"]) '+LF+ + 'print("\n***") '; + +Const ISBNAGENT2 = + //'while True: '+LF+ + 'import urllib.request, json, textwrap' +LF+ + 'pls = [] '+LF+ + 'base_api_link="https://www.googleapis.com/books/v1/volumes?q=isbn:" '+LF+ + 'user_input = ("3935042469").strip() '+LF+ + + 'with urllib.request.urlopen(base_api_link + user_input) as f: '+LF+ + ' text = f.read() '+LF+ + + 'decoded_text = text.decode("utf-8") '+LF+ + 'obj = json.loads(decoded_text) # deserializes decoded_textto Py object'+LF+ + 'volume_info = obj["items"][0] '+LF+ + 'authors = obj["items"][0]["volumeInfo"]["authors"] '+LF+ + + '# displays title, summary, author, domain, page count and language '+LF+ + 'pls.append("\nTitle:"+ volume_info["volumeInfo"]["title"]) '+LF+ + 'pls.append("\nSummary:\n") '+LF+ + 'pls.append(textwrap.fill(volume_info["saleInfo"]["country"],width=65))'+LF+ + 'pls.append("\nAuthor(s):"+ ",".join(authors)) '+LF+ + 'pls.append("\nPubDom:"+str(volume_info["accessInfo"]["publicDomain"]))'+LF+ + 'pls.append("\nPagecount:"+str(volume_info["volumeInfo"]["pageCount"]))'+LF+ + 'pls.append("\nLanguage:"+volume_info["volumeInfo"]["language"]) '+LF+//*) + 'pls.append("\n***************") '; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL= 'https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +function ValidISBN_10(const aISBN: string): boolean; +var + hNumber, + hCheckDigit: string; + hCheckValue, + hCheckSum, + Err: integer; + i,Cnt: Word; +begin + Result := false; + hCheckDigit := Copy(aISBN, Length(aISBN), 1); + {Get rest of ISBN, minus check digit and its hyphen} + hNumber := Copy(aISBN, 1, Length(aISBN) - 2); + {Length of ISBN remainder must be 11 and check digit + between 9 and 9 or X} + if (Length(hNumber)=11)and(Pos(hCheckDigit, + '0123456789X') > 0) then begin + {Get numeric value for check digit} + if (hCheckDigit = 'X') then + hCheckSum := 10 + else + Val(hCheckDigit, hCheckSum, Err); + {Iterate through ISBN remainder, applying decode + algorithm} + Cnt := 1; + for i := 1 to 12 do begin + {Act only if current character is between "0" and "9" + to exclude hyphens} + if (Pos(hNumber[i], '0123456789') > 0) then begin + Val(hNumber[i], hCheckValue, Err); + {Algorithm for each character in ISBN remainder, Cnt + is the nth character so processed} + hCheckSum := hCheckSum + hCheckValue * (11 - Cnt); + Inc(Cnt); + end; + end; + {Verify final value is evenly divisible by 11} + if (hCheckSum mod 11 = 0) then + Result := true + else + Result := false; + end; +end; + +{Funktion validiert ISBN-13 +G�ltig ab 1.1.2007 +Wenn streng = True, wird die Voranstellung von 'ISBN ' und die korrekte +Verwendung der Bindestriche verlangt} +function ValidISBN_13(const s: string; streng: Boolean): Boolean; +var + i, x, n: Integer; + tmp: string; +begin + Result:= True; + writeln(s[9]) + if (not streng) or ((Copy(s, 1, 5) = 'ISBN ') and (Length(s) = 22) + and (s[9] = '-') and (s[21] = '-')) then begin + for i:= 1 to Length(s) do + if s[i] in StrToCharSet(DIGISET) then //['0'..'9'] then + tmp:= tmp + s[i] + else + if streng then + if (s[i] = '-') then + Inc(n) + else if (i > 5) then + Result:= False; + if (Result) and ((not streng) or (n = 4)) then begin + if Length(tmp) = 13 then begin + for i:= 1 to 12 do + if i div 2 = i/2 then + x:= x + StrToInt(tmp[i]) * 3 + else + x:= x + StrToInt(tmp[i]); + if StrToInt(tmp[13]) > ((10 - (x mod 10)) mod 10) then //> < + Result := False; + end else + Result:= False; + end else + Result:= False; + end else + Result:= False; +end; + +{procedure InitSockets; +var Data: WSAData; +begin + WSAStartup( MakeWord(1,1), Data); //Das w�re dann Version 1.1 +end;} + +Begin //@Main +// + +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 + ISBN-13 ? : 978-3935042468} + + writeln(botostr(ValidISBN_13('ISBN 978-3-9350-4246-8', True))); + writeln(botostr(IsValidISBN2('3935042469'))); + + writeln(botostr(ValidISBN_13('ISBN 978-3-7657-2780-1', True))); //True back + writeln(botostr(ValidISBN_13('ISBN 978-3-7657-2780-1', False))); //True back + writeln(botostr(IsValidISBN('9783765727801'))); + writeln(botostr(IsValidISBN('3765727806'))); //ISBN 13<-->10 converters + writeln(botostr(IsValidISBN2('3765727806'))); //-- + + //writeln(botostr(ValidISBN_13('9783765727801', false))); + + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'+LF+'import urllib.parse'); + eng.Execstring('import urllib.request'+LF+'import os,re,textwrap,json'); + eng.Execstring(REXDEF); + + eng.Execstring('url = "https://www.google.com/search"'+LF+ + 'url2= "https://www.google.com/search?q=python+maxbox"'+LF+ + 'url3= "'+WEBURL+'"'+LF+ + 'values = {"q" : "python programming tutorials"}'+LF+ + 'uheaders = {}'); + + eng.Execstring('data = urllib.parse.urlencode(values)'+LF+ + 'data = data.encode("utf-8") # data should be bytes'+LF+ + 'uheaders["User-Agent"] = "'+USERAGENT+'"'+LF+ + // 'req= urllib.request.Request(url,data,headers=uheaders)'+LF+ + 'req = urllib.request.Request(url3, headers= uheaders)'+LF+ + 'resp = urllib.request.urlopen(req)'); + + println(eng.evalStr('striphtml(str(resp.read()))')); + + {first integration with internal script/invoke} + eng.Execstring(ISBNAGENT2); + println(eng.evalStr('pls')); + println(StringReplace(eng.evalStr('pls'),'\n',#13#10,[rfReplaceAll])); + + {second integration with external script/shell} + //saveString(exepath+'py_isbnagent.py', ISBNAGENT); + //writeln(getDosOutput('py '+exepath+'py_isbnagent.py', exePath)); + +//Turns out that Google will return a 405, method not allowed. Google is not happy with request! +//Exception: : HTTP Error 429: Too Many Requests. + + except + eng.raiseError; + finally + eng.Free; + //aPythonVersion.Free; + end; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Ref code: +Patterns konkret. +ISBN-13: 9783935042468 +ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, +This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 02 + HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- \ No newline at end of file diff --git a/Demos/pydemo103.txt b/Demos/pydemo103.txt new file mode 100644 index 00000000..6f2ca747 --- /dev/null +++ b/Demos/pydemo103.txt @@ -0,0 +1,170 @@ +PROGRAM Jewels_and_stones_7_python_hidden_features; + +//https://rosettacode.org/wiki/Giuga_numbers#Delphi +//https://rosettacode.org/wiki/Jewels_and_stones#Delphi +//from https://python.plainenglish.io/5-python-mistakes-that-cost-me-a-job-offer-42fc4e73b814 + +CONST +// + TEXTOUT = 'hi world of code stone rage page'; + +function CommonLetters(S1,S2: string): integer; +{Count the number of letters in S1 are found in S2} +var I, J: integer; +begin + Result:=0; + for I:=1 to Length(S1) do + for J:=1 to Length(S2) do + if S1[I]=S2[J] then Inc(Result); +end; + +procedure ShowJewelsStones(Memo: TMemo; Jewels,Stones: string); +{Show one Jewels-Stones comparison} +begin + Memo2.Lines.Add(Jewels+' '+Stones+' '+IntToStr(CommonLetters(Jewels,Stones))); +end; + +procedure TestJewelsStones(Memo: TMemo); +begin + ShowJewelsStones(Memo,'aAAbbbb', 'aA'); + ShowJewelsStones(Memo,'ZZ','z'); + ShowJewelsStones(Memo,'aB',''); + ShowJewelsStones(Memo,'12345643','34'); + ShowJewelsStones(Memo,'ABCDEFGHIJKLMNOPQRSTUVWXYZ@abcdefghijklmnopqrstuvwxyz', + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ@abcdefghijklmnopqrstuvwxyz'); +end; + +const PYFUNC = + 'def countJewels(s, j): '+LF+ + ' return sum(x in j for x in s) '; + + PYCOLLECT= + 'def collect_items(item, items=[]): '+lf+ + ' if items is None: '+lf+ + ' items = [] '+lf+ + ' items.append(item) '+lf+ + ' return items '; + +BEGIN //@Main +// + maxform1.console1click(self); + maXcalcF('2^64 / (60*60*24*365)') + TestJewelsStones(memo2); + + with TPythonEngine.Create(Nil) do begin + autofinalize:= false; + loadDLL; + try + ExecString('import sys,io'); + execstr('output = io.StringIO()') + execstr('sys.stdout = output') + ExecString(PYFUNC); + println('pyout: '+evalstr('countJewels("taAAbbbb","aA"),sys.version')); + println('pyout: '+evalstr('countJewels("12345643","34"),sys.version')); + addclient(TEngineClient.create(nil)); + addclient(TEngineClient.create(nil)); + writeln('PythonOK '+botostr(PythonOK)+ ' cl.count:'+itoa(clientcount)); + //I didn�t fail because of syntax. I failed because of habits. + //1. I used == Instead of is With None + //is checks object identity. == checks equality, which can be overridden. + execstr('if "A" is None: '+lf+ + ' print(sys.version) '); + + //2. I Forgot That Default Arguments Are Evaluated Once + //This can easily break programs. + ExecStr(PYCOLLECT); + println(evalstr('collect_items("a")')); + println(evalstr('collect_items("b")')); + //3. I Didn�t Use List Comprehensions + execstr('result = [] '+lf+ + 'for x in range(10): '+lf+ + ' if x % 2 == 0: '+lf+ + ' result.append(x) '); + println(evalstr('result')); + println(evalstr('[x for x in range(10) if x % 2 == 0]')); + + //4. I Didn�t Know About enumerate() + {for index, item in enumerate(items): + print(index, item) } + execstr('result = [] '+lf+ + 'for idx,x in enumerate("A,B,C"):'+lf+ + ' if x == "B": '+lf+ + ' result.append(x+str(idx)) '); + println(evalstr('result')); + + //1. The else Clause in Loops + execstr('for i in range(5): '+lf+ + ' if i == 3: '+lf+ + ' break '+lf+ + 'else: '+lf+ + ' print("Loop completed without break!")'); + + //2. The collections Module + ExecStr('from collections import Counter'); + + //3. The Walrus Operator (:=) + ExecStr('if (n := len([1, 2, 3, 4, 5])) > 3: '+lf+ + ' print(f"List is long with {n} elements.")'); + + //4. Unpacking with the * Operator + ExecStr('a, *b, c = [1, 2, 3, 4, 5] '+lf+ + 'print(a, b, c) # Output: 1 [2, 3, 4] 5'); + ExecStr('print(" thois \n")'); + //5. The dataclasses Module + // 6. The zip Function + (*names = ['Alice', 'Bob', 'Charlie'] + scores = [85, 90, 95] + + for name, score in zip(names, scores): + print(f"{name} scored {score}") } *) + + println(evalstr('(output.getvalue().strip())')); + + //5. I Misused try/except + //I had used a bare except, which is dangerous. + { before + try: + value = int(user_input) + except: + print("Invalid input") } + // after + { try: + value = int(user_input) + except ValueError: + print("Invalid input") } + except + raiseError; + finally + unloadDll; + Free; + end; + end; +END. + + +ref: Output: https://medium.com/@arslanshoukatali/i-thought-i-knew-python-then-i-discovered-these-6-hidden-features-86ebbebe2dbe + https://rosettacode.org/wiki/Jewels_and_stones#Delphi + https://rosettacode.org/wiki/Jewels_and_stones#Python + +https://python.plainenglish.io/5-python-mistakes-that-cost-me-a-job-offer-42fc4e73b814 + + +aAAbbbb aA 3 +ZZ z 0 +ABCDEFGHIJKLMNOPQRSTUVWXYZ@abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ@abcdefghijklmnopqrstuvwxyz 53 + +https://bbs.archlinux.org/viewtopic.php?id=297117 + +https://cloudspinx.com/how-to-install-wine-10-x-on-kali-linux/ + +debug 2147483647 +30 +858 +1722 +66198 + + mX5?? executed: 03/04/2024 11:44:25 Runtime: 0:0:2.935 Memload: 71% use + + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- \ No newline at end of file diff --git a/Demos/pydemo10__.txt b/Demos/pydemo10__.txt new file mode 100644 index 00000000..9dee5e1d --- /dev/null +++ b/Demos/pydemo10__.txt @@ -0,0 +1,252 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_URLLib_ISBN_Agent; +//https://pythonprogramming.net/urllib-tutorial-python-3/ +//https://gist.github.com/AO8/faa3f52d3d5eac63820cfa7ec2b24aa7 + +// +//Please check providers list below: ['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE +} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; + PYDLL64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// +// +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const PYTURTLE = 'from turtle import * '+LF+ + 'color("red", "yellow") '+LF+ + 's = Screen() '+LF+ + 's.setup(700,500) '+LF+ + 's.bgcolor("black") '+LF+ + '#speed(5) '+LF+ + 'begin_fill() '+LF+ + 'while True: '+LF+ + ' forward(250) '+LF+ + ' left(170) '+LF+ + ' if abs(pos()) < 1: '+LF+ + ' break '+LF+ + 'end_fill() '+LF+ + 'done() '; + +//https://gist.github.com/AO8/faa3f52d3d5eac63820cfa7ec2b24aa7 +Const ISBNAGENT = + //'while True: '+LF+ + + 'import urllib.request, json, textwrap' +LF+ + 'base_api_link="https://www.googleapis.com/books/v1/volumes?q=isbn:" '+LF+ + 'user_input = ("3935042469").strip() '+LF+ + + 'with urllib.request.urlopen(base_api_link + user_input) as f: '+LF+ + ' text = f.read() '+LF+ + + 'decoded_text = text.decode("utf-8") '+LF+ + 'obj = json.loads(decoded_text) # deserializes decoded_textto Py object'+LF+ + 'volume_info = obj["items"][0] '+LF+ + 'authors = obj["items"][0]["volumeInfo"]["authors"] '+LF+ + + '# displays title, summary, author, domain, page count and language '+LF+ + 'print("\nTitle:", volume_info["volumeInfo"]["title"]) '+LF+ + 'print("\nSummary:\n") '+LF+ + 'print(textwrap.fill(volume_info["saleInfo"]["country"],width=65)) '+LF+ + 'print("\nAuthor(s):", ",".join(authors)) '+LF+ + 'print("\nPublic Domain:", volume_info["accessInfo"]["publicDomain"]) '+LF+ + 'print("\nPage count:", volume_info["volumeInfo"]["pageCount"]) '+LF+ + 'print("\nLanguage:", volume_info["volumeInfo"]["language"]) '+LF+ + 'print("\n***") '; + + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL = 'https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469'; + +Const REXDEF = 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +function ValidISBN_10(const aISBN: string): boolean; +var + hNumber, + hCheckDigit: string; + hCheckValue, + hCheckSum, + Err: integer; + i,Cnt: Word; +begin + Result := false; + hCheckDigit := Copy(aISBN, Length(aISBN), 1); + {Get rest of ISBN, minus check digit and its hyphen} + hNumber := Copy(aISBN, 1, Length(aISBN) - 2); + {Length of ISBN remainder must be 11 and check digit + between 9 and 9 or X} + if (Length(hNumber)=11)and(Pos(hCheckDigit, + '0123456789X') > 0) then begin + {Get numeric value for check digit} + if (hCheckDigit = 'X') then + hCheckSum := 10 + else + Val(hCheckDigit, hCheckSum, Err); + {Iterate through ISBN remainder, applying decode + algorithm} + Cnt := 1; + for i := 1 to 12 do begin + {Act only if current character is between "0" and "9" + to exclude hyphens} + if (Pos(hNumber[i], '0123456789') > 0) then begin + Val(hNumber[i], hCheckValue, Err); + {Algorithm for each character in ISBN remainder, Cnt + is the nth character so processed} + hCheckSum := hCheckSum + hCheckValue * (11 - Cnt); + Inc(Cnt); + end; + end; + {Verify final value is evenly divisible by 11} + if (hCheckSum mod 11 = 0) then + Result := true + else + Result := false; + end; +end; + +{Funktion validiert ISBN-13 +G�ltig ab 1.1.2007 +Wenn streng = True, wird die Voranstellung von 'ISBN ' und die korrekte +Verwendung der Bindestriche verlangt} +function ValidISBN_13(const s: string; streng: Boolean): Boolean; +var + i, x, n: Integer; + tmp: string; +begin + Result:= True; + writeln(s[9]) + if (not streng) or ((Copy(s, 1, 5) = 'ISBN ') and (Length(s) = 22) + and (s[9] = '-') and (s[21] = '-')) then begin + for i:= 1 to Length(s) do + if s[i] in StrToCharSet(DIGISET) then //['0'..'9'] then + tmp:= tmp + s[i] + else + if streng then + if (s[i] = '-') then + Inc(n) + else if (i > 5) then + Result:= False; + if (Result) and ((not streng) or (n = 4)) then begin + if Length(tmp) = 13 then begin + for i:= 1 to 12 do + if i div 2 = i/2 then + x:= x + StrToInt(tmp[i]) * 3 + else + x:= x + StrToInt(tmp[i]); + if StrToInt(tmp[13]) > ((10 - (x mod 10)) mod 10) then //> < + Result := False; + end else + Result:= False; + end else + Result:= False; + end else + Result:= False; +end; + +{procedure InitSockets; +var Data: WSAData; +begin + WSAStartup( MakeWord(1,1), Data); //Das w�re dann Version 1.1 +end;} + +Begin //@Main +// + +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 + ISBN-13 ? : 978-3935042468} + + writeln(botostr(ValidISBN_13('ISBN 978-3-9350-4246-8', True))); + writeln(botostr(IsValidISBN2('3935042469'))); + + writeln(botostr(ValidISBN_13('ISBN 978-3-7657-2780-1', True))); //liefert True zur�ck + writeln(botostr(ValidISBN_13('ISBN 978-3-7657-2780-1', False))); //liefert True zur�ck + + writeln(botostr(IsValidISBN('9783765727801'))); + writeln(botostr(IsValidISBN('3765727806'))); //ISBN 13<-->10 converters + writeln(botostr(IsValidISBN2('3765727806'))); //-- + + //writeln(botostr(ValidISBN_13('9783765727801', false))); + + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'+LF+'import urllib.parse'); + eng.Execstring('import urllib.request'+LF+'import os,re,textwrap,json'); + eng.Execstring(REXDEF); + + eng.Execstring('url = "https://www.google.com/search"'+LF+ + 'url2= "https://www.google.com/search?q=python+maxbox"'+LF+ + 'url3= "'+WEBURL+'"'+LF+ + 'values = {"q" : "python programming tutorials"}'+LF+ + 'uheaders = {}'); + + eng.Execstring('data = urllib.parse.urlencode(values)'+LF+ + 'data = data.encode("utf-8") # data should be bytes'+LF+ + 'uheaders["User-Agent"] = "'+USERAGENT+'"'+LF+ + // 'req= urllib.request.Request(url,data,headers=uheaders)'+LF+ + 'req = urllib.request.Request(url3, headers= uheaders)'+LF+ + 'resp = urllib.request.urlopen(req)'); + + println(eng.evalStr('striphtml(str(resp.read()))')); + + //eng.Execstring(ISBNAGENT); + saveString(exepath+'py_isbnagent.py', ISBNAGENT); + writeln(getDosOutput('py '+exepath+'py_isbnagent.py', exePath)); + +//Turns out Google will return a 405, method not allowed. Google is not happy with request! +//Exception: : HTTP Error 429: Too Many Requests. + + except + eng.raiseError; + finally + eng.Free; + //aPythonVersion.Free; + end; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Ref code: +Patterns konkret. +ISBN-13: 9783935042468 +ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, +This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 02 + HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- \ No newline at end of file diff --git a/Demos/pydemo11.htm b/Demos/pydemo11.htm new file mode 100644 index 00000000..786f235a --- /dev/null +++ b/Demos/pydemo11.htm @@ -0,0 +1,267 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000049215 +StartFragment:0000001053 +EndFragment:0000049199 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo_App_mX4_PythonTemplate_URLLib_JSON_PyPas;
+//https://pythonprogramming.net/urllib-tutorial-python-3/
+//https://realpython.com/python-json/
+{Purpose: Go ahead and make a request to the JSONPlaceholder API for the /todos endpoint. }
+
+//<Constant declarations> 
+//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre'].
+{TYPE <Type declarations> Pascal-Delphi-Python-Json-OLEAutomation} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+      PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; 
+      PYDLL64  = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; 
+
+Var 
+//<Variable declarations>
+  i: integer; eng: TPythonEngine;
+
+//<FUNCTION>
+//<PROCEDURE> 
+//Generate public key and private key
+
+Const PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+              
+Const JSONLIST =
+//# Increment complete TODOs count for each user.
+  'for todo in todos:                                 '+LF+
+  '  if todo["completed"]:                            '+LF+
+  '     try:                                          '+LF+
+  '     # Increment the existing user''s count.       '+LF+
+  '        todos_by_user[todo["userId"]] += 1         '+LF+
+  '     except KeyError:                              '+LF+
+  '     # user has not been seen. Set count to 1.     '+LF+
+  '        todos_by_user[todo["userId"]] = 1          ';     
+     
+Const JSONLISTDEFAULT =
+  'from collections import defaultdict                '+LF+
+  'todos_by_user = defaultdict(int)                   '+LF+
+  'for todo in todos:                                 '+LF+
+  '  if todo["completed"]:                            '+LF+
+  '     todos_by_user[todo["userId"]]+= 1             ';
+                   
+
+Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+
+                  '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; 
+
+Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; 
+
+Const REXDEF= 'def striphtml(data):      '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+               
+
+{Funktion validiert ISBN-13 Valid from 1.1.2007
+Wenn streng = True, wird die Voranstellung von 'ISBN ' und die korrekte
+Verwendung der Bindestriche verlangt}
+function ValidISBN_13(const s: string; streng: Boolean): Boolean;
+var
+  i, x, n: Integer;
+  tmp: string;
+begin
+  Result:= True;
+  writeln(s[9])
+  if (not streng) or ((Copy(s, 1, 5) = 'ISBN ') and (Length(s) = 22)
+    and (s[9] = '-') and (s[21] = '-')) then begin
+    for i:= 1 to Length(s) do
+      if s[i] in StrToCharSet(DIGISET) then //['0'..'9'] then
+        tmp:= tmp + s[i]
+      else
+        if streng then
+          if (s[i] = '-') then
+            Inc(n)
+          else if (i > 5) then
+            Result:= False;
+    if (Result) and ((not streng) or (n = 4)) then begin
+      if Length(tmp) = 13 then begin
+        for i:= 1 to 12 do
+          if i div 2 = i/2 then
+            x:= x + StrToInt(tmp[i]) * 3
+          else
+            x:= x + StrToInt(tmp[i]);
+        if StrToInt(tmp[13]) > ((10 - (x mod 10)) mod 10) then  //> <
+          Result := False;
+      end else
+        Result:= False;
+    end else
+      Result:= False;
+  end else
+    Result:= False;
+end; 
+
+procedure GetJSONData;
+var  XMLhttp: OleVariant; // As Object Automation
+     ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2;
+     response,statuscode: string; cnt: integer;
+begin  
+  XMLhttp:= CreateOleObject('msxml2.xmlhttp')      
+  XMLhttp.Open('GET', WEBURL, False)   //False is async
+  //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
+  XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
+  XMLhttp.Send();
+   
+  response:= XMLhttp.responseText; //assign the data
+  statuscode:= XMLhttp.status; 
+  //writeln(statuscode +CRLF+ response)
+  ajt:= TJson.create(); 
+  try
+    ajt.parse(response);
+  except
+    writeln( 'Exception: <TJsonClass>"" parse error: {'+
+                  exceptiontostring(exceptiontype, exceptionparam)) 
+  end; 
+  JArray:= ajt.JsonArray;
+  writeln('Get all Titles: '+itoa(jarray.count));     
+  for cnt:= 0 to jarray.count-1 do
+    writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString);   
+  ajt.Free;
+end;
+
+{procedure InitSockets;
+var Data: WSAData;
+begin
+  WSAStartup( MakeWord(1,1), Data);  //Das wäre dann Version 1.1
+end;}               
+                         
+Begin  //@Main
+//<Executable statements>
+//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469
+{ ISBN-10 ? : 3935042469
+  ISBN-13 ? : 978-3935042468} 
+
+  writeln(botostr(ValidISBN_13('ISBN 978-3-7657-2780-1', True))); //True back
+  writeln(botostr(ValidISBN_13('ISBN 978-3-7657-2780-1', False))); //True back  
+  writeln(botostr(IsValidISBN('9783765727801')));
+  writeln(botostr(IsValidISBN2('3765727806'))); ////ISBN 13<-->10 converters
+
+  eng:= TPythonEngine.Create(Nil);
+  eng.pythonhome:= PYHOME32;
+  eng.opendll(PYDLL32)
+  //eng.IO:= pyMemo;
+  try
+    eng.Execstring('import base64'+LF+'import urllib.parse');
+    eng.Execstring('import urllib.request, os, re, textwrap, json, requests');
+    eng.Execstring(REXDEF);
+ 
+    eng.Execstring('url3= "'+WEBURL+'"'+LF+
+                   'values = {"q" : "python programming tutorials"}'+LF+
+                   'uheaders = {}');
+                              
+    eng.Execstring('data = urllib.parse.urlencode(values)'+LF+
+                   'data = data.encode("utf-8") # data should be bytes'+LF+
+                   'uheaders["User-Agent"] = "'+USERAGENT+'"'+LF+
+                // 'req= urllib.request.Request(url,data,headers=uheaders)'+LF+
+                   'req = urllib.request.Request(url3, headers= uheaders)'+LF+
+                   'resp = urllib.request.urlopen(req)'); 
+   
+   eng.Execstring('response = requests.get("'+WEBURL+'")');
+   eng.Execstring('todos = json.loads(response.text)');
+   //println(eng.evalStr('response.json()'));  
+   println('rettype is: '+eng.evalStr('type(todos)')); 
+    
+   //check of completed todos
+   Println('list len: '+ eng.EvalStr('len(todos)'));
+    
+   Println('completed: '+ eng.EvalStr('sum([x["completed"] for x in todos])'));
+   Println('notcompleted:'+eng.EvalStr('sum([x["completed"] for x in todos '+
+                                                           'if x == False])'));
+   Println('notcompleted:'+eng.EvalStr('len(todos)-sum([x["completed"]for x in todos])'));                                       
+   //# Map of userId to number of complete TODOs for that user     
+   eng.Execstring(JSONLISTDEFAULT);
+   println('rettype is: '+eng.evalStr('type(todos_by_user)'));
+   
+   //# Create a sorted list of (userId, num_complete) pairs.
+   eng.Execstring('top_users = sorted(todos_by_user.items(),'+LF+
+                  'key=lambda x: x[1], reverse=True)');           
+   println(eng.evalStr('top_users')); 
+    
+   //# Get the maximum number of complete TODOs.
+   println('user_max_complete = '+eng.evalStr('top_users[0][1]')); 
+                      
+ {Yeah, your implementation is better, you can now manipulate JSON data as a normal Python object! }
+                     
+    //println(eng.evalStr('striphtml(str(resp.read()))'));  
+    {first integration with internal script/invoke}
+    //println(StringReplace(eng.evalStr('pls'),'\n',#13#10,[rfReplaceAll]));
+    {second integration with external script/shell}
+    //saveString(exepath+'py_isbnagent.py', ISBNAGENT);
+    //writeln(getDosOutput('py '+exepath+'py_isbnagent.py', exePath));          
+
+ //Exception: <class 'urllib.error.HTTPError'>: HTTP Error 429: Too Many Requests.
+  except
+    eng.raiseError;
+  finally
+    eng.Free;
+    //aPythonVersion.Free;
+  end;  
+  
+  GetJSONData;  
+  //maXcalcF('2^64 /(60*60*24*365)')  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+
+Ref code:  mX4 byte code executed: 16/09/2021 15:06:24  Runtime: 0:0:1.484  Memload: 62% use
+ByteCode Success Message of: C:\maXbox\mX47464\maxbox4\examples\1059_pypas_demo11.psb 
+Patterns konkret.
+ISBN-13: 9783935042468
+ISBN-10: 3935042469
+Author: Kleiner, Max
+Binding: Paperback
+Publisher: Software + Support
+Published: September 2003
+
+https://mymemory.translated.net/doc/spec.php
+Hello PyWorld_, 
+This data will be written on the file.
+Hola PyWorld_,&#10; Estos datos se escribirán en el archivo.
+
+MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN  02
+ HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+ 
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo11.txt b/Demos/pydemo11.txt new file mode 100644 index 00000000..7f69eeb5 --- /dev/null +++ b/Demos/pydemo11.txt @@ -0,0 +1,234 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_URLLib_JSON_PyPas; +//https://pythonprogramming.net/urllib-tutorial-python-3/ +//https://realpython.com/python-json/ +{Purpose: Go ahead and make a request to the JSONPlaceholder API for the /todos endpoint. } + +// +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-OLEAutomation} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; + PYDLL64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// +// +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const JSONLIST = +//# Increment complete TODOs count for each user. + 'for todo in todos: '+LF+ + ' if todo["completed"]: '+LF+ + ' try: '+LF+ + ' # Increment the existing user''s count. '+LF+ + ' todos_by_user[todo["userId"]] += 1 '+LF+ + ' except KeyError: '+LF+ + ' # user has not been seen. Set count to 1. '+LF+ + ' todos_by_user[todo["userId"]] = 1 '; + +Const JSONLISTDEFAULT = + 'from collections import defaultdict '+LF+ + 'todos_by_user = defaultdict(int) '+LF+ + 'for todo in todos: '+LF+ + ' if todo["completed"]: '+LF+ + ' todos_by_user[todo["userId"]]+= 1 '; + + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + + +{Funktion validiert ISBN-13 Valid from 1.1.2007 +Wenn streng = True, wird die Voranstellung von 'ISBN ' und die korrekte +Verwendung der Bindestriche verlangt} +function ValidISBN_13(const s: string; streng: Boolean): Boolean; +var + i, x, n: Integer; + tmp: string; +begin + Result:= True; + writeln(s[9]) + if (not streng) or ((Copy(s, 1, 5) = 'ISBN ') and (Length(s) = 22) + and (s[9] = '-') and (s[21] = '-')) then begin + for i:= 1 to Length(s) do + if s[i] in StrToCharSet(DIGISET) then //['0'..'9'] then + tmp:= tmp + s[i] + else + if streng then + if (s[i] = '-') then + Inc(n) + else if (i > 5) then + Result:= False; + if (Result) and ((not streng) or (n = 4)) then begin + if Length(tmp) = 13 then begin + for i:= 1 to 12 do + if i div 2 = i/2 then + x:= x + StrToInt(tmp[i]) * 3 + else + x:= x + StrToInt(tmp[i]); + if StrToInt(tmp[13]) > ((10 - (x mod 10)) mod 10) then //> < + Result := False; + end else + Result:= False; + end else + Result:= False; + end else + Result:= False; +end; + +procedure GetJSONData; +var XMLhttp: OleVariant; // As Object Automation + ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2; + response,statuscode: string; cnt: integer; +begin + XMLhttp:= CreateOleObject('msxml2.xmlhttp') + XMLhttp.Open('GET', WEBURL, False) //False is async + //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8'); + XMLhttp.Send(); + + response:= XMLhttp.responseText; //assign the data + statuscode:= XMLhttp.status; + //writeln(statuscode +CRLF+ response) + ajt:= TJson.create(); + try + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JArray:= ajt.JsonArray; + writeln('Get all Titles: '+itoa(jarray.count)); + for cnt:= 0 to jarray.count-1 do + writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString); + ajt.Free; +end; + +{procedure InitSockets; +var Data: WSAData; +begin + WSAStartup( MakeWord(1,1), Data); //Das w�re dann Version 1.1 +end;} + +Begin //@Main +// +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 + ISBN-13 ? : 978-3935042468} + + writeln(botostr(ValidISBN_13('ISBN 978-3-7657-2780-1', True))); //True back + writeln(botostr(ValidISBN_13('ISBN 978-3-7657-2780-1', False))); //True back + writeln(botostr(IsValidISBN('9783765727801'))); + writeln(botostr(IsValidISBN2('3765727806'))); ////ISBN 13<-->10 converters + + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'+LF+'import urllib.parse'); + eng.Execstring('import urllib.request, os, re, textwrap, json, requests'); + eng.Execstring(REXDEF); + + eng.Execstring('url3= "'+WEBURL+'"'+LF+ + 'values = {"q" : "python programming tutorials"}'+LF+ + 'uheaders = {}'); + + eng.Execstring('data = urllib.parse.urlencode(values)'+LF+ + 'data = data.encode("utf-8") # data should be bytes'+LF+ + 'uheaders["User-Agent"] = "'+USERAGENT+'"'+LF+ + // 'req= urllib.request.Request(url,data,headers=uheaders)'+LF+ + 'req = urllib.request.Request(url3, headers= uheaders)'+LF+ + 'resp = urllib.request.urlopen(req)'); + + eng.Execstring('response = requests.get("'+WEBURL+'")'); + eng.Execstring('todos = json.loads(response.text)'); + //println(eng.evalStr('response.json()')); + println('rettype is: '+eng.evalStr('type(todos)')); + + //check of completed todos + Println('list len: '+ eng.EvalStr('len(todos)')); + + Println('completed: '+ eng.EvalStr('sum([x["completed"] for x in todos])')); + Println('notcompleted:'+eng.EvalStr('sum([x["completed"] for x in todos '+ + 'if x == False])')); + Println('notcompleted:'+eng.EvalStr('len(todos)-sum([x["completed"]for x in todos])')); + //# Map of userId to number of complete TODOs for that user + eng.Execstring(JSONLISTDEFAULT); + println('rettype is: '+eng.evalStr('type(todos_by_user)')); + + //# Create a sorted list of (userId, num_complete) pairs. + eng.Execstring('top_users = sorted(todos_by_user.items(),'+LF+ + 'key=lambda x: x[1], reverse=True)'); + println(eng.evalStr('top_users')); + + //# Get the maximum number of complete TODOs. + println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + + {Yeah, your implementation is better, you can now manipulate JSON data as a normal Python object! } + + //println(eng.evalStr('striphtml(str(resp.read()))')); + {first integration with internal script/invoke} + //println(StringReplace(eng.evalStr('pls'),'\n',#13#10,[rfReplaceAll])); + {second integration with external script/shell} + //saveString(exepath+'py_isbnagent.py', ISBNAGENT); + //writeln(getDosOutput('py '+exepath+'py_isbnagent.py', exePath)); + + //Exception: : HTTP Error 429: Too Many Requests. + except + eng.raiseError; + finally + eng.Free; + //aPythonVersion.Free; + end; + + GetJSONData; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Ref code:  mX4 byte code executed: 16/09/2021 15:06:24 Runtime: 0:0:1.484 Memload: 62% use +ByteCode Success Message of: C:\maXbox\mX47464\maxbox4\examples\1059_pypas_demo11.psb +Patterns konkret. +ISBN-13: 9783935042468 +ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, +This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 02 + HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + + \ No newline at end of file diff --git a/Demos/pydemo12.txt b/Demos/pydemo12.txt new file mode 100644 index 00000000..7b96ac50 --- /dev/null +++ b/Demos/pydemo12.txt @@ -0,0 +1,181 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_RSA_PyPas; +//https://pythonprogramming.net/urllib-tutorial-python-3/ +//https://realpython.com/python-json/ +{Purpose: Go ahead and make a request to the JSONPlaceholder API for the /todos endpoint. } + +// +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-OLEAutomation} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// // +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +//https://gist.github.com/lkdocs/6519378 +Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+ + ' '''''+LF+ + //' Generate an RSA keypair with exponent of 65537 in PEM format'+LF+ + //' param: bits The key length in bits '+LF+ + //' Return private key and public key '+LF+ + ' '''''+LF+ + ' from Crypto.PublicKey import RSA '+LF+ + ' new_key = RSA.generate(bits, e=65537)'+LF+ + ' public_key = new_key.publickey().exportKey("PEM")'+LF+ + ' private_key = new_key.exportKey("PEM")'+LF+ + ' return private_key, public_key'; + + +procedure GetJSONData; +var XMLhttp: OleVariant; // As Object Automation + ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2; + response,statuscode: string; cnt: integer; +begin + XMLhttp:= CreateOleObject('msxml2.xmlhttp') + XMLhttp.Open('GET', WEBURL, False) //False is async + //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8'); + XMLhttp.Send(); + + response:= XMLhttp.responseText; //assign the data + statuscode:= XMLhttp.status; + //writeln(statuscode +CRLF+ response) + ajt:= TJson.create(); + try + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JArray:= ajt.JsonArray; + writeln('Get all Titles: '+itoa(jarray.count)); + for cnt:= 0 to jarray.count-1 do + writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString); + ajt.Free; +end; + +{procedure InitSockets; +var Data: WSAData; +begin + WSAStartup( MakeWord(1,1), Data); //Das w�re dann Version 1.1 +end;} + +Begin //@Main +// +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 ISBN-13 ? : 978-3935042468} + + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'+LF+'import urllib.parse'); + eng.Execstring('import urllib.request, os, textwrap, json, requests, pydub'); + eng.Execstring(REXDEF); + + eng.Execstring('import nacl'); + eng.Execstring('from nacl.encoding import HexEncoder'+CRLF+ + 'from nacl.exceptions import CryptoError'+CRLF+ + 'from nacl.encoding import Base64Encoder'+CRLF+ + 'from pydub import AudioSegment'); + + eng.Execstring('from Crypto.PublicKey import RSA'); + + println(eng.evalStr('base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")')); + + //eng.Execstring('priv_key = nacl.public.PrivateKey.generate()'); + + + // eng.Execstring('AudioSegment.from_wav(r"C:\maXbox\soundnvision\01_magix.wav").export(r"C:\maXbox\mX47464\maxbox4\web\G9\G9_magix.mp3", format="mp3")'); + + + + { eng.Execstring(DEF_RSAKEYS); + eng.Execstring('d=generate_RSA(bits=2048)') + println('RSA Publickey '+eng.evalStr('d.public_key')); } + + //# Map of userId to number of complete TODOs for that user + //eng.Execstring(JSONLISTDEFAULT); + //println('rettype is: '+eng.evalStr('type(todos_by_user)')); + //println(eng.evalStr('top_users')); + + //# Get the maximum number of complete TODOs. + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + + except + eng.raiseError; + finally + eng.Free; + //aPythonVersion.Free; + end; + + GetJSONData; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +C:\maXbox\mX39998\maxbox3>pip3 install -t C:\Users\max\AppData\Local\Programs\Py +thon\Python36-32\Lib pydub +Collecting pydub + Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB) +Installing collected packages: pydub +Successfully installed pydub-0.25.1 + +Then to convert any file from wav to mp3 just use pydub as + +import pydub +sound = pydub.AudioSegment.from_wav("D:/example/apple.wav") +sound.export("D:/example/apple.mp3", format="mp3") + + +Exception: : Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_MD5.pyd': [WinError 126] The specified module could not be found. + +Ref code:  mX4 byte code executed: 16/09/2021 15:06:24 Runtime: 0:0:1.484 Memload: 62% use +ByteCode Success Message of: C:\maXbox\mX47464\maxbox4\examples\1059_pypas_demo11.psb +Patterns konkret. +ISBN-13: 9783935042468 +ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, +This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + + + + + \ No newline at end of file diff --git a/Demos/pydemo12ibz_zh.txt b/Demos/pydemo12ibz_zh.txt new file mode 100644 index 00000000..eff433a7 --- /dev/null +++ b/Demos/pydemo12ibz_zh.txt @@ -0,0 +1,210 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_RSA_PyPas; +//https://pythonprogramming.net/urllib-tutorial-python-3/ +//https://realpython.com/python-json/ +{Purpose: Go ahead and make a request to the JSONPlaceholder API for the /todos endpoint. } + +//pass: sep2021 + +// +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-OLEAutomation} + +Const PYHOME32 = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYDLL32 = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// // +//Generate public key and private key + +Const n='131798069975677186430812583254301846420499053652464526744060956660680086191708591665234413533962305430548077353930570627355296177902735662050036083669895732129386762377495294220312510244514575486344692415682028866858406505626112758230991205303719647558808329331489671608634857922659169405430839242940754268809'; + +p='10860706918450955689844145527501983595992436701173054648104471236408378718746974595697570946185341544228133278859636613128875678870505729830664097383355063'; +q='12135312274357489324587220671594930942014693384778568426795143568889708549803954472938344835413422899444933434949631371672806794755231479031846513398039743'; + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +//https://gist.github.com/lkdocs/6519378 +Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+ + ' '''''+LF+ + //' Generate an RSA keypair with exponent of 65537 in PEM format'+LF+ + //' param: bits The key length in bits '+LF+ + //' Return private key and public key '+LF+ + ' '''''+LF+ + ' from Crypto.PublicKey import RSA '+LF+ + ' new_key = RSA.generate(bits, e=65537)'+LF+ + ' public_key = new_key.publickey().exportKey("PEM")'+LF+ + ' private_key = new_key.exportKey("PEM")'+LF+ + ' return private_key, public_key, new_key'; + + +procedure GetJSONData; +var XMLhttp: OleVariant; // As Object Automation + ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2; + response,statuscode: string; cnt: integer; +begin + XMLhttp:= CreateOleObject('msxml2.xmlhttp') + XMLhttp.Open('GET', WEBURL, False) //False is async + //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8'); + XMLhttp.Send(); + + response:= XMLhttp.responseText; //assign the data + statuscode:= XMLhttp.status; + //writeln(statuscode +CRLF+ response) + ajt:= TJson.create(); + try + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JArray:= ajt.JsonArray; + writeln('Get all Titles: '+itoa(jarray.count)); + for cnt:= 0 to jarray.count-1 do + writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString); + ajt.Free; +end; + +{procedure InitSockets; +var Data: WSAData; +begin + WSAStartup( MakeWord(1,1), Data); //Das w�re dann Version 1.1 +end;} + +Begin //@Main +// +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 ISBN-13 ? : 978-3935042468} + + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'+LF+'import urllib.parse'); + eng.Execstring('import urllib.request, os, textwrap, json, requests'); + eng.Execstring(REXDEF); + + //DLL := LoadLibrary('c:\windows\desktop\shell\project1.dll'); + + //eng.ExecString('from sklearn.linear_model import LinearRegression'); + + eng.ExecString('import ctypes, _ctypes'); + eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["cmd ", "/c", "dir"])') + + //https://stackoverflow.com/questions/46450368/removing-loaded-pyd-files + { + eng.ExecString('dll = ctypes.CDLL(r"C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\numpy\core\_multiarray_umath.cp37-win32.pyd")'); + println(eng.evalStr('dll')); + + eng.ExecString('_ctypes.FreeLibrary(dll._handle)'); + + eng.ExecString('from sklearn.linear_model import LinearRegression'); } + + // eng.ExecString('subprocess.call(["pip3", "install", "pycryptodome"])') + //showmessage('stop'); + // eng.Execstring('import scipy'); + //Exception: Access violation at address 529C9DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000048. + //eng.ExecString('from langdetect import detect'); + //opendir(PYHOME32) + + { eng.Execstring('import nacl'); + eng.Execstring('from nacl.encoding import HexEncoder'+CRLF+ + 'from nacl.exceptions import CryptoError'+CRLF+ + 'from nacl.encoding import Base64Encoder'); } + + // eng.Execstring('from Crypto.PublicKey import RSA'); + + println(eng.evalStr('base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")')); + + //eng.Execstring('priv_key = nacl.public.PrivateKey.generate()'); + + eng.Execstring(DEF_RSAKEYS); + eng.Execstring('d=generate_RSA(bits=1024)') + + println('RSA new '+eng.evalStr('d[2]')); + println('RSA Privatekey '+eng.evalStr('d[0]')); //} + println('---------------------------------'); //} + println('RSA Publickey '+eng.evalStr('d[1]')); //} + println('---------------------------------'); //} + + eng.Execstring('from Crypto.PublicKey import RSA'); + + println('RSA new2 '+eng.evalStr('repr(RSA.generate(1024, e=65537))')); + + println('n=p*q show: '+CRLF+bigmulu(p,q)); + + //# Map of userId to number of complete TODOs for that user + //eng.Execstring(JSONLISTDEFAULT); + //println('rettype is: '+eng.evalStr('type(todos_by_user)')); + //println(eng.evalStr('top_users')); + + //# Get the maximum number of complete TODOs. + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + + except + eng.raiseError; + finally + eng.unloadDll; + eng.Free; + //_multiarray_umath.cp37-win32.pyd + //aPythonVersion.Free; + end; + + GetJSONData; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +"C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\numpy\core\_multiarray_umath.cp37-win32.pyd" + +Exception: : Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_MD5.pyd': [WinError 126] The specified module could not be found. + +Ref code:  mX4 byte code executed: 16/09/2021 15:06:24 Runtime: 0:0:1.484 Memload: 62% use +ByteCode Success Message of: C:\maXbox\mX47464\maxbox4\examples\1059_pypas_demo11.psb +Patterns konkret. +ISBN-13: 9783935042468 +ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, +This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + +https://teams.microsoft.com/l/meetup-join/19%3Af3295ea62d3d43648b07ee3e49d49380%40thread.tacv2/1632548344164?context=%7B%22Tid%22%3A%223609beda-5426-4db4-9eb3-7d89046d0d7e%22%2C%22Oid%22%3A%229976e4f6-5f4c-4718-bb60-07b0a38e0544%22%7D + + + + + + \ No newline at end of file diff --git a/Demos/pydemo13.htm b/Demos/pydemo13.htm new file mode 100644 index 00000000..734fd0e2 --- /dev/null +++ b/Demos/pydemo13.htm @@ -0,0 +1,250 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000039732 +StartFragment:0000001053 +EndFragment:0000039716 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo_App_mX4_Python_Cheat_Sheet5;
+//Python Cheat Sheet: Functions and Tricks
+//http://www.softwareschule.ch/examples/cheatsheetpython.pdf
+//https://realpython.com/python-json/
+//https://wiki.freepascal.org/Developing_Python_Modules_with_Pascal#Minimum_Python_API
+{Purpose: Python Cheat Sheet: Functions and Tricks. }
+
+//<Constant declarations> 
+//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre'].
+{TYPE <Type declarations> Pascal-Delphi-Python-Json-OLEAutomation} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+
+Var  //<Variable declarations>
+  i: integer; eg: TPythonEngine;
+
+//<FUNCTION> //<PROCEDURE> 
+//Generate public key and private key
+
+Const PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+              
+Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+
+                  '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; 
+
+Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; 
+
+Const REXDEF= 'def striphtml(data):      '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+               
+//https://gist.github.com/lkdocs/6519378               
+Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+
+          '  '''''+LF+
+          //'  Generate an RSA keypair with exponent of 65537 in PEM format'+LF+
+          //'  param: bits The key length in bits '+LF+
+          //'  Return private key and public key '+LF+
+          '  '''''+LF+
+          '  from Crypto.PublicKey import RSA '+LF+
+          '  new_key = RSA.generate(bits, e=65537)'+LF+ 
+          '  public_key = new_key.publickey().exportKey("PEM")'+LF+ 
+          '  private_key = new_key.exportKey("PEM")'+LF+ 
+          '  return private_key, public_key';
+               
+procedure GetJSONData;
+var  XMLhttp: OleVariant; // As Object Automation
+     ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2;
+     response,statuscode: string; cnt: integer;
+begin  
+  XMLhttp:= CreateOleObject('msxml2.xmlhttp')      
+  XMLhttp.Open('GET', WEBURL, False)   //False is async
+  //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
+  XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
+  XMLhttp.Send();
+  response:= XMLhttp.responseText; //assign the data
+  statuscode:= XMLhttp.status; 
+  //writeln(statuscode +CRLF+ response)
+  ajt:= TJson.create(); 
+  try
+    ajt.parse(response);
+  except
+    writeln( 'Exception: <TJsonClass>"" parse error: {'+
+                  exceptiontostring(exceptiontype, exceptionparam)) 
+  end; 
+  JArray:= ajt.JsonArray;
+  writeln('Get all Titles: '+itoa(jarray.count));     
+  for cnt:= 0 to jarray.count-1 do
+    writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString);   
+  ajt.Free;
+end;
+
+Begin  //@Main
+//<Executable statements>
+//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469
+{ ISBN-10 ? : 3935042469  ISBN-13 ? : 978-3935042468} 
+
+  eg:= TPythonEngine.Create(Nil);
+  eg.pythonhome:= PYHOME32;
+  eg.opendll(PYDLL32)
+  //eng.IO:= pyMemo;
+  try
+    eg.Execstring('import base64'+LF+'import urllib.parse');
+    eg.Execstring('import urllib.request, os, textwrap, json, requests');
+    eg.Execstring(REXDEF);
+    
+   { eg.Execstring('import nacl');
+    eg.Execstring('from nacl.encoding import HexEncoder'+CRLF+
+                   'from nacl.exceptions import CryptoError'+CRLF+
+                   'from nacl.encoding import Base64Encoder'+CRLF+
+                   'from pydub import AudioSegment');  }           
+    
+   //eg.Execstring('from Crypto.PublicKey import RSA');                
+    
+   println(eg.evalStr('base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")'));
+  //eng.Execstring('priv_key = nacl.public.PrivateKey.generate()');
+  //openWeb('http://www.softwareschule.ch/examples/cheatsheetpython.pdf');
+    
+  //# 1.map(func, iter) Executes the function on all elements of iterable
+   println(eg.evalStr('list(map( lambda x: x[0],["red","green","blue"]))'));
+   
+  //# 2.map(func, i1,...,Executes the function on all k elements of k iterables
+   println(eg.evalStr('list(map(lambda x,y: str(x)+" "+y + "s",[0,2,2],'+
+                                       '[ "apple" , "orange" , "banana" ]))'));
+    
+  //# 3.string.join(iter), Concatenates iterable elements separated by string
+   println(eg.evalStr('" marries " .join(list([ "Alice" , "Bob" ]))'));
+
+  //# 4.filter(func,iterable),Filters out elements in iterable for function returns False (or 0)
+   println(eg.evalStr('list(filter(lambda x: True if x> 17 else False,[1,15,17,18]))'));
+   
+  //# 5.string.strip(), Removes leading and trailing whitespaces of string
+   println(eg.evalStr('( " \n \t 42 \t " .strip())'));
+   
+  //# 6.sorted(iter), Sorts iterable in ascending order
+   println(eg.evalStr('sorted([ 8 , 3 , 2 , 42 , 5 ])'));
+   
+  //# 7.sorted(iter,key=key) , Sorts according to the key function in ascending order 
+   println(eg.evalStr('sorted([ 8,3,2,42,5 ], key=lambda x: 0 if x== 42 else x)'));
+   
+  //# 8.help(func) , Returns documentation of func
+  // println(eg.evalStr('help(''print'')'));
+   saveString(exepath+'pyhelp.py', 'help(''print'')');
+   print(getDosOutput('py '+exepath+'pyhelp.py', exePath));
+   
+  //# 9.zip(i1, i2, ...), Groups the i-th elements of iterators i1,i2,...together
+   println(eg.evalStr('list(zip([''Alice'',''Anna''],[''Bob'',''Jon'',''Frank'']))'));
+   
+  //# 10.Unzip, Equal to: 1) unpack the zipped list, 2) zip the result
+   println(eg.evalStr('list(zip(*[(''Alice'',''Bob''),(''Anna'',''Jon'')]))'));
+  
+  //# 11.enumerate(iter), Assigns a counter value to each element of iterable
+   println(eg.evalStr('list(enumerate(["Alice","Bob","Jon"]))'));
+   
+  //# 12.python -m http.server<P>,Want to share files between PC and phone?
+  //https://docs.python.org/3/library/http.server.html
+   //print(getDosOutput('py -m http.server<8080>', exePath));
+   //ExecuteShell('py', '-m http.server 8080');
+  
+  //# 13.Read comic Open the comic series xkcd in your web browser
+  //eg.Execstring('import antigravity');
+  
+  //# 14.Zen of Python import this
+   eg.execString('from this import *');
+   println('14. import this: '+CRLF+
+        StringReplace(eg.EvalStr('repr("".join([d.get(c,c) for c in s]))'),
+                                                '\n',CR+LF,[rfReplaceAll]));
+  
+  //# 15.Swapping numbers, Swapping vars is a breeze in Python. No offense, Java!
+  eg.execString('a, b = ''Jane'' , ''Alice'''+CRLF+'a, b = b, a');
+  println(eg.evalStr('a, b'));
+  
+  //# 16.Unpacking arguments, Use a sequence as function arguments!
+  eg.execString('def f (x, y, z) : return x + y * z');
+  println(eg.evalStr('f(*[ 1 , 3 , 4 ])'));
+  println(eg.evalStr('f(**{ ''z'': 4 , ''x'': 1 , ''y'': 3 })'));
+    
+  // eg.Execstring('AudioSegment.from_wav(r"C:\maXbox\soundnvision\01_magix.wav").export(r"C:\maXbox\mX47464\maxbox4\web\G9\G9_magix.mp3", format="mp3")');           
+
+    { eng.Execstring(DEF_RSAKEYS);
+      eng.Execstring('d=generate_RSA(bits=2048)')
+      println('RSA Publickey '+eng.evalStr('d[1]'));  }
+ 
+   //# Get the maximum number of complete TODOs.
+   //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); 
+                    
+  except
+    eg.raiseError;
+  finally
+    eg.Free;
+    //aPythonVersion.Free;
+  end;  
+  
+  //GetJSONData;  
+  //maXcalcF('2^64 /(60*60*24*365)')  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+ mX4 executed: 20/09/2021 19:20:40  Runtime: 0:0:2.782  Memload: 69% use
+
+C:\maXbox\mX39998\maxbox3>pip3 install -t C:\Users\max\AppData\Local\Programs\Py
+thon\Python36-32\Lib pydub
+Collecting pydub
+  Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)
+Installing collected packages: pydub
+Successfully installed pydub-0.25.1
+
+Then to convert any file from wav to mp3 just use pydub as
+import pydub
+sound = pydub.AudioSegment.from_wav("D:/example/apple.wav")
+sound.export("D:/example/apple.mp3", format="mp3")
+
+Exception: <class 'OSError'>: Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_MD5.pyd'
+
+Patterns konkret.
+ISBN-13: 9783935042468  ISBN-10: 3935042469
+Author: Kleiner, Max
+Binding: Paperback
+Publisher: Software + Support
+Published: September 2003
+
+https://mymemory.translated.net/doc/spec.php
+Hello PyWorld_, This data will be written on the file.
+Hola PyWorld_,&#10; Estos datos se escribirán en el archivo.
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+----File newtemplate.txt not exists - now saved!----
+
+       
+   
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo13.txt b/Demos/pydemo13.txt new file mode 100644 index 00000000..9adca5dc --- /dev/null +++ b/Demos/pydemo13.txt @@ -0,0 +1,316 @@ +PROGRAM SEPDemo_App_mX4_Python_Cheat_Sheet5; +//Python Cheat Sheet: Functions and Tricks +//http://www.softwareschule.ch/examples/cheatsheetpython.pdf +//https://realpython.com/python-json/ +//https://wiki.freepascal.org/Developing_Python_Modules_with_Pascal#Minimum_Python_API +{Purpose: Python Cheat Sheet: Functions and Tricks. } + +// +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-OLEAutomation} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + +Var // + i: integer; eg: TPythonEngine; + runterrors, sdata: ansistring; + +// // +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +//https://gist.github.com/lkdocs/6519378 +Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+ + ' '''''+LF+ + //' Generate an RSA keypair with exponent of 65537 in PEM format'+LF+ + //' param: bits The key length in bits '+LF+ + //' Return private key and public key '+LF+ + ' '''''+LF+ + ' from Crypto.PublicKey import RSA '+LF+ + ' new_key = RSA.generate(bits, e=65537)'+LF+ + ' public_key = new_key.publickey().exportKey("PEM")'+LF+ + ' private_key = new_key.exportKey("PEM")'+LF+ + ' return private_key, public_key'; + +procedure GetJSONData; +var XMLhttp: OleVariant; // As Object Automation + ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2; + response,statuscode: string; cnt: integer; +begin + XMLhttp:= CreateOleObject('msxml2.xmlhttp') + XMLhttp.Open('GET', WEBURL, False) //False is async + //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8'); + XMLhttp.Send(); + response:= XMLhttp.responseText; //assign the data + statuscode:= XMLhttp.status; + //writeln(statuscode +CRLF+ response) + ajt:= TJson.create(); + try + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JArray:= ajt.JsonArray; + writeln('Get all Titles: '+itoa(jarray.count)); + for cnt:= 0 to jarray.count-1 do + writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString); + ajt.Free; +end; + +Begin //@Main +// +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 ISBN-13 ? : 978-3935042468} + + eg:= TPythonEngine.Create(Nil); + eg.pythonhome:= PYHOME32; + eg.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eg.Execstring('import base64'+LF+'import urllib.parse'); + eg.Execstring('import urllib.request, os, textwrap, json, requests'); + eg.Execstring(REXDEF); + + { eg.Execstring('import nacl'); + eg.Execstring('from nacl.encoding import HexEncoder'+CRLF+ + 'from nacl.exceptions import CryptoError'+CRLF+ + 'from nacl.encoding import Base64Encoder'+CRLF+ + 'from pydub import AudioSegment'); } + + //eg.Execstring('from Crypto.PublicKey import RSA'); + + println(eg.evalStr('base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")')); + //eng.Execstring('priv_key = nacl.public.PrivateKey.generate()'); + //openWeb('http://www.softwareschule.ch/examples/cheatsheetpython.pdf'); + + //# 1.map(func, iter) Executes the function on all elements of iterable + println(eg.evalStr('list(map( lambda x: x[0],["red","green","blue"]))')); + + //# 2.map(func, i1,...,Executes the function on all k elements of k iterables + println(eg.evalStr('list(map(lambda x,y: str(x)+" "+y + "s",[0,2,2],'+ + '[ "apple" , "orange" , "banana" ]))')); + + //# 3.string.join(iter), Concatenates iterable elements separated by string + println(eg.evalStr('" marries " .join(list([ "Alice" , "Bob" ]))')); + + //# 4.filter(func,iterable),Filters out elements in iterable for function returns False (or 0) + println(eg.evalStr('list(filter(lambda x: True if x> 17 else False,[1,15,17,18]))')); + + //# 5.string.strip(), Removes leading and trailing whitespaces of string + println(eg.evalStr('( " \n \t 42 \t " .strip())')); + + //# 6.sorted(iter), Sorts iterable in ascending order + println(eg.evalStr('sorted([ 8 , 3 , 2 , 42 , 5 ])')); + + //# 7.sorted(iter,key=key) , Sorts according to the key function in ascending order + println(eg.evalStr('sorted([ 8,3,2,42,5 ], key=lambda x: 0 if x== 42 else x)')); + + //# 8.help(func) , Returns documentation of func + // println(eg.evalStr('help(''print'')')); + saveString(exepath+'pyhelp.py', 'help(''print'')'); + print(getDosOutput('py '+exepath+'pyhelp.py', exePath)); + + //# 9.zip(i1, i2, ...), Groups the i-th elements of iterators i1,i2,...together + println(eg.evalStr('list(zip([''Alice'',''Anna''],[''Bob'',''Jon'',''Frank'']))')); + + //# 10.Unzip, Equal to: 1) unpack the zipped list, 2) zip the result + println(eg.evalStr('list(zip(*[(''Alice'',''Bob''),(''Anna'',''Jon'')]))')); + + //# 11.enumerate(iter), Assigns a counter value to each element of iterable + println(eg.evalStr('list(enumerate(["Alice","Bob","Jon"]))')); + + //# 12.python -m http.server

,Want to share files between PC and phone? + //https://docs.python.org/3/library/http.server.html + //print(getDosOutput('py -m http.server<8080>', exePath)); + //ExecuteShell('py', '-m http.server 8080'); + + //# 13.Read comic Open the comic series xkcd in your web browser + //eg.Execstring('import antigravity'); + + //# 14.Zen of Python import this + eg.execString('from this import *'); + println('14. import this: '+CRLF+ + StringReplace(eg.EvalStr('repr("".join([d.get(c,c) for c in s]))'), + '\n',CR+LF,[rfReplaceAll])); + + //# 15.Swapping numbers, Swapping vars is a breeze in Python. No offense, Java! + eg.execString('a, b = ''Jane'' , ''Alice'''+CRLF+'a, b = b, a'); + println(eg.evalStr('a, b')); + + //# 16.Unpacking arguments, Use a sequence as function arguments! + eg.execString('def f (x, y, z) : return x + y * z'); + println(eg.evalStr('f(*[ 1 , 3 , 4 ])')); + println(eg.evalStr('f(**{ ''z'': 4 , ''x'': 1 , ''y'': 3 })')); + + { eg.execString('import psutil, os') + eg.execString('adlst = []') + eg.execString('p = psutil.Process( os.getpid())'); + eg.execString('for dll in p.memory_maps():'+CRLF+' print(dll.path)'); + eg.execString('for dll in p.memory_maps():'+CRLF+' adlst.append(dll.path)'); + //println(eg.evalStr(' print(dll.path)')); + println(eg.evalStr('p')); + println(eg.evalStr('adlst')); + println('dll list detect: '+ + StringReplace(eg.EvalStr('adlst'),',',CR+LF,[rfReplaceAll])); } + + // eg.Execstring('AudioSegment.from_wav(r"C:\maXbox\soundnvision\01_magix.wav").export(r"C:\maXbox\mX47464\maxbox4\web\G9\G9_magix.mp3", format="mp3")'); + + { eng.Execstring(DEF_RSAKEYS); + eng.Execstring('d=generate_RSA(bits=2048)') + println('RSA Publickey '+eng.evalStr('d[1]')); } + + //# Get the maximum number of complete TODOs. + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + + except + eg.raiseError; + finally + eg.Free; + //aPythonVersion.Free; + end; + + sdata:= loadfile(Exepath+'\examples\058_pas_filefinder32test.psb'); + + writeln(botostr(RunBytecode(sdata, runterrors))); + + + //GetJSONData; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + mX4 executed: 20/09/2021 19:20:40 Runtime: 0:0:2.782 Memload: 69% use + +C:\maXbox\mX39998\maxbox3>pip3 install -t C:\Users\max\AppData\Local\Programs\Py +thon\Python36-32\Lib pydub +Collecting pydub + Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB) +Installing collected packages: pydub +Successfully installed pydub-0.25.1 + +C:\maXbox\mX39998\maxbox3>pip3 install -U -t C:\Users\max\AppData\Local\Programs +\Python\Python36-32\Lib https://files.pythonhosted.org/packages/19/29/f7a38ee300 +83f2caa14cc77a6d34c4d5cfd1a69641e87bf1b3d6ba90d0ba/psutil-5.8.0-cp36-cp36m-win32 +.whl +Collecting psutil==5.8.0 + Using cached psutil-5.8.0-cp36-cp36m-win32.whl (240 kB) +ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl +oudpickle 0.5.3 which is incompatible. +Installing collected packages: psutil +Successfully installed psutil-5.8.0 + +C:\maXbox\mX39998\maxbox3>py +Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64 + on win32 +Type "help", "copyright", "credits" or "license" for more information. +>>> import psutil, os +>>> p = psutil.Process( os.getpid()) +>>> for dll in p.memory_maps(): +... print(dll.path) +... +C:\Users\max\AppData\Local\Programs\Python\Python36\python.exe +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_bz2.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_ctypes.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\select.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_socket.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll +C:\Windows\System32\locale.nls +C:\Windows\Globalization\Sorting\SortDefault.nls +C:\Windows\System32\en-US\KernelBase.dll.mui +C:\Windows\SysWOW64\en-US\kernel32.dll.mui +C:\Windows\System32\ucrtbase.dll +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_lzma.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\Lib\site-packages\psutil\_ +util_windows.cp36-win_amd64.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\python3.dll +C:\Windows\System32\api-ms-win-crt-filesystem-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-conio-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-process-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-environment-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-time-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-convert-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-string-l1-1-0.dll +C:\Users\max\AppData\Local\Programs\Python\Python36\vcruntime140.dll +C:\Windows\System32\api-ms-win-crt-heap-l1-1-0.dll +C:\Windows\System32\pdh.dll +C:\Windows\System32\api-ms-win-crt-locale-l1-1-0.dll +C:\Windows\System32\version.dll +C:\Windows\System32\winnsi.dll +C:\Windows\System32\IPHLPAPI.DLL +C:\Windows\System32\wtsapi32.dll +C:\Windows\System32\api-ms-win-crt-stdio-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-math-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-runtime-l1-1-0.dll +C:\Windows\System32\rsaenh.dll +C:\Windows\System32\cryptsp.dll +C:\Windows\System32\bcrypt.dll +C:\Windows\System32\bcryptprimitives.dll +C:\Windows\System32\cryptbase.dll +C:\Windows\System32\powrprof.dll +C:\Windows\System32\KernelBase.dll +C:\Windows\System32\sspicli.dll +C:\Windows\System32\ole32.dll +C:\Windows\System32\oleaut32.dll +C:\Windows\System32\rpcrt4.dll +C:\Windows\System32\msvcrt.dll +C:\Windows\System32\ws2_32.dll +C:\Windows\System32\user32.dll +C:\Windows\System32\msctf.dll +C:\Windows\System32\shlwapi.dll +C:\Windows\System32\imm32.dll +C:\Windows\System32\advapi32.dll +C:\Windows\System32\shell32.dll +C:\Windows\System32\kernel32.dll +C:\Windows\System32\combase.dll +C:\Windows\System32\gdi32.dll +C:\Windows\System32\sechost.dll +C:\Windows\System32\psapi.dll +C:\Windows\System32\nsi.dll +C:\Windows\System32\ntdll.dll +>>> + + +Then to convert any file from wav to mp3 just use pydub as +import pydub +sound = pydub.AudioSegment.from_wav("D:/example/apple.wav") +sound.export("D:/example/apple.mp3", format="mp3") + +Exception: : Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_MD5.pyd' + +Patterns konkret. +ISBN-13: 9783935042468 ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin +----File newtemplate.txt not exists - now saved!---- + + + + \ No newline at end of file diff --git a/Demos/pydemo13_cheatsheet_Tutorial_90.htm b/Demos/pydemo13_cheatsheet_Tutorial_90.htm new file mode 100644 index 00000000..c4e426cf --- /dev/null +++ b/Demos/pydemo13_cheatsheet_Tutorial_90.htm @@ -0,0 +1,404 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000087990 +StartFragment:0000001053 +EndFragment:0000087974 + + + + +mXScriptasHTML + + + + + +

PROGRAM SEPDemo_App_mX4_Python_Cheat_Sheet5_Tutorial_90;
+//Python Cheat Sheet: Functions and Tricks
+//http://www.softwareschule.ch/examples/cheatsheetpython.pdf
+//https://realpython.com/python-json/
+//https://wiki.freepascal.org/Developing_Python_Modules_with_Pascal#Minimum_Python_API
+{Purpose: Python Cheat Sheet: Functions and Tricks. }
+
+//<Constant declarations> 
+//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre'].
+{TYPE <Type declarations> Pascal-Delphi-Python-Json-OLEAutomation} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+
+Var  //<Variable declarations>
+  i: integer; eg: TPythonEngine;
+
+//<FUNCTION> //<PROCEDURE> 
+//Generate public key and private key
+
+Const PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+              
+Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+
+                  '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; 
+
+Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; 
+
+Const REXDEF= 'def striphtml(data):      '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+               
+//https://gist.github.com/lkdocs/6519378               
+Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+
+          '  '''''+LF+
+          //'  Generate an RSA keypair with exponent of 65537 in PEM format'+LF+
+          //'  param: bits The key length in bits '+LF+
+          //'  Return private key and public key '+LF+
+          '  '''''+LF+
+          '  from Crypto.PublicKey import RSA '+LF+
+          '  new_key = RSA.generate(bits, e=65537)'+LF+ 
+          '  public_key = new_key.publickey().exportKey("PEM")'+LF+ 
+          '  private_key = new_key.exportKey("PEM")'+LF+ 
+          '  return private_key, public_key';
+               
+procedure GetJSONData;
+var  XMLhttp: OleVariant; // As Object Automation
+     ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2;
+     response,statuscode: string; cnt: integer;
+begin  
+  XMLhttp:= CreateOleObject('msxml2.xmlhttp')      
+  XMLhttp.Open('GET', WEBURL, False)   //False is async
+  //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
+  XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
+  XMLhttp.Send();
+  response:= XMLhttp.responseText; //assign the data
+  statuscode:= XMLhttp.status; 
+  //writeln(statuscode +CRLF+ response)
+  ajt:= TJson.create(); 
+  try
+    ajt.parse(response);
+  except
+    writeln( 'Exception: <TJsonClass>"" parse error: {'+
+                  exceptiontostring(exceptiontype, exceptionparam)) 
+  end; 
+  JArray:= ajt.JsonArray;
+  writeln('Get all Titles: '+itoa(jarray.count));     
+  for cnt:= 0 to jarray.count-1 do
+    writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString);   
+  ajt.Free;
+end;
+
+Begin  //@Main
+//<Executable statements>
+//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469
+{ ISBN-10 ? : 3935042469  ISBN-13 ? : 978-3935042468} 
+
+  eg:= TPythonEngine.Create(Nil);
+  eg.pythonhome:= PYHOME32;
+  eg.opendll(PYDLL32)
+  //eng.IO:= pyMemo;
+  try
+    eg.Execstring('import base64'+LF+'import urllib.parse');
+    eg.Execstring('import urllib.request, os, textwrap, json, requests');
+    eg.Execstring(REXDEF);
+    
+   { eg.Execstring('import nacl');
+    eg.Execstring('from nacl.encoding import HexEncoder'+CRLF+
+                   'from nacl.exceptions import CryptoError'+CRLF+
+                   'from nacl.encoding import Base64Encoder'+CRLF+
+                   'from pydub import AudioSegment');  }           
+    
+   //eg.Execstring('from Crypto.PublicKey import RSA');                
+    
+   println(eg.evalStr('base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")'));
+  //eng.Execstring('priv_key = nacl.public.PrivateKey.generate()');
+  //openWeb('http://www.softwareschule.ch/examples/cheatsheetpython.pdf');
+    
+  //# 1.map(func, iter) Executes the function on all elements of iterable
+   println(eg.evalStr('list(map( lambda x: x[0],["red","green","blue"]))'));
+   
+  //# 2.map(func, i1,...,Executes the function on all k elements of k iterables
+   println(eg.evalStr('list(map(lambda x,y: str(x)+" "+y + "s",[0,2,2],'+
+                                       '[ "apple" , "orange" , "banana" ]))'));
+    
+  //# 3.string.join(iter), Concatenates iterable elements separated by string
+   println(eg.evalStr('" marries " .join(list([ "Alice" , "Bob" ]))'));
+
+  //# 4.filter(func,iterable),Filters out elements in iterable for function returns False (or 0)
+   println(eg.evalStr('list(filter(lambda x: True if x> 17 else False,[1,15,17,18]))'));
+   
+  //# 5.string.strip(), Removes leading and trailing whitespaces of string
+   println(eg.evalStr('( " \n \t 42 \t " .strip())'));
+   
+  //# 6.sorted(iter), Sorts iterable in ascending order
+   println(eg.evalStr('sorted([ 8 , 3 , 2 , 42 , 5 ])'));
+   
+  //# 7.sorted(iter,key=key) , Sorts according to the key function in ascending order 
+   println(eg.evalStr('sorted([ 8,3,2,42,5 ], key=lambda x: 0 if x== 42 else x)'));
+   
+  //# 8.help(func) , Returns documentation of func
+  // println(eg.evalStr('help(''print'')'));
+   saveString(exepath+'pyhelp.py', 'help(''print'')');
+   print(getDosOutput('py '+exepath+'pyhelp.py', exePath));
+   
+  //# 9.zip(i1, i2, ...), Groups the i-th elements of iterators i1,i2,...together
+   println(eg.evalStr('list(zip([''Alice'',''Anna''],[''Bob'',''Jon'',''Frank'']))'));
+   
+  //# 10.Unzip, Equal to: 1) unpack the zipped list, 2) zip the result
+   println(eg.evalStr('list(zip(*[(''Alice'',''Bob''),(''Anna'',''Jon'')]))'));
+  
+  //# 11.enumerate(iter), Assigns a counter value to each element of iterable
+   println(eg.evalStr('list(enumerate(["Alice","Bob","Jon"]))'));
+   
+  //# 12.python -m http.server<P>,Want to share files between PC and phone?
+  //https://docs.python.org/3/library/http.server.html
+   //print(getDosOutput('py -m http.server<8080>', exePath));
+   //ExecuteShell('py', '-m http.server 8080');
+  
+  //# 13.Read comic Open the comic series xkcd in your web browser
+  //eg.Execstring('import antigravity');
+  
+  //# 14.Zen of Python import this
+   eg.execString('from this import *');
+   println('14. import this: '+CRLF+
+        StringReplace(eg.EvalStr('repr("".join([d.get(c,c) for c in s]))'),
+                                                '\n',CR+LF,[rfReplaceAll]));
+  
+  //# 15.Swapping numbers, Swapping vars is a breeze in Python. No offense, Java!
+  eg.execString('a, b = ''Jane'' , ''Alice'''+CRLF+'a, b = b, a');
+  println(eg.evalStr('a, b'));
+  
+  //# 16.Unpacking arguments, Use a sequence as function arguments!
+  eg.execString('def f (x, y, z) : return x + y * z');
+  println(eg.evalStr('f(*[ 1 , 3 , 4 ])'));
+  println(eg.evalStr('f(**{ ''z'': 4 , ''x'': 1 , ''y'': 3 })'));
+  
+  //# 17.Generate QRCode!
+  eg.Execstring('import psutil');
+  eg.Execstring('import pyqrcode');
+      
+  eg.Execstring('Qr_Code = pyqrcode.create("maXbox4")');
+  eg.Execstring('Qr_Code.svg("qrmx42.svg", scale=8)');
+  
+  //# 18.Checking Free RAM
+  
+  println('Virtual Mem: '+ 
+              eg.EvalStr('(__import__("psutil").virtual_memory())'));
+  
+ { eg.execString('import psutil, os')
+  eg.execString('adlst = []')
+  eg.execString('p = psutil.Process( os.getpid())');
+  eg.execString('for dll in p.memory_maps():'+CRLF+' print(dll.path)');
+  eg.execString('for dll in p.memory_maps():'+CRLF+' adlst.append(dll.path)');
+  //println(eg.evalStr(' print(dll.path)'));
+  println(eg.evalStr('p'));
+  println(eg.evalStr('adlst'));
+  println('dll list detect: '+
+             StringReplace(eg.EvalStr('adlst'),',',CR+LF,[rfReplaceAll]));   }
+    
+  // eg.Execstring('AudioSegment.from_wav(r"C:\maXbox\soundnvision\01_magix.wav").export(r"C:\maXbox\mX47464\maxbox4\web\G9\G9_magix.mp3", format="mp3")');           
+
+    { eng.Execstring(DEF_RSAKEYS);
+      eng.Execstring('d=generate_RSA(bits=2048)')
+      println('RSA Publickey '+eng.evalStr('d[1]'));  }
+   //# Get the maximum number of complete TODOs.
+   //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); 
+                    
+  except
+    eg.raiseError;
+  finally
+    eg.Free;
+    //aPythonVersion.Free;
+  end;  
+  
+  //GetJSONData;  
+  //maXcalcF('2^64 /(60*60*24*365)')  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+ mX4 executed: 20/09/2021 19:20:40  Runtime: 0:0:2.782  Memload: 69% use
+
+C:\maXbox\mX39998\maxbox3>pip3 install -t C:\Users\max\AppData\Local\Programs\Py
+thon\Python36-32\Lib pydub
+Collecting pydub
+  Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)
+Installing collected packages: pydub
+Successfully installed pydub-0.25.1
+
+C:\maXbox\mX39998\maxbox3>pip3 install -U -t C:\Users\max\AppData\Local\Programs
+\Python\Python36-32\Lib https://files.pythonhosted.org/packages/19/29/f7a38ee300
+83f2caa14cc77a6d34c4d5cfd1a69641e87bf1b3d6ba90d0ba/psutil-5.8.0-cp36-cp36m-win32
+.whl
+Collecting psutil==5.8.0
+  Using cached psutil-5.8.0-cp36-cp36m-win32.whl (240 kB)
+ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl
+oudpickle 0.5.3 which is incompatible.
+Installing collected packages: psutil
+Successfully installed psutil-5.8.0
+
+C:\maXbox\mX39998\maxbox3>py
+Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64
+ on win32
+Type "help", "copyright", "credits" or "license" for more information.
+>>> import psutil, os
+>>> p = psutil.Process( os.getpid())
+>>> for dll in p.memory_maps():
+...   print(dll.path)
+...
+C:\Users\max\AppData\Local\Programs\Python\Python36\python.exe
+C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_bz2.pyd
+C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_ctypes.pyd
+C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\select.pyd
+C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_socket.pyd
+C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll
+C:\Windows\System32\locale.nls
+C:\Windows\Globalization\Sorting\SortDefault.nls
+C:\Windows\System32\en-US\KernelBase.dll.mui
+C:\Windows\SysWOW64\en-US\kernel32.dll.mui
+C:\Windows\System32\ucrtbase.dll
+C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_lzma.pyd
+C:\Users\max\AppData\Local\Programs\Python\Python36\Lib\site-packages\psutil\_
+util_windows.cp36-win_amd64.pyd
+C:\Users\max\AppData\Local\Programs\Python\Python36\python3.dll
+C:\Windows\System32\api-ms-win-crt-filesystem-l1-1-0.dll
+C:\Windows\System32\api-ms-win-crt-conio-l1-1-0.dll
+C:\Windows\System32\api-ms-win-crt-process-l1-1-0.dll
+C:\Windows\System32\api-ms-win-crt-environment-l1-1-0.dll
+C:\Windows\System32\api-ms-win-crt-time-l1-1-0.dll
+C:\Windows\System32\api-ms-win-crt-convert-l1-1-0.dll
+C:\Windows\System32\api-ms-win-crt-string-l1-1-0.dll
+C:\Users\max\AppData\Local\Programs\Python\Python36\vcruntime140.dll
+C:\Windows\System32\api-ms-win-crt-heap-l1-1-0.dll
+C:\Windows\System32\pdh.dll
+C:\Windows\System32\api-ms-win-crt-locale-l1-1-0.dll
+C:\Windows\System32\version.dll
+C:\Windows\System32\winnsi.dll
+C:\Windows\System32\IPHLPAPI.DLL
+C:\Windows\System32\wtsapi32.dll
+C:\Windows\System32\api-ms-win-crt-stdio-l1-1-0.dll
+C:\Windows\System32\api-ms-win-crt-math-l1-1-0.dll
+C:\Windows\System32\api-ms-win-crt-runtime-l1-1-0.dll
+C:\Windows\System32\rsaenh.dll
+C:\Windows\System32\cryptsp.dll
+C:\Windows\System32\bcrypt.dll
+C:\Windows\System32\bcryptprimitives.dll
+C:\Windows\System32\cryptbase.dll
+C:\Windows\System32\powrprof.dll
+C:\Windows\System32\KernelBase.dll
+C:\Windows\System32\sspicli.dll
+C:\Windows\System32\ole32.dll
+C:\Windows\System32\oleaut32.dll
+C:\Windows\System32\rpcrt4.dll
+C:\Windows\System32\msvcrt.dll
+C:\Windows\System32\ws2_32.dll
+C:\Windows\System32\user32.dll
+C:\Windows\System32\msctf.dll
+C:\Windows\System32\shlwapi.dll
+C:\Windows\System32\imm32.dll
+C:\Windows\System32\advapi32.dll
+C:\Windows\System32\shell32.dll
+C:\Windows\System32\kernel32.dll
+C:\Windows\System32\combase.dll
+C:\Windows\System32\gdi32.dll
+C:\Windows\System32\sechost.dll
+C:\Windows\System32\psapi.dll
+C:\Windows\System32\nsi.dll
+C:\Windows\System32\ntdll.dll
+>>>
+
+
+Then to convert any file from wav to mp3 just use pydub as
+import pydub
+sound = pydub.AudioSegment.from_wav("D:/example/apple.wav")
+sound.export("D:/example/apple.mp3", format="mp3")
+
+Exception: <class 'OSError'>: Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_MD5.pyd'
+
+Patterns konkret.
+ISBN-13: 9783935042468  ISBN-10: 3935042469
+Author: Kleiner, Max
+Binding: Paperback
+Publisher: Software + Support
+Published: September 2003
+
+https://mymemory.translated.net/doc/spec.php
+Hello PyWorld_, This data will be written on the file.
+Hola PyWorld_,&#10; Estos datos se escribirán en el archivo.
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+----File newtemplate.txt not exists - now saved!----
+
+
+Verifying EU Digital COVID-19 Certificate with Python CWT
+
+https://medium.com/@dajiaji/verifying-eu-digital-covid-19-certificate-with-python-cwt-fd3d5de27eed
+
+import cwt
+from cwt import Claims, load_pem_hcert_dsc
+
+# A DSC(Document Signing Certificate) issued by a CSCA (Certificate Signing Certificate Authority)
+# quoted from: https://github.com/eu-digital-green-certificates/dgc-testdata/blob/main/AT/2DCode/raw/1.json
+dsc = "-----BEGIN CERTIFICATE-----\nMIIBvTCCAWOgAwIBAgIKAXk8i88OleLsuTAKBggqhkjOPQQDAjA2MRYwFAYDVQQDDA1BVCBER0MgQ1NDQSAxMQswCQYDVQQGEwJBVDEPMA0GA1UECgwGQk1TR1BLMB4XDTIxMDUwNTEyNDEwNloXDTIzMDUwNTEyNDEwNlowPTERMA8GA1UEAwwIQVQgRFNDIDExCzAJBgNVBAYTAkFUMQ8wDQYDVQQKDAZCTVNHUEsxCjAIBgNVBAUTATEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASt1Vz1rRuW1HqObUE9MDe7RzIk1gq4XW5GTyHuHTj5cFEn2Rge37+hINfCZZcozpwQKdyaporPUP1TE7UWl0F3o1IwUDAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFO49y1ISb6cvXshLcp8UUp9VoGLQMB8GA1UdIwQYMBaAFP7JKEOflGEvef2iMdtopsetwGGeMAoGCCqGSM49BAMCA0gAMEUCIQDG2opotWG8tJXN84ZZqT6wUBz9KF8D+z9NukYvnUEQ3QIgdBLFSTSiDt0UJaDF6St2bkUQuVHW6fQbONd731/M4nc=\n-----END CERTIFICATE-----"
+
+# An EUDCC (EU Digital COVID Certificate)
+# quoted from: https://github.com/eu-digital-green-certificates/dgc-testdata/blob/main/AT/2DCode/raw/1.json
+eudcc = bytes.fromhex("d2844da20448d919375fc1e7b6b20126a0590133a4041a61817ca0061a60942ea001624154390103a101a4617681aa62646e01626d616d4f52472d3130303033303231356276706a313131393334393030376264746a323032312d30322d313862636f624154626369783155524e3a555643493a30313a41543a31303830373834334639344145453045453530393346424332353442443831332342626d706c45552f312f32302f31353238626973781b4d696e6973747279206f66204865616c74682c20417573747269616273640262746769383430353339303036636e616da463666e74754d5553544552465241553c474f455353494e47455262666e754d7573746572667261752d47c3b6c39f696e67657263676e74684741425249454c4562676e684761627269656c656376657265312e302e3063646f626a313939382d30322d323658405812fce67cb84c3911d78e3f61f890d0c80eb9675806aebed66aa2d0d0c91d1fc98d7bcb80bf00e181806a9502e11b071325901bd0d2c1b6438747b8cc50f521")
+
+# 1. Loads a DSC as a COSEKey for verifying a signature in EUDCC.
+public_key = load_pem_hcert_dsc(dsc)
+
+# 2. Verifies and decodes a target EUDCC.
+decoded = cwt.decode(eudcc, keys=[public_key])
+
+# 3. Get the payload of the EUCC. It is a JSON-formatted Electronic Health Certificate as follows:
+claims = Claims.new(decoded)
+# claims.hcert[1] == decoded[-260][1] ==
+# {
+#     'v': [
+#         {
+#             'dn': 1,
+#             'ma': 'ORG-100030215',
+#             'vp': '1119349007',
+#             'dt': '2021-02-18',
+#             'co': 'AT',
+#             'ci': 'URN:UVCI:01:AT:10807843F94AEE0EE5093FBC254BD813#B',
+#             'mp': 'EU/1/20/1528',
+#             'is': 'Ministry of Health, Austria',
+#             'sd': 2,
+#             'tg': '840539006',
+#         }
+#     ],
+#     'nam': {
+#         'fnt': 'MUSTERFRAU<GOESSINGER',
+#         'fn': 'Musterfrau-Gößinger',
+#         'gnt': 'GABRIELE',
+#         'gn': 'Gabriele',
+#     },
+#     'ver': '1.0.0',
+#     'dob': '1998-02-26',
+# }
+
+       
+   
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo13_cheatsheet_Tutorial_90.txt b/Demos/pydemo13_cheatsheet_Tutorial_90.txt new file mode 100644 index 00000000..63737229 --- /dev/null +++ b/Demos/pydemo13_cheatsheet_Tutorial_90.txt @@ -0,0 +1,371 @@ +PROGRAM SEPDemo_App_mX4_Python_Cheat_Sheet5_Tutorial_90; +//Python Cheat Sheet: Functions and Tricks +//http://www.softwareschule.ch/examples/cheatsheetpython.pdf +//https://realpython.com/python-json/ +//https://wiki.freepascal.org/Developing_Python_Modules_with_Pascal#Minimum_Python_API +{Purpose: Python Cheat Sheet: Functions and Tricks. } + +// +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-OLEAutomation} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + +Var // + i: integer; eg: TPythonEngine; + +// // +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +//https://gist.github.com/lkdocs/6519378 +Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+ + ' '''''+LF+ + //' Generate an RSA keypair with exponent of 65537 in PEM format'+LF+ + //' param: bits The key length in bits '+LF+ + //' Return private key and public key '+LF+ + ' '''''+LF+ + ' from Crypto.PublicKey import RSA '+LF+ + ' new_key = RSA.generate(bits, e=65537)'+LF+ + ' public_key = new_key.publickey().exportKey("PEM")'+LF+ + ' private_key = new_key.exportKey("PEM")'+LF+ + ' return private_key, public_key'; + +procedure GetJSONData; +var XMLhttp: OleVariant; // As Object Automation + ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2; + response,statuscode: string; cnt: integer; +begin + XMLhttp:= CreateOleObject('msxml2.xmlhttp') + XMLhttp.Open('GET', WEBURL, False) //False is async + //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8'); + XMLhttp.Send(); + response:= XMLhttp.responseText; //assign the data + statuscode:= XMLhttp.status; + //writeln(statuscode +CRLF+ response) + ajt:= TJson.create(); + try + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JArray:= ajt.JsonArray; + writeln('Get all Titles: '+itoa(jarray.count)); + for cnt:= 0 to jarray.count-1 do + writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString); + ajt.Free; +end; + +Begin //@Main +// +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 ISBN-13 ? : 978-3935042468} + + eg:= TPythonEngine.Create(Nil); + eg.pythonhome:= PYHOME32; + eg.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eg.Execstring('import base64'+LF+'import urllib.parse'); + eg.Execstring('import urllib.request, os, textwrap, json, requests'); + eg.Execstring(REXDEF); + + { eg.Execstring('import nacl'); + eg.Execstring('from nacl.encoding import HexEncoder'+CRLF+ + 'from nacl.exceptions import CryptoError'+CRLF+ + 'from nacl.encoding import Base64Encoder'+CRLF+ + 'from pydub import AudioSegment'); } + + //eg.Execstring('from Crypto.PublicKey import RSA'); + + println(eg.evalStr('base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")')); + //eng.Execstring('priv_key = nacl.public.PrivateKey.generate()'); + //openWeb('http://www.softwareschule.ch/examples/cheatsheetpython.pdf'); + + //# 1.map(func, iter) Executes the function on all elements of iterable + println(eg.evalStr('list(map( lambda x: x[0],["red","green","blue"]))')); + + //# 2.map(func, i1,...,Executes the function on all k elements of k iterables + println(eg.evalStr('list(map(lambda x,y: str(x)+" "+y + "s",[0,2,2],'+ + '[ "apple" , "orange" , "banana" ]))')); + + //# 3.string.join(iter), Concatenates iterable elements separated by string + println(eg.evalStr('" marries " .join(list([ "Alice" , "Bob" ]))')); + + //# 4.filter(func,iterable),Filters out elements in iterable for function returns False (or 0) + println(eg.evalStr('list(filter(lambda x: True if x> 17 else False,[1,15,17,18]))')); + + //# 5.string.strip(), Removes leading and trailing whitespaces of string + println(eg.evalStr('( " \n \t 42 \t " .strip())')); + + //# 6.sorted(iter), Sorts iterable in ascending order + println(eg.evalStr('sorted([ 8 , 3 , 2 , 42 , 5 ])')); + + //# 7.sorted(iter,key=key) , Sorts according to the key function in ascending order + println(eg.evalStr('sorted([ 8,3,2,42,5 ], key=lambda x: 0 if x== 42 else x)')); + + //# 8.help(func) , Returns documentation of func + // println(eg.evalStr('help(''print'')')); + saveString(exepath+'pyhelp.py', 'help(''print'')'); + print(getDosOutput('py '+exepath+'pyhelp.py', exePath)); + + //# 9.zip(i1, i2, ...), Groups the i-th elements of iterators i1,i2,...together + println(eg.evalStr('list(zip([''Alice'',''Anna''],[''Bob'',''Jon'',''Frank'']))')); + + //# 10.Unzip, Equal to: 1) unpack the zipped list, 2) zip the result + println(eg.evalStr('list(zip(*[(''Alice'',''Bob''),(''Anna'',''Jon'')]))')); + + //# 11.enumerate(iter), Assigns a counter value to each element of iterable + println(eg.evalStr('list(enumerate(["Alice","Bob","Jon"]))')); + + //# 12.python -m http.server

,Want to share files between PC and phone? + //https://docs.python.org/3/library/http.server.html + //print(getDosOutput('py -m http.server<8080>', exePath)); + //ExecuteShell('py', '-m http.server 8080'); + + //# 13.Read comic Open the comic series xkcd in your web browser + //eg.Execstring('import antigravity'); + + //# 14.Zen of Python import this + eg.execString('from this import *'); + println('14. import this: '+CRLF+ + StringReplace(eg.EvalStr('repr("".join([d.get(c,c) for c in s]))'), + '\n',CR+LF,[rfReplaceAll])); + + //# 15.Swapping numbers, Swapping vars is a breeze in Python. No offense, Java! + eg.execString('a, b = ''Jane'' , ''Alice'''+CRLF+'a, b = b, a'); + println(eg.evalStr('a, b')); + + //# 16.Unpacking arguments, Use a sequence as function arguments! + eg.execString('def f (x, y, z) : return x + y * z'); + println(eg.evalStr('f(*[ 1 , 3 , 4 ])')); + println(eg.evalStr('f(**{ ''z'': 4 , ''x'': 1 , ''y'': 3 })')); + + //# 17.Generate QRCode! + eg.Execstring('import psutil'); + eg.Execstring('import pyqrcode'); + + eg.Execstring('Qr_Code = pyqrcode.create("maXbox4")'); + eg.Execstring('Qr_Code.svg("qrmx42.svg", scale=8)'); + + //# 18.Checking Free RAM + + println('Virtual Mem: '+ + eg.EvalStr('(__import__("psutil").virtual_memory())')); + + { eg.execString('import psutil, os') + eg.execString('adlst = []') + eg.execString('p = psutil.Process( os.getpid())'); + eg.execString('for dll in p.memory_maps():'+CRLF+' print(dll.path)'); + eg.execString('for dll in p.memory_maps():'+CRLF+' adlst.append(dll.path)'); + //println(eg.evalStr(' print(dll.path)')); + println(eg.evalStr('p')); + println(eg.evalStr('adlst')); + println('dll list detect: '+ + StringReplace(eg.EvalStr('adlst'),',',CR+LF,[rfReplaceAll])); } + + // eg.Execstring('AudioSegment.from_wav(r"C:\maXbox\soundnvision\01_magix.wav").export(r"C:\maXbox\mX47464\maxbox4\web\G9\G9_magix.mp3", format="mp3")'); + + { eng.Execstring(DEF_RSAKEYS); + eng.Execstring('d=generate_RSA(bits=2048)') + println('RSA Publickey '+eng.evalStr('d[1]')); } + //# Get the maximum number of complete TODOs. + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + + except + eg.raiseError; + finally + eg.Free; + //aPythonVersion.Free; + end; + + //GetJSONData; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + mX4 executed: 20/09/2021 19:20:40 Runtime: 0:0:2.782 Memload: 69% use + +C:\maXbox\mX39998\maxbox3>pip3 install -t C:\Users\max\AppData\Local\Programs\Py +thon\Python36-32\Lib pydub +Collecting pydub + Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB) +Installing collected packages: pydub +Successfully installed pydub-0.25.1 + +C:\maXbox\mX39998\maxbox3>pip3 install -U -t C:\Users\max\AppData\Local\Programs +\Python\Python36-32\Lib https://files.pythonhosted.org/packages/19/29/f7a38ee300 +83f2caa14cc77a6d34c4d5cfd1a69641e87bf1b3d6ba90d0ba/psutil-5.8.0-cp36-cp36m-win32 +.whl +Collecting psutil==5.8.0 + Using cached psutil-5.8.0-cp36-cp36m-win32.whl (240 kB) +ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl +oudpickle 0.5.3 which is incompatible. +Installing collected packages: psutil +Successfully installed psutil-5.8.0 + +C:\maXbox\mX39998\maxbox3>py +Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64 + on win32 +Type "help", "copyright", "credits" or "license" for more information. +>>> import psutil, os +>>> p = psutil.Process( os.getpid()) +>>> for dll in p.memory_maps(): +... print(dll.path) +... +C:\Users\max\AppData\Local\Programs\Python\Python36\python.exe +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_bz2.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_ctypes.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\select.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_socket.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll +C:\Windows\System32\locale.nls +C:\Windows\Globalization\Sorting\SortDefault.nls +C:\Windows\System32\en-US\KernelBase.dll.mui +C:\Windows\SysWOW64\en-US\kernel32.dll.mui +C:\Windows\System32\ucrtbase.dll +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_lzma.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\Lib\site-packages\psutil\_ +util_windows.cp36-win_amd64.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\python3.dll +C:\Windows\System32\api-ms-win-crt-filesystem-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-conio-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-process-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-environment-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-time-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-convert-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-string-l1-1-0.dll +C:\Users\max\AppData\Local\Programs\Python\Python36\vcruntime140.dll +C:\Windows\System32\api-ms-win-crt-heap-l1-1-0.dll +C:\Windows\System32\pdh.dll +C:\Windows\System32\api-ms-win-crt-locale-l1-1-0.dll +C:\Windows\System32\version.dll +C:\Windows\System32\winnsi.dll +C:\Windows\System32\IPHLPAPI.DLL +C:\Windows\System32\wtsapi32.dll +C:\Windows\System32\api-ms-win-crt-stdio-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-math-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-runtime-l1-1-0.dll +C:\Windows\System32\rsaenh.dll +C:\Windows\System32\cryptsp.dll +C:\Windows\System32\bcrypt.dll +C:\Windows\System32\bcryptprimitives.dll +C:\Windows\System32\cryptbase.dll +C:\Windows\System32\powrprof.dll +C:\Windows\System32\KernelBase.dll +C:\Windows\System32\sspicli.dll +C:\Windows\System32\ole32.dll +C:\Windows\System32\oleaut32.dll +C:\Windows\System32\rpcrt4.dll +C:\Windows\System32\msvcrt.dll +C:\Windows\System32\ws2_32.dll +C:\Windows\System32\user32.dll +C:\Windows\System32\msctf.dll +C:\Windows\System32\shlwapi.dll +C:\Windows\System32\imm32.dll +C:\Windows\System32\advapi32.dll +C:\Windows\System32\shell32.dll +C:\Windows\System32\kernel32.dll +C:\Windows\System32\combase.dll +C:\Windows\System32\gdi32.dll +C:\Windows\System32\sechost.dll +C:\Windows\System32\psapi.dll +C:\Windows\System32\nsi.dll +C:\Windows\System32\ntdll.dll +>>> + + +Then to convert any file from wav to mp3 just use pydub as +import pydub +sound = pydub.AudioSegment.from_wav("D:/example/apple.wav") +sound.export("D:/example/apple.mp3", format="mp3") + +Exception: : Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_MD5.pyd' + +Patterns konkret. +ISBN-13: 9783935042468 ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin +----File newtemplate.txt not exists - now saved!---- + + +Verifying EU Digital COVID-19 Certificate with Python CWT + +https://medium.com/@dajiaji/verifying-eu-digital-covid-19-certificate-with-python-cwt-fd3d5de27eed + +import cwt +from cwt import Claims, load_pem_hcert_dsc + +# A DSC(Document Signing Certificate) issued by a CSCA (Certificate Signing Certificate Authority) +# quoted from: https://github.com/eu-digital-green-certificates/dgc-testdata/blob/main/AT/2DCode/raw/1.json +dsc = "-----BEGIN CERTIFICATE-----\nMIIBvTCCAWOgAwIBAgIKAXk8i88OleLsuTAKBggqhkjOPQQDAjA2MRYwFAYDVQQDDA1BVCBER0MgQ1NDQSAxMQswCQYDVQQGEwJBVDEPMA0GA1UECgwGQk1TR1BLMB4XDTIxMDUwNTEyNDEwNloXDTIzMDUwNTEyNDEwNlowPTERMA8GA1UEAwwIQVQgRFNDIDExCzAJBgNVBAYTAkFUMQ8wDQYDVQQKDAZCTVNHUEsxCjAIBgNVBAUTATEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASt1Vz1rRuW1HqObUE9MDe7RzIk1gq4XW5GTyHuHTj5cFEn2Rge37+hINfCZZcozpwQKdyaporPUP1TE7UWl0F3o1IwUDAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFO49y1ISb6cvXshLcp8UUp9VoGLQMB8GA1UdIwQYMBaAFP7JKEOflGEvef2iMdtopsetwGGeMAoGCCqGSM49BAMCA0gAMEUCIQDG2opotWG8tJXN84ZZqT6wUBz9KF8D+z9NukYvnUEQ3QIgdBLFSTSiDt0UJaDF6St2bkUQuVHW6fQbONd731/M4nc=\n-----END CERTIFICATE-----" + +# An EUDCC (EU Digital COVID Certificate) +# quoted from: https://github.com/eu-digital-green-certificates/dgc-testdata/blob/main/AT/2DCode/raw/1.json +eudcc = bytes.fromhex("d2844da20448d919375fc1e7b6b20126a0590133a4041a61817ca0061a60942ea001624154390103a101a4617681aa62646e01626d616d4f52472d3130303033303231356276706a313131393334393030376264746a323032312d30322d313862636f624154626369783155524e3a555643493a30313a41543a31303830373834334639344145453045453530393346424332353442443831332342626d706c45552f312f32302f31353238626973781b4d696e6973747279206f66204865616c74682c20417573747269616273640262746769383430353339303036636e616da463666e74754d5553544552465241553c474f455353494e47455262666e754d7573746572667261752d47c3b6c39f696e67657263676e74684741425249454c4562676e684761627269656c656376657265312e302e3063646f626a313939382d30322d323658405812fce67cb84c3911d78e3f61f890d0c80eb9675806aebed66aa2d0d0c91d1fc98d7bcb80bf00e181806a9502e11b071325901bd0d2c1b6438747b8cc50f521") + +# 1. Loads a DSC as a COSEKey for verifying a signature in EUDCC. +public_key = load_pem_hcert_dsc(dsc) + +# 2. Verifies and decodes a target EUDCC. +decoded = cwt.decode(eudcc, keys=[public_key]) + +# 3. Get the payload of the EUCC. It is a JSON-formatted Electronic Health Certificate as follows: +claims = Claims.new(decoded) +# claims.hcert[1] == decoded[-260][1] == +# { +# 'v': [ +# { +# 'dn': 1, +# 'ma': 'ORG-100030215', +# 'vp': '1119349007', +# 'dt': '2021-02-18', +# 'co': 'AT', +# 'ci': 'URN:UVCI:01:AT:10807843F94AEE0EE5093FBC254BD813#B', +# 'mp': 'EU/1/20/1528', +# 'is': 'Ministry of Health, Austria', +# 'sd': 2, +# 'tg': '840539006', +# } +# ], +# 'nam': { +# 'fnt': 'MUSTERFRAU +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-OLEAutomation} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + +Var // + i: integer; eg: TPythonEngine; + +// // +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +//https://gist.github.com/lkdocs/6519378 +Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+ + ' '''''+LF+ + //' Generate an RSA keypair with exponent of 65537 in PEM format'+LF+ + //' param: bits The key length in bits '+LF+ + //' Return private key and public key '+LF+ + ' '''''+LF+ + ' from Crypto.PublicKey import RSA '+LF+ + ' new_key = RSA.generate(bits, e=65537)'+LF+ + ' public_key = new_key.publickey().exportKey("PEM")'+LF+ + ' private_key = new_key.exportKey("PEM")'+LF+ + ' return private_key, public_key'; + +procedure GetJSONData; +var XMLhttp: OleVariant; // As Object Automation + ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2; + response,statuscode: string; cnt: integer; +begin + XMLhttp:= CreateOleObject('msxml2.xmlhttp') + XMLhttp.Open('GET', WEBURL, False) //False is async + //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8'); + XMLhttp.Send(); + response:= XMLhttp.responseText; //assign the data + statuscode:= XMLhttp.status; + //writeln(statuscode +CRLF+ response) + ajt:= TJson.create(); + try + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JArray:= ajt.JsonArray; + writeln('Get all Titles: '+itoa(jarray.count)); + for cnt:= 0 to jarray.count-1 do + writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString); + ajt.Free; +end; + +const filename='maXbox4.exe'; + +Begin //@Main +// +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 ISBN-13 ? : 978-3935042468} + + eg:= TPythonEngine.Create(Nil); + eg.pythonhome:= PYHOME32; + eg.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eg.Execstring('import base64'+LF+'import urllib.parse'); + eg.Execstring('import urllib.request, os, textwrap, json, requests'); + eg.Execstring(REXDEF); + + { eg.Execstring('import nacl'); + eg.Execstring('from nacl.encoding import HexEncoder'+CRLF+ + 'from nacl.exceptions import CryptoError'+CRLF+ + 'from nacl.encoding import Base64Encoder'+CRLF+ + 'from pydub import AudioSegment'); } + + //eg.Execstring('from Crypto.PublicKey import RSA'); + + println(eg.evalStr('base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")')); + //eng.Execstring('priv_key = nacl.public.PrivateKey.generate()'); + //openWeb('http://www.softwareschule.ch/examples/cheatsheetpython.pdf'); + + //# 1.map(func, iter) Executes the function on all elements of iterable + println(eg.evalStr('list(map( lambda x: x[0],["red","green","blue"]))')); + + //# 2.map(func, i1,...,Executes the function on all k elements of k iterables + println(eg.evalStr('list(map(lambda x,y: str(x)+" "+y + "s",[0,2,2],'+ + '[ "apple" , "orange" , "banana" ]))')); + + //# 3.string.join(iter), Concatenates iterable elements separated by string + println(eg.evalStr('" marries " .join(list([ "Alice" , "Bob" ]))')); + + //# 4.filter(func,iterable),Filters out elements in iterable for function returns False (or 0) + println(eg.evalStr('list(filter(lambda x: True if x> 17 else False,[1,15,17,18]))')); + + //# 5.string.strip(), Removes leading and trailing whitespaces of string + println(eg.evalStr('( " \n \t 42 \t " .strip())')); + + //# 6.sorted(iter), Sorts iterable in ascending order + println(eg.evalStr('sorted([ 8 , 3 , 2 , 42 , 5 ])')); + + //# 7.sorted(iter,key=key) , Sorts according to the key function in ascending order + println(eg.evalStr('sorted([ 8,3,2,42,5 ], key=lambda x: 0 if x== 42 else x)')); + + //# 8.help(func) , Returns documentation of func + // println(eg.evalStr('help(''print'')')); + saveString(exepath+'pyhelp.py', 'help(''print'')'); + print(getDosOutput('py '+exepath+'pyhelp.py', exePath)); + + //# 9.zip(i1, i2, ...), Groups the i-th elements of iterators i1,i2,...together + println(eg.evalStr('list(zip([''Alice'',''Anna''],[''Bob'',''Jon'',''Frank'']))')); + + //# 10.Unzip, Equal to: 1) unpack the zipped list, 2) zip the result + println(eg.evalStr('list(zip(*[(''Alice'',''Bob''),(''Anna'',''Jon'')]))')); + + //# 11.enumerate(iter), Assigns a counter value to each element of iterable + println(eg.evalStr('list(enumerate(["Alice","Bob","Jon"]))')); + + //# 12.python -m http.server

,Want to share files between PC and phone? + //https://docs.python.org/3/library/http.server.html + //print(getDosOutput('py -m http.server<8080>', exePath)); + //ExecuteShell('py', '-m http.server 8080'); + + //# 13.Read comic Open the comic series xkcd in your web browser + //eg.Execstring('import antigravity'); + + //# 14.Zen of Python import this + eg.execString('from this import *'); + println('14. import this: '+CRLF+ + StringReplace(eg.EvalStr('repr("".join([d.get(c,c) for c in s]))'), + '\n',CR+LF,[rfReplaceAll])); + + //# 15.Swapping numbers, Swapping vars is a breeze in Python. No offense, Java! + eg.execString('a, b = ''Jane'' , ''Alice'''+CRLF+'a, b = b, a'); + println(eg.evalStr('a, b')); + + //# 16.Unpacking arguments, Use a sequence as function arguments! + eg.execString('def f (x, y, z) : return x + y * z'); + println(eg.evalStr('f(*[ 1 , 3 , 4 ])')); + println(eg.evalStr('f(**{ ''z'': 4 , ''x'': 1 , ''y'': 3 })')); + + // eg.Execstring('AudioSegment.from_wav(r"C:\maXbox\soundnvision\01_magix.wav").export(r"C:\maXbox\mX47464\maxbox4\web\G9\G9_magix.mp3", format="mp3")'); + + { eng.Execstring(DEF_RSAKEYS); + eng.Execstring('d=generate_RSA(bits=2048)') + println('RSA Publickey '+eng.evalStr('d[1]')); } + + //# Get the maximum number of complete TODOs. + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a + eg.execString('from faker import Faker'); + eg.execString('fake = Faker()'); + println(eg.evalStr('fake.profile()')); + println(eg.evalStr('fake.credit_card_number()')); + print(' fake ip: '+eg.evalStr('fake.ipv4_private()')); + print(' fake adr: '+eg.evalStr('fake.address()')); + + //fake.address() + + //https://medium.com/@codedev101/13-advanced-snippets-to-automate-the-cool-stuff-with-python-5d8ea3d389e9 + + //# 17.Get Google Search Result + //https://github.com/MarioVilas/googlesearch/issues/39 + + eg.execString('from googlesearch import search'); + eg.execString('query = "maXbox4"'); + + eg.execString('lst=[]'+CRLF+'for i in search(query):'+crLF+ + ' lst.append(i)'); + println(eg.evalStr('str(lst)')); + + //# 18. Convert Pdf to Image + // eg.execString('import fitz'); + //Exception: : No module named 'frontend'. + //ERROR: Could not find a version that satisfies the requirement frontend (from versions: none) + + //const filename='maXbox4.exe'; + + //# 19.# Get File Size + println('file size '+eg.evalStr('os.stat("maXbox4.exe").st_size')); + println('file size '+eg.evalStr('os.stat("'+filename+'").st_size')); + + //20_ 9. Get IP Address + eg.execString('import socket'); + eg.execString('s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)'); + println('ip adr '+eg.evalStr('s.connect(("8.8.8.8", 80))')); + println('ip adr '+eg.evalStr('s.getsockname()[0]')); + eg.evalStr('s.close()'); + + except + eg.raiseError; + finally + eg.Free; + //aPythonVersion.Free; + end; + + //GetJSONData; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + mX4 executed: 20/09/2021 19:20:40 Runtime: 0:0:2.782 Memload: 69% use + +C:\maXbox\mX39998\maxbox3>pip3 install -t C:\Users\max\AppData\Local\Programs\Py +thon\Python36-32\Lib pydub +Collecting pydub + Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB) +Installing collected packages: pydub +Successfully installed pydub-0.25.1 + + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python -m pip install goo +gle +Collecting google + Using cached https://files.pythonhosted.org/packages/ac/35/17c9141c4ae21e9a29a +43acdfd848e3e468a810517f862cad07977bf8fe9/google-3.0.0-py2.py3-none-any.whl +Requirement already satisfied: beautifulsoup4 in c:\users\max\appdata\local\prog +rams\python\python36-32\lib\site-packages (from google) +Requirement already satisfied: soupsieve>1.2 in c:\users\max\appdata\local\progr +ams\python\python36-32\lib\site-packages (from beautifulsoup4->google) +Installing collected packages: google +Successfully installed google-3.0.0 + +Then to convert any file from wav to mp3 just use pydub as +import pydub +sound = pydub.AudioSegment.from_wav("D:/example/apple.wav") +sound.export("D:/example/apple.mp3", format="mp3") + +Exception: : Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_MD5.pyd' + +Patterns konkret. +ISBN-13: 9783935042468 ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin +----File newtemplate.txt not exists - now saved!---- + + + + + + \ No newline at end of file diff --git a/Demos/pydemo13tutor.psb b/Demos/pydemo13tutor.psb new file mode 100644 index 00000000..f62c4dd4 Binary files /dev/null and b/Demos/pydemo13tutor.psb differ diff --git a/Demos/pydemo13tutor.txt b/Demos/pydemo13tutor.txt new file mode 100644 index 00000000..23648939 --- /dev/null +++ b/Demos/pydemo13tutor.txt @@ -0,0 +1,409 @@ +PROGRAM SEPDemo_App_mX4_Python_Cheat_Sheet5; +//Python Cheat Sheet: Functions and Tricks +//http://www.softwareschule.ch/examples/cheatsheetpython.pdf +//https://realpython.com/python-json/ +//https://wiki.freepascal.org/Developing_Python_Modules_with_Pascal#Minimum_Python_API +{Purpose: Python Cheat Sheet: Functions and Tricks. } + +// +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-OLEAutomation} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + +Var // + i: integer; eg: TPythonEngine; + +// // +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +//https://gist.github.com/lkdocs/6519378 +Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+ + ' '''''+LF+ + //' Generate an RSA keypair with exponent of 65537 in PEM format'+LF+ + //' param: bits The key length in bits '+LF+ + //' Return private key and public key '+LF+ + ' '''''+LF+ + ' from Crypto.PublicKey import RSA '+LF+ + ' new_key = RSA.generate(bits, e=65537)'+LF+ + ' public_key = new_key.publickey().exportKey("PEM")'+LF+ + ' private_key = new_key.exportKey("PEM")'+LF+ + ' return private_key, public_key'; + +procedure GetJSONData; +var XMLhttp: OleVariant; // As Object Automation + ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2; + response,statuscode: string; cnt: integer; +begin + XMLhttp:= CreateOleObject('msxml2.xmlhttp') + XMLhttp.Open('GET', WEBURL, False) //False is async + //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8'); + XMLhttp.Send(); + response:= XMLhttp.responseText; //assign the data + statuscode:= XMLhttp.status; + //writeln(statuscode +CRLF+ response) + ajt:= TJson.create(); + try + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JArray:= ajt.JsonArray; + writeln('Get all Titles: '+itoa(jarray.count)); + for cnt:= 0 to jarray.count-1 do + writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString); + ajt.Free; +end; + +var runterrors, sdata: ansistring; atext: string; + +Begin //@Main +// +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 ISBN-13 ? : 978-3935042468} + + eg:= TPythonEngine.Create(Nil); + eg.pythonhome:= PYHOME32; + eg.opendll(PYDLL32) + //eg.IO:= pyMemo; + try + eg.ExecStr('import base64'+LF+'import urllib.parse'); + eg.ExecStr('import urllib.request,re,os,textwrap,json,requests,math,csv'); + eg.Execstring(REXDEF); + + { eg.Execstring('import nacl'); + eg.Execstring('from nacl.encoding import HexEncoder'+CRLF+ + 'from nacl.exceptions import CryptoError'+CRLF+ + 'from nacl.encoding import Base64Encoder'+CRLF+ + 'from pydub import AudioSegment'); } + + //eg.Execstring('from Crypto.PublicKey import RSA'); + + println(eg.evalStr('base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")')); + //eng.Execstring('priv_key = nacl.public.PrivateKey.generate()'); + //openWeb('http://www.softwareschule.ch/examples/cheatsheetpython.pdf'); + + //# 1.map(func, iter) Executes the function on all elements of iterable + println(eg.evalStr('list(map( lambda x: x[0],["red","green","blue"]))')); + + //# 2.map(func, i1,...,Executes the function on all k elements of k iterables + println(eg.evalStr('list(map(lambda x,y: str(x)+" "+y + "s",[0,2,2],'+ + '[ "apple" , "orange" , "banana" ]))')); + + //# 3.string.join(iter), Concatenates iterable elements separated by string + println(eg.evalStr('" marries " .join(list([ "Alice" , "Bob" ]))')); + + //# 4.filter(func,iterable),Filters out elements in iterable for function returns False (or 0) + println(eg.evalStr('list(filter(lambda x: True if x> 17 else False,[1,15,17,18]))')); + + //# 5.string.strip(), Removes leading and trailing whitespaces of string + println(eg.evalStr('( " \n \t 42 \t " .strip())')); + + //# 6.sorted(iter), Sorts iterable in ascending order + println(eg.evalStr('sorted([ 8 , 3 , 2 , 42 , 5 ])')); + + //# 7.sorted(iter,key=key) , Sorts according to the key function in ascending order + println(eg.evalStr('sorted([ 8,3,2,42,5 ], key=lambda x: 0 if x== 42 else x)')); + + //# 8.help(func) , Returns documentation of func + // println(eg.evalStr('help(''print'')')); + saveString(exepath+'pyhelp.py', 'help(''print'')'); + print(getDosOutput('py '+exepath+'pyhelp.py', exePath)); + + //# 9.zip(i1, i2, ...), Groups the i-th elements of iterators i1,i2,...together + println(eg.evalStr('list(zip([''Alice'',''Anna''],[''Bob'',''Jon'',''Frank'']))')); + + //# 10.Unzip, Equal to: 1) unpack the zipped list, 2) zip the result + println(eg.evalStr('list(zip(*[(''Alice'',''Bob''),(''Anna'',''Jon'')]))')); + + //# 11.enumerate(iter), Assigns a counter value to each element of iterable + println(eg.evalStr('list(enumerate(["Alice","Bob","Jon"]))')); + + //# 12.python -m http.server

,Want to share files between PC and phone? + //https://docs.python.org/3/library/http.server.html + //print(getDosOutput('py -m http.server<8080>', exePath)); + //ExecuteShell('py', '-m http.server 8080'); + + //# 13.Read comic Open the comic series xkcd in your web browser + //eg.Execstring('import antigravity'); + + //# 14.Zen of Python import this + eg.execString('from this import *'); + println('14. import this: '+CRLF+ + StringReplace(eg.EvalStr('repr("".join([d.get(c,c) for c in s]))'), + '\n',CR+LF,[rfReplaceAll])); + + //# 15.Swapping numbers, Swapping vars is a breeze in Python. No offense, Java! + eg.execString('a, b = ''Jane'' , ''Alice'''+CRLF+'a, b = b, a'); + println(eg.evalStr('a, b')); + + //# 16.Unpacking arguments, Use a sequence as function arguments! + eg.execString('def f (x, y, z) : return x + y * z'); + println(eg.evalStr('f(*[ 1 , 3 , 4 ])')); + println(eg.evalStr('f(**{ ''z'': 4 , ''x'': 1 , ''y'': 3 })')); + println('30 cos: '+eg.evalStr('math.cos(math.radians(30))')); + printF('30 cos in rad: %.18f ',[cos((30.0))]); + //Assuming trigonometric arguments in degrees | Use radians instead + printF('30 cos in deg: %.18f ',[cos(degtorad(30.0))]); + //Assuming trigonometric arguments in radians | Use degrees instead + printF('30 cos in deg: %.18f ',[cos(radtodeg(degtorad(30.0)))]); + println('pi '+eg.evalStr('math.sin((math.pi))')); + maXcalcF('sin(pi)') + writeln(floattostr(sin((PI)))); + println('45 rad: '+eg.evalStr('math.sin(45)')); + writeln('45 rad: '+floattostr(sin(45.0))); + writeln('45 rad: '+floattostr(maXcalc('sin(45.0)'))); + printF('45 rad: %.18f ',[maxCalc('sin(45.0)')]); + printF('45 rad: %.18f ',[sin(45.0)]); + + printF('this is %.18f ',[maxCalc('ln(2)^e')]); //this is 0.369248502937272178 + //println('error: '+eg.evalStr('math.foo()')); + + //eg.ExecStr('try:'+CRLF+' math.foo()'+CRLF+'except ValueError:'+ + // ' print("not an attribute")'); + eg.execString('from faker import Faker'); + //eg.execString('import Faker from faker'); + eg.execString('fake = Faker()'); + eg.execString('fake1 = Faker()'); + println('compare faker: '+eg.evalStr('fake == fake1')); + //csv files: + eg.execString('f = open(r"C:\maXbox\works2021\maxbox4\Import\maxbox\Examples\EKON\BASTA2020\titanic_train.csv", "r")'); + //eg.execString('csvReader = csv.reader(f)'); + //# for every row, print the row + eg.execStr('csvReader = csv.reader(f)'); + eg.execStr('titanic=[]'); + eg.execStr('for row in csvReader:'+CRLF+' titanic.append(row)'); + println(eg.evalStr('len(titanic)')); + println(eg.evalStr('titanic[1:10]')); + {for row in csvReader: + print(row) } + eg.execString('f.close()'); + + //lambda func + eg.execString('f = lambda x , y : x + y') + println('lambda back; '+eg.evalStr('f(2,7)')); + + printF('quora : %.18f ',[sqrt(111.0)]); + + //map Apply specific function on each list element: + eg.execStr('li = [1,4,81,9]'); + println('lambda list; '+eg.evalStr('list(map(lambda x : x * 2, li))')); + //Functions with more than one parameter requires an additional list per parameter: + println('lambda list2; '+eg.evalStr('list(map(math.pow, li, [1,2,3,4]))')); + + println(ReverseStr('SPAM')); + println(ReverseString('SPAM')); + + Writeln('some HEX RegEx___________________________________^'); + + println('RegEx: '+eg.evalStr('re.findall(r"a.c", "abc aac aa abb a c")')); + + println('RegEx: '+eg.evalStr('re.findall(r"\s\d\s", "1 22 4 22 1 a b c")')); + println('RegEx: '+eg.evalStr('re.findall(r"[^aeiou ]","Python Kurs")')); + atext:= '"adm06:x:706:1000:St.Graf:/home/adm06:/bin/bash"'; + println(eg.evalStr('re.match("([a-z0 -9]+):x:[0 -9]+:[0 -9]+:(.+):.+:.+$",' + +atext+')')); + + { In Python 3, the purpose of input() in Python 2 is removed and the same result can be achieved by using the eval(input()).} + //println(eg.evalStr('raw_input(prompt)')); + //println(eg.evalStr('input()')); + //Exception: : input(): lost sys.stdin. + + + //if RunByteCode(exepath+'examples\pydemo13tutor.psb', runterrors) then + // writeln('errors '+runterrors); + + + { eg.execString('import psutil, os') + eg.execString('adlst = []') + eg.execString('p = psutil.Process( os.getpid())'); + eg.execString('for dll in p.memory_maps():'+CRLF+' print(dll.path)'); + eg.execString('for dll in p.memory_maps():'+CRLF+' adlst.append(dll.path)'); + //println(eg.evalStr(' print(dll.path)')); + println(eg.evalStr('p')); + println(eg.evalStr('adlst')); + println('dll list detect: '+ + StringReplace(eg.EvalStr('adlst'),',',CR+LF,[rfReplaceAll])); } + + // eg.Execstring('AudioSegment.from_wav(r"C:\maXbox\soundnvision\01_magix.wav").export(r"C:\maXbox\mX47464\maxbox4\web\G9\G9_magix.mp3", format="mp3")'); + + { eng.Execstring(DEF_RSAKEYS); + eng.Execstring('d=generate_RSA(bits=2048)') + println('RSA Publickey '+eng.evalStr('d[1]')); } + + //# Get the maximum number of complete TODOs. + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + + except + eg.raiseError; + finally + eg.Free; + //aPythonVersion.Free; + end; + + //if RunByteCode(exepath+'examples\pydemo13tutor.psb', runterrors) then + //writeln('errors '+runterrors); + + //writeln(botostr(RunCompiledScript2(exepath+'examples\pydemo13tutor.psb', runterrors))); + //sdata:= loadfile(exepath+ + // 'examples\058_pas_filefinder32test.psb'); + { writeln('starts byte code__________________________________^'); + sdata:= loadfile(exepath+ + 'examples\pydemo13tutor.psb'); + writeln(botostr(RunBytecode(sdata, runterrors))); + println('hasta la vista dont come back'); } + + // Code Example Binary file: + { sr:= loadFile(Exepath+'maXbox4.exe') + writeln(SHA256ToStr(CalcSHA256(sr))) + stringtofile(Exepath+'maXbox42.exe',sr,false); //append = false + writeln(SHA256ToStr(CalcSHA256(loadFile(Exepath+'maXbox42.exe')))); } + + + //GetJSONData; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + mX4 executed: 20/09/2021 19:20:40 Runtime: 0:0:2.782 Memload: 69% use + + The sine of 30 = -0.9880316240928618 + + The sine of 45 = 0.8509035245341184 + + The sine of 60 = -0.3048106211022167 + +C:\maXbox\mX39998\maxbox3>pip3 install -t C:\Users\max\AppData\Local\Programs\Py +thon\Python36-32\Lib pydub +Collecting pydub + Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB) +Installing collected packages: pydub +Successfully installed pydub-0.25.1 + +C:\maXbox\mX39998\maxbox3>pip3 install -U -t C:\Users\max\AppData\Local\Programs +\Python\Python36-32\Lib https://files.pythonhosted.org/packages/19/29/f7a38ee300 +83f2caa14cc77a6d34c4d5cfd1a69641e87bf1b3d6ba90d0ba/psutil-5.8.0-cp36-cp36m-win32 +.whl +Collecting psutil==5.8.0 + Using cached psutil-5.8.0-cp36-cp36m-win32.whl (240 kB) +ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl +oudpickle 0.5.3 which is incompatible. +Installing collected packages: psutil +Successfully installed psutil-5.8.0 + +C:\maXbox\mX39998\maxbox3>py +Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64 + on win32 +Type "help", "copyright", "credits" or "license" for more information. +>>> import psutil, os +>>> p = psutil.Process( os.getpid()) +>>> for dll in p.memory_maps(): +... print(dll.path) +... +C:\Users\max\AppData\Local\Programs\Python\Python36\python.exe +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_bz2.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_ctypes.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\select.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_socket.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll +C:\Windows\System32\locale.nls +C:\Windows\Globalization\Sorting\SortDefault.nls +C:\Windows\System32\en-US\KernelBase.dll.mui +C:\Windows\SysWOW64\en-US\kernel32.dll.mui +C:\Windows\System32\ucrtbase.dll +C:\Users\max\AppData\Local\Programs\Python\Python36\DLLs\_lzma.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\Lib\site-packages\psutil\_ +util_windows.cp36-win_amd64.pyd +C:\Users\max\AppData\Local\Programs\Python\Python36\python3.dll +C:\Windows\System32\api-ms-win-crt-filesystem-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-conio-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-process-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-environment-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-time-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-convert-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-string-l1-1-0.dll +C:\Users\max\AppData\Local\Programs\Python\Python36\vcruntime140.dll +C:\Windows\System32\api-ms-win-crt-heap-l1-1-0.dll +C:\Windows\System32\pdh.dll +C:\Windows\System32\api-ms-win-crt-locale-l1-1-0.dll +C:\Windows\System32\version.dll +C:\Windows\System32\winnsi.dll +C:\Windows\System32\IPHLPAPI.DLL +C:\Windows\System32\wtsapi32.dll +C:\Windows\System32\api-ms-win-crt-stdio-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-math-l1-1-0.dll +C:\Windows\System32\api-ms-win-crt-runtime-l1-1-0.dll +C:\Windows\System32\rsaenh.dll +C:\Windows\System32\cryptsp.dll +C:\Windows\System32\bcrypt.dll +C:\Windows\System32\bcryptprimitives.dll +C:\Windows\System32\cryptbase.dll +C:\Windows\System32\powrprof.dll +C:\Windows\System32\KernelBase.dll +C:\Windows\System32\sspicli.dll +C:\Windows\System32\ole32.dll +C:\Windows\System32\oleaut32.dll +C:\Windows\System32\rpcrt4.dll +C:\Windows\System32\msvcrt.dll +C:\Windows\System32\ws2_32.dll +C:\Windows\System32\user32.dll +C:\Windows\System32\msctf.dll +C:\Windows\System32\shlwapi.dll +C:\Windows\System32\imm32.dll +C:\Windows\System32\advapi32.dll +C:\Windows\System32\shell32.dll +C:\Windows\System32\kernel32.dll +C:\Windows\System32\combase.dll +C:\Windows\System32\gdi32.dll +C:\Windows\System32\sechost.dll +C:\Windows\System32\psapi.dll +C:\Windows\System32\nsi.dll +C:\Windows\System32\ntdll.dll +>>> + + +Then to convert any file from wav to mp3 just use pydub as +import pydub +sound = pydub.AudioSegment.from_wav("D:/example/apple.wav") +sound.export("D:/example/apple.mp3", format="mp3") + +Exception: : Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_MD5.pyd' + +Patterns konkret. +ISBN-13: 9783935042468 ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin +----File newtemplate.txt not exists - now saved!---- + + + + \ No newline at end of file diff --git a/Demos/pydemo14.htm b/Demos/pydemo14.htm new file mode 100644 index 00000000..ebebeb3f --- /dev/null +++ b/Demos/pydemo14.htm @@ -0,0 +1,123 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000016123 +StartFragment:0000001053 +EndFragment:0000016107 + + + + +mXScriptasHTML + + + + + +

PROGRAM SEPDemo_App_mX4_PythonTemplate_ImportModule;
+//https://realpython.com/python-json/
+{Purpose: import a module with execstring(). get PyModule first!}
+
+//<Constant declarations> 
+//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre'].
+{TYPE <Type declarations> Pascal-Delphi-Python-Json-OLEAutomation} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+
+Var 
+//<Variable declarations>
+  eg: TPythonEngine;
+  pyModule: string;
+
+Const PYMODFILE = 'C:\maXbox\mX47464\maxbox4\examples\1062_utils.py';
+
+Const PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+              
+Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+
+                  '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; 
+
+Const REXDEF= 'def striphtml(data):      '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+               
+//https://gist.github.com/lkdocs/6519378               
+Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+
+          '  '''''+LF+
+          //'  Generates RSA keypair with exponent of 65537 in PEM format'+LF+
+          //'  param: bits The key length in bits '+LF+
+          //'  return: private key and public key '+LF+
+          '  '''''+LF+
+          '  from Crypto.PublicKey import RSA '+LF+
+          '  new_key = RSA.generate(bits, e=65537)'+LF+ 
+          '  public_key = new_key.publickey().exportKey("PEM")'+LF+ 
+          '  private_key = new_key.exportKey("PEM")'+LF+ 
+          '  return private_key, public_key';
+               
+Begin  //@Main
+//<Executable statements>
+//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469
+{ ISBN-10 ? : 3935042469  ISBN-13 ? : 978-3935042468} 
+
+  eg:= TPythonEngine.Create(Nil);
+  eg.pythonhome:= PYHOME32;
+  eg.opendll(PYDLL32)
+  try
+    eg.Execstring('import base64'+LF+'import urllib.parse, re');
+    eg.Execstring(REXDEF);
+    
+    if fileExists(PYMODFILE) then begin
+      pymodule:= LoadStringJ(PYMODFILE);
+      println(UTF8toAnsi(pymodule)+CRLF)
+      eg.Execstring(pymodule);
+      //Exception: <class 'ValueError'>: invalid literal for int() with base 10: '2021-04'.
+      println('get module func: '+eg.evalStr('quarterlyDateParser("2021-Q4")'));
+      println('get module func: '+eg.evalStr('monthlyDateParser("2021-09")'));
+    end;
+   
+    println(eg.evalStr('striphtml(str(base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")))'));
+    
+    //# Get maximum number of complete TODOs.
+    //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); 
+  except
+    eg.raiseError;
+  finally
+    eg.Free;
+  end;  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+ 
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+
+       
+   
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo14.txt b/Demos/pydemo14.txt new file mode 100644 index 00000000..5a16f85d --- /dev/null +++ b/Demos/pydemo14.txt @@ -0,0 +1,90 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_ImportModule; +//https://realpython.com/python-json/ +{Purpose: import a module with execstring(). get PyModule first!} + +// +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-OLEAutomation} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + +Var +// + eg: TPythonEngine; + pyModule: string; + +Const PYMODFILE = 'C:\maXbox\mX47464\maxbox4\examples\1062_utils.py'; + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +//https://gist.github.com/lkdocs/6519378 +Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+ + ' '''''+LF+ + //' Generates RSA keypair with exponent of 65537 in PEM format'+LF+ + //' param: bits The key length in bits '+LF+ + //' return: private key and public key '+LF+ + ' '''''+LF+ + ' from Crypto.PublicKey import RSA '+LF+ + ' new_key = RSA.generate(bits, e=65537)'+LF+ + ' public_key = new_key.publickey().exportKey("PEM")'+LF+ + ' private_key = new_key.exportKey("PEM")'+LF+ + ' return private_key, public_key'; + +Begin //@Main +// +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 ISBN-13 ? : 978-3935042468} + + eg:= TPythonEngine.Create(Nil); + eg.pythonhome:= PYHOME32; + eg.opendll(PYDLL32) + try + eg.Execstring('import base64'+LF+'import urllib.parse, re'); + eg.Execstring(REXDEF); + + if fileExists(PYMODFILE) then begin + pymodule:= LoadStringJ(PYMODFILE); + println(UTF8toAnsi(pymodule)+CRLF) + eg.Execstring(pymodule); + //Exception: : invalid literal for int() with base 10: '2021-04'. + println('get module func: '+eg.evalStr('quarterlyDateParser("2021-Q4")')); + println('get module func: '+eg.evalStr('monthlyDateParser("2021-09")')); + end; + + println(eg.evalStr('striphtml(str(base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")))')); + + //# Get maximum number of complete TODOs. + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + except + eg.raiseError; + finally + eg.Free; + end; +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + + + + + \ No newline at end of file diff --git a/Demos/pydemo15.htm b/Demos/pydemo15.htm new file mode 100644 index 00000000..bda06837 --- /dev/null +++ b/Demos/pydemo15.htm @@ -0,0 +1,89 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000011337 +StartFragment:0000001053 +EndFragment:0000011321 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo__PythonTemplate_ImportModuleData;
+{Purpose: import a module with execstring(). and shows ddata -get PyModule first!}
+//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre'].
+{TYPE <Type declarations> Pascal-Delphi-Python-Json-JScript} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+      PYMODULE = 'C:\maXbox\mX47464\maxbox4\examples\histogram15.py';
+      PYMODULEPATH = 'C:\maXbox\mX47464\maxbox4\examples';
+
+      PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+              
+      REXDEF= 'def striphtml(data):      '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+               
+Begin  //@Main
+  with TPythonEngine.Create(Nil) do begin
+    pythonhome:= PYHOME32;
+    opendll(PYDLL32)
+    try
+      Execstring('import base64'+LF+'import urllib.parse, re, sys');
+      Execstring(REXDEF);
+      if fileExists(PYMODULE) then begin
+        println(UTF8toAnsi(pymodule)+CRLF)
+        {Execstring('sys.path.append(r'+'"'+PYMODULEPATH+'")');
+         Execstring('from histogram import *'); }
+        Execstring(LoadStringJ(PYMODULE));
+        //Exception: Exception: RaiseError: couldn't fetch last exception..
+        println('get module data: '+evalStr('pyplot.hist(x)'));
+      end;
+      println(evalStr('striphtml(str(base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")))'));
+    except
+      raiseError;
+    finally                         
+      Free;
+    end;
+  end;  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+----File newtemplate.txt not exists - now saved!----
+
+
+       
+   
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo15.txt b/Demos/pydemo15.txt new file mode 100644 index 00000000..6c5474b0 --- /dev/null +++ b/Demos/pydemo15.txt @@ -0,0 +1,56 @@ +PROGRAM SEPDemo__PythonTemplate_ImportModuleData; +{Purpose: import a module with execstring(). and shows ddata -get PyModule first!} +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-JScript} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYMODULE = 'C:\maXbox\mX47464\maxbox4\examples\histogram15.py'; + PYMODULEPATH = 'C:\maXbox\mX47464\maxbox4\examples'; + + PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + + REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +Begin //@Main + with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME32; + opendll(PYDLL32) + try + Execstring('import base64'+LF+'import urllib.parse, re, sys'); + Execstring(REXDEF); + if fileExists(PYMODULE) then begin + println(UTF8toAnsi(pymodule)+CRLF) + {Execstring('sys.path.append(r'+'"'+PYMODULEPATH+'")'); + Execstring('from histogram import *'); } + Execstring(LoadStringJ(PYMODULE)); + //Exception: Exception: RaiseError: couldn't fetch last exception.. + println('get module data: '+evalStr('pyplot.hist(x)')); + end; + println(evalStr('striphtml(str(base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")))')); + except + raiseError; + finally + Free; + end; + end; +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin +----File newtemplate.txt not exists - now saved!---- + + + + + \ No newline at end of file diff --git a/Demos/pydemo16.htm b/Demos/pydemo16.htm new file mode 100644 index 00000000..435338c5 --- /dev/null +++ b/Demos/pydemo16.htm @@ -0,0 +1,103 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000014994 +StartFragment:0000001053 +EndFragment:0000014978 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo__PythonTemplate_ImportModuleData_Export;
+{Purpose: import a module with execstring(). and shows ddata -get PyModule first!}
+//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre'].
+{TYPE <Type declarations> Pascal-Delphi-Python-Json-JScript} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+      PYMODULE = 'C:\maXbox\mX47464\maxbox4\examples\histogram15.py';
+      PYMODULEPATH = 'C:\maXbox\mX47464\maxbox4\examples';
+
+      PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+              
+      REXDEF= 'def striphtml(data):      '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+               
+var pystr: string; pyole: Olevariant;  pystrlist: TStrings;
+               
+Begin  //@Main
+  with TPythonEngine.Create(Nil) do begin
+    pythonhome:= PYHOME32;
+    opendll(PYDLL32)
+    try
+      Execstring('import base64'+LF+'import urllib.parse, re, sys');
+      Execstring(REXDEF);
+      if fileExists(PYMODULE) then begin
+        println(UTF8toAnsi(pymodule)+CRLF)
+        {Execstring('sys.path.append(r'+'"'+PYMODULEPATH+'")');
+         Execstring('from histogram import *'); }
+        Execstring(LoadStringJ(PYMODULE));
+        //Exception: Exception: RaiseError: couldn't fetch last exception..
+        println('get module data: '+evalStr('pyplot.hist(x)'));
+        
+        pystr:= evalStr('pyplot.hist(x)');
+        pyole:= StringToVarArray(pystr);
+        //writeln(vartostr(pyole));
+        //Proc StrToStrings(S,Sep: Ansistr; const List:TStrings;const AllowEmptyString :Bool)
+        pystrlist:= TStringlist.create;
+          StrToStrings(pystr,',', pystrlist, false)
+            writeln(pystrlist.text);
+            writeln('how many items: '+itoa(pystrlist.count))
+          for it:= 0 to pystrlist.count-1 do 
+            write(pystrlist[it]+' - ');  
+         pystrlist.Free;   
+      end;
+      println(evalStr('striphtml(str(base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")))'));
+    except
+      raiseError;
+    finally                         
+      Free;
+    end;
+  end;  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+----File newtemplate.txt not exists - now saved!----
+
+
+       
+   
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo16.txt b/Demos/pydemo16.txt new file mode 100644 index 00000000..2036ef93 --- /dev/null +++ b/Demos/pydemo16.txt @@ -0,0 +1,70 @@ +PROGRAM SEPDemo__PythonTemplate_ImportModuleData_Export; +{Purpose: import a module with execstring(). and shows ddata -get PyModule first!} +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-JScript} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYMODULE = 'C:\maXbox\mX47464\maxbox4\examples\histogram15.py'; + PYMODULEPATH = 'C:\maXbox\mX47464\maxbox4\examples'; + + PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + + REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +var pystr: string; pyole: Olevariant; pystrlist: TStrings; + +Begin //@Main + with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME32; + opendll(PYDLL32) + try + Execstring('import base64'+LF+'import urllib.parse, re, sys'); + Execstring(REXDEF); + if fileExists(PYMODULE) then begin + println(UTF8toAnsi(pymodule)+CRLF) + {Execstring('sys.path.append(r'+'"'+PYMODULEPATH+'")'); + Execstring('from histogram import *'); } + Execstring(LoadStringJ(PYMODULE)); + //Exception: Exception: RaiseError: couldn't fetch last exception.. + println('get module data: '+evalStr('pyplot.hist(x)')); + + pystr:= evalStr('pyplot.hist(x)'); + pyole:= StringToVarArray(pystr); + //writeln(vartostr(pyole)); + //Proc StrToStrings(S,Sep: Ansistr; const List:TStrings;const AllowEmptyString :Bool) + pystrlist:= TStringlist.create; + StrToStrings(pystr,',', pystrlist, false) + writeln(pystrlist.text); + writeln('how many items: '+itoa(pystrlist.count)) + for it:= 0 to pystrlist.count-1 do + write(pystrlist[it]+' - '); + pystrlist.Free; + end; + println(evalStr('striphtml(str(base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")))')); + except + raiseError; + finally + Free; + end; + end; +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin +----File newtemplate.txt not exists - now saved!---- + + + + + \ No newline at end of file diff --git a/Demos/pydemo17.htm b/Demos/pydemo17.htm new file mode 100644 index 00000000..ecb8955e --- /dev/null +++ b/Demos/pydemo17.htm @@ -0,0 +1,87 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000010687 +StartFragment:0000001053 +EndFragment:0000010671 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo__PythonTemplate_ImportModuleDataHistogramShell;
+{Purpose: executes a py script and shows histogram!}
+{TYPE <Type declarations> Pascal-Delphi-Python-Json-JScript} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+      PYMODULE = 'C:\maXbox\mX47464\maxbox4\examples\histogram15.py';
+      PYMODULEPATH = 'C:\maXbox\mX47464\maxbox4\examples';
+
+      PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+              
+      REXDEF= 'def striphtml(data):      '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+               
+Begin  //@Main
+  with TPythonEngine.Create(Nil) do begin
+    pythonhome:= PYHOME32;
+    opendll(PYDLL32)
+    try
+      Execstring('import base64'+LF+'import urllib.parse, re, sys');
+      Execstring(REXDEF);
+      if fileExists(PYMODULE) then begin
+        println(UTF8toAnsi(pymodule)+CRLF)
+        {Execstring('sys.path.append(r'+'"'+PYMODULEPATH+'")');
+         Execstring('from histogram import *'); }
+        //Execstring(LoadStringJ(PYMODULE));
+        //println('get module data: '+evalStr('pyplot.hist(x)'));
+        ExecuteShell('py', PYMODULE);
+      end;
+    except
+      raiseError;
+    finally                         
+      Free;
+    end;
+  end;  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+----File newtemplate.txt not exists - now saved!----
+
+
+       
+   
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo17.txt b/Demos/pydemo17.txt new file mode 100644 index 00000000..95cb749e --- /dev/null +++ b/Demos/pydemo17.txt @@ -0,0 +1,54 @@ +PROGRAM SEPDemo__PythonTemplate_ImportModuleDataHistogramShell; +{Purpose: executes a py script and shows histogram!} +{TYPE Pascal-Delphi-Python-Json-JScript} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYMODULE = 'C:\maXbox\mX47464\maxbox4\examples\histogram15.py'; + PYMODULEPATH = 'C:\maXbox\mX47464\maxbox4\examples'; + + PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + + REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +Begin //@Main + with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME32; + opendll(PYDLL32) + try + Execstring('import base64'+LF+'import urllib.parse, re, sys'); + Execstring(REXDEF); + if fileExists(PYMODULE) then begin + println(UTF8toAnsi(pymodule)+CRLF) + {Execstring('sys.path.append(r'+'"'+PYMODULEPATH+'")'); + Execstring('from histogram import *'); } + //Execstring(LoadStringJ(PYMODULE)); + //println('get module data: '+evalStr('pyplot.hist(x)')); + ExecuteShell('py', PYMODULE); + end; + except + raiseError; + finally + Free; + end; + end; +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin +----File newtemplate.txt not exists - now saved!---- + + + + + \ No newline at end of file diff --git a/Demos/pydemo18.htm b/Demos/pydemo18.htm new file mode 100644 index 00000000..d6e308e8 --- /dev/null +++ b/Demos/pydemo18.htm @@ -0,0 +1,81 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000011321 +StartFragment:0000001053 +EndFragment:0000011305 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo__PythonTemplate_ImportModuleDataHistogramShell;
+{Purpose: shows running dlls from process!}
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+      PYMODULE = 'C:\maXbox\mX47464\maxbox4\examples\histogram15.py';
+
+      REXDEF= 'def striphtml(data):       '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+               
+Begin  //@Main
+  with TPythonEngine.Create(Nil) do begin
+    pythonhome:= PYHOME32;
+    opendll(PYDLL32)
+    try
+      execString('import psutil, os')
+      execString('dlst = []'+CRLF+'p = psutil.Process(os.getpid())');
+      execString('for dll in p.memory_maps():'+CRLF+' print(dll.path)');
+      execString('for dll in p.memory_maps():'+CRLF+' dlst.append(dll.path)');
+      //println(eg.evalStr(' print(dll.path)'));
+      println(evalStr('dlst'));
+      println('dll list detect: '+
+                StringReplace(EvalStr('dlst'),',',CR+LF,[rfReplaceAll]));   //}
+      println(evalStr('p'));          
+    except
+      raiseError;
+    finally                         
+      Free;
+    end;
+  end;  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+C:\maXbox\mX39998\maxbox3>pip3 install -U -t C:\Users\max\AppData\Local\Programs
+\Python\Python36-32\Lib https://files.pythonhosted.org/packages/19/29/f7a38ee300
+83f2caa14cc77a6d34c4d5cfd1a69641e87bf1b3d6ba90d0ba/psutil-5.8.0-cp36-cp36m-win32.whl
+Collecting psutil==5.8.0
+  Using cached psutil-5.8.0-cp36-cp36m-win32.whl (240 kB)
+ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl
+oudpickle 0.5.3 which is incompatible.
+Installing collected packages: psutil
+Successfully installed psutil-5.8.0
+----File newtemplate.txt not exists - now saved!----
+        
+   
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo18.txt b/Demos/pydemo18.txt new file mode 100644 index 00000000..2b3fb705 --- /dev/null +++ b/Demos/pydemo18.txt @@ -0,0 +1,48 @@ +PROGRAM SEPDemo__PythonTemplate_ImportModuleDataHistogramShell; +{Purpose: shows running dlls from process!} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYMODULE = 'C:\maXbox\mX47464\maxbox4\examples\histogram15.py'; + + REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +Begin //@Main + with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME32; + opendll(PYDLL32) + try + execString('import psutil, os') + execString('dlst = []'+CRLF+'p = psutil.Process(os.getpid())'); + execString('for dll in p.memory_maps():'+CRLF+' print(dll.path)'); + execString('for dll in p.memory_maps():'+CRLF+' dlst.append(dll.path)'); + //println(eg.evalStr(' print(dll.path)')); + println(evalStr('dlst')); + println('dll list detect: '+ + StringReplace(EvalStr('dlst'),',',CR+LF,[rfReplaceAll])); //} + println(evalStr('p')); + except + raiseError; + finally + Free; + end; + end; +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ +C:\maXbox\mX39998\maxbox3>pip3 install -U -t C:\Users\max\AppData\Local\Programs +\Python\Python36-32\Lib https://files.pythonhosted.org/packages/19/29/f7a38ee300 +83f2caa14cc77a6d34c4d5cfd1a69641e87bf1b3d6ba90d0ba/psutil-5.8.0-cp36-cp36m-win32.whl +Collecting psutil==5.8.0 + Using cached psutil-5.8.0-cp36-cp36m-win32.whl (240 kB) +ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl +oudpickle 0.5.3 which is incompatible. +Installing collected packages: psutil +Successfully installed psutil-5.8.0 +----File newtemplate.txt not exists - now saved!---- + + + \ No newline at end of file diff --git a/Demos/pydemo19.rtf b/Demos/pydemo19.rtf new file mode 100644 index 00000000..b4889ac7 --- /dev/null +++ b/Demos/pydemo19.rtf @@ -0,0 +1,102 @@ +{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fmodern Courier New;}} +{\colortbl\red128\green0\blue0;\red0\green0\blue0;\red128\green128\blue0;\red255\green0\blue0;\red0\green0\blue255;\red0\green0\blue128;\red128\green128\blue128;\red0\green128\blue128;} +{\info{\comment Generated by the SynEdit RTF exporter} +{\title Untitled}} +\deflang1033\pard\plain\f0\fs20 \cf0 PROGRAM\cf1 \cf0 SEPDemo__PythonTemplate_ColabMini\cf2 ; +\par \{\cf0 Purpose\cf2 :\cf1 \cf0 shows\cf1 \cf0 running\cf1 \cf0 dlls\cf1 \cf3\b from\b0\cf1 \cf0 process\cf2 !\} +\par +\par \cf0 Const\cf1 \cf0 PYHOME32\cf1 \cf2 =\cf1 \cf4 'C:\\Users\\max\\AppData\\Local\\Programs\\Python\\Python36-32\\'; +\par \cf1 \cf0 PYDLL32\cf1 \cf2 =\cf1 \cf4 'C:\\Users\\max\\AppData\\Local\\Programs\\Python\\Python36-32\\python36.dll'\cf2 ;\cf1 +\par +\par \cf0 REXDEF\cf2 =\cf1 \cf4 'def striphtml(data): '\cf2 +\cf0 LF\cf2 + +\par \cf1 \cf4 ' p = re.compile(r"<.*?>")'\cf2 +\cf0 LF\cf2 + +\par \cf1 \cf4 ' return p.sub("", data) '\cf2 ;\cf1 +\par +\par \cf0 Begin\cf1 \cf2 //\cf3 @\cf0 Main +\par \cf1 \cf0 with\cf1 \cf0 TPythonEngine\cf2 .\cf0 Create\cf2 (\cf0 Nil\cf2 )\cf1 \cf0 do\cf1 \cf0 begin +\par \cf1 \cf0 pythonhome\cf2 :=\cf1 \cf0 PYHOME32\cf2 ; +\par \cf1 \cf3\b try +\par \b0\cf1 \cf0 opendll\cf2 (\cf0 PYDLL32\cf2 ) +\par \cf1 \cf0 Println\cf2 (\cf4 'Colab Platform: '\cf2 +\cf1 +\par \cf0 EvalStr\cf2 (\cf4 '__import__("platform").platform()'\cf2 ));\cf1 +\par \cf2 //\cf0 Println\cf2 (\cf4 'CPU Check: '\cf2 +\cf1 +\par \cf2 //\cf0 EvalStr\cf2 (\cf4 '__import__("subprocess").check_output("lscpu",shell=True).strip().decode()'\cf2 ));\cf1 +\par \cf3\b except +\par \b0\cf1 \cf0 raiseError\cf2 ; +\par \cf1 \cf3\b finally\b0\cf1 +\par \cf0 Free\cf2 ; +\par \cf1 \cf0 end\cf2 ; +\par \cf1 \cf0 end\cf2 ;\cf1 +\par \cf2 //<\cf0 Definitions\cf2 >\cf1 +\par \cf0 End\cf2 .\cf1 +\par +\par \cf3\b if\b0\cf1 \cf2 (\cf0 ValidationRate\cf1 \cf2 >\cf1 \cf0 ValidationRecord\cf2 )\cf1 \cf0 then +\par \cf1 \cf0 begin +\par \cf1 \cf0 ValidationRecord\cf1 \cf2 :=\cf1 \cf0 ValidationRate\cf2 ; +\par \cf1 \cf0 FMessageProc\cf2 (\cf4 'VALIDATION RECORD! Saving NN at '\cf2 +\cf0 fileName\cf2 ); +\par \cf1 \cf0 FAvgWeight\cf2 .\cf0 SaveToFile\cf2 (\cf0 fileName\cf2 ); +\par \cf1 \cf0 end\cf2 ; +\par +\par \cf0 Ref\cf2 :\cf1 \cf0 https\cf2 ://\cf0 www\cf2 .\cf0 sonarqube\cf2 .\cf0 org\cf2 /\cf0 features\cf2 /\cf0 multi\cf2 -\cf0 languages\cf2 /\cf0 python\cf2 / +\par \cf0 C\cf2 :\\\cf0 maXbox\cf2 \\\cf0 mX39998\cf2 \\\cf0 maxbox3\cf2 >\cf0 pip3\cf1 \cf0 install\cf1 \cf2 -\cf0 U\cf1 \cf2 -\cf0 t\cf1 \cf0 C\cf2 :\\\cf0 Users\cf2 \\\cf5\b max\b0\cf2 \\\cf0 AppData\cf2 \\\cf0 Local\cf2 \\\cf0 Programs +\par \cf2 \\\cf0 Python\cf2 \\\cf0 Python36\cf2 -\cf3 32\cf2 \\\cf0 Lib\cf1 \cf0 https\cf2 ://\cf0 files\cf2 .\cf0 pythonhosted\cf2 .\cf0 org\cf2 /\cf0 packages\cf2 /\cf3 19\cf2 /\cf3 29\cf2 /\cf0 f7a38ee300 +\par \cf3 83f2caa14cc77a6d34c4d5cfd1a69641e87bf1b3d6ba90d0ba\cf2 /\cf0 psutil\cf2 -\cf3 5.8.0\cf2 -\cf0 cp36\cf2 -\cf0 cp36m\cf2 -\cf0 win32\cf2 .\cf0 whl +\par Collecting\cf1 \cf0 psutil\cf2 ==\cf3 5.8.0 +\par \cf1 \cf0 Using\cf1 \cf0 cached\cf1 \cf0 psutil\cf2 -\cf3 5.8.0\cf2 -\cf0 cp36\cf2 -\cf0 cp36m\cf2 -\cf0 win32\cf2 .\cf0 whl\cf1 \cf2 (\cf3 240\cf1 \cf0 kB\cf2 ) +\par \cf0 ERROR\cf2 :\cf1 \cf0 distributed\cf1 \cf3 2.22.0\cf1 \cf0 has\cf1 \cf0 requirement\cf1 \cf0 cloudpickle\cf2 >=\cf3 1.5.0\cf2 ,\cf1 \cf0 but\cf1 \cf0 you\cf4 'll have cl +\par \cf0 oudpickle\cf1 \cf3 0.5.3\cf1 \cf0 which\cf1 \cf3\b is\b0\cf1 \cf0 incompatible\cf2 . +\par \cf0 Installing\cf1 \cf0 collected\cf1 \cf0 packages\cf2 :\cf1 \cf0 psutil +\par Successfully\cf1 \cf0 installed\cf1 \cf0 psutil\cf2 -\cf3 5.8.0 +\par \cf2 ----\cf0 File\cf1 \cf0 newtemplate\cf2 .\cf0 txt\cf1 \cf3\b not\b0\cf1 \cf0 exists\cf1 \cf2 -\cf1 \cf0 now\cf1 \cf0 saved\cf2 !---- +\par +\par \cf6\i # -*- coding: utf-8 -*- +\par \i0\cf7 """Kopie von EKON_SimpleImageClassificationCPU.ipynb +\par Automatically generated by Colaboratory. +\par +\par Original file is located at +\par https://colab.research.google.com/drive/1clvG2uoMGo-_bfrJnxBJmpNTxjvnsMx9 +\par """ +\par +\par \cf2 !\cf0 apt\cf2 -\cf0 get\cf1 \cf0 update +\par \cf2 !\cf0 apt\cf2 -\cf0 get\cf1 \cf0 install\cf1 \cf0 fpc\cf1 \cf0 fpc\cf2 -\cf0 source\cf1 \cf0 lazarus\cf1 \cf0 git\cf1 \cf0 subversion +\par +\par \cf2 !\cf0 git\cf1 \cf0 clone\cf1 \cf0 https\cf2 ://\cf0 github\cf2 .\cf0 com\cf2 /\cf0 joaopauloschuler\cf2 /\cf0 neural\cf2 -\cf0 api\cf2 .\cf0 git +\par +\par \cf2 !\cf0 svn\cf1 \cf0 checkout\cf1 \cf0 https\cf2 ://\cf0 svn\cf2 .\cf0 code\cf2 .\cf0 sf\cf2 .\cf0 net\cf2 /\cf0 p\cf2 /\cf0 lazarus\cf2 -\cf0 ccr\cf2 /\cf0 svn\cf2 /\cf0 components\cf2 /\cf0 multithreadprocs\cf1 \cf0 mtprocs +\par +\par \cf2 !\cf0 lazbuild\cf1 \cf0 mtprocs\cf2 /\cf0 multithreadprocslaz\cf2 .\cf0 lpk +\par +\par \cf2 !\cf0 ls\cf1 \cf2 -\cf0 l\cf1 \cf0 neural\cf2 -\cf0 api\cf2 /\cf0 examples\cf2 /\cf0 SimpleImageClassifier\cf2 /\cf0 SimpleImageClassifier\cf2 .\cf0 lpi +\par +\par \cf2 !\cf0 lazbuild\cf1 \cf0 neural\cf2 -\cf0 api\cf2 /\cf0 examples\cf2 /\cf0 SimpleImageClassifier\cf2 /\cf0 SimpleImageClassifier\cf2 .\cf0 lpi +\par +\par ls\cf1 \cf2 -\cf0 l\cf1 \cf0 neural\cf2 -\cf0 api\cf2 /\cf0 bin\cf2 /\cf0 x86_64\cf2 -\cf0 linux\cf2 /\cf0 bin\cf2 /\cf0 SimpleImageClassifier +\par +\par \cf3\b import\b0\cf1 \cf0 os +\par \cf3\b import\b0\cf1 \cf0 urllib\cf2 .\cf0 request +\par +\par \cf3\b if\b0\cf1 \cf3\b not\b0\cf1 \cf0 os\cf2 .\cf0 path\cf2 .\cf0 isfile\cf2 (\cf4 'cifar-10-batches-bin/data_batch_1.bin'\cf2 ): +\par \cf1 \cf3\b print\b0\cf2 (\cf4 "Downloading CIFAR-10 Files"\cf2 ) +\par \cf1 \cf0 url\cf1 \cf2 =\cf1 \cf4 'https://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz' +\par \cf1 \cf0 urllib\cf2 .\cf0 request\cf2 .\cf0 urlretrieve\cf2 (\cf0 url\cf2 ,\cf1 \cf4 './file.tar'\cf2 ) +\par +\par \cf0 ls\cf1 \cf2 -\cf0 l +\par \cf2 !\cf0 tar\cf1 \cf2 -\cf0 xvf\cf1 \cf2 ./\cf5\b file\b0\cf2 .\cf0 tar +\par +\par \cf3\b if\b0\cf1 \cf3\b not\b0\cf1 \cf0 os\cf2 .\cf0 path\cf2 .\cf0 isfile\cf2 (\cf4 './data_batch_1.bin'\cf2 ): +\par \cf1 \cf3\b print\b0\cf2 (\cf4 "Copying files to current folder"\cf2 ) +\par \cf1 \cf2 !\cf0 cp\cf1 \cf2 ./\cf0 cifar\cf2 -\cf3 10\cf2 -\cf0 batches\cf2 -\cf0 bin\cf2 /*\cf1 \cf2 ./ +\par +\par \cf3\b if\b0\cf1 \cf0 os\cf2 .\cf0 path\cf2 .\cf0 isfile\cf2 (\cf4 './data_batch_1.bin'\cf2 ): +\par \cf1 \cf3\b print\b0\cf2 (\cf4 "RUNNING!"\cf2 ) +\par \cf1 \cf2 !\cf0 neural\cf2 -\cf0 api\cf2 /\cf0 bin\cf2 /\cf0 x86_64\cf2 -\cf0 linux\cf2 /\cf0 bin\cf2 /\cf0 SimpleImageClassifier +\par +\par \cf3\b from\b0\cf1 \cf0 google\cf2 .\cf0 colab\cf1 \cf3\b import\b0\cf1 \cf0 files +\par \cf2 !\cf0 ls\cf1 \cf2 -\cf0 l +\par +\par files\cf2 .\cf0 download\cf2 (\cf4 'SimpleImageClassifier-66.nn'\cf2 ) +\par \cf0 files\cf2 .\cf0 download\cf2 (\cf4 'SimpleImageClassifier-66.csv'\cf2 ) +\par \cf1 +\par +\par +\par } \ No newline at end of file diff --git a/Demos/pydemo19.txt b/Demos/pydemo19.txt new file mode 100644 index 00000000..5da2443d --- /dev/null +++ b/Demos/pydemo19.txt @@ -0,0 +1,133 @@ +PROGRAM SEPDemo__PythonTemplate_ColabMini; +{Purpose: shows running dlls from process!} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + + REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +Begin //@Main + maxform1.console1click(self) + memo2.height:= 200; + with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME32; + try + opendll(PYDLL32) + Println('Colab Platform: '+ + EvalStr('__import__("platform").platform()')); + //Println('CPU Arch. Check Linux: '+ + //EvalStr('__import__("subprocess").check_output("lscpu",shell=True).strip().decode()')); + Println('DIR Check: '+ + EvalStr('__import__("subprocess").check_output("dir",shell=True).strip().decode()')); + + except + raiseError; + finally + Free; + end; + end; +// +End. + +Ref Error: Command 'lscpu' returned non-zero exit status 1 +It occurs randomly ; after restarting the same build, the error first happened on another job then it passed... +Or maybe it's cache-related (passing only the second time ?) + + if (ValidationRate > ValidationRecord) then + begin + ValidationRecord := ValidationRate; + FMessageProc('VALIDATION RECORD! Saving NN at '+fileName); + FAvgWeight.SaveToFile(fileName); + end; + +Ref: https://www.sonarqube.org/features/multi-languages/python/ +C:\maXbox\mX39998\maxbox3>pip3 install -U -t C:\Users\max\AppData\Local\Programs +\Python\Python36-32\Lib https://files.pythonhosted.org/packages/19/29/f7a38ee300 +83f2caa14cc77a6d34c4d5cfd1a69641e87bf1b3d6ba90d0ba/psutil-5.8.0-cp36-cp36m-win32.whl +Collecting psutil==5.8.0 + Using cached psutil-5.8.0-cp36-cp36m-win32.whl (240 kB) +ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl +oudpickle 0.5.3 which is incompatible. +Installing collected packages: psutil +Successfully installed psutil-5.8.0 +----File newtemplate.txt not exists - now saved!---- + +# -*- coding: utf-8 -*- +"""Kopie von EKON_SimpleImageClassificationCPU.ipynb +Automatically generated by Colaboratory. + +Original file is located at + https://colab.research.google.com/drive/1clvG2uoMGo-_bfrJnxBJmpNTxjvnsMx9 +""" + +!apt-get update +!apt-get install fpc fpc-source lazarus git subversion + +!git clone https://github.com/joaopauloschuler/neural-api.git + +!svn checkout https://svn.code.sf.net/p/lazarus-ccr/svn/components/multithreadprocs mtprocs + +!lazbuild mtprocs/multithreadprocslaz.lpk + +!ls -l neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi + +!lazbuild neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi + +ls -l neural-api/bin/x86_64-linux/bin/SimpleImageClassifier + +import os +import urllib.request + +if not os.path.isfile('cifar-10-batches-bin/data_batch_1.bin'): + print("Downloading CIFAR-10 Files") + url = 'https://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz' + urllib.request.urlretrieve(url, './file.tar') + +ls -l +!tar -xvf ./file.tar + +if not os.path.isfile('./data_batch_1.bin'): + print("Copying files to current folder") + !cp ./cifar-10-batches-bin/* ./ + +if os.path.isfile('./data_batch_1.bin'): + print("RUNNING!") + !neural-api/bin/x86_64-linux/bin/SimpleImageClassifier + +from google.colab import files +!ls -l + +files.download('SimpleImageClassifier-66.nn') +files.download('SimpleImageClassifier-66.csv') + +Statistic +Starting Rate:100% +Rate:94% +Characters:55104 +Char. w/o Space:47777 +Words:7132 +Lines:716 +Errors (Red):250 +Unknown (Orange):198 +Auto Corrected (Green):5 +Corrected by user (Blue):1 + +Gen private key pair tester +OpenSSL> genpkey -algorithm RSA -out genpkeySSH.cer -outform DER -pkeyopt rsa_ke +ygen_bits:2048 +......................................................+++ +.+++ +OpenSSL> rsa -inform DER -outform PEM -in genpkeySSH.cer -out genpkeySSH.pem +writing RSA key +OpenSSL> +Extract the public key from the PEM formatted RSA pair +OpenSSL> rsa -in genpkeySSH.pem -pubout -out genpubkeySSH.pem +writing RSA key +ssh-rsa 2048 49:c8:b6:21:b0:90:76:47:2f:e9:ab:6e:5e:e6:6c:ef +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjRMOq7NaaonIGzYYrYClbNEztVDnZ+rIK21R3xLJogPJwiaKQk3ZPLf9Wf9SaZkEkFb+xDdecU+NsOk0Plmc65eY7dsJHfa/UqYj7KXDy7cf+TxZN5EA2+QuTLkQEcWvj4IJXknNMxlZUZUJ5kvTcm0U+FdvYQPIZtcipmslPblx0YfXSXI4QkpBuEerKHanwU0lI+iXUQTC6yOubICaSC0lU3UAkShr/iS5JKjWiB8OI7cEmGTqjvzRhQe4nzhl92Vi1y2DqTN0vmVRQSXFdEsq1AaHPXjrhuLgBiCsDNCC4r6o3MDZMf6O2MpeDQHtaa8YcK8TyXl6YmbdxQ3E5 imported-openssh-key + + + + \ No newline at end of file diff --git a/Demos/pydemo2.txt b/Demos/pydemo2.txt new file mode 100644 index 00000000..775c6278 --- /dev/null +++ b/Demos/pydemo2.txt @@ -0,0 +1,284 @@ +Program PyDemo5_Eval_Exec5_Powerliners23; + +//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas +//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine +//https://thepythonguru.com/python-builtin-functions/eval/ +//https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/ +//https://stackoverflow.com/questions/359498/how-can-i-unload-a-dll-using-ctypes-in-python +//https://levelup.gitconnected.com/5-powerful-python-one-liners-you-should-know-469b9c4737c7 + +//interface - customize your PY environment first +{uses + Classes, SysUtils, + Windows, Messages, Graphics, Controls, Forms, Dialogs, + StdCtrls, ComCtrls, ExtCtrls, + PythonEngine, Vcl.PythonGUIInputOutput, PythonVersions.pas ; } + +{procedure PyFinalize(); + external + 'Py_Finalize@C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll stdcall'; } +//Note: modify PYHOME and PYDLL : + +const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py'; + LB = CR+LF; + +const PyModule = + 'def printData(data): '+#13#10+ + ' return data+data+"/n"'; + +const PYCMD = 'print("this is box")'+LB+ + 'import sys'+LB+ + 'f=open(r"1050pytest21_5powers.txt","w")'+LB+ + 'f.write("Hello PyWorld_mX47580, \n")'+LB+ + 'f.write("This data will be written on the file.")'+LB+ + 'f.close()'; + +var myloadscript: string; + PyForm: TForm; pyMemo: TMemo; + avar: string; pyval: variant; pyint: integer; + +Procedure PYLaz_P4D_Demo2; +//https://wiki.freepascal.org/Python4Delphi +var eng : TPythonEngine; + Out1: TPythonGUIInputOutput; + pystrings: TStrings; +begin + eng:= TPythonEngine.Create(Nil); + Out1:= TPythonGUIInputOutput.create(nil) + Out1.output:= pyMemo; //debugout.output; or memo2; + Out1.RawOutput:= False; + Out1.UnicodeIO:= False; + Out1.maxlines:= 20; + out1.displaystring('this string thing draw the line') + + writeln(botostr(Isx64(PYDLL))); + //writeln(botostr(Isx64(pydllpath2))); + //eng.dllpath:= exepath; + //eng.dllname:='python37.dll'; + eng.pythonhome:= PYHOME; + try + //pymod.InitializeForNewInterpreter; //} + //pymod.engine:= eng; + eng.opendll(PYDLL) + //eng.loadDLL; + eng.IO:= Out1; + eng.AutoFinalize:= True; + //eng.AutoUnload:= false; + writeln(eng.dllname); + //pymod.engine:= eng; + if eng.IsHandleValid then begin + writeln('DLLhandle: '+botostr(eng.IsHandleValid)) + WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]')); + WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])')); + WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])')); + WriteLn('mathstr: '+ eng.EvalStr('"py " * 7')); + //WriteLn('builtins: '+ eng.EvalStr('dir(__builtins__)')); + WriteLn('upperstr: '+ eng.EvalStr('"hello again".upper()')); + pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("os").getcwd()')); + writeln('syncheck '+ + botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])'))); + + WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))')); + WriteLn('powerline2: '+ eng.EvalStr('list(map(float, ["1",2,"3.0",4.0,"5",6]))')); + eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))'); + WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)')); + + eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]'); + eng.Execstring('transpose_A = [list(i) for i in zip(*A)]'); + WriteLn('powerline4: '+ eng.EvalStr('transpose_A')); + + //We can use dictionary comprehension to swap key-value pairs. + eng.Execstring('staff= {"Data Scientist":"John","Django Developer":"Max"}'); + WriteLn('powerline5: '+ eng.EvalStr('{i:j for j, i in staff.items()}')); + eng.ExecString('print("powers:",[x**2 for x in range(10)])'); + writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(PYCMD))); + eng.ExecString(PYCMD); + + { pystrings:= TStringlist.create; + pystrings.add('import matplotlib.pyplot as plt') + pystrings.add('import numpy as np') + pystrings.add('np.arange(5, 24, 3)') + pystrings.add('fig, ax = plt.subplots(dpi=153)') + pystrings.add('plt.plot([1,2,3,4,5,6], [1,2,3,4,9,5], "go")') + pystrings.add('plt.show()') + eng.ExecStrings4(pystrings); + pystrings.free; } + + (* eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "sympy"])') + eng.ExecString('from sympy import *'); + eng.ExecString('from sympy.plotting import plot'); + writeln(eng.EvalStr('list(primerange(7, 150))')); + writeln(eng.EvalStr('sum(list(primerange(0, 100)))')); + writeln(eng.EvalStr('(list(primerange(0, 101)))')); + writeln(eng.EvalStr('len(list(primerange(0, 101)))')); + //https://www.tutorialspoint.com/sympy/sympy_solvers.htm + avar:= '-2'; + eng.ExecString('x=Symbol("x")'); + eng.ExecString('x,y=symbols("x y")'); + writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)')); + writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)')); + writeln(eng.EvalStr('solveset(exp(x),x)')); + println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))')); + *) + + //eng.ExecString('plot(x**'+avar+', line_color="red")'); + //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))'); + { + eng.ExecString('from sympy.plotting import plot3d'); + eng.ExecString('x,y=symbols("x y") '); + eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); } + + pyval:= VarPythonEval('sum([x for x in range(201)])'); + //writeln('evalvar '+botostr(VarIsPythonList(pyval))); + writeln('evalvar '+botostr(VarIsnumeric(pyval))); + pyval:= NewPythonDict; + writeln(botostr(VarIsPython( pyval))); + pyval := (VarPythonEval('2 ** 3')); + { eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "langdetect"])') + eng.ExecString('from langdetect import detect'); + println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")')); + } + pymemo.update; + end + else writeln('invalid library handle! '+Getlasterrortext); + println('PythonOK: '+botostr(PythonOK)); + except + eng.raiseError; + writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam)); + //PyErr Exception: Access violation at address 50F49DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000022. + finally + //eng.close + eng.unloaddll; + //PyFinalize(); + eng.free; + //PyFinalize(); + end; + out1.free; + //pyImport(PyModule); +end; + +begin //@main + //PythonEngine1.Free; + //myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(300,200, clgreen,'PyFrm4D'); + pyMemo:= TMemo.create(PyForm); + pyMemo.parent:= PyForm + PyForm.show; + + PYLaz_P4D_Demo2; + + //register_PYthonGUI; +End. +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + +doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191 + +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. +Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before. + +Evil eval() + +You should never pass untrusted source to the eval() directly. As it is quite easy for the malicious user to wreak havoc on your system. For example, the following code can be used to delete all the files from the system. + +1 >>> +2 eval('os.system("RM -RF /")') # command is deliberately capitalized +3 >>> + + +Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download +-------------------------------------------------------- +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. +PascalScript maXbox4 - RemObjects & SynEdit + +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. + +dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E. +TRUE +Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD. + +mapdll EXCEPT Exception: There is already one instance of TPythonEngine running. +PythonOK TRUE +ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC. + mX4 executed: 26/07/2021 13:30:51 Runtime: 0:0:2.48 Memload: 71% use + +Example 3: Python multithreading + +All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program. + + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) + +t1.start() +t2.start() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demos/pydemo20.htm b/Demos/pydemo20.htm new file mode 100644 index 00000000..7626229a --- /dev/null +++ b/Demos/pydemo20.htm @@ -0,0 +1,183 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000032207 +StartFragment:0000001053 +EndFragment:0000032191 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo__PythonTemplate_RSA_Hexer;
+{Purpose: convert hex to int of RSA Keys!}
+//https://dev.to/dandyvica/understanding-public-private-rsa-keys-3j81
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+
+      REXDEF= 'def striphtml(data):       '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+      CHEXSTR = '00:c9:73:e2:3b:11:01:2f:2c:62:a4:1a:74:3f:92:';         
+               
+      HEXCONVERT =
+      '""" convert hex string integer to int """ '+LF+
+      'def convert(n: str) -> int:               '+LF+
+      '    # get rid of ":", spaces and newlines '+LF+
+      '    hex = n.replace(":", "").replace("\n","").replace(" ","")'+LF+
+      '    return int(hex,16)';          
+         
+var bufs: string;               
+Begin  //@Main
+  maxform1.console1click(self)
+  memo2.height:= 200;
+  with TPythonEngine.Create(Nil) do begin
+    pythonhome:= PYHOME32;
+    try
+      opendll(PYDLL32)
+      Println('Colab Platform: '+ 
+          EvalStr('__import__("platform").platform()')); 
+      //Println('CPU Arch. Check Linux: '+ 
+      //EvalStr('__import__("subprocess").check_output("lscpu",shell=True).strip().decode()'));     
+     Println('DIR Check: '+ 
+     EvalStr('__import__("subprocess").check_output("dir",shell=True).strip().decode()'));
+     ExecString(HEXCONVERT); 
+     println(EvalStr('convert("'+CHEXSTR+'")'));
+     bufs:= StringReplace(CHEXSTR,':','',[rfReplaceAll]);
+     with TInteger.create(0) do begin
+       if AssignHex(bufs) then
+         writeln(ConvertToDecimalString(false));
+       free
+     end;     
+     writeln(sha1tohex(sha1ofstr(bufs)))
+     //HexToBuf(CHEXSTR, bufs);
+    except
+      raiseError;
+    finally                         
+      Free;
+    end;
+  end;  
+End. 
+
+Ref Error:  Command 'lscpu' returned non-zero exit status 1
+It occurs randomly ; after restarting the same build, the error first happened on another job then it passed...
+Or maybe it's cache-related (passing only the second time ?)
+
+      if (ValidationRate > ValidationRecord) then
+        begin
+          ValidationRecord := ValidationRate;
+          FMessageProc('VALIDATION RECORD! Saving NN at '+fileName);
+          FAvgWeight.SaveToFile(fileName);
+        end;
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+C:\maXbox\mX39998\maxbox3>pip3 install -U -t C:\Users\max\AppData\Local\Programs
+\Python\Python36-32\Lib https://files.pythonhosted.org/packages/19/29/f7a38ee300
+83f2caa14cc77a6d34c4d5cfd1a69641e87bf1b3d6ba90d0ba/psutil-5.8.0-cp36-cp36m-win32.whl
+Collecting psutil==5.8.0
+  Using cached psutil-5.8.0-cp36-cp36m-win32.whl (240 kB)
+ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl
+oudpickle 0.5.3 which is incompatible.
+Installing collected packages: psutil
+Successfully installed psutil-5.8.0
+----File newtemplate.txt not exists - now saved!----
+
+# -*- coding: utf-8 -*-
+"""Kopie von EKON_SimpleImageClassificationCPU.ipynb
+Automatically generated by Colaboratory.
+
+Original file is located at
+    https://colab.research.google.com/drive/1clvG2uoMGo-_bfrJnxBJmpNTxjvnsMx9
+"""
+
+!apt-get update
+!apt-get install fpc fpc-source lazarus git subversion
+
+!git clone https://github.com/joaopauloschuler/neural-api.git
+
+!svn checkout https://svn.code.sf.net/p/lazarus-ccr/svn/components/multithreadprocs mtprocs
+
+!lazbuild mtprocs/multithreadprocslaz.lpk
+
+!ls -l neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi
+
+!lazbuild neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi
+
+ls -l neural-api/bin/x86_64-linux/bin/SimpleImageClassifier
+
+import os
+import urllib.request
+
+if not os.path.isfile('cifar-10-batches-bin/data_batch_1.bin'):
+  print("Downloading CIFAR-10 Files")
+  url = 'https://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz'
+  urllib.request.urlretrieve(url, './file.tar')
+
+ls -l
+!tar -xvf ./file.tar
+
+if not os.path.isfile('./data_batch_1.bin'):
+  print("Copying files to current folder")
+  !cp ./cifar-10-batches-bin/* ./
+
+if os.path.isfile('./data_batch_1.bin'):
+  print("RUNNING!")
+  !neural-api/bin/x86_64-linux/bin/SimpleImageClassifier
+
+from google.colab import files
+!ls -l
+files.download('SimpleImageClassifier-66.nn')
+files.download('SimpleImageClassifier-66.csv')
+
+Statistic
+Starting Rate:100%
+Rate:94%
+Characters:55104
+Char. w/o Space:47777
+Words:7132
+Lines:716
+Errors (Red):250
+Unknown (Orange):198
+Auto Corrected (Green):5
+Corrected by user (Blue):1
+
+Gen private key pair tester
+OpenSSL> genpkey -algorithm RSA -out genpkeySSH.cer -outform DER -pkeyopt rsa_ke
+ygen_bits:2048
+......................................................+++
+.+++
+OpenSSL> rsa -inform DER -outform PEM -in genpkeySSH.cer -out genpkeySSH.pem
+writing RSA key
+OpenSSL>
+Extract the public key from the PEM formatted RSA pair
+OpenSSL> rsa -in genpkeySSH.pem -pubout -out genpubkeySSH.pem
+writing RSA key
+ssh-rsa 2048 49:c8:b6:21:b0:90:76:47:2f:e9:ab:6e:5e:e6:6c:ef
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjRMOq7NaaonIGzYYrYClbNEztVDnZ+rIK21R3xLJogPJwiaKQk3ZPLf9Wf9SaZkEkFb+xDdecU+NsOk0Plmc65eY7dsJHfa/UqYj7KXDy7cf+TxZN5EA2+QuTLkQEcWvj4IJXknNMxlZUZUJ5kvTcm0U+FdvYQPIZtcipmslPblx0YfXSXI4QkpBuEerKHanwU0lI+iXUQTC6yOubICaSC0lU3UAkShr/iS5JKjWiB8OI7cEmGTqjvzRhQe4nzhl92Vi1y2DqTN0vmVRQSXFdEsq1AaHPXjrhuLgBiCsDNCC4r6o3MDZMf6O2MpeDQHtaa8YcK8TyXl6YmbdxQ3E5 imported-openssh-key
+
+        
+   
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo20.txt b/Demos/pydemo20.txt new file mode 100644 index 00000000..5b193fbd --- /dev/null +++ b/Demos/pydemo20.txt @@ -0,0 +1,150 @@ +PROGRAM SEPDemo__PythonTemplate_RSA_Hexer; +{Purpose: convert hex to int of RSA Keys!} +//https://dev.to/dandyvica/understanding-public-private-rsa-keys-3j81 + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + + REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + CHEXSTR = '00:c9:73:e2:3b:11:01:2f:2c:62:a4:1a:74:3f:92:'; + + HEXCONVERT = + '""" convert hex string integer to int """ '+LF+ + 'def convert(n: str) -> int: '+LF+ + ' # get rid of ":", spaces and newlines '+LF+ + ' hex = n.replace(":", "").replace("\n","").replace(" ","")'+LF+ + ' return int(hex,16)'; + +var bufs: string; +Begin //@Main + maxform1.console1click(self) + memo2.height:= 200; + with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME32; + try + opendll(PYDLL32) + Println('Colab Platform: '+ + EvalStr('__import__("platform").platform()')); + //Println('CPU Arch. Check Linux: '+ + //EvalStr('__import__("subprocess").check_output("lscpu",shell=True).strip().decode()')); + Println('DIR Check: '+ + EvalStr('__import__("subprocess").check_output("dir",shell=True).strip().decode()')); + ExecString(HEXCONVERT); + println(EvalStr('convert("'+CHEXSTR+'")')); + bufs:= StringReplace(CHEXSTR,':','',[rfReplaceAll]); + with TInteger.create(0) do begin + if AssignHex(bufs) then + writeln(ConvertToDecimalString(false)); + free + end; + writeln(sha1tohex(sha1ofstr(bufs))) + //HexToBuf(CHEXSTR, bufs); + except + raiseError; + finally + Free; + end; + end; +End. + +Ref Error: Command 'lscpu' returned non-zero exit status 1 +It occurs randomly ; after restarting the same build, the error first happened on another job then it passed... +Or maybe it's cache-related (passing only the second time ?) + + if (ValidationRate > ValidationRecord) then + begin + ValidationRecord := ValidationRate; + FMessageProc('VALIDATION RECORD! Saving NN at '+fileName); + FAvgWeight.SaveToFile(fileName); + end; + +Ref: https://www.sonarqube.org/features/multi-languages/python/ +C:\maXbox\mX39998\maxbox3>pip3 install -U -t C:\Users\max\AppData\Local\Programs +\Python\Python36-32\Lib https://files.pythonhosted.org/packages/19/29/f7a38ee300 +83f2caa14cc77a6d34c4d5cfd1a69641e87bf1b3d6ba90d0ba/psutil-5.8.0-cp36-cp36m-win32.whl +Collecting psutil==5.8.0 + Using cached psutil-5.8.0-cp36-cp36m-win32.whl (240 kB) +ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl +oudpickle 0.5.3 which is incompatible. +Installing collected packages: psutil +Successfully installed psutil-5.8.0 +----File newtemplate.txt not exists - now saved!---- + +# -*- coding: utf-8 -*- +"""Kopie von EKON_SimpleImageClassificationCPU.ipynb +Automatically generated by Colaboratory. + +Original file is located at + https://colab.research.google.com/drive/1clvG2uoMGo-_bfrJnxBJmpNTxjvnsMx9 +""" + +!apt-get update +!apt-get install fpc fpc-source lazarus git subversion + +!git clone https://github.com/joaopauloschuler/neural-api.git + +!svn checkout https://svn.code.sf.net/p/lazarus-ccr/svn/components/multithreadprocs mtprocs + +!lazbuild mtprocs/multithreadprocslaz.lpk + +!ls -l neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi + +!lazbuild neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi + +ls -l neural-api/bin/x86_64-linux/bin/SimpleImageClassifier + +import os +import urllib.request + +if not os.path.isfile('cifar-10-batches-bin/data_batch_1.bin'): + print("Downloading CIFAR-10 Files") + url = 'https://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz' + urllib.request.urlretrieve(url, './file.tar') + +ls -l +!tar -xvf ./file.tar + +if not os.path.isfile('./data_batch_1.bin'): + print("Copying files to current folder") + !cp ./cifar-10-batches-bin/* ./ + +if os.path.isfile('./data_batch_1.bin'): + print("RUNNING!") + !neural-api/bin/x86_64-linux/bin/SimpleImageClassifier + +from google.colab import files +!ls -l +files.download('SimpleImageClassifier-66.nn') +files.download('SimpleImageClassifier-66.csv') + +Statistic +Starting Rate:100% +Rate:94% +Characters:55104 +Char. w/o Space:47777 +Words:7132 +Lines:716 +Errors (Red):250 +Unknown (Orange):198 +Auto Corrected (Green):5 +Corrected by user (Blue):1 + +Gen private key pair tester +OpenSSL> genpkey -algorithm RSA -out genpkeySSH.cer -outform DER -pkeyopt rsa_ke +ygen_bits:2048 +......................................................+++ +.+++ +OpenSSL> rsa -inform DER -outform PEM -in genpkeySSH.cer -out genpkeySSH.pem +writing RSA key +OpenSSL> +Extract the public key from the PEM formatted RSA pair +OpenSSL> rsa -in genpkeySSH.pem -pubout -out genpubkeySSH.pem +writing RSA key +ssh-rsa 2048 49:c8:b6:21:b0:90:76:47:2f:e9:ab:6e:5e:e6:6c:ef +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjRMOq7NaaonIGzYYrYClbNEztVDnZ+rIK21R3xLJogPJwiaKQk3ZPLf9Wf9SaZkEkFb+xDdecU+NsOk0Plmc65eY7dsJHfa/UqYj7KXDy7cf+TxZN5EA2+QuTLkQEcWvj4IJXknNMxlZUZUJ5kvTcm0U+FdvYQPIZtcipmslPblx0YfXSXI4QkpBuEerKHanwU0lI+iXUQTC6yOubICaSC0lU3UAkShr/iS5JKjWiB8OI7cEmGTqjvzRhQe4nzhl92Vi1y2DqTN0vmVRQSXFdEsq1AaHPXjrhuLgBiCsDNCC4r6o3MDZMf6O2MpeDQHtaa8YcK8TyXl6YmbdxQ3E5 imported-openssh-key + + + + \ No newline at end of file diff --git a/Demos/pydemo21.htm b/Demos/pydemo21.htm new file mode 100644 index 00000000..b99a55a8 --- /dev/null +++ b/Demos/pydemo21.htm @@ -0,0 +1,113 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000015853 +StartFragment:0000001053 +EndFragment:0000015837 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo__PythonTemplate_RSA_Hexer_Indexer_1_20_PyDemo;
+{Purpose: convert hex to int of RSA Keys!}
+//https://dev.to/dandyvica/understanding-public-private-rsa-keys-3j81
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+
+      REXDEF= 'def striphtml(data):       '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';  
+      CHEXSTR = '00:c9:73:e2:3b:11:01:2f:2c:62:a4:1a:74:3f:92:';         
+               
+      HEXCONVERT =
+      '""" convert hex string integer to int """ '+LF+
+      'def convert(n: str) -> int:               '+LF+
+      '    # get rid of ":", spaces and newlines '+LF+
+      '    hex = n.replace(":", "").replace("\n","").replace(" ","")'+LF+
+      '    return int(hex,16)';          
+         
+var bufs: string;               
+Begin  //@Main
+  maxform1.console1click(self)
+  memo2.height:= 200;
+  with TPythonEngine.Create(Nil) do begin
+    pythonhome:= PYHOME32;
+    try
+      opendll(PYDLL32)
+      Println('Colab Platform: '+ 
+          EvalStr('__import__("platform").platform()')); 
+      //Println('CPU Arch. Check Linux: '+ 
+     Println('DIR Check: '+ 
+     EvalStr('__import__("subprocess").check_output("dir",shell=True).strip().decode()'));
+     ExecString(HEXCONVERT); 
+     println(EvalStr('convert("'+CHEXSTR+'")'));
+     bufs:= StringReplace(CHEXSTR,':','',[rfReplaceAll]);
+     with TInteger.create(0) do begin
+       if AssignHex(bufs) then
+         writeln(ConvertToDecimalString(false));
+       free
+     end;     
+     writeln(sha1tohex(sha1ofstr(bufs)))
+     //HexToBuf(CHEXSTR, bufs);
+    except
+      raiseError;
+    finally                         
+      Free;
+    end;
+  end; 
+    Writeln('Demo01	A simple Python evaluator Gauss evaluator '+CRLF+
+   'Demo02	Evaluate a Python expression with ExecSynCheck1 and Strlist'+CRLF+
+   'http://www.softwareschule.ch/examples/pydemo2.txt'          +CRLF+
+   'http://www.softwareschule.ch/examples/pydemo2.htm'+CRLF+
+   'Demo03	15-powerful-python-one-liners PYLaz_P4D_Demo2       '+CRLF+
+   'Demo04	Eval_IOEvents (advanced case) extension Demo3 PYLaz_P4D_Demo2'+CRLF+
+   'Demo05	Defining a mX4_Python Template                     '+CRLF+
+   'Demo06	Defining a Python Template_PyCryptoDome_Bitcoin    '+CRLF+
+   'Demo07	Using Translator with Subprocess()                 '+CRLF+
+   'Demo08	Using Turtle Graph for new Python types            '+CRLF+
+   'Demo09	Making a URLLib_Agent with GoggleSearch            '+CRLF+
+   'Demo10  Using URLLib_ISBN_Agent_PyPas inside Python        '+CRLF+
+   'Demo11	Using URLLib_JSON_PyPas inside Pascal               '+CRLF+
+   'Demo12	Using a RSA_PyPa crypto methods                     '+CRLF+
+   'Demo13	Using Python_Cheat_Sheet5 big demo                  '+CRLF+
+   'Demo14	Get Import Module with LoadStringJ(PYMODFILE)                '+CRLF+
+   'Demo15	ImportModuleData: this is a extension of Demo14              '+CRLF+
+   'Demo16	Using ImportModuleData_Export in TPythonModule or Pylist     '+CRLF+
+   'Demo17	Using Threading, Windows Console and Command line arguments  '+CRLF+
+   'Demo18	Using Threading and Delphi log window                        '+CRLF+
+   'Demo19	Using VarPyth.pas                                            '+CRLF+
+   'Demo20	Demo8 revisited to allow the new Python type to be subclassed'+CRLF+
+   'Demo21  Container indexing this one!   ' );                                     
+End.                                                                    
+
+
+
+
+
+        
+   
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo21.txt b/Demos/pydemo21.txt new file mode 100644 index 00000000..4c46c9d0 --- /dev/null +++ b/Demos/pydemo21.txt @@ -0,0 +1,108 @@ +PROGRAM SEPDemo__PythonTemplate_RSA_Hexer_Indexer_1_20_PyDemo; +{Purpose: convert hex to int of RSA Keys!} +//https://dev.to/dandyvica/understanding-public-private-rsa-keys-3j81 + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + + REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + CHEXSTR = '00:c9:73:e2:3b:11:01:2f:2c:62:a4:1a:74:3f:92:'; + + HEXCONVERT = + '""" convert hex string integer to int """ '+LF+ + 'def convert(n: str) -> int: '+LF+ + ' # get rid of ":", spaces and newlines '+LF+ + ' hex = n.replace(":", "").replace("\n","").replace(" ","")'+LF+ + ' return int(hex,16)'; + +var bufs, tabstr: string; +Begin //@Main + maxform1.console1click(self) + memo2.height:= 200; + memo2.font.name:= 'Courier'; + with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME32; + try + opendll(PYDLL32) + Println('Colab Platform: '+ + EvalStr('__import__("platform").platform()')); + //Println('CPU Arch. Check Linux: '+ + Println('DIR Check: '+ + EvalStr('__import__("subprocess").check_output("dir",shell=True).strip().decode()')); + ExecString(HEXCONVERT); + + //https://towardsdatascience.com/two-cool-functions-to-know-in-python-7c36da49f884 + ExecString('from tabulate import tabulate'); + + ExecString('table = [["First Name", "Last Name", "Age"], ["John", "Smith", 39],'+ + ' ["Mary", "Jane", 25], ["Jennifer", "Doe", 28]]'); + println('Tabulate '+evalstr('print(tabulate(table))')); + println('Tabulate '+evalstr('repr(tabulate(table))')); + writeln('') + tabstr:= evalstr('repr(tabulate(table, headers="firstrow"))') + writeln(StringReplace(tabstr,'\n',CRLF,[rfReplaceAll])); + writeln(''); + tabstr:= evalstr('repr(tabulate(table, headers="firstrow",tablefmt="fancy_grid"))') + //writeln(tabstr) + tabstr:= StringReplace(tabstr,'\n',CRLF,[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'│','I',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'���','-',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'���','-',[rfReplaceAll]); + writeln(tabstr); + writeln(''); + + + println(EvalStr('convert("'+CHEXSTR+'")')); + bufs:= StringReplace(CHEXSTR,':','',[rfReplaceAll]); + with TInteger.create(0) do begin + if AssignHex(bufs) then + writeln(ConvertToDecimalString(false)); + free + end; + writeln(sha1tohex(sha1ofstr(bufs))) + //HexToBuf(CHEXSTR, bufs); + except + raiseError; + finally + Free; + end; + end; + Writeln('Demo01 A simple Python evaluator Gauss evaluator '+CRLF+ + 'Demo02 Evaluate a Python expression with ExecSynCheck1 and Strlist'+CRLF+ + 'http://www.softwareschule.ch/examples/pydemo2.txt' +CRLF+ + 'http://www.softwareschule.ch/examples/pydemo2.htm'+CRLF+ + 'Demo03 15-powerful-python-one-liners PYLaz_P4D_Demo2 '+CRLF+ + 'Demo04 Eval_IOEvents (advanced case) extension Demo3 PYLaz_P4D_Demo2'+CRLF+ + 'Demo05 Defining a mX4_Python Template '+CRLF+ + 'Demo06 Defining a Python Template_PyCryptoDome_Bitcoin '+CRLF+ + 'Demo07 Using Translator with Subprocess() '+CRLF+ + 'Demo08 Using Turtle Graph for new Python types '+CRLF+ + 'Demo09 Making a URLLib_Agent with GoggleSearch '+CRLF+ + 'Demo10 Using URLLib_ISBN_Agent_PyPas inside Python '+CRLF+ + 'Demo11 Using URLLib_JSON_PyPas inside Pascal '+CRLF+ + 'Demo12 Using a RSA_PyPa crypto methods '+CRLF+ + 'Demo13 Using Python_Cheat_Sheet5 big demo '+CRLF+ + 'Demo14 Get Import Module with LoadStringJ(PYMODFILE) '+CRLF+ + 'Demo15 ImportModuleData: this is a extension of Demo14 '+CRLF+ + 'Demo16 Using ImportModuleData_Export in TPythonModule or Pylist '+CRLF+ + 'Demo17 Using Threading, Windows Console and Command line arguments '+CRLF+ + 'Demo18 Using Threading and Delphi log window '+CRLF+ + 'Demo19 Using VarPyth.pas '+CRLF+ + 'Demo20 Demo8 revisited to allow the new Python type to be subclassed'+CRLF+ + 'Demo21 Container indexing this one! ' ); +End. + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demos/pydemo22.txt b/Demos/pydemo22.txt new file mode 100644 index 00000000..23c016eb --- /dev/null +++ b/Demos/pydemo22.txt @@ -0,0 +1,267 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_RSA_PyPas; +//https://pythonprogramming.net/urllib-tutorial-python- +//https://realpython.com/python-json/ +{Purpose: Go ahead and make a request to the JSONPlaceholder API for the /todos endpoint. } + +//pass: sep2021 + +// +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-OLEAutomation} + +Const PYHOME32 = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYDLL32 = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// // +//Generate public key and private key //https://xkcd.com/2522/ + + +Const n='131798069975677186430812583254301846420499053652464526744060956660680086191708591665234413533962305430548077353930570627355296177902735662050036083669895732129386762377495294220312510244514575486344692415682028866858406505626112758230991205303719647558808329331489671608634857922659169405430839242940754268809'; + +p='10860706918450955689844145527501983595992436701173054648104471236408378718746974595697570946185341544228133278859636613128875678870505729830664097383355063'; +q='12135312274357489324587220671594930942014693384778568495143568889708549803954472938344835413422899444933434949631371672806794755231479031846513398039743'; + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +//https://gist.github.com/lkdocs/6519378 +Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+ + ' '''''+LF+ + //' Generate an RSA keypair with exponent of 65537 in PEM format'+LF+ + //' param: bits The key length in bits '+LF+ + //' Return private key and public key '+LF+ + ' '''''+LF+ + ' from Crypto.PublicKey import RSA '+LF+ + ' new_key = RSA.generate(bits, e=65537)'+LF+ + ' public_key = new_key.publickey().exportKey("PEM")'+LF+ + ' private_key = new_key.exportKey("PEM")'+LF+ + ' return private_key, public_key, new_key'; + + +procedure GetJSONData; +var XMLhttp: OleVariant; // As Object Automation + ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2; + response,statuscode: string; cnt: integer; +begin + XMLhttp:= CreateOleObject('msxml2.xmlhttp') + XMLhttp.Open('GET', WEBURL, False) //False is async + //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8'); + XMLhttp.Send(); + + response:= XMLhttp.responseText; //assign the data + statuscode:= XMLhttp.status; + //writeln(statuscode +CRLF+ response) + ajt:= TJson.create(); + try + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JArray:= ajt.JsonArray; + writeln('Get all Titles: '+itoa(jarray.count)); + for cnt:= 0 to jarray.count-1 do + writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString); + ajt.Free; +end; + +{procedure InitSockets; +var Data: WSAData; +begin + WSAStartup( MakeWord(1,1), Data); //Das w�re dann Version 1.1 +end;} + +Begin //@Main +// +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3042469 +{ ISBN-10 ? : 3935042469 ISBN-13 ? : 978-3935042468} + + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'+LF+'import urllib.parse'); + eng.Execstring('import urllib.request, os, textwrap, json, requests'); + eng.Execstring(REXDEF); + + //DLL := LoadLibrary('c:\windows\desktop\shell\project1.dll'); + + //eng.ExecString('from sklearn.linear_model import LinearRegression'); + + eng.ExecString('import ctypes, _ctypes'); + eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["cmd ", "/c", "dir"])') + + //https://stackoverflow.com/questions/46450368/removing-loaded-pyd-files + { + eng.ExecString('dll = ctypes.CDLL(r"C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\numpy\core\_multiarray_umath.cp37-win32.pyd")'); + println(eng.evalStr('dll')); + + eng.ExecString('_ctypes.FreeLibrary(dll._handle)'); + + eng.ExecString('from sklearn.linear_model import LinearRegression'); } + + // eng.ExecString('subprocess.call(["pip3", "install", "pycryptodome"])') + //showmessage('stop'); + // eng.Execstring('import scipy'); + //Exception: Access violation at address 529C9DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000048. + //eng.ExecString('from langdetect import detect'); + //opendir(PYHOME32) + + { eng.Execstring('import nacl'); + eng.Execstring('from nacl.encoding import HexEncoder'+CRLF+ + 'from nacl.exceptions import CryptoError'+CRLF+ + 'from nacl.encoding import Base64Encoder'); } + + // eng.Execstring('from Crypto.PublicKey import RSA'); + + println(eng.evalStr('base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")')); + + //eng.Execstring('priv_key = nacl.public.PrivateKey.generate()'); + + eng.Execstring(DEF_RSAKEYS); + eng.Execstring('d=generate_RSA(bits=1024)') + + println('RSA new '+eng.evalStr('d[2]')); + println('RSA Privatekey '+eng.evalStr('d[0]')); //} + println('---------------------------------'); //} + println('RSA Publickey '+eng.evalStr('d[1]')); //} + println('---------------------------------'); //} + + eng.Execstring('from Crypto.PublicKey import RSA'); + + println('RSA new2 '+eng.evalStr('repr(RSA.generate(1024, e=65537))')); + + println('n=p*q show: '+CRLF+bigmulu(p,q)); + + println('RSA new3 '+eng.evalStr('repr(d[2])')); + println('RSA new3 '+eng.evalStr('d[2].e')); + println('RSA new3 '+eng.evalStr('d[2].d')); + println('RSA new3 '+eng.evalStr('d[2].u')); + + //eng.Execstring('pub_key = RSA.importKey(open("key.pub", "r").read())'); + //println('only e '+eng.evalStr('pub_key.e')); + + eng.Execstring('from nltk import WordNetLemmatizer'); + + eng.Execstring('lemmatizer = WordNetLemmatizer()'); + eng.Execstring('words = ["papers", "friendship", "parties", "tables"]'); + eng.execstring('ad=[]'+LF+'for word in words:'+LF+ + ' ad.append(lemmatizer.lemmatize(word))'); + println(eng.evalstr('ad')); + + //# Map of userId to number of complete TODOs for that user + //eng.Execstring(JSONLISTDEFAULT); + //println('rettype is: '+eng.evalStr('type(todos_by_user)')); + //println(eng.evalStr('top_users')); + + //# Get the maximum number of complete TODOs. + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + + except + eng.raiseError; + finally + eng.unloadDll; + eng.Free; + //_multiarray_umath.cp37-win32.pyd + //aPythonVersion.Free; + end; + + //GetJSONData; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ +https://medium.com/@frank-andrade/all-top-python-libraries-for-data-science-explained-with-code-40f64b363663 + + raise LookupError(resource_not_found) +LookupError: +********************************************************************** + Resource ?[93mwordnet?[0m not found. + Please use the NLTK Downloader to obtain the resource: + + ?[31m>>> import nltk + >>> nltk.download('wordnet') + ?[0m + For more information see: https://www.nltk.org/data.html + + Attempted to load ?[93mcorpora/wordnet?[0m + + Searched in: + - 'C:\\Users\\breitsch/nltk_data' + - 'C:\\Users\\breitsch\\AppData\\Local\\Programs\\Python\\Python37-32\\nltk_data' + - 'C:\\Users\\breitsch\\AppData\\Local\\Programs\\Python\\Python37-32\\share\\nltk_data' + - 'C:\\Users\\breitsch\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\nltk_data' + - 'C:\\Users\\breitsch\\AppData\\Roaming\\nltk_data' + - 'C:\\nltk_data' + - 'D:\\nltk_data' + - 'E:\\nltk_data' + + >>> import nltk +>>> nltk.download('wordnet') +[nltk_data] Downloading package wordnet to +[nltk_data] C:\Users\breitsch\AppData\Roaming\nltk_data... +[nltk_data] Unzipping corpora\wordnet.zip. +True +********************************************************************** + +"C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\numpy\core\_multiarray_umath.cp37-win32.pyd" + +Exception: : Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_MD5.pyd': [WinError 126] The specified module could not be found. + +Ref code:  mX4 byte code executed: 16/09/2021 15:06:24 Runtime: 0:0:1.484 Memload: 62% use +ByteCode Success Message of: C:\maXbox\mX47464\maxbox4\examples\1059_pypas_demo11.psb +Patterns konkret. +ISBN-13: 9783935042468 +ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, +This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demos/pydemo23.txt b/Demos/pydemo23.txt new file mode 100644 index 00000000..81908060 --- /dev/null +++ b/Demos/pydemo23.txt @@ -0,0 +1,120 @@ +PROGRAM SEPDemo__PythonTemplate_RSA_Hexer_Indexer_1_23_PyDemo_Tabulator; +{Purpose: tab a table!} +//https://towardsdatascience.com/two-cool-functions-to-know-in-python-7c36da49f884 +//https://dev.to/dandyvica/understanding-public-private-rsa-keys-3j81 + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + + REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + CHEXSTR = '00:c9:73:e2:3b:11:01:2f:2c:62:a4:1a:74:3f:92:'; + + HEXCONVERT = + '""" convert hex string integer to int """ '+LF+ + 'def convert(n: str) -> int: '+LF+ + ' # get rid of ":", spaces and newlines '+LF+ + ' hex = n.replace(":", "").replace("\n","").replace(" ","")'+LF+ + ' return int(hex,16)'; + +var bufs, tabstr: string; +Begin //@Main + maxform1.console1click(self) + memo2.height:= 200; + memo2.font.name:= 'Courier'; + with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME32; + try + opendll(PYDLL32) + Println('Colab Platform: '+ + EvalStr('__import__("platform").platform()')); + //Println('CPU Arch. Check Linux: '+ + Println('DIR Check: '+ + EvalStr('__import__("subprocess").check_output("dir",shell=True).strip().decode()')); + ExecString(HEXCONVERT); + + //https://towardsdatascience.com/two-cool-functions-to-know-in-python-7c36da49f884 + ExecString('from tabulate import tabulate'); + + ExecString('table = [["First Name", "Last Name", "Age"], ["John", "Smith", 39],'+ + ' ["Mary", "Jane", 25], ["Jennifer", "Doe", 28]]'); + println('Tabulate '+evalstr('print(tabulate(table))')); + println('Tabulate '+evalstr('repr(tabulate(table))')); + writeln('') + tabstr:= evalstr('repr(tabulate(table, headers="firstrow"))') + tabstr:= StringReplace(tabstr,'''',CRLF,[rfReplaceAll]); + println(StringReplace(tabstr,'\n',CRLF,[rfReplaceAll])); + writeln(''+CRLF); + tabstr:= evalstr('repr(tabulate(table, headers="firstrow",tablefmt="fancy_grid"))') + //writeln(tabstr) + tabstr:= StringReplace(tabstr,'\n',CRLF,[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'│','I',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'���','-',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'���','-',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'���','-',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'╞�','I',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'╘�','I',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'���','I',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'���','+',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'├�','+',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'��','+',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'╒�','-',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'���','',[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'��','I',[rfReplaceAll]); + writeln(tabstr); + writeln(''); + println(EvalStr('convert("'+CHEXSTR+'")')); + bufs:= StringReplace(CHEXSTR,':','',[rfReplaceAll]); + with TInteger.create(0) do begin + if AssignHex(bufs) then + writeln(ConvertToDecimalString(false)); + free + end; + writeln(sha1tohex(sha1ofstr(bufs))) + + ExecString('import numpy as np'); + //>>> import numpy as np + //>>> np.ones([1,2,3,4,5]) + println(EvalStr('repr(np.ones([1,2,3,4,5]))')); + writeln(StringReplace(EvalStr('repr(np.ones([1,2,3,4,5]))'),'],',CRLF,[rfReplaceAll])); + writeln(CRLF); + tabstr:= StringReplace(EvalStr('repr(np.ones([1,2,3,4,5]))'),'],',CRLF,[rfReplaceAll]); + tabstr:= StringReplace(tabstr,'[[',CRLF+' [[',[rfReplaceAll]); + //tabstr:= StringReplace(tabstr,'[[[',CRLF,[rfReplaceAll]); + println(tabstr); + //HexToBuf(CHEXSTR, bufs); + //ExecString('from statsmodels.stats.proportion import proportion_confint'); + except + raiseError; + finally + Free; + end; + end; + Writeln('Demo01 A simple Python evaluator Gauss evaluator '+CRLF+ + 'Demo02 Evaluate a Python expression with ExecSynCheck1 and Strlist'+CRLF+ + 'http://www.softwareschule.ch/examples/pydemo2.txt' +CRLF+ + 'http://www.softwareschule.ch/examples/pydemo2.htm'+CRLF+ + 'Demo03 15-powerful-python-one-liners PYLaz_P4D_Demo2 '+CRLF+ + 'Demo04 Eval_IOEvents (advanced case) extension Demo3 PYLaz_P4D_Demo2'+CRLF+ + 'Demo05 Defining a mX4_Python Template '+CRLF+ + 'Demo06 Defining a Python Template_PyCryptoDome_Bitcoin '+CRLF+ + 'Demo07 Using Translator with Subprocess() '+CRLF+ + 'Demo08 Using Turtle Graph for new Python types '+CRLF+ + 'Demo09 Making a URLLib_Agent with GoggleSearch '+CRLF+ + 'Demo10 Using URLLib_ISBN_Agent_PyPas inside Python '+CRLF+ + 'Demo11 Using URLLib_JSON_PyPas inside Pascal '+CRLF+ + 'Demo12 Using a RSA_PyPa crypto methods '+CRLF+ + 'Demo13 Using Python_Cheat_Sheet5 big demo '+CRLF+ + 'Demo14 Get Import Module with LoadStringJ(PYMODFILE) '+CRLF+ + 'Demo15 ImportModuleData: this is a extension of Demo14 '+CRLF+ + 'Demo16 Using ImportModuleData_Export in TPythonModule or Pylist '+CRLF+ + 'Demo17 Using Threading, Windows Console and Command line arguments '+CRLF+ + 'Demo18 Using Threading and Delphi log window '+CRLF+ + 'Demo19 Using VarPyth.pas '+CRLF+ + 'Demo20 Demo8 revisited to allow the new Python type to be subclassed'+CRLF+ + 'Demo21 Container indexing this one! ' ); +End. + + + \ No newline at end of file diff --git a/Demos/pydemo24.htm b/Demos/pydemo24.htm new file mode 100644 index 00000000..00867a75 --- /dev/null +++ b/Demos/pydemo24.htm @@ -0,0 +1,126 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000017562 +StartFragment:0000001053 +EndFragment:0000017546 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo__PythonTemplate_Puzzle_24;
+//https://blog.finxter.com/python-one-line-sum-list/
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+
+      CHEXSTR = '00:c9:73:e2:3b:11:01:2f:2c:62:a4:1a:74:3f:92:';         
+               
+      HEXCONVERT =
+      '""" convert hex string integer to int """ '+LF+
+      'def convert(n: str) -> int:               '+LF+
+      '    # get rid of ":", spaces and newlines '+LF+
+      '    hex = n.replace(":", "").replace("\n","").replace(" ","")'+LF+
+      '    return int(hex,16)';     
+      
+      FUNC1 =
+      '""" returns increment """ '+LF+
+      'def func1(x: int) -> int: '+LF+
+      '    return x+1';               
+         
+var bufs, tabstr: string;               
+Begin  //@Main
+  maxform1.console1click(self)
+  memo2.height:= 200;
+  memo2.font.name:= 'Courier';
+  with TPythonEngine.Create(Nil) do begin
+    pythonhome:= PYHOME32;
+    try
+      opendll(PYDLL32)
+      Println('Colab Platform: '+ 
+          EvalStr('__import__("platform").platform()')); 
+      //Println('CPU Arch. Check Linux: '+ 
+     Println('DIR Check: '+ 
+     EvalStr('__import__("subprocess").check_output("dir",shell=True).strip().decode()'));
+     ExecString(HEXCONVERT); 
+     println(EvalStr('convert("'+CHEXSTR+'")'));
+     bufs:= StringReplace(CHEXSTR,':','',[rfReplaceAll]);
+     with TInteger.create(0) do begin
+       if AssignHex(bufs) then
+         writeln(ConvertToDecimalString(false));
+       free
+     end;     
+     ExecString('x="cool"');
+     println('finxter id 332, puzzle: '+EvalStr('x[-1]+x[-2]+x[-4]+x[-3]'));
+     ExecString(FUNC1); 
+     ExecString('f = func1'); 
+     println('finxter id 358, puzzle: '+EvalStr('f(2)+func1(2)'));
+    except
+      raiseError;
+    finally                         
+      Free;
+    end;
+  end; 
+    Writeln('Demo01	A simple Python evaluator Gauss evaluator '+CRLF+
+   'Demo02	Evaluate expression with ExecSynCheck1 and Strlist '+CRLF+
+   'http://www.softwareschule.ch/examples/pydemo2.txt'         +CRLF+
+   'http://www.softwareschule.ch/examples/pydemo2.htm'+CRLF+
+   'Demo03	15-powerful-python-one-liners PYLaz_P4D_Demo2      '+CRLF+
+   'Demo04	Eval_IOEvents (advanced case) Demo3 PYLaz_P4D_Demo2'+CRLF+
+   'Demo05	Defining a mX4_Python Template                     '+CRLF+
+   'Demo06	Defining a Python Template_PyCryptoDome_Bitcoin    '+CRLF+
+   'Demo07	Using Translator with Subprocess()                 '+CRLF+
+   'Demo08	Using Turtle Graph for new Python types            '+CRLF+
+   'Demo09	Making a URLLib_Agent with GoggleSearch            '+CRLF+
+   'Demo10  Using URLLib_ISBN_Agent_PyPas inside Python        '+CRLF+
+   'Demo11	Using URLLib_JSON_PyPas inside Pascal              '+CRLF+
+   'Demo12	Using a RSA_PyPa crypto methods                    '+CRLF+
+   'Demo13	Using Python_Cheat_Sheet5 big demo                 '+CRLF+
+   'Demo14	Get Import Module with LoadStringJ(PYMODFILE)               '+CRLF+
+   'Demo15	ImportModuleData: this is a extension of Demo14             '+CRLF+
+   'Demo16	Using ImportModuleData_Export in TPythonModule or Pylist    '+CRLF+
+   'Demo17	Using Threading, Windows Console and Command line arguments '+CRLF+
+   'Demo18	Using Threading and Delphi log window                       '+CRLF+
+   'Demo19	Using VarPyth.pas                                           '+CRLF+
+   'Demo20	Demo8 revisited to allow new Python type to be subclassed   '+CRLF+
+   'Demo21  Container indexing this one!   '+CRLF+
+   'Demo22	NLTK and wordnet'+CRLF+ 
+   'Demo23	import tabulator TAB Formater'+CRLF+ 
+   'Demo24	this finxter Demo');                                     
+End.        
+
+
+                                                              
+
+
+
+
+
+        
+   
+   
+      
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo24.txt b/Demos/pydemo24.txt new file mode 100644 index 00000000..67c14189 --- /dev/null +++ b/Demos/pydemo24.txt @@ -0,0 +1,93 @@ +PROGRAM SEPDemo__PythonTemplate_Puzzle_24; +//https://blog.finxter.com/python-one-line-sum-list/ + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + + CHEXSTR = '00:c9:73:e2:3b:11:01:2f:2c:62:a4:1a:74:3f:92:'; + + HEXCONVERT = + '""" convert hex string integer to int """ '+LF+ + 'def convert(n: str) -> int: '+LF+ + ' # get rid of ":", spaces and newlines '+LF+ + ' hex = n.replace(":", "").replace("\n","").replace(" ","")'+LF+ + ' return int(hex,16)'; + + FUNC1 = + '""" returns increment """ '+LF+ + 'def func1(x: int) -> int: '+LF+ + ' return x+1'; + +var bufs, tabstr: string; +Begin //@Main + maxform1.console1click(self) + memo2.height:= 200; + memo2.font.name:= 'Courier'; + with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME32; + try + opendll(PYDLL32) + Println('Colab Platform: '+ + EvalStr('__import__("platform").platform()')); + //Println('CPU Arch. Check Linux: '+ + Println('DIR Check: '+ + EvalStr('__import__("subprocess").check_output("dir",shell=True).strip().decode()')); + ExecString(HEXCONVERT); + println(EvalStr('convert("'+CHEXSTR+'")')); + bufs:= StringReplace(CHEXSTR,':','',[rfReplaceAll]); + with TInteger.create(0) do begin + if AssignHex(bufs) then + writeln(ConvertToDecimalString(false)); + free + end; + ExecString('x="cool"'); + println('finxter id 332, puzzle: '+EvalStr('x[-1]+x[-2]+x[-4]+x[-3]')); + ExecString(FUNC1); + ExecString('f = func1'); + println('finxter id 358, puzzle: '+EvalStr('f(2)+func1(2)')); + except + raiseError; + finally + Free; + end; + end; + Writeln('Demo01 A simple Python evaluator Gauss evaluator '+CRLF+ + 'Demo02 Evaluate expression with ExecSynCheck1 and Strlist '+CRLF+ + 'http://www.softwareschule.ch/examples/pydemo2.txt' +CRLF+ + 'http://www.softwareschule.ch/examples/pydemo2.htm'+CRLF+ + 'Demo03 15-powerful-python-one-liners PYLaz_P4D_Demo2 '+CRLF+ + 'Demo04 Eval_IOEvents (advanced case) Demo3 PYLaz_P4D_Demo2'+CRLF+ + 'Demo05 Defining a mX4_Python Template '+CRLF+ + 'Demo06 Defining a Python Template_PyCryptoDome_Bitcoin '+CRLF+ + 'Demo07 Using Translator with Subprocess() '+CRLF+ + 'Demo08 Using Turtle Graph for new Python types '+CRLF+ + 'Demo09 Making a URLLib_Agent with GoggleSearch '+CRLF+ + 'Demo10 Using URLLib_ISBN_Agent_PyPas inside Python '+CRLF+ + 'Demo11 Using URLLib_JSON_PyPas inside Pascal '+CRLF+ + 'Demo12 Using a RSA_PyPa crypto methods '+CRLF+ + 'Demo13 Using Python_Cheat_Sheet5 big demo '+CRLF+ + 'Demo14 Get Import Module with LoadStringJ(PYMODFILE) '+CRLF+ + 'Demo15 ImportModuleData: this is a extension of Demo14 '+CRLF+ + 'Demo16 Using ImportModuleData_Export in TPythonModule or Pylist '+CRLF+ + 'Demo17 Using Threading, Windows Console and Command line arguments '+CRLF+ + 'Demo18 Using Threading and Delphi log window '+CRLF+ + 'Demo19 Using VarPyth.pas '+CRLF+ + 'Demo20 Demo8 revisited to allow new Python type to be subclassed '+CRLF+ + 'Demo21 Container indexing this one! '+CRLF+ + 'Demo22 NLTK and wordnet'+CRLF+ + 'Demo23 import tabulator TAB Formater'+CRLF+ + 'Demo24 this finxter Demo'); +End. + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demos/pydemo25.htm b/Demos/pydemo25.htm new file mode 100644 index 00000000..25c3c22d --- /dev/null +++ b/Demos/pydemo25.htm @@ -0,0 +1,152 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000022556 +StartFragment:0000001053 +EndFragment:0000022540 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo__PythonTemplate_Puzzle_25;
+//https://medium.com/fintechexplained/top-python-tips-tricks-dd996b807865
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+
+      CHEXSTR = '00:c9:73:e2:3b:11:01:2f:2c:62:a4:1a:74:3f:92:';         
+               
+      HEXCONVERT =
+      '""" convert hex string integer to int """ '+LF+
+      'def convert(n: str) -> int:               '+LF+
+      '    # get rid of ":", spaces and newlines '+LF+
+      '    hex = n.replace(":", "").replace("\n","").replace(" ","")'+LF+
+      '    return int(hex,16)';     
+      
+var bufs, tabstr: string;               
+Begin  //@Main
+  maxform1.console1click(self)
+  memo2.height:= 200;
+  memo2.font.name:= 'Courier';
+  with TPythonEngine.Create(Nil) do begin
+    pythonhome:= PYHOME32;
+    try
+     opendll(PYDLL32)
+      Println('Colab Platform: '+ 
+          EvalStr('__import__("platform").platform()')); 
+     Println('DIR Check: '+ 
+     EvalStr('__import__("subprocess").check_output("dir",shell=True).strip().decode()'));
+     //1. Unpacking Array Items
+     ExecString('first_name, last_name = ["Farhad", "Malik"]');
+     Println('Unpacking Array: '+EvalStr('first_name, last_name'));
+     //2. Swapping Variables
+     ExecString('last_name, first_name = first_name, last_name');
+     Println('Swapping Variables: '+EvalStr('first_name, last_name'));
+     //4. Repeat String
+     Println('Repeat String: '+EvalStr('"A"*3'));
+     //5. Slicing
+     ExecString('y = "Abc"');
+     Println('5. Slicing: '+EvalStr('y[:2], y[1:], y[:-2], y[-2:]'));
+     ExecString('x = "abc"');
+     Println('6. Reversing: '+EvalStr('x[::-1]'));
+     Println('6. Reversing: '+EvalStr('"abc"[::-1]'));
+     Println('7. Negative Index: '+EvalStr('"abc"[-1]'));
+     Println('8. Intersect Sets: '+EvalStr('{1,2,3}.intersection({3,4,5})'));
+     Println('9. Difference In Sets: '+EvalStr('{1,2,3}.difference({3,4,5})'));
+     Println('10. Union Of Collections: '+EvalStr('{1,2,3}.union({3,4,5})'));
+     ExecString('def my_new_function(my_value="hello"):'+LF+
+                '  return my_value');
+     Println('11. Optional Arguments: '+EvalStr('my_new_function()'));
+     Println('11. Optional Arguments: '+EvalStr('my_new_function("test")'));
+     
+     ExecString('l=[]'+LF+'def myfunc(*arguments):'+LF+
+                '  for a in arguments:            '+LF+
+                '    l.append(a)                  '+LF+
+                '  return l                       '  );
+     Println('12. Unknown Arguments Using *arguments: '+
+                  EvalStr('myfunc("a","b","c")'));
+                  
+     ExecString('def myfunc2(**arguments):'+LF+
+                '  return arguments["city"]');
+     ExecString('ddata={"school":"DAV","standard":"7","city": "Delphi"}');
+     Println('13. Dictionary As Arguments Using **arguments '+
+                  EvalStr('myfunc2(**ddata)'));  
+                                        
+     Println('20. Joining Collection: '+EvalStr('" ".join(["FinTech", "Explained"])'));  
+     Println('21. Memory Footprint Of An Object: '+
+                  EvalStr('__import__("sys").getsizeof("farhadmalik")'));  
+     Println('22. Print Current Directory: '+
+                  EvalStr('__import__("os").getcwd()'));
+     
+     ExecString('import sys'); 
+     Println('23. Print Imported Modules: '+  
+                  EvalStr('[m.__name__ for m in sys.modules.values() if m]'));
+     Println('24. Get Current Process Id: '+
+                  EvalStr('__import__("os").getpid()')); 
+                  
+     ExecString('data={"Name": "Roger","Pin": 3056,"ActNo":9892345112234565}');
+     Println('25. FrozenSet: '+
+                  EvalStr('frozenset(data)'));   
+     ExecString('with open("pydata.txt","w") as f:'+LF+' f.write("HelloPy2")');
+     openfile(exepath+'pydata.txt'); 
+     ExecString('num_list = [21,13,19,3,11,5,18]'+LF+'num_list.sort()'); 
+     Println('26. Median Skill Test: '+EvalStr('num_list[len(num_list)//2]'));
+     ExecString('import math'); 
+     Println('27. map() function Area Test: '+
+           EvalStr('list(map(lambda x: round(math.pi*(x**2),2), [1,2,3]))'));  
+    except
+      raiseError;
+    finally                         
+      Free;
+    end;
+  end; 
+    Writeln('Demo01	A simple Python evaluator Gauss evaluator '+CRLF+
+   'Demo02	Evaluate expression with ExecSynCheck1 and Strlist '+CRLF+
+   'http://www.softwareschule.ch/examples/pydemo2.txt'+CRLF+
+   'http://www.softwareschule.ch/examples/pydemo2.htm'+CRLF+
+   'Demo03	15-powerful-python-one-liners PYLaz_P4D_Demo2      '+CRLF+
+   'Demo04	Eval_IOEvents (advanced case) Demo3 PYLaz_P4D_Demo2'+CRLF+
+   'Demo05	Defining a mX4_Python Template                     '+CRLF+
+   'Demo06	Defining a Python Template_PyCryptoDome_Bitcoin    '+CRLF+
+   'Demo07	Using Translator with Subprocess()                 '+CRLF+
+   'Demo25	this finteche expalained Demo                      ');
+End.
+
+//https://medium.com/pythoneers/10-important-python-questions-you-should-know-ed42b4104185
+//https://github.com/Ebazhanov/linkedin-skill-assessments-quizzes/blob/master/python/python-quiz.md  
+
+        
+       
+
+
+
+
+
+        
+   
+   
+      
+   
+
+ \ No newline at end of file diff --git a/Demos/pydemo25.txt b/Demos/pydemo25.txt new file mode 100644 index 00000000..3bff1524 --- /dev/null +++ b/Demos/pydemo25.txt @@ -0,0 +1,119 @@ +PROGRAM SEPDemo__PythonTemplate_Puzzle_25; +//https://medium.com/fintechexplained/top-python-tips-tricks-dd996b807865 + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + + CHEXSTR = '00:c9:73:e2:3b:11:01:2f:2c:62:a4:1a:74:3f:92:'; + + HEXCONVERT = + '""" convert hex string integer to int """ '+LF+ + 'def convert(n: str) -> int: '+LF+ + ' # get rid of ":", spaces and newlines '+LF+ + ' hex = n.replace(":", "").replace("\n","").replace(" ","")'+LF+ + ' return int(hex,16)'; + +var bufs, tabstr: string; +Begin //@Main + maxform1.console1click(self) + memo2.height:= 200; + memo2.font.name:= 'Courier'; + with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME32; + try + opendll(PYDLL32) + Println('Colab Platform: '+ + EvalStr('__import__("platform").platform()')); + Println('DIR Check: '+ + EvalStr('__import__("subprocess").check_output("dir",shell=True).strip().decode()')); + //1. Unpacking Array Items + ExecString('first_name, last_name = ["Farhad", "Malik"]'); + Println('Unpacking Array: '+EvalStr('first_name, last_name')); + //2. Swapping Variables + ExecString('last_name, first_name = first_name, last_name'); + Println('Swapping Variables: '+EvalStr('first_name, last_name')); + //4. Repeat String + Println('Repeat String: '+EvalStr('"A"*3')); + //5. Slicing + ExecString('y = "Abc"'); + Println('5. Slicing: '+EvalStr('y[:2], y[1:], y[:-2], y[-2:]')); + ExecString('x = "abc"'); + Println('6. Reversing: '+EvalStr('x[::-1]')); + Println('6. Reversing: '+EvalStr('"abc"[::-1]')); + Println('7. Negative Index: '+EvalStr('"abc"[-1]')); + Println('8. Intersect Sets: '+EvalStr('{1,2,3}.intersection({3,4,5})')); + Println('9. Difference In Sets: '+EvalStr('{1,2,3}.difference({3,4,5})')); + Println('10. Union Of Collections: '+EvalStr('{1,2,3}.union({3,4,5})')); + ExecString('def my_new_function(my_value="hello"):'+LF+ + ' return my_value'); + Println('11. Optional Arguments: '+EvalStr('my_new_function()')); + Println('11. Optional Arguments: '+EvalStr('my_new_function("test")')); + + ExecString('l=[]'+LF+'def myfunc(*arguments):'+LF+ + ' for a in arguments: '+LF+ + ' l.append(a) '+LF+ + ' return l ' ); + Println('12. Unknown Arguments Using *arguments: '+ + EvalStr('myfunc("a","b","c")')); + + ExecString('def myfunc2(**arguments):'+LF+ + ' return arguments["city"]'); + ExecString('ddata={"school":"DAV","standard":"7","city": "Delphi"}'); + Println('13. Dictionary As Arguments Using **arguments '+ + EvalStr('myfunc2(**ddata)')); + + Println('20. Joining Collection: '+EvalStr('" ".join(["FinTech", "Explained"])')); + Println('21. Memory Footprint Of An Object: '+ + EvalStr('__import__("sys").getsizeof("farhadmalik")')); + Println('22. Print Current Directory: '+ + EvalStr('__import__("os").getcwd()')); + + ExecString('import sys'); + Println('23. Print Imported Modules: '+ + EvalStr('[m.__name__ for m in sys.modules.values() if m]')); + Println('24. Get Current Process Id: '+ + EvalStr('__import__("os").getpid()')); + + ExecString('data={"Name": "Roger","Pin": 3056,"ActNo":9892345112234565}'); + Println('25. FrozenSet: '+ + EvalStr('frozenset(data)')); + ExecString('with open("pydata.txt","w") as f:'+LF+' f.write("HelloPy2")'); + openfile(exepath+'pydata.txt'); + ExecString('num_list = [21,13,19,3,11,5,18]'+LF+'num_list.sort()'); + Println('26. Median Skill Test: '+EvalStr('num_list[len(num_list)//2]')); + ExecString('import math'); + Println('27. map() function Area Test: '+ + EvalStr('list(map(lambda x: round(math.pi*(x**2),2), [1,2,3]))')); + except + raiseError; + finally + Free; + end; + end; + Writeln('Demo01 A simple Python evaluator Gauss evaluator '+CRLF+ + 'Demo02 Evaluate expression with ExecSynCheck1 and Strlist '+CRLF+ + 'http://www.softwareschule.ch/examples/pydemo2.txt'+CRLF+ + 'http://www.softwareschule.ch/examples/pydemo2.htm'+CRLF+ + 'Demo03 15-powerful-python-one-liners PYLaz_P4D_Demo2 '+CRLF+ + 'Demo04 Eval_IOEvents (advanced case) Demo3 PYLaz_P4D_Demo2'+CRLF+ + 'Demo05 Defining a mX4_Python Template '+CRLF+ + 'Demo06 Defining a Python Template_PyCryptoDome_Bitcoin '+CRLF+ + 'Demo07 Using Translator with Subprocess() '+CRLF+ + 'Demo25 this finteche expalained Demo '); +End. + +//https://medium.com/pythoneers/10-important-python-questions-you-should-know-ed42b4104185 +//https://github.com/Ebazhanov/linkedin-skill-assessments-quizzes/blob/master/python/python-quiz.md + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demos/pydemo26.htm b/Demos/pydemo26.htm new file mode 100644 index 00000000..d445983d --- /dev/null +++ b/Demos/pydemo26.htm @@ -0,0 +1,168 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000027091 +StartFragment:0000001053 +EndFragment:0000027075 + + + + +mXScriptasHTML + + + + + +
Program Python_ThreadsDemo26;
+
+//https://www.programiz.com/python-programming/time/sleep
+//Note: modify PYHOME and PYDLL :
+
+const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\';
+    PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
+    PYDLL  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+    PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py';
+    LB= CR+LF;
+       
+const TH1 = 'def print_hello_three_times(): '+LB+
+            '  for i in range(3):           '+LB+
+            '    winsound.Beep(540, 500)    '+LB+
+            '    #time.sleep(1.4)           '+LB+
+            '  return "Hello"';
+  
+const TH2 = 'def print_hi_three_times():    '+LB+ 
+            '  for i in range(3):           '+LB+
+            '    print("\a")                '+LB+
+            '    winsound.Beep(440, 500)    '+LB+
+            '  return "Hi"'; 
+            
+const ATIME='while True: '+LB+ 
+            '  localtime = time.localtime()'+LB+ 
+            '  result = time.strftime("%I:%M:%S %p", localtime)'+LB+ 
+            '  print(result, end="", flush=True)'+LB+ 
+            '  print("\r", end="", flush=True)'+LB+ 
+            '  time.sleep(1)';                        
+              
+var  PyForm: TForm; pyMemo: TMemo;
+     pyval: variant;
+     
+
+var eng: TPythonEngine; aPythonVersion: TPythonVersion;
+         PythonVersions: TPythonVersions; AllUserInstall: Boolean;
+         apd: TApdMeter;
+
+begin  //@main
+  //PythonEngine1.Free;
+  //myloadscript2:= filetostring(PYSCRIPT2);
+  
+  PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_VersionThread_Tester_EKON25');
+  pyMemo:= TMemo.create(PyForm);
+  apd:= TApdMeter.create(pyform);
+  //apd.color:= clyellow;
+  apd.parent:= pyform;
+  apd.barcolor:= clred;
+  apd.position:= 30;
+  apd.SetBounds(10,100, 150, 150);
+  apd.visible:= true;
+  pyMemo.parent:= PyForm
+  PyForm.show;
+  aPythonVersion:= TPythonVersion.create;
+  
+ //3. replace maps demo
+   eng:= TPythonEngine.Create(Nil);
+   eng.pythonhome:= PYHOME;
+   eng.opendll(PYDLL)
+   //eng.IO:= pyMemo;
+   try
+     eng.Execstring('pets= ("bird","snake","dog","turtle","cat","hamster")');
+     // eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)');
+     eng.Execstring('uppercased_pets = list(map(str.upper, pets))');
+     println('Tip replace maps: '+eng.EvalStr('uppercased_pets'));
+     pyMemo.lines.add(eng.EvalStr('list(map(str.upper, pets))'));
+     
+     //# syntax for set comprehension {expression for item in iterable}
+     eng.Execstring('numbers = (1, 34, 5, 8, 10, 12, 3, 90, 70, 70, 90)');
+     println('Set comprehension: '+
+             eng.EvalStr('{number for number in numbers if number%2 == 0}')); 
+     eng.Execstr('import threading, winsound, time');
+     eng.Execstr(TH1+CRLF+TH2);
+    
+     eng.Execstring('t1 = threading.Thread(target=print_hello_three_times)');
+     eng.Execstring('t2 = threading.Thread(target=print_hi_three_times)');
+     eng.EvalStr('t1.start()'); 
+     eng.EvalStr('t2.start()'); 
+     println('thread target1: '+eng.EvalStr('t1'));
+     println('thread target2: '+eng.EvalStr('t2')); 
+     //println('def call: '+eng.EvalStr('print_hello_three_times()')); 
+     
+     //eng.Execstring(ATIME);
+     if PythonVersionFromPath(PYHOME, aPythonVersion, false) then begin
+       aPythonVersion.AssignTo(eng) ;
+       writeln('Version from path: '+TPythonEngine(eng).RegVersion);
+       writeln('DLL from path: '+TPythonEngine(eng).DLLName);
+     end;
+     for it:= 10 to 50 do begin
+       sleep(100) 
+       apd.position:= it;
+     end;
+   except
+     //eng.raiseError;
+     writeln(ExceptionToString(ExceptionType, ExceptionParam));
+   finally
+     eng.Free;
+     aPythonVersion.Free;
+  end;    
+  
+  //PYLaz_P4D_Demo2; 
+End.
+
+Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable.
+writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion));
+https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib
+
+Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL.
+Example 3: Python multithreading
+All programs are single-threaded programs. Here's an example of a multithreaded Python program.
+
+import threading 
+  
+def print_hello_three_times():
+  for i in range(3):
+    print("Hello")
+  
+def print_hi_three_times(): 
+    for i in range(3): 
+      print("Hi") 
+
+t1 = threading.Thread(target=print_hello_three_times)  
+t2 = threading.Thread(target=print_hi_three_times)  
+t1.start()
+t2.start()
+
+This package implements JSON support for FPC.
+You might want to have a look at the lazarus jsonviewer tool, written using
+fpJSON (see lazarus/tools/jsonviewer). It visualizes the fpJSON data and
+shows how to program using fpjson.
+
+
+
+
+    
+
+ \ No newline at end of file diff --git a/Demos/pydemo26.txt b/Demos/pydemo26.txt new file mode 100644 index 00000000..83f95aa5 --- /dev/null +++ b/Demos/pydemo26.txt @@ -0,0 +1,135 @@ +Program Python_ThreadsDemo26; + +//https://www.programiz.com/python-programming/time/sleep +//Note: modify PYHOME and PYDLL : + +const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + LB= CR+LF; + +const TH1 = 'def print_hello_three_times(): '+LB+ + ' for i in range(3): '+LB+ + ' winsound.Beep(540, 500) '+LB+ + ' #time.sleep(1.4) '+LB+ + ' return "Hello"'; + +const TH2 = 'def print_hi_three_times(): '+LB+ + ' for i in range(3): '+LB+ + ' print("\a") '+LB+ + ' winsound.Beep(440, 500) '+LB+ + ' return "Hi"'; + +const ATIME='while True: '+LB+ + ' localtime = time.localtime()'+LB+ + ' result = time.strftime("%I:%M:%S %p", localtime)'+LB+ + ' print(result, end="", flush=True)'+LB+ + ' print("\r", end="", flush=True)'+LB+ + ' time.sleep(1)'; + +var PyForm: TForm; pyMemo: TMemo; + pyval: variant; + + +var eng: TPythonEngine; aPythonVersion: TPythonVersion; + PythonVersions: TPythonVersions; AllUserInstall: Boolean; + apd: TApdMeter; + +begin //@main + //PythonEngine1.Free; + //myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_VersionThread_Tester_EKON25'); + pyMemo:= TMemo.create(PyForm); + apd:= TApdMeter.create(pyform); + //apd.color:= clyellow; + apd.parent:= pyform; + apd.barcolor:= clred; + apd.position:= 30; + apd.SetBounds(10,100, 150, 150); + apd.visible:= true; + pyMemo.parent:= PyForm + PyForm.show; + aPythonVersion:= TPythonVersion.create; + + //3. replace maps demo + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME; + eng.opendll(PYDLL) + //eng.IO:= pyMemo; + try + eng.Execstring('pets= ("bird","snake","dog","turtle","cat","hamster")'); + // eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)'); + eng.Execstring('uppercased_pets = list(map(str.upper, pets))'); + println('Tip replace maps: '+eng.EvalStr('uppercased_pets')); + pyMemo.lines.add(eng.EvalStr('list(map(str.upper, pets))')); + + //# syntax for set comprehension {expression for item in iterable} + eng.Execstring('numbers = (1, 34, 5, 8, 10, 12, 3, 90, 70, 70, 90)'); + println('Set comprehension: '+ + eng.EvalStr('{number for number in numbers if number%2 == 0}')); + eng.Execstr('import threading, winsound, time'); + eng.Execstr(TH1+CRLF+TH2); + + eng.Execstring('t1 = threading.Thread(target=print_hello_three_times)'); + eng.Execstring('t2 = threading.Thread(target=print_hi_three_times)'); + eng.EvalStr('t1.start()'); + eng.EvalStr('t2.start()'); + println('thread target1: '+eng.EvalStr('t1')); + println('thread target2: '+eng.EvalStr('t2')); + //println('def call: '+eng.EvalStr('print_hello_three_times()')); + + //eng.Execstring(ATIME); + if PythonVersionFromPath(PYHOME, aPythonVersion, false) then begin + aPythonVersion.AssignTo(eng) ; + writeln('Version from path: '+TPythonEngine(eng).RegVersion); + writeln('DLL from path: '+TPythonEngine(eng).DLLName); + end; + for it:= 10 to 50 do begin + sleep(100) + apd.position:= it; + end; + except + //eng.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eng.Free; + aPythonVersion.Free; + end; + + //PYLaz_P4D_Demo2; +End. + +Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable. +writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion)); +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. +Example 3: Python multithreading +All programs are single-threaded programs. Here's an example of a multithreaded Python program. + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) +t1.start() +t2.start() + +This package implements JSON support for FPC. +You might want to have a look at the lazarus jsonviewer tool, written using +fpJSON (see lazarus/tools/jsonviewer). It visualizes the fpJSON data and +shows how to program using fpjson. + + + + + \ No newline at end of file diff --git a/Demos/pydemo27.htm b/Demos/pydemo27.htm new file mode 100644 index 00000000..48450419 --- /dev/null +++ b/Demos/pydemo27.htm @@ -0,0 +1,500 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000084114 +StartFragment:0000001053 +EndFragment:0000084098 + + + + +mXScriptasHTML + + + + + +
Program PyDemo27_CodeSnippets;
+
+//22 Python Code Snippets for Everyday Problems
+//https://medium.com/@codedev101/22-python-code-snippets-for-everyday-problems-2f6e5025cd70
+
+//Note: modify PYHOME and PYDLL :
+
+Const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\';
+  PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; 
+  PYDLL  = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll';
+  PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py';
+  LB = CR+LF;
+       
+const PyModule =
+              'def printData(data): '+#13#10+
+              '  return data+data+"/n"';       
+         
+const PYCMD = 'print("this is box")'+LB+ 
+              'import sys'+LB+ 
+              'f=open(r"1050pytest21_5powers.txt","w")'+LB+
+              'f.write("Hello PyWorld_mX47580, \n")'+LB+
+              'f.write("This data will be written on the file.")'+LB+ 
+              'f.close()';
+
+              
+var  PyForm: TForm; pyMemo: TMemo;
+     avar: string; pyval: variant;
+     
+Procedure PYLaz_P4D_Demo27;
+//https://wiki.freepascal.org/Python4Delphi 
+var eng : TPythonEngine;
+    Out1: TPythonGUIInputOutput;
+    pystrings: TStrings;
+begin
+
+// FIOPythonModule := TPythonModule.Create( Self );
+    //with  TPythonModule.Create( Self ) do
+      //AddMethod(
+      
+  eng:= TPythonEngine.Create(Nil);
+  Out1:= TPythonGUIInputOutput.create(eng)
+  pystrings:= TStringlist.create;
+  Out1.output:= pyMemo; //debugout.output; or memo2;
+  //eng.IO:= Out1;
+  Out1.RawOutput:= True;
+  Out1.UnicodeIO:= False;
+  Out1.maxlines:= 40;
+  out1.DelayWrites:= False;
+  out1.displaystring('this string thing draw the line')
+  out1.write('YXthis write string thing draw the line');
+  writeln(botostr(Isx64(PYDLL)));
+  //writeln(botostr(Isx64(pydllpath2)));
+  //eng.dllpath:= exepath;
+  //eng.dllname:='python37.dll';
+  eng.pythonhome:= PYHOME;
+  eng.InitScript:= pystrings;
+  try
+   //pymod.InitializeForNewInterpreter; //}
+    eng.RedirectIO:= true;
+    eng.opendll(PYDLL)
+    eng.RedirectIO:= true;
+    eng.IO:= Out1;
+    Out1.output:= pyMemo; 
+    //eng.traceback
+    eng.AutoFinalize:= True; 
+    //eng.RedirectIO:= true;
+    //eng.AutoUnload:= false; 
+    writeln(eng.dllname);
+    //pymod.engine:= eng;
+    if eng.IsHandleValid then begin
+      writeln('DLLhandle: '+botostr(eng.IsHandleValid))
+      WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]'));
+      WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])'));
+      WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])'));
+      WriteLn('mathstr: '+ eng.EvalStr('"py " * 7'));
+      WriteLn('builtins: '+ eng.EvalStr('dir(__builtins__)'));
+      WriteLn('upperstr: '+ eng.EvalStr('"hello again".upper()'));
+      pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("os").getcwd()'));
+      writeln('syncheck '+
+      botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])')));
+      
+      WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))'));
+      WriteLn('powerline2: '+ 
+               eng.EvalStr('list(map(float,["1",2,"3.0",4.0,"5",6]))'));
+               eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))');
+      WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)'));
+      
+               eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]');
+               eng.Execstring('transpose_A = [list(i) for i in zip(*A)]');
+      WriteLn('powerline4: '+ eng.EvalStr('transpose_A')+CRLF);  
+      
+      //1 � Invert Dictionary
+      eng.Execstr('mydict = {1: "Py", 2: "Js", 3: "C++", 4: "Dart"}');
+      PrintLn('powerl1: '+ eng.EvalStr('{v: k for k, v in mydict.items()}')); 
+      
+      //3 � Cloning/Duplicate list    
+      eng.ExecStr('import copy')                                              
+      eng.ExecString('mylst1 = [100, 200, 300]');
+      eng.ExecString('mylst2 = copy.deepcopy(mylst1)');
+      PrintLn('powerl3: '+ eng.EvalStr('mylst2')); 
+      
+      //4 � Merge two Dictionaries with **
+      eng.ExecStr('dict1 = {1: "PY", 2: "JS"}');
+      eng.ExecStr('dict2 = {3: "CPP", 4: "C#"}');
+      PrintLn('powerl4 dict3: '+ eng.EvalStr('{**dict1, **dict2}'));
+      
+      //5� Quick variable Exchanging
+      eng.ExecStr('value1 = 125');
+      eng.ExecStr('value2 = 625');
+      eng.ExecStr('(value2, value1) = (value1, value2)');
+      PrintLn('powerl5: '+eng.EvalStr('value1, value2'));
+     
+      //6� Quick Reversing a List
+      eng.ExecStr('lst = [125, 625, 123, 435]');
+      PrintLn('powerl6 Reverse: '+eng.EvalStr('lst[::-1]'));
+     
+      //7� Format() method
+      eng.Execstr('name = "Haider Imtiaz"');
+      eng.Execstr('profession = "Programmer"');
+      PrintLn('powerl7 Format: '
+            +eng.Evalstr('"Hi My Name is {} and {}".format(name, profession)'));
+     
+      //8 � Extract Vowels from String
+      eng.Execstr('def Extract_Vowels(data):'+CRLF+
+                  ' return [each for each in data if each in "aeiou"]');
+      PrintLn('powerl8 Callfunc: '+
+                 eng.Evalstr('Extract_Vowels("language")'));
+               
+      //9� Convert Irregular List to Single List
+      eng.ExecStr('import itertools') 
+      eng.Execstr('mylist = [[10, 20], [30, 40], [50, 60, 70]]');
+      PrintLn('powerl9 Flatten: '+
+                 eng.EvalStr('list(itertools.chain.from_iterable(mylist))'));
+               
+      //10 � Printing Multiples of String
+      PrintLn('powerl10 multi: '+eng.EvalStr('"Py"*3, "JS"*3'));
+      PrintLn('powerl10 multi: '+eng.EvalStr('"Code"* 5'));             
+    
+      //11 � Transpose A Matrix
+      eng.ExecStr('lst = [[10, 20, 30], [40, 50, 60]]') 
+      eng.Execstr('transpose = list(zip(*lst))');
+      PrintLn('powerl11 Matrix: '+eng.EvalStr('transpose'));
+    
+      //12 � Short If-Else
+      PrintLn('powerl12 Short: '+
+                 eng.EvalStr('("Yes") if 100 > 50 else ("No")'));
+                 
+      //13 � Reversed Iteration 
+      eng.ExecStr('mylist = [100, 200, 300, 400, 500]')
+      eng.ExecStr('for x in reversed(mylist): '+CRLF+
+                  '  lst.append(x)'); 
+      println('powerl13 Short: '+eng.evalstr('lst'));  
+      
+      //14� Taking Multiple Integer Input
+      //eng.ExecStr('take_input = list(map(lambda x:int(x) ,input().split()))')
+      eng.ExecStr('take_input=list(map(lambda x:int(x),"10 20 30 40".split()))')
+      PrintLn('powerl14 Matrix: '+eng.EvalStr('take_input')); 
+      
+      //15 � Joining String                                            
+      eng.ExecStr('mylist = ["Hi", "Programmer", "How''s", "Going"]')
+      PrintLn('powerl15 Matrix: '+eng.EvalStr('" ".join(mylist)')); 
+      
+      //16 � Reset the Recursion Limit
+      eng.ExecStr('import sys') 
+      PrintLn('powerl16 Limit: '+eng.EvalStr('(sys.setrecursionlimit(2000))')); 
+      
+      //17� Filter any list
+      eng.ExecStr('mylst = [11, 12, 13, 14, 15, 16]') 
+      PrintLn('powerl17 Limit: '+eng.EvalStr('[i for i in mylst if i%2 == 0]'));
+      
+      //18� Generate Random Number
+      Println('Rand Gen:'+eng.EvalStr('__import__("random").randrange(45,1066)')); 
+      
+      //20�Get Rid of Duplicates
+      eng.ExecStr('mylst = ["a", "b", "b", "c", "c", "a", "d", "d"]') 
+      Println('powerl20:  '+eng.EvalStr('list(dict.fromkeys(mylst))')); 
+      
+      //21� Unpack a Tuple
+      eng.ExecStr('tuples = (100, 200, 300, 400)'+CRLF+'a, b, c, d = tuples') 
+      Println('powerl21 tuple: '+eng.EvalStr('a, b, c, d'));
+      
+      //22� Empty containers of Data
+      eng.ExecStr('a = list()'+CRLF+'b = tuple()'+CRLF+
+                  'c = set()'+CRLF+'d = dict()');
+      Println('powerl22 cont: '+eng.EvalStr('a, b, c, d'));
+    
+      eng.CheckError(true);
+     { pystrings:= TStringlist.create;
+      pystrings.add('import matplotlib.pyplot as plt')
+      pystrings.add('import numpy as np')
+      pystrings.add('np.arange(5, 24, 3)')
+      pystrings.add('fig, ax = plt.subplots(dpi=153)')
+      pystrings.add('plt.plot([1,2,3,4,5,6], [1,2,3,4,9,5], "go")')
+      pystrings.add('plt.show()')
+      eng.ExecStrings4(pystrings);
+      pystrings.free; }
+      
+     (* eng.ExecString('import subprocess');  
+      eng.ExecString('subprocess.call(["pip", "install", "sympy"])')
+      eng.ExecString('from sympy import *');
+      eng.ExecString('from sympy.plotting import plot'); 
+      writeln(eng.EvalStr('list(primerange(7, 150))'));
+      writeln(eng.EvalStr('sum(list(primerange(0, 100)))'));
+      writeln(eng.EvalStr('(list(primerange(0, 101)))'));
+      writeln(eng.EvalStr('len(list(primerange(0, 101)))'));
+      //https://www.tutorialspoint.com/sympy/sympy_solvers.htm
+      avar:= '-2';
+      eng.ExecString('x=Symbol("x")');
+      eng.ExecString('x,y=symbols("x y")');
+      writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)'));
+      writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)'));
+      writeln(eng.EvalStr('solveset(exp(x),x)'));
+      println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))'));
+       *)
+      //eng.ExecString('plot(x**'+avar+', line_color="red")');
+      //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))');
+      {
+      eng.ExecString('from sympy.plotting import plot3d'); 
+      eng.ExecString('x,y=symbols("x y") '); 
+      eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); }
+      
+      WriteLn('powerline6last: '+ eng.EvalStr('len(str(2**4096))'));
+      pymemo.lines.add('Decimal: '+ 
+              eng.EvalStr('__import__("decimal").Decimal((0,(3,1,4),-2))'));
+      pymemo.lines.add('Decimal: '+ 
+              eng.EvalStr('__import__("decimal").Decimal(0.1)')); 
+      eng.ExecString('import decimal')  
+      //https://www.w3schools.com/python/python_ref_functions.asp      
+      writeln('is instance: '+eng.EvalStr('isinstance(decimal.Decimal,'+
+                    '(float, int, str, list, dict, tuple, type))')); 
+      {writeln('is type: '+eng.EvalStr('type(str(decimal.Decimal(0.1)))'));
+      writeln('is type: '+eng.EvalStr('type(float(decimal.Decimal(0.1)))'));
+      writeln('is type: '+eng.EvalStr('type(decimal.Decimal)')); 
+      writeln('is type: '+eng.EvalStr('type(decimal)')); }                   
+      //eng.ExecString('from spacy import *');
+      //eng.ExecString('from nltk.classify import MaxentClassifier')          
+      //eng.ExecString('import tensorflow')  
+      
+      pyval:= VarPythonEval('sum([x for x in range(201)])');
+      //writeln('evalvar '+botostr(VarIsPythonList(pyval)));
+      writeln('evalvar '+botostr(VarIsnumeric(pyval)));
+      pyval:= NewPythonDict;
+      writeln(botostr(VarIsPython( pyval)));
+      pyval := (VarPythonEval('2 ** 3'));         
+     { eng.ExecString('import subprocess');  
+      eng.ExecString('subprocess.call(["pip", "install", "langdetect"])')
+      eng.ExecString('from langdetect import detect'); 
+      println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")'));
+      }
+      Out1.output:= pyMemo; 
+      pymemo.update;
+    end
+      else writeln('invalid library handle! '+Getlasterrortext);
+    println('PythonOK: '+botostr(PythonOK));  
+  except
+     eng.raiseError;
+     writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam));
+  finally
+     //eng.close 
+     eng.unloaddll; 
+     out1.free;
+     eng.free;
+     //PyFinalize();
+     pystrings.Free;
+  end;     
+  //out1.free;
+  //pyImport(PyModule);
+end;
+
+
+function SysVersionFromDLLName2(const DLLFileName : string): string;
+var Minor, Major: integer;
+begin
+  PythonVersionFromDLLName(DLLFileName, Major, Minor);
+  Result := Format('%d.%d', [Major, Minor]);
+end;
+
+//https://stackoverflow.com/questions/64324481/delphi-4-python/69123825#69123825
+procedure callDynPy;
+var
+  PyEngine_netA: TPythonEngine;
+  PyInpOut_netA: TPythonInputOutput;
+  FIOPythonModule : TPythonModule;
+  pystrings: TStrings;
+begin
+  PyEngine_netA:= TPythonEngine.Create(Self);
+  PyInpOut_netA:= TPythonInputOutput.Create(Self);
+  FIOPythonModule:= TPythonModule.Create( Self );
+  pystrings:= TStringlist.create;
+  
+  pystrings.text:=
+   'import sys'+LF+
+   'import os'+LF+
+   'pylist = []'+LF+
+   'print("Python path =", sys.path)         '+LF+
+   'print()                                  '+LF+
+   'print("Python modules already imported:")'+LF+
+   'for m in sys.modules.values():           '+LF+
+   '    if m:                                '+LF+
+   '        print(" ", m,"\n")               '+LF+
+   '        pylist.append(m)                 '+LF+
+   '        pylist.append("\n")              '+LF+
+   'print()                                  '+LF+
+   '#pylist = "\n".join(pylist)              '+LF+ 
+   '#PYTHONHOME=os.getenv(r"'+PYHOME+'\"))   '+LF+
+   'pylist.append(os.getenv("PYTHONHOME"))   '+LF+
+   '#print("PYTHONPATH =", os.getenv("PYTHONPATH"))';
+   
+  try
+    // configure components
+    //saveString(exepath+'pystrings.py', pystrings.text);
+    //writeln(getDosOutput('py '+exepath+'pystrings.py', exePath));
+    PyEngine_netA.DllName:= PYDLL;
+    PyEngine_netA.pythonhome:= PYHOME;
+    writeln(FIOPythonModule.modulename);
+    writeln(objtostr(PyEngine_netA.IOPythonModule)); 
+    //PyEngine_netA.modulename 
+   
+    //PyEngine_netA.IO := PyInpOut_netA;
+    PyEngine_netA.UseLastKnownVersion := True;
+    writeln('SysVersionFromDLLName2: '+SysVersionFromDLLName2(PYDLL));
+    //PyEngine_netA.opendll(PYDLL)
+    PyEngine_netA.LoadDll;
+    //PyEngine_netA.CheckPython;
+    PyEngine_netA.IO := PyInpOut_netA;
+    PyEngine_netA.redirectio := true;
+    PyInpOut_netA.Writeline('print(49+78+23,"\n")');
+    
+    {with PyEngine_netA do begin
+      ExecString('import subprocess');  
+      ExecString('subprocess.call(["pip", "install", "pyio"])')
+    end; } 
+          
+    println('CheckExecSyntax:'+botostr(PyEngine_netA.CheckExecSyntax(pystrings.text)));
+    PyEngine_netA.ExecStrings4(pystrings);
+    //synStringReplace(const S, OldPattern,NewPattern:str;Flags:TReplaceFlags):str
+    println('module list detect: '+
+           StringReplace(PyEngine_netA.EvalStr('pylist'),'\n',CR+LF,[rfReplaceAll]));
+    //PyInpOut_netA.Read('print(49+78,"\n")');
+    //PyInpOut_netA.output:= pyMemo;     
+    //PyEngine_netA.IO:= PyInpOut_netA;
+
+    //PyEngine_netA.ExecString(UTF8Encode(mmo_pythoncode.text));
+//https://stackoverflow.com/questions/49599004/how-to-convert-a-python-datetime-to-a-delphi-tdatetime#49599145
+    PyEngine_netA.ExecString(UTF8Encode('print(49+78),"\n"'));
+    PyEngine_netA.ExecString(('from datetime import datetime, timedelta'));
+    PyEngine_netA.ExecString(UTF8Encode('DELPHI_EPOCH=datetime(1899,12,30)'));
+    PyEngine_netA.ExecString('def datetime_fromdelphi(dvalue):'+LF+
+                             '  return DELPHI_EPOCH + timedelta(days=dvalue)');
+    println(PyEngine_netA.EvalStr(('datetime_fromdelphi(43191.68205925926)')));
+                                 
+    //PyEngine_netA.ExecString(('49+78'));
+    println(PyEngine_netA.EvalStr(('(49+78+2**5),"\n"'+LF)));
+    println(PyEngine_netA.EvalStr(('__import__("sys").version')));
+  except
+    PyEngine_netA.raiseError;  
+  finally
+    PyEngine_netA.free;
+    PyInpOut_netA.free;
+    FIOPythonModule.Free;
+    pystrings.Free;
+  end;
+end;  
+
+begin  //@main
+  //myloadscript2:= filetostring(PYSCRIPT2);
+  //Memo1.beginUpdate;
+  PyForm:= loadForm2(300,200, clgreen,'PyFrm4D_27');
+  pyMemo:= TMemo.create(PyForm);
+  pyMemo.parent:= PyForm
+  pymemo.align:= albottom;
+  PyForm.show;
+  
+  PYLaz_P4D_Demo27; 
+  //Memo1.EndUpdate;
+  
+  //callDynPy;
+  
+  //---register_PYthonGUI;---
+End.
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191
+
+https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib
+
+maXbox_Starter86_3_Python4maXbox
+
+Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL.
+Or, if you're just using the Python API without the VCL wrappers, TPythonInterface 
+
+Evil eval()
+
+You should never pass untrusted source to the eval() directly. 
+ For example, the following code can be used to delete all the files from the system.
+1 >>>
+2 eval('os.system("RM -RF /")') # command is deliberately capitalized
+3 >>>
+
+#  demo script
+import matplotlib.pyplot as plt
+import numpy as np
+x = np.arange(0,8*np.pi,0.1)   # start,stop,step
+y = np.cos(x) *1/(1+x)
+plt.plot(x,y)
+plt.show()
+
+
+Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download
+--------------------------------------------------------
+dll EXCEPT Exception: There is already one instance of TPythonEngine running.
+TRUE
+Exception: Python is not properly initialized.
+PascalScript maXbox4 - RemObjects & SynEdit
+
+
+procedure TPythonEngine.DoRedirectIO;
+const
+  code = 'import sys'+LF+
+         'class DebugOutput:'+LF+
+         '  pyio = __import__("pyio")'+LF+
+         '  softspace=0'+LF+
+         '  encoding=None'+LF+
+         '  def write(self,message):'+LF+
+         '     self.pyio.write(message)'+LF+
+         '  def readline(self, size=None):'+LF+
+         '     return self.pyio.read(size)'+LF+
+         '  def flush(self):' + LF +
+         '     pass' + LF +
+         '  def isatty(self):' + LF +
+         '     return True' + LF +
+         'sys.old_stdin=sys.stdin'+LF+
+         'sys.old_stdout=sys.stdout'+LF+
+         'sys.old_stderr=sys.stderr'+LF+
+         'sys.stdin=sys.stderr=sys.stdout=DebugOutput()'+LF+#0;
+begin
+  if csDesigning in ComponentState then
+    Exit;
+  CheckPython;
+  if not Assigned(FIOPythonModule) then
+  begin
+    // create a new module called pyio
+    FIOPythonModule := TPythonModule.Create( Self );
+    with FIOPythonModule as TPythonModule do begin
+      Engine := Self;
+      ModuleName := 'pyio';
+      AddMethod('write', pyio_write, 'write(String) -> None' );
+      AddMethod('read',  pyio_read,  'read() -> String' );
+      AddMethod('SetDelayWrites',pyio_SetDelayWrites,'SetDelayWrites(Boolean)->None');
+      AddMethod( 'SetMaxLines',  pyio_SetMaxLines,  'SetMaxLines(Integer) -> None' );
+      AddMethod( 'GetTypesStats',pyio_GetTypesStats,'GetTypesStats([type name])-> a list of tuple (TypeName, InstanceCount, CreateHits, DeleteHits)' );
+      end;
+  end;
+  with FIOPythonModule as TPythonModule do
+    if not Initialized then
+      Initialize;
+  // execute the code
+  ExecString(code);
+  FIORedirected := True;
+end;
+
+
+
+                
+
+
+
+ \ No newline at end of file diff --git a/Demos/pydemo27.txt b/Demos/pydemo27.txt new file mode 100644 index 00000000..9f7fae75 --- /dev/null +++ b/Demos/pydemo27.txt @@ -0,0 +1,466 @@ +Program PyDemo27_CodeSnippets; + +//22 Python Code Snippets for Everyday Problems +//https://medium.com/@codedev101/22-python-code-snippets-for-everyday-problems-2f6e5025cd70 + +//Note: modify PYHOME and PYDLL : + +Const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYDLL = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll'; + PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py'; + LB = CR+LF; + +const PyModule = + 'def printData(data): '+#13#10+ + ' return data+data+"/n"'; + +const PYCMD = 'print("this is box")'+LB+ + 'import sys'+LB+ + 'f=open(r"1050pytest21_5powers.txt","w")'+LB+ + 'f.write("Hello PyWorld_mX47580, \n")'+LB+ + 'f.write("This data will be written on the file.")'+LB+ + 'f.close()'; + + +var PyForm: TForm; pyMemo: TMemo; + avar: string; pyval: variant; + +Procedure PYLaz_P4D_Demo27; +//https://wiki.freepascal.org/Python4Delphi +var eng : TPythonEngine; + Out1: TPythonGUIInputOutput; + pystrings: TStrings; +begin + +// FIOPythonModule := TPythonModule.Create( Self ); + //with TPythonModule.Create( Self ) do + //AddMethod( + + eng:= TPythonEngine.Create(Nil); + Out1:= TPythonGUIInputOutput.create(eng) + pystrings:= TStringlist.create; + Out1.output:= pyMemo; //debugout.output; or memo2; + //eng.IO:= Out1; + Out1.RawOutput:= True; + Out1.UnicodeIO:= False; + Out1.maxlines:= 40; + out1.DelayWrites:= False; + out1.displaystring('this string thing draw the line') + out1.write('YXthis write string thing draw the line'); + writeln(botostr(Isx64(PYDLL))); + //writeln(botostr(Isx64(pydllpath2))); + //eng.dllpath:= exepath; + //eng.dllname:='python37.dll'; + eng.pythonhome:= PYHOME; + eng.InitScript:= pystrings; + try + //pymod.InitializeForNewInterpreter; //} + eng.RedirectIO:= true; + eng.opendll(PYDLL) + eng.RedirectIO:= true; + eng.IO:= Out1; + Out1.output:= pyMemo; + //eng.traceback + eng.AutoFinalize:= True; + //eng.RedirectIO:= true; + //eng.AutoUnload:= false; + writeln(eng.dllname); + //pymod.engine:= eng; + if eng.IsHandleValid then begin + writeln('DLLhandle: '+botostr(eng.IsHandleValid)) + WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]')); + WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])')); + WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])')); + WriteLn('mathstr: '+ eng.EvalStr('"py " * 7')); + WriteLn('builtins: '+ eng.EvalStr('dir(__builtins__)')); + WriteLn('upperstr: '+ eng.EvalStr('"hello again".upper()')); + pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("os").getcwd()')); + writeln('syncheck '+ + botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])'))); + + WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))')); + WriteLn('powerline2: '+ + eng.EvalStr('list(map(float,["1",2,"3.0",4.0,"5",6]))')); + eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))'); + WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)')); + + eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]'); + eng.Execstring('transpose_A = [list(i) for i in zip(*A)]'); + WriteLn('powerline4: '+ eng.EvalStr('transpose_A')+CRLF); + + //1 � Invert Dictionary + eng.Execstr('mydict = {1: "Py", 2: "Js", 3: "C++", 4: "Dart"}'); + PrintLn('powerl1: '+ eng.EvalStr('{v: k for k, v in mydict.items()}')); + + //3 � Cloning/Duplicate list + eng.ExecStr('import copy') + eng.ExecString('mylst1 = [100, 200, 300]'); + eng.ExecString('mylst2 = copy.deepcopy(mylst1)'); + PrintLn('powerl3: '+ eng.EvalStr('mylst2')); + + //4 � Merge two Dictionaries with ** + eng.ExecStr('dict1 = {1: "PY", 2: "JS"}'); + eng.ExecStr('dict2 = {3: "CPP", 4: "C#"}'); + PrintLn('powerl4 dict3: '+ eng.EvalStr('{**dict1, **dict2}')); + + //5� Quick variable Exchanging + eng.ExecStr('value1 = 125'); + eng.ExecStr('value2 = 625'); + eng.ExecStr('(value2, value1) = (value1, value2)'); + PrintLn('powerl5: '+eng.EvalStr('value1, value2')); + + //6� Quick Reversing a List + eng.ExecStr('lst = [125, 625, 123, 435]'); + PrintLn('powerl6 Reverse: '+eng.EvalStr('lst[::-1]')); + + //7� Format() method + eng.Execstr('name = "Haider Imtiaz"'); + eng.Execstr('profession = "Programmer"'); + PrintLn('powerl7 Format: ' + +eng.Evalstr('"Hi My Name is {} and {}".format(name, profession)')); + + //8 � Extract Vowels from String + eng.Execstr('def Extract_Vowels(data):'+CRLF+ + ' return [each for each in data if each in "aeiou"]'); + PrintLn('powerl8 Callfunc: '+ + eng.Evalstr('Extract_Vowels("language")')); + + //9� Convert Irregular List to Single List + eng.ExecStr('import itertools') + eng.Execstr('mylist = [[10, 20], [30, 40], [50, 60, 70]]'); + PrintLn('powerl9 Flatten: '+ + eng.EvalStr('list(itertools.chain.from_iterable(mylist))')); + + //10 � Printing Multiples of String + PrintLn('powerl10 multi: '+eng.EvalStr('"Py"*3, "JS"*3')); + PrintLn('powerl10 multi: '+eng.EvalStr('"Code"* 5')); + + //11 � Transpose A Matrix + eng.ExecStr('lst = [[10, 20, 30], [40, 50, 60]]') + eng.Execstr('transpose = list(zip(*lst))'); + PrintLn('powerl11 Matrix: '+eng.EvalStr('transpose')); + + //12 � Short If-Else + PrintLn('powerl12 Short: '+ + eng.EvalStr('("Yes") if 100 > 50 else ("No")')); + + //13 � Reversed Iteration + eng.ExecStr('mylist = [100, 200, 300, 400, 500]') + eng.ExecStr('for x in reversed(mylist): '+CRLF+ + ' lst.append(x)'); + println('powerl13 Short: '+eng.evalstr('lst')); + + //14� Taking Multiple Integer Input + //eng.ExecStr('take_input = list(map(lambda x:int(x) ,input().split()))') + eng.ExecStr('take_input=list(map(lambda x:int(x),"10 20 30 40".split()))') + PrintLn('powerl14 Matrix: '+eng.EvalStr('take_input')); + + //15 � Joining String + eng.ExecStr('mylist = ["Hi", "Programmer", "How''s", "Going"]') + PrintLn('powerl15 Matrix: '+eng.EvalStr('" ".join(mylist)')); + + //16 � Reset the Recursion Limit + eng.ExecStr('import sys') + PrintLn('powerl16 Limit: '+eng.EvalStr('(sys.setrecursionlimit(2000))')); + + //17� Filter any list + eng.ExecStr('mylst = [11, 12, 13, 14, 15, 16]') + PrintLn('powerl17 Limit: '+eng.EvalStr('[i for i in mylst if i%2 == 0]')); + + //18� Generate Random Number + Println('Rand Gen:'+eng.EvalStr('__import__("random").randrange(45,1066)')); + + //20�Get Rid of Duplicates + eng.ExecStr('mylst = ["a", "b", "b", "c", "c", "a", "d", "d"]') + Println('powerl20: '+eng.EvalStr('list(dict.fromkeys(mylst))')); + + //21� Unpack a Tuple + eng.ExecStr('tuples = (100, 200, 300, 400)'+CRLF+'a, b, c, d = tuples') + Println('powerl21 tuple: '+eng.EvalStr('a, b, c, d')); + + //22� Empty containers of Data + eng.ExecStr('a = list()'+CRLF+'b = tuple()'+CRLF+ + 'c = set()'+CRLF+'d = dict()'); + Println('powerl22 cont: '+eng.EvalStr('a, b, c, d')); + + eng.CheckError(true); + { pystrings:= TStringlist.create; + pystrings.add('import matplotlib.pyplot as plt') + pystrings.add('import numpy as np') + pystrings.add('np.arange(5, 24, 3)') + pystrings.add('fig, ax = plt.subplots(dpi=153)') + pystrings.add('plt.plot([1,2,3,4,5,6], [1,2,3,4,9,5], "go")') + pystrings.add('plt.show()') + eng.ExecStrings4(pystrings); + pystrings.free; } + + (* eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "sympy"])') + eng.ExecString('from sympy import *'); + eng.ExecString('from sympy.plotting import plot'); + writeln(eng.EvalStr('list(primerange(7, 150))')); + writeln(eng.EvalStr('sum(list(primerange(0, 100)))')); + writeln(eng.EvalStr('(list(primerange(0, 101)))')); + writeln(eng.EvalStr('len(list(primerange(0, 101)))')); + //https://www.tutorialspoint.com/sympy/sympy_solvers.htm + avar:= '-2'; + eng.ExecString('x=Symbol("x")'); + eng.ExecString('x,y=symbols("x y")'); + writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)')); + writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)')); + writeln(eng.EvalStr('solveset(exp(x),x)')); + println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))')); + *) + //eng.ExecString('plot(x**'+avar+', line_color="red")'); + //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))'); + { + eng.ExecString('from sympy.plotting import plot3d'); + eng.ExecString('x,y=symbols("x y") '); + eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); } + + WriteLn('powerline6last: '+ eng.EvalStr('len(str(2**4096))')); + pymemo.lines.add('Decimal: '+ + eng.EvalStr('__import__("decimal").Decimal((0,(3,1,4),-2))')); + pymemo.lines.add('Decimal: '+ + eng.EvalStr('__import__("decimal").Decimal(0.1)')); + eng.ExecString('import decimal') + //https://www.w3schools.com/python/python_ref_functions.asp + writeln('is instance: '+eng.EvalStr('isinstance(decimal.Decimal,'+ + '(float, int, str, list, dict, tuple, type))')); + {writeln('is type: '+eng.EvalStr('type(str(decimal.Decimal(0.1)))')); + writeln('is type: '+eng.EvalStr('type(float(decimal.Decimal(0.1)))')); + writeln('is type: '+eng.EvalStr('type(decimal.Decimal)')); + writeln('is type: '+eng.EvalStr('type(decimal)')); } + //eng.ExecString('from spacy import *'); + //eng.ExecString('from nltk.classify import MaxentClassifier') + //eng.ExecString('import tensorflow') + + pyval:= VarPythonEval('sum([x for x in range(201)])'); + //writeln('evalvar '+botostr(VarIsPythonList(pyval))); + writeln('evalvar '+botostr(VarIsnumeric(pyval))); + pyval:= NewPythonDict; + writeln(botostr(VarIsPython( pyval))); + pyval := (VarPythonEval('2 ** 3')); + { eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "langdetect"])') + eng.ExecString('from langdetect import detect'); + println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")')); + } + Out1.output:= pyMemo; + pymemo.update; + end + else writeln('invalid library handle! '+Getlasterrortext); + println('PythonOK: '+botostr(PythonOK)); + except + eng.raiseError; + writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam)); + finally + //eng.close + eng.unloaddll; + out1.free; + eng.free; + //PyFinalize(); + pystrings.Free; + end; + //out1.free; + //pyImport(PyModule); +end; + + +function SysVersionFromDLLName2(const DLLFileName : string): string; +var Minor, Major: integer; +begin + PythonVersionFromDLLName(DLLFileName, Major, Minor); + Result := Format('%d.%d', [Major, Minor]); +end; + +//https://stackoverflow.com/questions/64324481/delphi-4-python/69123825#69123825 +procedure callDynPy; +var + PyEngine_netA: TPythonEngine; + PyInpOut_netA: TPythonInputOutput; + FIOPythonModule : TPythonModule; + pystrings: TStrings; +begin + PyEngine_netA:= TPythonEngine.Create(Self); + PyInpOut_netA:= TPythonInputOutput.Create(Self); + FIOPythonModule:= TPythonModule.Create( Self ); + pystrings:= TStringlist.create; + + pystrings.text:= + 'import sys'+LF+ + 'import os'+LF+ + 'pylist = []'+LF+ + 'print("Python path =", sys.path) '+LF+ + 'print() '+LF+ + 'print("Python modules already imported:")'+LF+ + 'for m in sys.modules.values(): '+LF+ + ' if m: '+LF+ + ' print(" ", m,"\n") '+LF+ + ' pylist.append(m) '+LF+ + ' pylist.append("\n") '+LF+ + 'print() '+LF+ + '#pylist = "\n".join(pylist) '+LF+ + '#PYTHONHOME=os.getenv(r"'+PYHOME+'\")) '+LF+ + 'pylist.append(os.getenv("PYTHONHOME")) '+LF+ + '#print("PYTHONPATH =", os.getenv("PYTHONPATH"))'; + + try + // configure components + //saveString(exepath+'pystrings.py', pystrings.text); + //writeln(getDosOutput('py '+exepath+'pystrings.py', exePath)); + PyEngine_netA.DllName:= PYDLL; + PyEngine_netA.pythonhome:= PYHOME; + writeln(FIOPythonModule.modulename); + writeln(objtostr(PyEngine_netA.IOPythonModule)); + //PyEngine_netA.modulename + + //PyEngine_netA.IO := PyInpOut_netA; + PyEngine_netA.UseLastKnownVersion := True; + writeln('SysVersionFromDLLName2: '+SysVersionFromDLLName2(PYDLL)); + //PyEngine_netA.opendll(PYDLL) + PyEngine_netA.LoadDll; + //PyEngine_netA.CheckPython; + PyEngine_netA.IO := PyInpOut_netA; + PyEngine_netA.redirectio := true; + PyInpOut_netA.Writeline('print(49+78+23,"\n")'); + + {with PyEngine_netA do begin + ExecString('import subprocess'); + ExecString('subprocess.call(["pip", "install", "pyio"])') + end; } + + println('CheckExecSyntax:'+botostr(PyEngine_netA.CheckExecSyntax(pystrings.text))); + PyEngine_netA.ExecStrings4(pystrings); + //synStringReplace(const S, OldPattern,NewPattern:str;Flags:TReplaceFlags):str + println('module list detect: '+ + StringReplace(PyEngine_netA.EvalStr('pylist'),'\n',CR+LF,[rfReplaceAll])); + //PyInpOut_netA.Read('print(49+78,"\n")'); + //PyInpOut_netA.output:= pyMemo; + //PyEngine_netA.IO:= PyInpOut_netA; + + //PyEngine_netA.ExecString(UTF8Encode(mmo_pythoncode.text)); +//https://stackoverflow.com/questions/49599004/how-to-convert-a-python-datetime-to-a-delphi-tdatetime#49599145 + PyEngine_netA.ExecString(UTF8Encode('print(49+78),"\n"')); + PyEngine_netA.ExecString(('from datetime import datetime, timedelta')); + PyEngine_netA.ExecString(UTF8Encode('DELPHI_EPOCH=datetime(1899,12,30)')); + PyEngine_netA.ExecString('def datetime_fromdelphi(dvalue):'+LF+ + ' return DELPHI_EPOCH + timedelta(days=dvalue)'); + println(PyEngine_netA.EvalStr(('datetime_fromdelphi(43191.68205925926)'))); + + //PyEngine_netA.ExecString(('49+78')); + println(PyEngine_netA.EvalStr(('(49+78+2**5),"\n"'+LF))); + println(PyEngine_netA.EvalStr(('__import__("sys").version'))); + except + PyEngine_netA.raiseError; + finally + PyEngine_netA.free; + PyInpOut_netA.free; + FIOPythonModule.Free; + pystrings.Free; + end; +end; + +begin //@main + //myloadscript2:= filetostring(PYSCRIPT2); + //Memo1.beginUpdate; + PyForm:= loadForm2(300,200, clgreen,'PyFrm4D_27'); + pyMemo:= TMemo.create(PyForm); + pyMemo.parent:= PyForm + pymemo.align:= albottom; + PyForm.show; + + PYLaz_P4D_Demo27; + //Memo1.EndUpdate; + + //callDynPy; + + //---register_PYthonGUI;--- +End. +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + +doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191 + +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +maXbox_Starter86_3_Python4maXbox + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. +Or, if you're just using the Python API without the VCL wrappers, TPythonInterface + +Evil eval() + +You should never pass untrusted source to the eval() directly. + For example, the following code can be used to delete all the files from the system. +1 >>> +2 eval('os.system("RM -RF /")') # command is deliberately capitalized +3 >>> + +# demo script +import matplotlib.pyplot as plt +import numpy as np +x = np.arange(0,8*np.pi,0.1) # start,stop,step +y = np.cos(x) *1/(1+x) +plt.plot(x,y) +plt.show() + + +Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download +-------------------------------------------------------- +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. +PascalScript maXbox4 - RemObjects & SynEdit + + +procedure TPythonEngine.DoRedirectIO; +const + code = 'import sys'+LF+ + 'class DebugOutput:'+LF+ + ' pyio = __import__("pyio")'+LF+ + ' softspace=0'+LF+ + ' encoding=None'+LF+ + ' def write(self,message):'+LF+ + ' self.pyio.write(message)'+LF+ + ' def readline(self, size=None):'+LF+ + ' return self.pyio.read(size)'+LF+ + ' def flush(self):' + LF + + ' pass' + LF + + ' def isatty(self):' + LF + + ' return True' + LF + + 'sys.old_stdin=sys.stdin'+LF+ + 'sys.old_stdout=sys.stdout'+LF+ + 'sys.old_stderr=sys.stderr'+LF+ + 'sys.stdin=sys.stderr=sys.stdout=DebugOutput()'+LF+#0; +begin + if csDesigning in ComponentState then + Exit; + CheckPython; + if not Assigned(FIOPythonModule) then + begin + // create a new module called pyio + FIOPythonModule := TPythonModule.Create( Self ); + with FIOPythonModule as TPythonModule do begin + Engine := Self; + ModuleName := 'pyio'; + AddMethod('write', pyio_write, 'write(String) -> None' ); + AddMethod('read', pyio_read, 'read() -> String' ); + AddMethod('SetDelayWrites',pyio_SetDelayWrites,'SetDelayWrites(Boolean)->None'); + AddMethod( 'SetMaxLines', pyio_SetMaxLines, 'SetMaxLines(Integer) -> None' ); + AddMethod( 'GetTypesStats',pyio_GetTypesStats,'GetTypesStats([type name])-> a list of tuple (TypeName, InstanceCount, CreateHits, DeleteHits)' ); + end; + end; + with FIOPythonModule as TPythonModule do + if not Initialized then + Initialize; + // execute the code + ExecString(code); + FIORedirected := True; +end; + + + + + diff --git a/Demos/pydemo28.txt b/Demos/pydemo28.txt new file mode 100644 index 00000000..f8fdfc6d --- /dev/null +++ b/Demos/pydemo28.txt @@ -0,0 +1,330 @@ +Program Python_ThreadsDemo28_Dissasemble; + +//https://arutselvan99.medium.com/python-why-is-faster-than-list-1b52d0ea9ac9 +//https://www.programiz.com/python-programming/time/sleep +//Note: modify PYHOME and PYDLL : + +const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + LB= CR+LF; + +const TH1 = 'def print_hello_three_times(): '+LB+ + ' for i in range(3): '+LB+ + ' winsound.Beep(540, 500) '+LB+ + ' #time.sleep(1.4) '+LB+ + ' return "Hello"'; + +const TH2 = 'def print_hi_three_times(): '+LB+ + ' for i in range(3): '+LB+ + ' print("\a") '+LB+ + ' winsound.Beep(440, 500) '+LB+ + ' return "Hi"'; + +const ATIME='while True: '+LB+ + ' localtime = time.localtime()'+LB+ + ' result = time.strftime("%I:%M:%S %p", localtime)'+LB+ + ' print(result, end="", flush=True)'+LB+ + ' print("\r", end="", flush=True)'+LB+ + ' time.sleep(1)'; + +var PyForm: TForm; pyMemo: TMemo; + pyval: variant; + + +var eng: TPythonEngine; aPythonVersion: TPythonVersion; + PythonVersions: TPythonVersions; AllUserInstall: Boolean; + apd: TApdMeter; + +begin //@main + //myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_VersionThread_Tester_EKON25'); + pyMemo:= TMemo.create(PyForm); + apd:= TApdMeter.create(pyform); + //apd.color:= clyellow; + apd.parent:= pyform; + apd.barcolor:= clred; + apd.position:= 30; + apd.SetBounds(10,100, 150, 150); + apd.visible:= true; + pyMemo.parent:= PyForm + PyForm.show; + aPythonVersion:= TPythonVersion.create; + + //3. replace maps demo + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME; + eng.opendll(PYDLL) + //eng.IO:= pyMemo; + try + eng.Execstring('pets= ("bird","snake","dog","turtle","cat","hamster")'); + // eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)'); + eng.Execstring('uppercased_pets = list(map(str.upper, pets))'); + println('Tip replace maps: '+eng.EvalStr('uppercased_pets')); + pyMemo.lines.add(eng.EvalStr('list(map(str.upper, pets))')); + + eng.Execstr('import dis, winsound, time'); + println('disassemble call1: '+eng.EvalStr('(dis.dis(lambda: []))')); + println('disassemble call2: '+eng.EvalStr('(dis.dis(lambda: list()))')); + //println('def call: '+eng.EvalStr('print_hello_three_times()')); + println('call3: '+eng.evalstr('__import__("dis").dis(lambda: [])')); + //saveString(exepath+'pydis.py', 'import dis'+CRLF+('print(dis.dis(lambda: list()))')); + //saveString(exepath+'pydis.py','import dis'+CRLF+('repr(print(dis.dis(print("TXT"))))'+CRLF)); + //ExecuteShell('py', 'pydis.py'); + saveString(exepath+'pydis.py', 'import dis'+CRLF+('dis.dis(x for x in range(5))')); + println(getDOSOutput('py '+exepath+'pydis.py', exePath)); + + //eng.Execstring(ATIME); + if PythonVersionFromPath(PYHOME, aPythonVersion, false) then begin + aPythonVersion.AssignTo(eng) ; + writeln('Version from path: '+TPythonEngine(eng).RegVersion); + writeln('DLL from path: '+TPythonEngine(eng).DLLName); + end; + {for it:= 10 to 50 do begin + sleep(100) + apd.position:= it; + end;} + except + //eng.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eng.Free; + aPythonVersion.Free; + apd.position:= 100; + end; + + //PYLaz_P4D_Demo2; +End. + +Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable. +writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion)); +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) +t1.start() +t2.start() + +This package implements JSON support for FPC. + + +[Application1] +File Number=3150161893 +TAction=176 +TActionList=12 +TADOCommand=1 +TADOConnection=1 +TADODataSet=2 +TADOQuery=2 +TADOStoredProc=2 +TADOTable=2 +TAfComPort=1 +TAfDataDispatcher=1 +TAfPortComboBox=1 +TAnimate=1 +TApplicationEvents=1 +TBevel=28 +TBitBtn=33 +TBrowseURL=2 +TButton=180 +TCheckBox=61 +TCheckers=1 +TCheckListBox=1 +TChessBrd=1 +TClientDataSet=2 +TColorDialog=7 +TColorSelect=2 +TComboBox=36 +TComboBoxEx=1 +TComComboBox=7 +TComDataPacket=1 +TComLed=2 +TComPort=1 +TComTerminal=1 +TControlBar=1 +TCoolBar=4 +TDataSetProvider=1 +TDataSetTableProducer=1 +TDataSource=6 +TDBGrid=3 +TDBImage=1 +TDBMemo=1 +TDBNavigator=1 +TDirectoryListBox=3 +TDoubleBufferedPanel=1 +TDownLoadURL=2 +TDrawGrid=1 +TDriveComboBox=3 +TEdit=87 +TEditCopy=2 +TEditCut=2 +TEditDelete=2 +TEditPaste=2 +TEditSelectAll=2 +TEditUndo=2 +TFileExit=2 +TFileListBox=2 +TFileOpen=2 +TFileOpenWith=2 +TFilePrintSetup=2 +TFileRun=2 +TFileSaveAs=2 +TFilterComboBox=2 +TFindDialog=1 +TFontDialog=5 +TFontEdit=2 +TGLActor=4 +TGLCadencer=2 +TGLCamera=2 +TGLDummyCube=3 +TGLLightSource=1 +TGLMaterialLibrary=2 +TGLParticleFXRenderer=1 +TGLPointLightPFXManager=1 +TGLScene=2 +TGLSceneViewer=2 +TGLShadowPlane=1 +TGLSphere=1 +TGPS=1 +TGPSCompass=1 +TGPSSatellitesPosition=1 +TGPSSatellitesReception=1 +TGPSSpeed=3 +TGPStoGPX=1 +TGroupBox=45 +THeaderControl=1 +THotKey=1 +THTTPReqResp=1 +THTTPSoapDispatcher=1 +THTTPSoapPascalInvoker=1 +TImage=41 +TImageList=31 +TIntegerField=1 +TJvBrowseForFolderDialog=1 +TJvColorComboBox=4 +TJvFilenameEdit=2 +TKPrintPreview=1 +TLabel=296 +TLabeledEdit=1 +TListBox=23 +TListControlClearSelection=2 +TListControlCopySelection=2 +TListControlDeleteSelection=2 +TListControlMoveSelection=2 +TListControlSelectAll=2 +TListView=9 +TMainMenu=16 +TMemo=21 +TMenuItem=703 +TNextTab=2 +TNotebook=1 +TOpenDialog=15 +TOpenPicture=2 +TOpenPictureDialog=3 +TPage=4 +TPageControl=8 +TPaintBox=4 +TPanel=101 +TPopupMenu=14 +TPreviousTab=2 +TPrintDialog=2 +TPrinterSetupDialog=2 +TProgressBar=2 +TPSDllPlugin=1 +TPSImport_Classes=1 +TPSImport_ComObj=1 +TPSImport_Controls=1 +TPSImport_DateUtils=1 +TPSImport_DB=1 +TPSImport_Forms=1 +TPSImport_StdCtrls=1 +TPSScript=1 +TPSScriptDebugger=1 +TRadioButton=12 +TRadioGroup=11 +TRichEdit=6 +TRichEditAlignCenter=2 +TRichEditAlignLeft=2 +TRichEditAlignRight=2 +TRichEditBold=2 +TRichEditBullets=2 +TRichEditItalic=2 +TRichEditStrikeOut=2 +TRichEditUnderline=2 +TSaveDialog=12 +TSavePictureDialog=1 +TScrollBox=6 +TSearchFind=2 +TSearchFindFirst=2 +TSearchFindNext=2 +TSearchReplace=2 +TSendMail=2 +TShape=2 +TSmallintField=1 +TSpeedButton=82 +TSpinEdit=8 +TSplitter=10 +TStaticListAction=2 +TStaticText=7 +TStatusBar=16 +TStringGrid=2 +TSynAsmSyn=1 +TSynBatSyn=1 +TSynCppSyn=2 +TSynCssSyn=1 +TSynCSSyn=1 +TSynDfmSyn=2 +TSynEdit=2 +TSynEditPrint=1 +TSynEditSearch=2 +TSynEiffelSyn=1 +TSynExporterHTML=2 +TSynExporterRTF=2 +TSynHTMLSyn=1 +TSynIdlSyn=1 +TSynIniSyn=1 +TSynJavaSyn=1 +TSynJScriptSyn=1 +TSynMemo=1 +TSynMsgSyn=1 +TSynMultiSyn=1 +TSynPasSyn=3 +TSynPerlSyn=1 +TSynPHPSyn=1 +TSynPythonSyn=1 +TSynRubySyn=1 +TSynSQLSyn=1 +TSynTeXSyn=1 +TSynUNIXShellScriptSyn=1 +TSynURIOpener=1 +TSynURISyn=1 +TSynVBScriptSyn=1 +TSynVBSyn=1 +TSynXMLSyn=1 +TTabControl=1 +TTabSheet=30 +TTimer=7 +TToolBar=18 +TToolButton=195 +TTrackBar=10 +TTreeView=2 +TUpDown=14 +TWebBrowser=1 +TWideStringField=1 +TWordField=2 +TWSDLHTMLPublish=1 +TXPManifest=1 + + \ No newline at end of file diff --git a/Demos/pydemo29.htm b/Demos/pydemo29.htm new file mode 100644 index 00000000..5dd9ae77 --- /dev/null +++ b/Demos/pydemo29.htm @@ -0,0 +1,169 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000027356 +StartFragment:0000001085 +EndFragment:0000027340 + + + + +mXScriptasHTML + + + + + +
Program Python_ThreadsDemo28_Dissasemble;
+
+//https://arutselvan99.medium.com/python-why-is-faster-than-list-1b52d0ea9ac9
+//https://www.programiz.com/python-programming/time/sleep
+//Note: modify PYHOME and PYDLL :
+
+const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\';
+    PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
+    PYDLL  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+    PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py';
+    LB= CR+LF;
+       
+const TH1 = 'def print_hello_three_times(): '+LB+
+            '  for i in range(3):           '+LB+
+            '    winsound.Beep(540, 500)    '+LB+
+            '    #time.sleep(1.4)           '+LB+
+            '  return "Hello"';
+  
+const TH2 = 'def print_hi_three_times():    '+LB+ 
+            '  for i in range(3):           '+LB+
+            '    print("\a")                '+LB+
+            '    winsound.Beep(440, 500)    '+LB+
+            '  return "Hi"'; 
+            
+const ATIME='while True: '+LB+ 
+            '  localtime = time.localtime()'+LB+ 
+            '  result = time.strftime("%I:%M:%S %p", localtime)'+LB+ 
+            '  print(result, end="", flush=True)'+LB+ 
+            '  print("\r", end="", flush=True)'+LB+ 
+            '  time.sleep(1)';                        
+              
+var  PyForm: TForm; pyMemo: TMemo;
+     pyval: variant;
+     
+
+var eng: TPythonEngine; aPythonVersion: TPythonVersion;
+         PythonVersions: TPythonVersions; AllUserInstall: Boolean;
+         apd: TApdMeter;
+
+begin  //@main
+  //myloadscript2:= filetostring(PYSCRIPT2);
+  
+  PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_VersionThread_Tester_EKON25');
+  pyMemo:= TMemo.create(PyForm);
+  apd:= TApdMeter.create(pyform);
+  //apd.color:= clyellow;
+  apd.parent:= pyform;
+  apd.barcolor:= clred;
+  apd.position:= 30;
+  apd.SetBounds(10,100, 150, 150);
+  apd.visible:= true;
+  pyMemo.parent:= PyForm
+  PyForm.show;
+  aPythonVersion:= TPythonVersion.create;
+  
+ //3. replace maps demo
+   eng:= TPythonEngine.Create(Nil);
+   eng.pythonhome:= PYHOME;
+   eng.opendll(PYDLL)
+   //eng.IO:= pyMemo;
+   try
+     eng.Execstring('pets= ("bird","snake","dog","turtle","cat","hamster")');
+     // eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)');
+     eng.Execstring('uppercased_pets = list(map(str.upper, pets))');
+     println('Tip replace maps: '+eng.EvalStr('uppercased_pets'));
+     pyMemo.lines.add(eng.EvalStr('list(map(str.upper, pets))'));
+     
+     eng.Execstr('import dis, winsound, time');
+     println('disassemble call1: '+eng.EvalStr('(dis.dis(lambda: []))')); 
+     println('disassemble call2: '+eng.EvalStr('(dis.dis(lambda: list()))')); 
+     //println('def call: '+eng.EvalStr('print_hello_three_times()')); 
+     println('call3: '+eng.evalstr('__import__("dis").dis(lambda: [])')); 
+     //saveString(exepath+'pydis.py', 'import dis'+CRLF+('print(dis.dis(lambda: list()))'));
+   //saveString(exepath+'pydis.py','import dis'+CRLF+('repr(print(dis.dis(print("TXT"))))'+CRLF));
+     //ExecuteShell('py', 'pydis.py');
+     saveString(exepath+'pydis.py', 'import dis'+CRLF+('dis.dis(x for x in range(5))'));
+     println(getDOSOutput('py '+exepath+'pydis.py', exePath));
+     
+     //eng.Execstring(ATIME);
+     if PythonVersionFromPath(PYHOME, aPythonVersion, false) then begin
+       aPythonVersion.AssignTo(eng) ;
+       writeln('Version from path: '+TPythonEngine(eng).RegVersion);
+       writeln('DLL from path: '+TPythonEngine(eng).DLLName);
+     end;
+     {for it:= 10 to 50 do begin
+       sleep(100) 
+       apd.position:= it;
+     end;}
+   except
+     //eng.raiseError;
+     writeln(ExceptionToString(ExceptionType, ExceptionParam));
+   finally
+     eng.Free;
+     aPythonVersion.Free;
+     apd.position:= 100;
+  end;  
+  
+ eng:= TPythonEngine.Create(Nil);
+ eng.pythonhome:= PYHOME;
+ eng.opendll(PYDLL)
+  //eng.IO:= pyMemo;
+ try
+   eng.Execstring('with open(r"'+exepath+'maXbox4.exe","rb") as afile:'+
+                           ' fbuf = afile.read()');
+   println(eng.evalstr('__import__("hashlib").sha512('+
+                                 'fbuf).hexdigest().upper()')); 
+ except
+   eng.raiseError;
+ finally
+   eng.Free;
+ end;      
+  
+  //PYLaz_P4D_Demo2; 
+End.
+
+Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable.
+writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion));
+https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib
+
+import threading 
+  
+def print_hello_three_times():
+  for i in range(3):
+    print("Hello")
+  
+def print_hi_three_times(): 
+    for i in range(3): 
+      print("Hi") 
+
+t1 = threading.Thread(target=print_hello_three_times)  
+t2 = threading.Thread(target=print_hi_three_times)  
+t1.start()
+t2.start()
+
+This package implements JSON support for FPC.
+    
+
+ \ No newline at end of file diff --git a/Demos/pydemo29.rtf b/Demos/pydemo29.rtf new file mode 100644 index 00000000..68e4ee25 --- /dev/null +++ b/Demos/pydemo29.rtf @@ -0,0 +1,141 @@ +{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fmodern Courier New;}} +{\colortbl\red0\green0\blue128;\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue128;\red166\green202\blue240;\red0\green128\blue0;\red255\green165\blue0;} +{\info{\comment Generated by the SynEdit RTF exporter} +{\title Untitled}} +\deflang1033\pard\plain\f0\fs20 \cf4\b Program\b0\cf1 Python_ThreadsDemo28_Dissasemble\cf5 ; +\par +\par \cf6\i //https://arutselvan99.medium.com/python-why-is-faster-than-list-1b52d0ea9ac9 +\par //https://www.programiz.com/python-programming/time/sleep +\par //Note: modify PYHOME and PYDLL : +\par +\par \i0\cf4\b const\b0\cf1 \cf6\i //PYHOME = 'C:\\Users\\breitsch\\AppData\\Local\\Programs\\Python\\Python37-32\\'; +\par \i0\cf1 PYHOME \cf5 =\cf1 \cf3 'C:\\Users\\max\\AppData\\Local\\Programs\\Python\\Python36-32\\'\cf5 ; +\par \cf1 PYDLL \cf5 =\cf1 \cf3 'C:\\Users\\max\\AppData\\Local\\Programs\\Python\\Python36-32\\python36.dll'\cf5 ;\cf1 +\par PYSCRIPT \cf5 =\cf1 \cf3 'C:\\maXbox\\maxbox3\\maxbox3\\maXbox3\\examples\\module1maxbox1.py'\cf5 ; +\par \cf1 LB\cf5 =\cf1 CR\cf5 +\cf1 LF\cf5 ; +\par \cf1 +\par \cf4\b const\b0\cf1 TH1 \cf5 =\cf1 \cf3 'def print_hello_three_times(): '\cf5 +\cf1 LB\cf5 + +\par \cf1 \cf3 ' for i in range(3): '\cf5 +\cf1 LB\cf5 + +\par \cf1 \cf3 ' winsound.Beep(540, 500) '\cf5 +\cf1 LB\cf5 + +\par \cf1 \cf3 ' #time.sleep(1.4) '\cf5 +\cf1 LB\cf5 + +\par \cf1 \cf3 ' return "Hello"'\cf5 ; +\par \cf1 +\par \cf4\b const\b0\cf1 TH2 \cf5 =\cf1 \cf3 'def print_hi_three_times(): '\cf5 +\cf1 LB\cf5 +\cf1 +\par \cf3 ' for i in range(3): '\cf5 +\cf1 LB\cf5 + +\par \cf1 \cf3 ' print("\\a") '\cf5 +\cf1 LB\cf5 + +\par \cf1 \cf3 ' winsound.Beep(440, 500) '\cf5 +\cf1 LB\cf5 + +\par \cf1 \cf3 ' return "Hi"'\cf5 ;\cf1 +\par +\par \cf4\b const\b0\cf1 ATIME\cf5 =\cf3 'while True: '\cf5 +\cf1 LB\cf5 +\cf1 +\par \cf3 ' localtime = time.localtime()'\cf5 +\cf1 LB\cf5 +\cf1 +\par \cf3 ' result = time.strftime("%I:%M:%S %p", localtime)'\cf5 +\cf1 LB\cf5 +\cf1 +\par \cf3 ' print(result, end="", flush=True)'\cf5 +\cf1 LB\cf5 +\cf1 +\par \cf3 ' print("\\r", end="", flush=True)'\cf5 +\cf1 LB\cf5 +\cf1 +\par \cf3 ' time.sleep(1)'\cf5 ;\cf1 +\par +\par \cf4\b var\b0\cf1 PyForm\cf5 :\cf1 TForm\cf5 ;\cf1 pyMemo\cf5 :\cf1 TMemo\cf5 ; +\par \cf1 pyval\cf5 :\cf1 variant\cf5 ; +\par \cf1 +\par +\par \cf4\b var\b0\cf1 eng\cf5 :\cf1 TPythonEngine\cf5 ;\cf1 aPythonVersion\cf5 :\cf1 TPythonVersion\cf5 ; +\par \cf1 PythonVersions\cf5 :\cf1 TPythonVersions\cf5 ;\cf1 AllUserInstall\cf5 :\cf1 Boolean\cf5 ; +\par \cf1 apd\cf5 :\cf1 TApdMeter\cf5 ; +\par +\par \cf4\b begin\b0\cf1 \cf6\i //@main +\par \i0\cf1 \cf6\i //myloadscript2:= filetostring(PYSCRIPT2); +\par \i0\cf1 +\par PyForm\cf5 :=\cf1 loadForm2\cf5 (\cf2 200\cf5 ,\cf2 300\cf5 ,\cf1 clgreen\cf5 ,\cf3 'PyFrm4D_VersionThread_Tester_EKON25'\cf5 ); +\par \cf1 pyMemo\cf5 :=\cf1 TMemo\cf5 .\cf1 create\cf5 (\cf1 PyForm\cf5 ); +\par \cf1 apd\cf5 :=\cf1 TApdMeter\cf5 .\cf1 create\cf5 (\cf1 pyform\cf5 ); +\par \cf1 \cf6\i //apd.color:= clyellow; +\par \i0\cf1 apd\cf5 .\cf1 parent\cf5 :=\cf1 pyform\cf5 ; +\par \cf1 apd\cf5 .\cf1 barcolor\cf5 :=\cf1 clred\cf5 ; +\par \cf1 apd\cf5 .\cf1 position\cf5 :=\cf1 \cf2 30\cf5 ; +\par \cf1 apd\cf5 .\cf1 SetBounds\cf5 (\cf2 10\cf5 ,\cf2 100\cf5 ,\cf1 \cf2 150\cf5 ,\cf1 \cf2 150\cf5 ); +\par \cf1 apd\cf5 .\cf1 visible\cf5 :=\cf1 true\cf5 ; +\par \cf1 pyMemo\cf5 .\cf1 parent\cf5 :=\cf1 PyForm +\par PyForm\cf5 .\cf1 show\cf5 ; +\par \cf1 aPythonVersion\cf5 :=\cf1 TPythonVersion\cf5 .\cf1 create\cf5 ; +\par \cf1 +\par \cf6\i //3. replace maps demo +\par \i0\cf1 eng\cf5 :=\cf1 TPythonEngine\cf5 .\cf1 Create\cf5 (\cf4\b Nil\b0\cf5 ); +\par \cf1 eng\cf5 .\cf1 pythonhome\cf5 :=\cf1 PYHOME\cf5 ; +\par \cf1 eng\cf5 .\cf1 opendll\cf5 (\cf1 PYDLL\cf5 ) +\par \cf1 \cf6\i //eng.IO:= pyMemo; +\par \i0\cf1 \cf4\b try +\par \b0\cf1 eng\cf5 .\cf1 Execstring\cf5 (\cf3 'pets= ("bird","snake","dog","turtle","cat","hamster")'\cf5 ); +\par \cf1 \cf6\i // eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)'); +\par \i0\cf1 eng\cf5 .\cf1 Execstring\cf5 (\cf3 'uppercased_pets = list(map(str.upper, pets))'\cf5 ); +\par \cf1 println\cf5 (\cf3 'Tip replace maps: '\cf5 +\cf1 eng\cf5 .\cf1 EvalStr\cf5 (\cf3 'uppercased_pets'\cf5 )); +\par \cf1 pyMemo\cf5 .\cf1 lines\cf5 .\cf1 add\cf5 (\cf1 eng\cf5 .\cf1 EvalStr\cf5 (\cf3 'list(map(str.upper, pets))'\cf5 )); +\par \cf1 +\par eng\cf5 .\cf1 Execstr\cf5 (\cf3 'import dis, winsound, time'\cf5 ); +\par \cf1 println\cf5 (\cf3 'disassemble call1: '\cf5 +\cf1 eng\cf5 .\cf1 EvalStr\cf5 (\cf3 '(dis.dis(lambda: []))'\cf5 ));\cf1 +\par println\cf5 (\cf3 'disassemble call2: '\cf5 +\cf1 eng\cf5 .\cf1 EvalStr\cf5 (\cf3 '(dis.dis(lambda: list()))'\cf5 ));\cf1 +\par \cf6\i //println('def call: '+eng.EvalStr('print_hello_three_times()')); +\par \i0\cf1 println\cf5 (\cf3 'call3: '\cf5 +\cf1 eng\cf5 .\cf1 evalstr\cf5 (\cf3 '__import__("dis").dis(lambda: [])'\cf5 ));\cf1 +\par \cf6\i //saveString(exepath+'pydis.py', 'import dis'+CRLF+('print(dis.dis(lambda: list()))')); +\par \i0\cf1 \cf6\i //saveString(exepath+'pydis.py','import dis'+CRLF+('repr(print(dis.dis(print("TXT"))))'+CRLF)); +\par \i0\cf1 \cf6\i //ExecuteShell('py', 'pydis.py'); +\par \i0\cf1 saveString\cf5 (\cf1 exepath\cf5 +\cf3 'pydis.py'\cf5 ,\cf1 \cf3 'import dis'\cf5 +\cf1 CRLF\cf5 +(\cf3 'dis.dis(x for x in range(5))'\cf5 )); +\par \cf1 println\cf5 (\cf1 getDOSOutput\cf5 (\cf3 'py '\cf5 +\cf1 exepath\cf5 +\cf3 'pydis.py'\cf5 ,\cf1 exePath\cf5 )); +\par \cf1 +\par \cf6\i //eng.Execstring(ATIME); +\par \i0\cf1 \cf4\b if\b0\cf1 PythonVersionFromPath\cf5 (\cf1 PYHOME\cf5 ,\cf1 aPythonVersion\cf5 ,\cf1 false\cf5 )\cf1 \cf4\b then\b0\cf1 \cf4\b begin +\par \b0\cf1 aPythonVersion\cf5 .\cf1 AssignTo\cf5 (\cf1 eng\cf5 )\cf1 \cf5 ; +\par \cf1 writeln\cf5 (\cf3 'Version from path: '\cf5 +\cf1 TPythonEngine\cf5 (\cf1 eng\cf5 ).\cf1 RegVersion\cf5 ); +\par \cf1 writeln\cf5 (\cf3 'DLL from path: '\cf5 +\cf1 TPythonEngine\cf5 (\cf1 eng\cf5 ).\cf1 DLLName\cf5 ); +\par \cf1 \cf4\b end\b0\cf5 ; +\par \cf1 \cf6\i \{for it:= 10 to 50 do begin +\par sleep(100) +\par apd.position:= it; +\par end;\} +\par \i0\cf1 \cf4\b except +\par \b0\cf1 \cf6\i //eng.raiseError; +\par \i0\cf1 writeln\cf5 (\cf1 ExceptionToString\cf5 (\cf1 ExceptionType\cf5 ,\cf1 ExceptionParam\cf5 )); +\par \cf1 \cf4\b finally +\par \b0\cf1 eng\cf5 .\cf1 Free\cf5 ; +\par \cf1 aPythonVersion\cf5 .\cf1 Free\cf5 ; +\par \cf1 apd\cf5 .\cf1 position\cf5 :=\cf1 \cf2 100\cf5 ; +\par \cf1 \cf4\b end\b0\cf5 ;\cf1 +\par +\par eng\cf5 :=\cf1 TPythonEngine\cf5 .\cf1 Create\cf5 (\cf4\b Nil\b0\cf5 ); +\par \cf1 eng\cf5 .\cf1 pythonhome\cf5 :=\cf1 PYHOME\cf5 ; +\par \cf1 eng\cf5 .\cf1 opendll\cf5 (\cf1 PYDLL\cf5 ) +\par \cf1 \cf6\i //eng.IO:= pyMemo; +\par \i0\cf1 \cf4\b try +\par \b0\cf1 eng\cf5 .\cf1 Execstring\cf5 (\cf3 'with open(r"'\cf5 +\cf1 exepath\cf5 +\cf3 'maXbox4.exe","rb") as afile:'\cf5 + +\par \cf1 \cf3 ' fbuf = afile.read()'\cf5 ); +\par \cf1 println\cf5 (\cf1 eng\cf5 .\cf1 evalstr\cf5 (\cf3 '__import__("hashlib").sha512('\cf5 + +\par \cf1 \cf3 'fbuf).hexdigest().upper()'\cf5 ));\cf1 +\par \cf4\b except +\par \b0\cf1 eng\cf5 .\cf1 raiseError\cf5 ; +\par \cf1 \cf4\b finally +\par \b0\cf1 eng\cf5 .\cf1 Free\cf5 ; +\par \cf1 \cf4\b end\b0\cf5 ;\cf1 +\par +\par \cf6\i //PYLaz_P4D_Demo2; +\par \i0\cf4\b End\b0\cf5 . +\par +\par \cf4\b Doc\b0\cf5 :\cf1 One thing \cf4\b to\b0\cf1 note \cf4\b is\b0\cf1 that the map\cf5 ()\cf1 \cf4\b function\b0\cf1 returns an iterable \cf4\b object\b0\cf5 ,\cf1 \cf4\b and\b0\cf1 thus we can use the list\cf5 ()\cf1 \cf4\b function\b0\cf1 \cf4\b to\b0\cf1 generate a list from this iterable\cf5 . +\par \cf1 writeln\cf5 (\cf3 'RegVersion: '\cf5 +\cf1 itoa\cf5 (\cf1 TPythonEngine\cf5 (\cf1 eng\cf5 ).\cf1 RegVersion\cf5 )); +\par \cf1 https\cf5 :\cf6\i //stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib +\par +\par \i0\cf1 import threading +\par +\par \cf4\b def\b0\cf1 print_hello_three_times\cf5 (): +\par \cf1 \cf4\b for\b0\cf1 i \cf4\b in\b0\cf1 range\cf5 (\cf2 3\cf5 ): +\par \cf1 print\cf5 ("\cf1 Hello\cf5 ") +\par \cf1 +\par \cf4\b def\b0\cf1 print_hi_three_times\cf5 ():\cf1 +\par \cf4\b for\b0\cf1 i \cf4\b in\b0\cf1 range\cf5 (\cf2 3\cf5 ):\cf1 +\par print\cf5 ("\cf1 Hi\cf5 ")\cf1 +\par +\par t1 \cf5 =\cf1 threading\cf5 .\cf1 Thread\cf5 (\cf1 target\cf5 =\cf1 print_hello_three_times\cf5 )\cf1 +\par t2 \cf5 =\cf1 threading\cf5 .\cf1 Thread\cf5 (\cf1 target\cf5 =\cf1 print_hi_three_times\cf5 )\cf1 +\par t1\cf5 .\cf1 start\cf5 () +\par \cf1 t2\cf5 .\cf1 start\cf5 () +\par +\par \cf1 This \cf4\b package\b0\cf1 implements JSON support \cf4\b for\b0\cf1 FPC\cf5 . +\par \cf1 +\par } \ No newline at end of file diff --git a/Demos/pydemo29.txt b/Demos/pydemo29.txt new file mode 100644 index 00000000..a62c4bc0 --- /dev/null +++ b/Demos/pydemo29.txt @@ -0,0 +1,156 @@ +Program Python_ThreadsDemo28_Dissasemble; + +//https://arutselvan99.medium.com/python-why-is-faster-than-list-1b52d0ea9ac9 +//https://www.programiz.com/python-programming/time/sleep +//Note: modify PYHOME and PYDLL : + +const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + LB= CR+LF; + +const TH1 = 'def print_hello_three_times(): '+LB+ + ' for i in range(3): '+LB+ + ' winsound.Beep(540, 500) '+LB+ + ' #time.sleep(1.4) '+LB+ + ' return "Hello"'; + +const TH2 = 'def print_hi_three_times(): '+LB+ + ' for i in range(3): '+LB+ + ' print("\a") '+LB+ + ' winsound.Beep(440, 500) '+LB+ + ' return "Hi"'; + +const ATIME='while True: '+LB+ + ' localtime = time.localtime()'+LB+ + ' result = time.strftime("%I:%M:%S %p", localtime)'+LB+ + ' print(result, end="", flush=True)'+LB+ + ' print("\r", end="", flush=True)'+LB+ + ' time.sleep(1)'; + +var PyForm: TForm; pyMemo: TMemo; + pyval: variant; + + +var eng: TPythonEngine; aPythonVersion: TPythonVersion; + PythonVersions: TPythonVersions; AllUserInstall: Boolean; + apd: TApdMeter; + +begin //@main + //myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_VersionThread_Tester_EKON25'); + pyMemo:= TMemo.create(PyForm); + apd:= TApdMeter.create(pyform); + //apd.color:= clyellow; + apd.parent:= pyform; + apd.barcolor:= clred; + apd.position:= 30; + apd.SetBounds(10,100, 150, 150); + apd.visible:= true; + pyMemo.parent:= PyForm + PyForm.show; + aPythonVersion:= TPythonVersion.create; + + //3. replace maps demo + //eng.Free + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME; + eng.opendll(PYDLL) + //eng.free; + //eng.IO:= pyMemo; + try + eng.Execstring('pets= ("bird","snake","dog","turtle","cat","hamster")'); + // eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)'); + eng.Execstring('uppercased_pets = list(map(str.upper, pets))'); + println('Tip replace maps: '+eng.EvalStr('uppercased_pets')); + pyMemo.lines.add(eng.EvalStr('list(map(str.upper, pets))')); + + eng.Execstr('import dis, winsound, time'); + println('disassemble call1: '+eng.EvalStr('(dis.dis(lambda: []))')); + println('disassemble call2: '+eng.EvalStr('(dis.dis(lambda: list()))')); + //println('def call: '+eng.EvalStr('print_hello_three_times()')); + println('call3: '+eng.evalstr('__import__("dis").dis(lambda: [])')); + //saveString(exepath+'pydis.py', 'import dis'+CRLF+('print(dis.dis(lambda: list()))')); + //saveString(exepath+'pydis.py','import dis'+CRLF+('repr(print(dis.dis(print("TXT"))))'+CRLF)); + //ExecuteShell('py', 'pydis.py'); + saveString(exepath+'pydis.py', 'import dis'+CRLF+('dis.dis(x for x in range(5))')); + println(getDOSOutput('py '+exepath+'pydis.py', exePath)); + + eng.Execstr('from collections import defaultdict, Counter'); + eng.Execstr('my_default_dict = defaultdict(list)'); + eng.Execstr('for letter in "the red fox ran as fast as it could":'+LB+ + ' my_default_dict[letter]=+ 1'+LB+ + ' my_default_dict[letter]+= 1'+LB); + println('call defaultdict: '+eng.evalstr('my_default_dict')); + + eng.Execstr('def LetterCount(text):'+LB+ + ' return Counter(c for c in text.lower() if c.isalpha())'); + println('call counter:'+eng.evalstr('Counter("the red fox ran as fast as it could")')); + + //eng.Execstring(ATIME); + if PythonVersionFromPath(PYHOME, aPythonVersion, false) then begin + aPythonVersion.AssignTo(eng) ; + writeln('Version from path: '+TPythonEngine(eng).RegVersion); + writeln('DLL from path: '+TPythonEngine(eng).DLLName); + end; + {for it:= 10 to 50 do begin + sleep(100) + apd.position:= it; + end;} + except + eng.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eng.Free; + aPythonVersion.Free; + //apd.position:= 100; + end; + + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME; + eng.opendll(PYDLL) + //eng.IO:= pyMemo; + try + eng.Execstring('with open(r"'+exepath+'maXbox4.exe","rb") as afile:'+ + ' fbuf = afile.read()'); + println(eng.evalstr('__import__("hashlib").sha512('+ + 'fbuf).hexdigest().upper()')); + except + eng.raiseError; + finally + eng.Free; + end; + + //PYLaz_P4D_Demo2; EKON25 - explicit better than implicit + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME; + eng.loadDLL; + println(GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + eng.Free; + apd.position:= 100; + +End. + +Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable. +writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion)); +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) +t1.start() +t2.start() + +This package implements JSON support for FPC. + \ No newline at end of file diff --git a/Demos/pydemo3.htm b/Demos/pydemo3.htm new file mode 100644 index 00000000..e1fa2aaf --- /dev/null +++ b/Demos/pydemo3.htm @@ -0,0 +1,373 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000059770 +StartFragment:0000001053 +EndFragment:0000059754 + + + + +mXScriptasHTML + + + + + +
Program PyDemo5_Eval_Exec5_10Pythontips;
+
+//https://betterprogramming.pub/10-python-tips-for-competitive-programming-bae8375dd73b
+
+//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas
+//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine
+//https://thepythonguru.com/python-builtin-functions/eval/
+//https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/
+//https://stackoverflow.com/questions/359498/how-can-i-unload-a-dll-using-ctypes-in-python
+//https://levelup.gitconnected.com/5-powerful-python-one-liners-you-should-know-469b9c4737c7
+
+//interface   - customize your PY environment first
+{uses
+  Classes, SysUtils,
+  Windows, Messages, Graphics, Controls, Forms, Dialogs,
+  StdCtrls, ComCtrls, ExtCtrls,
+  PythonEngine, Vcl.PythonGUIInputOutput, PythonVersions.pas ;   }  
+  
+{procedure PyFinalize();
+      external 
+  'Py_Finalize@C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll stdcall';   }    
+//Note: modify PYHOME and PYDLL :
+
+const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\';
+    PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
+    PYDLL  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+    PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py';
+    PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py';
+    LB = CR+LF;
+       
+const PyModule =
+              'def printData(data): '+#13#10+
+              '  return data+data+"/n"';       
+         
+const PYCMD = 'print("this is box")'+LB+ 
+              'import sys'+LB+ 
+              'f=open(r"1050pytest21_5powers.txt","w")'+LB+
+              'f.write("Hello PyWorld_mX47580, \n")'+LB+
+              'f.write("This data will be written on the file.")'+LB+ 
+              'f.close()';
+              
+var myloadscript: string;
+     PyForm: TForm; pyMemo: TMemo;
+     avar: string; pyval: variant; pyint: integer;
+     
+ function AddWhereClause4: string;
+  var
+    Start: PChar;
+    Rest, FName, SQL: string;
+    SQLToken, CurSection: TSQLToken;
+  begin
+    Start := PChar(SQL);
+    CurSection := stUnknown;
+    repeat
+      SQLToken := NextSQLToken(Start, FName, CurSection);
+    until SQLToken in [stFrom, stEnd];
+    if SQLToken = stFrom then
+      NextSQLToken(Start, FName, CurSection);
+    Rest := string(Start);
+    if Rest = '' then
+      Result := SQL + ' ' {+ GenerateParamSQL }
+    else
+      Result := Copy(SQL, 1, pos(Rest, SQL)) + ' ' + {GenerateParamSQL +} Rest;
+      //DecomposeDatabaseName
+  end;
+
+
+Procedure PYLaz_P4D_Demo2;
+//https://wiki.freepascal.org/Python4Delphi 
+var eng : TPythonEngine;
+    Out1: TPythonGUIInputOutput;
+    pystrings: TStrings;
+begin
+  eng:= TPythonEngine.Create(Nil);
+  Out1:= TPythonGUIInputOutput.create(nil)
+  Out1.output:= pyMemo; //debugout.output; or memo2;
+  Out1.RawOutput:= True;
+  Out1.UnicodeIO:= False;
+  Out1.maxlines:= 20;
+  out1.displaystring('this string thing draw the line')
+  
+  writeln(botostr(Isx64(PYDLL)));
+  //writeln(botostr(Isx64(pydllpath2)));
+  //eng.dllpath:= exepath;
+  //eng.dllname:='python37.dll';
+  eng.pythonhome:= PYHOME;
+  try
+   //pymod.InitializeForNewInterpreter; //}
+   //pymod.engine:= eng;
+    eng.opendll(PYDLL)
+    //eng.loadDLL;
+    eng.IO:= Out1;
+    eng.traceback
+    eng.AutoFinalize:= True; 
+    //eng.AutoUnload:= false; 
+    writeln(eng.dllname);
+    //pymod.engine:= eng;
+    if eng.IsHandleValid then begin
+      writeln('DLLhandle: '+botostr(eng.IsHandleValid))
+      WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]'));
+      WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])'));
+      WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])'));
+      
+      WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))'));
+      WriteLn('powerline2: '+ 
+               eng.EvalStr('list(map(float,["1",2,"3.0",4.0,"5",6]))'));
+               eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))');
+      WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)'));
+      
+               eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]');
+               eng.Execstring('transpose_A = [list(i) for i in zip(*A)]');
+      WriteLn('powerline4: '+ eng.EvalStr('transpose_A'));  
+      
+      eng.ExecString('print("powers:",[x**2 for x in range(10)])');
+      writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(PYCMD)));
+      eng.ExecString(PYCMD);
+      
+      
+     (* eng.ExecString('import subprocess');  
+      eng.ExecString('subprocess.call(["pip", "install", "sympy"])')
+      eng.ExecString('from sympy import *');
+      eng.ExecString('from sympy.plotting import plot'); 
+      writeln(eng.EvalStr('list(primerange(7, 150))'));
+      writeln(eng.EvalStr('sum(list(primerange(0, 100)))'));
+      writeln(eng.EvalStr('(list(primerange(0, 101)))'));
+      writeln(eng.EvalStr('len(list(primerange(0, 101)))'));
+      //https://www.tutorialspoint.com/sympy/sympy_solvers.htm
+      avar:= '-2';
+      eng.ExecString('x=Symbol("x")');
+      eng.ExecString('x,y=symbols("x y")');
+      writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)'));
+      writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)'));
+      writeln(eng.EvalStr('solveset(exp(x),x)'));
+      println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))'));
+       *)
+     
+      //eng.ExecString('plot(x**'+avar+', line_color="red")');
+      //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))');
+      {
+      eng.ExecString('from sympy.plotting import plot3d'); 
+      eng.ExecString('x,y=symbols("x y") '); 
+      eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); }
+      
+      WriteLn('powerline6: '+ eng.EvalStr('len(str(2**4096))'));
+      pymemo.lines.add('Decimal: '+ 
+              eng.EvalStr('__import__("decimal").Decimal((0,(3,1,4),-2))'));
+      pymemo.lines.add('Decimal: '+ 
+              eng.EvalStr('__import__("decimal").Decimal(0.1)')); 
+      eng.ExecString('import decimal')  
+      //https://www.w3schools.com/python/python_ref_functions.asp      
+      writeln('is instance: '+eng.EvalStr('isinstance(decimal.Decimal,'+
+                    '(float, int, str, list, dict, tuple, type))')); 
+      writeln('is type: '+eng.EvalStr('type(str(decimal.Decimal(0.1)))'));
+      writeln('is type: '+eng.EvalStr('type(float(decimal.Decimal(0.1)))'));
+      writeln('is type: '+eng.EvalStr('type(decimal.Decimal)')); 
+      writeln('is type: '+eng.EvalStr('type(decimal)'));                    
+      //eng.ExecString('from spacy import *');
+      //eng.ExecString('from nltk.classify import MaxentClassifier')          
+      eng.ExecString('print("2*4")');   
+      
+      //1. Checking Memory Usage of Any Object  
+      eng.Execstring('import sys');
+      eng.Execstring('dic = {"a": 3, "b": 2, "c": 1, "d": 1}'); 
+      println('tip1: '+ eng.EvalStr('sys.getsizeof(dic)'));
+      
+      //2. Use of Map Function
+      println('tip2: '+eng.EvalStr('list(map(int,("12345678").split()))'));
+      
+      //3. Sort List of Tuples by Any Index of Tuple Value
+      eng.Execstring('val=[("first",3,9),("second",4,6),("third",2,3)]');
+      eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)');
+      println('tip3: '+eng.EvalStr('val'));
+       
+      //4. Wise Use of Python Dictionary Comprehension 
+      eng.Execstring('dic= [(str(i)+" element", i*2) for i in range(5)]'); 
+      println('tip4: '+eng.EvalStr('dict(dic)')); 
+      
+      //5. Magical Use of Filter Function
+      println('tip5: '+eng.EvalStr('list(filter(lambda x: x%2, range(15)))'));
+      
+      //6. Get Your Permutated Strings 
+      eng.Execstring('import itertools');
+      println('tip6: '+eng.EvalStr('list(itertools.permutations("MAX",3))'));
+      
+      //7. Convert Your List Into a Single String
+      println('tip7: '+
+            eng.EvalStr('" ".join(["This", "is", "a", "list" ,"elements."])'));
+            
+      //8. Check for Anagrams
+      pystrings:= TStringlist.create;
+      pystrings.add('def is_anagram(str1, str2):')
+      pystrings.add(' return sorted(str1) == sorted(str2)')
+      //eng.EvalStringsAsStr(pystrings);
+      eng.ExecStrings4(pystrings);
+      print('tip8: '+eng.EvalStr('is_anagram("HAPPY", "NoSAD")'));
+      print(' tip8: '+eng.EvalStr('is_anagram("ANAGRAM", "RAGMANA")'));
+      //pystrings.add('is_anagram('HAPPY', 'NoSAD'))')
+      pystrings.free;
+      
+      //9. Perfect Use of Comparison Operators
+      eng.Execstring('n=16');
+      println('tip9: '+eng.EvalStr('15 < n < 20'));
+      
+      //10. Check for Time Complexity
+      OpenWeb('https://wiki.python.org/moin/TimeComplexity')
+      
+      pyval:= VarPythonEval('sum([x for x in range(201)])');
+      //writeln('evalvar '+botostr(VarIsPythonList(pyval)));
+      writeln('evalvar '+botostr(VarIsnumeric(pyval)));
+      pyval:= NewPythonDict;
+      writeln(botostr(VarIsPython( pyval)));
+      pyval := (VarPythonEval('2 ** 3'));         
+     { eng.ExecString('import subprocess');  
+      eng.ExecString('subprocess.call(["pip", "install", "langdetect"])')
+      eng.ExecString('from langdetect import detect'); 
+      println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")'));
+      }
+      Out1.output:= pyMemo; 
+      pymemo.update;
+    end
+      else writeln('invalid library handle! '+Getlasterrortext);
+    println('PythonOK: '+botostr(PythonOK));  
+  except
+     eng.raiseError;
+     writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam));
+  //PyErr Exception: Access violation at address 50F49DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000022.
+  finally
+     //eng.close 
+     eng.unloaddll; 
+     //PyFinalize();
+     eng.free;
+     //PyFinalize();
+  end;     
+  out1.free;
+  //pyImport(PyModule);
+end;
+
+begin  //@main
+  //PythonEngine1.Free;
+  //myloadscript2:= filetostring(PYSCRIPT2);
+  
+  PyForm:= loadForm2(300,200, clgreen,'PyFrm4D');
+  pyMemo:= TMemo.create(PyForm);
+  pyMemo.parent:= PyForm
+  PyForm.show;
+  
+  PYLaz_P4D_Demo2; 
+  
+  //register_PYthonGUI;
+End.
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191
+
+https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib
+
+Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL.
+Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before.
+
+Evil eval()
+
+You should never pass untrusted source to the eval() directly. As it is quite easy for the malicious user to wreak havoc on your system. For example, the following code can be used to delete all the files from the system.
+
+1 >>>
+2 eval('os.system("RM -RF /")') # command is deliberately capitalized
+3 >>>
+
+
+Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download
+--------------------------------------------------------
+dll EXCEPT Exception: There is already one instance of TPythonEngine running.
+TRUE
+Exception: Python is not properly initialized.
+PascalScript maXbox4 - RemObjects & SynEdit
+
+dll EXCEPT Exception: There is already one instance of TPythonEngine running.
+TRUE
+Exception: Python is not properly initialized.
+
+dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E.
+TRUE
+Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD.
+
+mapdll EXCEPT Exception: There is already one instance of TPythonEngine running.
+PythonOK TRUE
+ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC.
+ mX4 executed: 26/07/2021 13:30:51  Runtime: 0:0:2.48  Memload: 71% use
+ 
+Example 3: Python multithreading
+
+All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program.
+
+
+import threading 
+  
+def print_hello_three_times():
+  for i in range(3):
+    print("Hello")
+  
+def print_hi_three_times(): 
+    for i in range(3): 
+      print("Hi") 
+
+t1 = threading.Thread(target=print_hello_three_times)  
+t2 = threading.Thread(target=print_hi_three_times)  
+
+t1.start()
+t2.start()
+
+This package implements JSON support for FPC.
+
+You might want to have a look at the lazarus jsonviewer tool, written using
+fpJSON (see lazarus/tools/jsonviewer). It visualizes the fpJSON data and
+shows how to program using fpjson.
+
+JSON support consists of 3 parts:
+
+unit fpJSON contains the data representation. Basically, it defines a set of
+classes:
+
+TJSONData
++- TJSONNumber
+   +- TJSONIntegerNumber
+   +- TJSONFloatNumber
+   +- TJSONInt64Number
++- TJSONString
++- TJSONBoolean
++- TJSONNull
++- TJSONObject
++- TJSONArray
+
+The TJSONData.JSONType property is an enumerated:
+TJSONtype = (jtUnknown, jtNumber, jtString, jtBoolean, jtNull, jtArray, jtObject);
+
+Which allows to determine the type of a value.
+
+
+
+    
+
+ \ No newline at end of file diff --git a/Demos/pydemo3.txt b/Demos/pydemo3.txt new file mode 100644 index 00000000..45e6de4f --- /dev/null +++ b/Demos/pydemo3.txt @@ -0,0 +1,340 @@ +Program PyDemo5_Eval_Exec5_10Pythontips; + +//https://betterprogramming.pub/10-python-tips-for-competitive-programming-bae8375dd73b + +//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas +//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine +//https://thepythonguru.com/python-builtin-functions/eval/ +//https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/ +//https://stackoverflow.com/questions/359498/how-can-i-unload-a-dll-using-ctypes-in-python +//https://levelup.gitconnected.com/5-powerful-python-one-liners-you-should-know-469b9c4737c7 + +//interface - customize your PY environment first +{uses + Classes, SysUtils, + Windows, Messages, Graphics, Controls, Forms, Dialogs, + StdCtrls, ComCtrls, ExtCtrls, + PythonEngine, Vcl.PythonGUIInputOutput, PythonVersions.pas ; } + +{procedure PyFinalize(); + external + 'Py_Finalize@C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll stdcall'; } +//Note: modify PYHOME and PYDLL : + +const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py'; + LB = CR+LF; + +const PyModule = + 'def printData(data): '+#13#10+ + ' return data+data+"/n"'; + +const PYCMD = 'print("this is box")'+LB+ + 'import sys'+LB+ + 'f=open(r"1050pytest21_5powers.txt","w")'+LB+ + 'f.write("Hello PyWorld_mX47580, \n")'+LB+ + 'f.write("This data will be written on the file.")'+LB+ + 'f.close()'; + +var myloadscript: string; + PyForm: TForm; pyMemo: TMemo; + avar: string; pyval: variant; pyint: integer; + + function AddWhereClause4: string; + var + Start: PChar; + Rest, FName, SQL: string; + SQLToken, CurSection: TSQLToken; + begin + Start := PChar(SQL); + CurSection := stUnknown; + repeat + SQLToken := NextSQLToken(Start, FName, CurSection); + until SQLToken in [stFrom, stEnd]; + if SQLToken = stFrom then + NextSQLToken(Start, FName, CurSection); + Rest := string(Start); + if Rest = '' then + Result := SQL + ' ' {+ GenerateParamSQL } + else + Result := Copy(SQL, 1, pos(Rest, SQL)) + ' ' + {GenerateParamSQL +} Rest; + //DecomposeDatabaseName + end; + + +Procedure PYLaz_P4D_Demo2; +//https://wiki.freepascal.org/Python4Delphi +var eng : TPythonEngine; + Out1: TPythonGUIInputOutput; + pystrings: TStrings; +begin + eng:= TPythonEngine.Create(Nil); + Out1:= TPythonGUIInputOutput.create(nil) + Out1.output:= pyMemo; //debugout.output; or memo2; + Out1.RawOutput:= True; + Out1.UnicodeIO:= False; + Out1.maxlines:= 20; + out1.displaystring('this string thing draw the line') + + writeln(botostr(Isx64(PYDLL))); + //writeln(botostr(Isx64(pydllpath2))); + //eng.dllpath:= exepath; + //eng.dllname:='python37.dll'; + eng.pythonhome:= PYHOME; + try + //pymod.InitializeForNewInterpreter; //} + //pymod.engine:= eng; + eng.opendll(PYDLL) + //eng.loadDLL; + eng.IO:= Out1; + eng.traceback + eng.AutoFinalize:= True; + //eng.AutoUnload:= false; + writeln(eng.dllname); + //pymod.engine:= eng; + if eng.IsHandleValid then begin + writeln('DLLhandle: '+botostr(eng.IsHandleValid)) + WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]')); + WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])')); + WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])')); + + WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))')); + WriteLn('powerline2: '+ + eng.EvalStr('list(map(float,["1",2,"3.0",4.0,"5",6]))')); + eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))'); + WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)')); + + eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]'); + eng.Execstring('transpose_A = [list(i) for i in zip(*A)]'); + WriteLn('powerline4: '+ eng.EvalStr('transpose_A')); + + eng.ExecString('print("powers:",[x**2 for x in range(10)])'); + writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(PYCMD))); + eng.ExecString(PYCMD); + + + (* eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "sympy"])') + eng.ExecString('from sympy import *'); + eng.ExecString('from sympy.plotting import plot'); + writeln(eng.EvalStr('list(primerange(7, 150))')); + writeln(eng.EvalStr('sum(list(primerange(0, 100)))')); + writeln(eng.EvalStr('(list(primerange(0, 101)))')); + writeln(eng.EvalStr('len(list(primerange(0, 101)))')); + //https://www.tutorialspoint.com/sympy/sympy_solvers.htm + avar:= '-2'; + eng.ExecString('x=Symbol("x")'); + eng.ExecString('x,y=symbols("x y")'); + writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)')); + writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)')); + writeln(eng.EvalStr('solveset(exp(x),x)')); + println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))')); + *) + + //eng.ExecString('plot(x**'+avar+', line_color="red")'); + //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))'); + { + eng.ExecString('from sympy.plotting import plot3d'); + eng.ExecString('x,y=symbols("x y") '); + eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); } + + WriteLn('powerline6: '+ eng.EvalStr('len(str(2**4096))')); + pymemo.lines.add('Decimal: '+ + eng.EvalStr('__import__("decimal").Decimal((0,(3,1,4),-2))')); + pymemo.lines.add('Decimal: '+ + eng.EvalStr('__import__("decimal").Decimal(0.1)')); + eng.ExecString('import decimal') + //https://www.w3schools.com/python/python_ref_functions.asp + writeln('is instance: '+eng.EvalStr('isinstance(decimal.Decimal,'+ + '(float, int, str, list, dict, tuple, type))')); + writeln('is type: '+eng.EvalStr('type(str(decimal.Decimal(0.1)))')); + writeln('is type: '+eng.EvalStr('type(float(decimal.Decimal(0.1)))')); + writeln('is type: '+eng.EvalStr('type(decimal.Decimal)')); + writeln('is type: '+eng.EvalStr('type(decimal)')); + //eng.ExecString('from spacy import *'); + //eng.ExecString('from nltk.classify import MaxentClassifier') + eng.ExecString('print("2*4")'); + + //1. Checking Memory Usage of Any Object + eng.Execstring('import sys'); + eng.Execstring('dic = {"a": 3, "b": 2, "c": 1, "d": 1}'); + println('tip1: '+ eng.EvalStr('sys.getsizeof(dic)')); + + //2. Use of Map Function + println('tip2: '+eng.EvalStr('list(map(int,("12345678").split()))')); + + //3. Sort List of Tuples by Any Index of Tuple Value + eng.Execstring('val=[("first",3,9),("second",4,6),("third",2,3)]'); + eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)'); + println('tip3: '+eng.EvalStr('val')); + + //4. Wise Use of Python Dictionary Comprehension + eng.Execstring('dic= [(str(i)+" element", i*2) for i in range(5)]'); + println('tip4: '+eng.EvalStr('dict(dic)')); + + //5. Magical Use of Filter Function + println('tip5: '+eng.EvalStr('list(filter(lambda x: x%2, range(15)))')); + + //6. Get Your Permutated Strings + eng.Execstring('import itertools'); + println('tip6: '+eng.EvalStr('list(itertools.permutations("MAX",3))')); + + //7. Convert Your List Into a Single String + println('tip7: '+ + eng.EvalStr('" ".join(["This", "is", "a", "list" ,"elements."])')); + + //8. Check for Anagrams + pystrings:= TStringlist.create; + pystrings.add('def is_anagram(str1, str2):') + pystrings.add(' return sorted(str1) == sorted(str2)') + //eng.EvalStringsAsStr(pystrings); + eng.ExecStrings4(pystrings); + print('tip8: '+eng.EvalStr('is_anagram("HAPPY", "NoSAD")')); + print(' tip8: '+eng.EvalStr('is_anagram("ANAGRAM", "RAGMANA")')); + //pystrings.add('is_anagram('HAPPY', 'NoSAD'))') + pystrings.free; + + //9. Perfect Use of Comparison Operators + eng.Execstring('n=16'); + println('tip9: '+eng.EvalStr('15 < n < 20')); + + //10. Check for Time Complexity + OpenWeb('https://wiki.python.org/moin/TimeComplexity') + + pyval:= VarPythonEval('sum([x for x in range(201)])'); + //writeln('evalvar '+botostr(VarIsPythonList(pyval))); + writeln('evalvar '+botostr(VarIsnumeric(pyval))); + pyval:= NewPythonDict; + writeln(botostr(VarIsPython( pyval))); + pyval := (VarPythonEval('2 ** 3')); + { eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "langdetect"])') + eng.ExecString('from langdetect import detect'); + println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")')); + } + Out1.output:= pyMemo; + pymemo.update; + end + else writeln('invalid library handle! '+Getlasterrortext); + println('PythonOK: '+botostr(PythonOK)); + except + eng.raiseError; + writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam)); + //PyErr Exception: Access violation at address 50F49DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000022. + finally + //eng.close + eng.unloaddll; + //PyFinalize(); + eng.free; + //PyFinalize(); + end; + out1.free; + //pyImport(PyModule); +end; + +begin //@main + //PythonEngine1.Free; + //myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(300,200, clgreen,'PyFrm4D'); + pyMemo:= TMemo.create(PyForm); + pyMemo.parent:= PyForm + PyForm.show; + + PYLaz_P4D_Demo2; + + //register_PYthonGUI; +End. +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + +doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191 + +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. +Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before. + +Evil eval() + +You should never pass untrusted source to the eval() directly. As it is quite easy for the malicious user to wreak havoc on your system. For example, the following code can be used to delete all the files from the system. + +1 >>> +2 eval('os.system("RM -RF /")') # command is deliberately capitalized +3 >>> + + +Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download +-------------------------------------------------------- +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. +PascalScript maXbox4 - RemObjects & SynEdit + +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. + +dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E. +TRUE +Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD. + +mapdll EXCEPT Exception: There is already one instance of TPythonEngine running. +PythonOK TRUE +ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC. + mX4 executed: 26/07/2021 13:30:51 Runtime: 0:0:2.48 Memload: 71% use + +Example 3: Python multithreading + +All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program. + + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) + +t1.start() +t2.start() + +This package implements JSON support for FPC. + +You might want to have a look at the lazarus jsonviewer tool, written using +fpJSON (see lazarus/tools/jsonviewer). It visualizes the fpJSON data and +shows how to program using fpjson. + +JSON support consists of 3 parts: + +unit fpJSON contains the data representation. Basically, it defines a set of +classes: + +TJSONData ++- TJSONNumber + +- TJSONIntegerNumber + +- TJSONFloatNumber + +- TJSONInt64Number ++- TJSONString ++- TJSONBoolean ++- TJSONNull ++- TJSONObject ++- TJSONArray + +The TJSONData.JSONType property is an enumerated: +TJSONtype = (jtUnknown, jtNumber, jtString, jtBoolean, jtNull, jtArray, jtObject); + +Which allows to determine the type of a value. + + + + \ No newline at end of file diff --git a/Demos/pydemo30.htm b/Demos/pydemo30.htm new file mode 100644 index 00000000..c70caab6 --- /dev/null +++ b/Demos/pydemo30.htm @@ -0,0 +1,233 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000044326 +StartFragment:0000001053 +EndFragment:0000044310 + + + + +mXScriptasHTML + + + + + +
Program Python_Delphi_PrimeTime30_Compare;
+
+//https://arutselvan99.medium.com/python-why-is-faster-than-list-1b52d0ea9ac9
+//https://www.programiz.com/python-programming/time/sleep
+//Note: modify PYHOME and PYDLL :
+
+Const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\';
+    PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
+    PYDLL  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+    PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py';
+    LB= CR+LF;
+       
+const PRIME =  'def py_is_prime(n):'+LB+
+               '  import math'+LB+
+               '  """ totally naive implementation """'+LB+
+               '  if n <= 1:'+LB+
+               '    return False'+LB+
+               '  q = math.floor(math.sqrt(n))'+LB+
+               '  for i in range(2, q + 1):'+LB+
+               '    if (n % i == 0):'+LB+
+               '      return False'+LB+
+               '  return True';
+
+//   Delphi func with exit()
+function D_IsPrime(x: Integer): Boolean;
+var q, i: integer;
+begin 
+  if (x <= 1) then begin
+    result:= false
+    Exit;
+  end;  
+  q:= Floor(Sqrt(x)); 
+     for i:= 2 to q do 
+       if (x mod i = 0) then begin
+        result:= false;
+        Exit;
+       end;
+    result:= True
+    Exit;
+  end;
+  
+function D_IsPrime2Slow(N: Integer): Boolean;
+var M: Integer;
+begin
+  synAssert(N > 0);
+  if N = 1 then begin// annoying special case
+    Result := False;
+    exit;
+  end;
+  //for M := 2 to (N div 2) do begin
+  for M := 2 to floor(Sqrt(N)) do begin
+    if N mod M = 0 then begin
+      Result := False;
+      exit;
+    end;
+  end;
+  Result:= True;
+end; 
+  
+{ Returns a count of the number of occurences of SubText in Text }
+function CountOccurences( const SubText: string;
+                          const Text: string): Integer;
+begin
+  Result := Pos(SubText, Text); 
+  if Result > 0 then
+    Result:= (Length(Text)-Length(StringReplace(Text,SubText,'',
+                             [rfReplaceAll]))) div  Length(subtext);
+end;  { CountOccurences }
+  
+const ATIME='while True: '+LB+ 
+            '  localtime = time.localtime()'+LB+ 
+            '  result = time.strftime("%I:%M:%S %p", localtime)'+LB+ 
+            '  print(result, end="", flush=True)'+LB+ 
+            '  print("\r", end="", flush=True)'+LB+ 
+            '  time.sleep(1)';                        
+              
+var  PyForm: TForm; pyMemo: TMemo; pyval: variant;
+     eng: TPythonEngine; aPythonVersion: TPythonVersion;
+     PythonVersions: TPythonVersions; AllUserInstall: Boolean;
+     apd: TApdMeter; primelist: TStringlist; sw: TStopWatch; mpr: TPrimes;
+
+begin  //@main
+  //myloadscript2:= filetostring(PYSCRIPT2);
+  PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_VersionThread_Tester_EKON25');
+  pyMemo:= TMemo.create(PyForm);
+  apd:= TApdMeter.create(pyform);
+  //apd.color:= clyellow;
+  apd.parent:= pyform;
+  apd.barcolor:= clred;
+  apd.position:= 30;
+  apd.SetBounds(10,100, 150, 150);
+  apd.visible:= true;
+  pyMemo.parent:= PyForm
+  PyForm.show;
+  aPythonVersion:= TPythonVersion.create;
+  
+ //3. replace maps demo
+  eng:= TPythonEngine.Create(Nil);
+  eng.pythonhome:= PYHOME;
+  eng.opendll(PYDLL)
+  //eng.free;
+  //eng.IO:= pyMemo;
+  try
+    eng.Execstring('pets= ("bird","snake","dog","turtle","cat","hamster","monster")');
+    // eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)');
+    eng.Execstring('uppercased_pets = list(map(str.upper, pets))');
+    println('Tip replace maps: '+eng.EvalStr('uppercased_pets'));
+    pyMemo.lines.add(eng.EvalStr('list(map(str.upper, pets))'));
+     
+    eng.Execstr('import dis, winsound, time');
+    println('disassemble call1: '+eng.EvalStr('(dis.dis(lambda: []))')); 
+    println('disassemble call2: '+eng.EvalStr('(dis.dis(lambda: list()))')); 
+     
+    //eng.Execstring(ATIME);
+    eng.Execstring(PRIME);
+    println('primetest: '+eng.EvalStr('py_is_prime(4703)'));
+    primelist:= TStringlist.create;
+    //https://www.wolframalpha.com/input/?i=primes+between+4700+and+4800
+    sw:= TStopWatch.Create();
+    sw.Start;
+    for it:= 1000 to 11000 do 
+      //println(+itoa(it)+' primetest: '+eng.EvalStr('py_is_prime('+itoa(it)+')'));
+       primelist.add(eng.EvalStr('py_is_prime('+itoa(it)+')'));
+    //writeln('count primes1: '+itoa(CountOccurences('True',primelist.text)));
+    println('count primes1: '+itoa(SubstringCount('True', primelist.text)));
+    sw.Stop;
+    //sw.ElapsedMilliseconds;
+    writeln('Stop Watch Prime Tester1: '+sw.getValueStr)
+    primelist.clear;
+    sw.Start;
+    for it:= 1000 to 11000 do 
+      primelist.add(botostr(D_IsPrime(it)));
+    writeln('count primes2: '+itoa(SubstringCount('TRUE', primelist.text)));
+    sw.stop;
+    writeln('Stop Watch Prime Tester2: '+sw.getValueStr);
+    primelist.clear;
+    mpr:= TPrimes.create;
+    sw.Start;
+    writeln('compiled pretest '+botostr(mpr.isprime(4703)))
+    for it:= 1000 to 11000 do 
+      primelist.add(botostr(mpr.IsPrime(it)));
+    {for it:= 0 to 500000 do begin 
+       if it mod 100000 = 0 then apd.position:= apd.position+10;
+       primelist.add(botostr(mpr.IsPrime(it)));
+    end; }  
+    writeln('count primes3: '+itoa(SubstringCount('TRUE', primelist.text)));   
+    sw.stop;
+    writeln('Stop Watch Prime Tester3: '+sw.getValueStr);
+    
+    if PythonVersionFromPath(PYHOME, aPythonVersion, false) then begin
+      aPythonVersion.AssignTo(eng) ;
+      writeln('Version from path: '+TPythonEngine(eng).RegVersion);
+      writeln('DLL from path: '+TPythonEngine(eng).DLLName);
+    end;
+  except
+    eng.raiseError;
+    writeln(ExceptionToString(ExceptionType, ExceptionParam));
+  finally
+    eng.Free;
+    aPythonVersion.Free;
+    primelist.Free;
+    mpr.Free;
+    sw.Free;
+ end;  
+  
+  //PYLaz_P4D_Demo2;   EKON25 - explicit better than implicit
+  eng:= TPythonEngine.Create(Nil);
+  eng.pythonhome:= PYHOME;
+  eng.loadDLL;
+  println(GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); 
+  eng.Free;
+  apd.position:= 100;
+  
+End.
+
+Ref: 78498 prime numbers:
+ mX4 executed: 19/10/2021 12:28:54  Runtime: 0:0:16.485  Memload: 74% use
+ mX4 executed: 19/10/2021 11:59:40  Runtime: 0:1:4.390  Memload: 72% use
+
+Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable.
+writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion));
+https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib
+
+import threading 
+  
+def print_hello_three_times():
+  for i in range(3):
+    print("Hello")
+  
+def print_hi_three_times(): 
+    for i in range(3): 
+      print("Hi") 
+
+t1 = threading.Thread(target=print_hello_three_times)  
+t2 = threading.Thread(target=print_hi_three_times)  
+t1.start()
+t2.start()
+
+This package implements JSON support for FPC.
+    
+
+ \ No newline at end of file diff --git a/Demos/pydemo30.txt b/Demos/pydemo30.txt new file mode 100644 index 00000000..fffb5ba7 --- /dev/null +++ b/Demos/pydemo30.txt @@ -0,0 +1,200 @@ +Program Python_Delphi_PrimeTime30_Compare; + +//https://arutselvan99.medium.com/python-why-is-faster-than-list-1b52d0ea9ac9 +//https://www.programiz.com/python-programming/time/sleep +//Note: modify PYHOME and PYDLL : + +Const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + LB= CR+LF; + +const PRIME = 'def py_is_prime(n):'+LB+ + ' import math'+LB+ + ' """ totally naive implementation """'+LB+ + ' if n <= 1:'+LB+ + ' return False'+LB+ + ' q = math.floor(math.sqrt(n))'+LB+ + ' for i in range(2, q + 1):'+LB+ + ' if (n % i == 0):'+LB+ + ' return False'+LB+ + ' return True'; + +// Delphi func with exit() +function D_IsPrime(x: Integer): Boolean; +var q, i: integer; +begin + if (x <= 1) then begin + result:= false + Exit; + end; + q:= Floor(Sqrt(x)); + for i:= 2 to q do + if (x mod i = 0) then begin + result:= false; + Exit; + end; + result:= True + Exit; + end; + +function D_IsPrime2Slow(N: Integer): Boolean; +var M: Integer; +begin + synAssert(N > 0); + if N = 1 then begin// annoying special case + Result := False; + exit; + end; + //for M := 2 to (N div 2) do begin + for M := 2 to floor(Sqrt(N)) do begin + if N mod M = 0 then begin + Result := False; + exit; + end; + end; + Result:= True; +end; + +{ Returns a count of the number of occurences of SubText in Text } +function CountOccurences( const SubText: string; + const Text: string): Integer; +begin + Result := Pos(SubText, Text); + if Result > 0 then + Result:= (Length(Text)-Length(StringReplace(Text,SubText,'', + [rfReplaceAll]))) div Length(subtext); +end; { CountOccurences } + +const ATIME='while True: '+LB+ + ' localtime = time.localtime()'+LB+ + ' result = time.strftime("%I:%M:%S %p", localtime)'+LB+ + ' print(result, end="", flush=True)'+LB+ + ' print("\r", end="", flush=True)'+LB+ + ' time.sleep(1)'; + +var PyForm: TForm; pyMemo: TMemo; pyval: variant; + eng: TPythonEngine; aPythonVersion: TPythonVersion; + PythonVersions: TPythonVersions; AllUserInstall: Boolean; + apd: TApdMeter; primelist: TStringlist; sw: TStopWatch; mpr: TPrimes; + +begin //@main + //myloadscript2:= filetostring(PYSCRIPT2); + PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_VersionThread_Tester_EKON25'); + pyMemo:= TMemo.create(PyForm); + apd:= TApdMeter.create(pyform); + //apd.color:= clyellow; + apd.parent:= pyform; + apd.barcolor:= clred; + apd.position:= 30; + apd.SetBounds(10,100, 150, 150); + apd.visible:= true; + pyMemo.parent:= PyForm + PyForm.show; + aPythonVersion:= TPythonVersion.create; + + //3. replace maps demo + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME; + eng.opendll(PYDLL) + //eng.free; + //eng.IO:= pyMemo; + try + eng.Execstring('pets= ("bird","snake","dog","turtle","cat","hamster","monster")'); + // eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)'); + eng.Execstring('uppercased_pets = list(map(str.upper, pets))'); + println('Tip replace maps: '+eng.EvalStr('uppercased_pets')); + pyMemo.lines.add(eng.EvalStr('list(map(str.upper, pets))')); + + eng.Execstr('import dis, winsound, time'); + println('disassemble call1: '+eng.EvalStr('(dis.dis(lambda: []))')); + println('disassemble call2: '+eng.EvalStr('(dis.dis(lambda: list()))')); + + //eng.Execstring(ATIME); + eng.Execstring(PRIME); + println('primetest: '+eng.EvalStr('py_is_prime(4703)')); + primelist:= TStringlist.create; + //https://www.wolframalpha.com/input/?i=primes+between+4700+and+4800 + sw:= TStopWatch.Create(); + sw.Start; + for it:= 1000 to 11000 do + //println(+itoa(it)+' primetest: '+eng.EvalStr('py_is_prime('+itoa(it)+')')); + primelist.add(eng.EvalStr('py_is_prime('+itoa(it)+')')); + //writeln('count primes1: '+itoa(CountOccurences('True',primelist.text))); + println('count primes1: '+itoa(SubstringCount('True', primelist.text))); + sw.Stop; + //sw.ElapsedMilliseconds; + writeln('Stop Watch Prime Tester1: '+sw.getValueStr) + primelist.clear; + sw.Start; + for it:= 1000 to 11000 do + primelist.add(botostr(D_IsPrime(it))); + writeln('count primes2: '+itoa(SubstringCount('TRUE', primelist.text))); + sw.stop; + writeln('Stop Watch Prime Tester2: '+sw.getValueStr); + primelist.clear; + mpr:= TPrimes.create; + sw.Start; + writeln('compiled pretest '+botostr(mpr.isprime(4703))) + for it:= 1000 to 11000 do + primelist.add(botostr(mpr.IsPrime(it))); + {for it:= 0 to 500000 do begin + if it mod 100000 = 0 then apd.position:= apd.position+10; + primelist.add(botostr(mpr.IsPrime(it))); + end; } + writeln('count primes3: '+itoa(SubstringCount('TRUE', primelist.text))); + sw.stop; + writeln('Stop Watch Prime Tester3: '+sw.getValueStr); + + if PythonVersionFromPath(PYHOME, aPythonVersion, false) then begin + aPythonVersion.AssignTo(eng) ; + writeln('Version from path: '+TPythonEngine(eng).RegVersion); + writeln('DLL from path: '+TPythonEngine(eng).DLLName); + end; + except + eng.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eng.Free; + aPythonVersion.Free; + primelist.Free; + mpr.Free; + sw.Free; + end; + + //PYLaz_P4D_Demo2; EKON25 - explicit better than implicit + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME; + eng.loadDLL; + println(GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + eng.Free; + apd.position:= 100; + +End. + +Ref: 78498 prime numbers: + mX4 executed: 19/10/2021 12:28:54 Runtime: 0:0:16.485 Memload: 74% use + mX4 executed: 19/10/2021 11:59:40 Runtime: 0:1:4.390 Memload: 72% use + +Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable. +writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion)); +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) +t1.start() +t2.start() + +This package implements JSON support for FPC. + \ No newline at end of file diff --git a/Demos/pydemo31.txt b/Demos/pydemo31.txt new file mode 100644 index 00000000..dc0b16d2 --- /dev/null +++ b/Demos/pydemo31.txt @@ -0,0 +1,255 @@ +PROGRAM SEPDemo_App_mX4_Python_Cheat_Sheet5; +//Python Cheat Sheet: Functions and Tricks +//http://www.softwareschule.ch/examples/cheatsheetpython.pdf +//https://realpython.com/python-json/ +//https://wiki.freepascal.org/Developing_Python_Modules_with_Pascal#Minimum_Python_API +{Purpose: Python Cheat Sheet: Functions and Tricks. } + +// +//Please check providers list below:['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE Pascal-Delphi-Python-Json-OLEAutomation} + +Const PYHOME32 = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYDLL32 = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll'; + +Var // + i: integer; eg: TPythonEngine; + +// // +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '+ + '(KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const WEBURL= 'https://jsonplaceholder.typicode.com/todos'; + +Const REXDEF= 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +//https://gist.github.com/lkdocs/6519378 +Const DEF_RSAKEYS= 'def generate_RSA(bits=2048): '+LF+ + ' '''''+LF+ + //' Generate an RSA keypair with exponent of 65537 in PEM format'+LF+ + //' param: bits The key length in bits '+LF+ + //' Return private key and public key '+LF+ + ' '''''+LF+ + ' from Crypto.PublicKey import RSA '+LF+ + ' new_key = RSA.generate(bits, e=65537)'+LF+ + ' public_key = new_key.publickey().exportKey("PEM")'+LF+ + ' private_key = new_key.exportKey("PEM")'+LF+ + ' return private_key, public_key'; + +procedure GetJSONData; +var XMLhttp: OleVariant; // As Object Automation + ajt: TJson; JObj: TJsonObject2; JArray: TJsonArray2; + response,statuscode: string; cnt: integer; +begin + XMLhttp:= CreateOleObject('msxml2.xmlhttp') + XMLhttp.Open('GET', WEBURL, False) //False is async + //XMLhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XMLhttp.setRequestHeader('Content-Type', 'application/json; charset=utf-8'); + XMLhttp.Send(); + response:= XMLhttp.responseText; //assign the data + statuscode:= XMLhttp.status; + //writeln(statuscode +CRLF+ response) + ajt:= TJson.create(); + try + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JArray:= ajt.JsonArray; + writeln('Get all Titles: '+itoa(jarray.count)); + for cnt:= 0 to jarray.count-1 do + writeln(itoa(cnt)+' '+Jarray.items[cnt].asObject.values['title'].asString); + ajt.Free; +end; + +const filename='maXbox4.exe'; + +Begin //@Main +// +//https://www.amazon.com/Patterns-konkret-Max-Kleiner/dp/3935042469 +{ ISBN-10 ? : 3935042469 ISBN-13 ? : 978-3935042468} + + eg:= TPythonEngine.Create(Nil); + eg.pythonhome:= PYHOME32; + eg.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eg.Execstring('import base64'+LF+'import urllib.parse'); + eg.Execstring('import urllib.request, os, textwrap, json, requests'); + eg.Execstring(REXDEF); + + { eg.Execstring('import nacl'); + eg.Execstring('from nacl.encoding import HexEncoder'+CRLF+ + 'from nacl.exceptions import CryptoError'+CRLF+ + 'from nacl.encoding import Base64Encoder'+CRLF+ + 'from pydub import AudioSegment'); } + + //eg.Execstring('from Crypto.PublicKey import RSA'); + + println(eg.evalStr('base64.b64decode("2e8WuEr0+5nc14VBxQrOl4ob6guOTySr")')); + //eng.Execstring('priv_key = nacl.public.PrivateKey.generate()'); + //openWeb('http://www.softwareschule.ch/examples/cheatsheetpython.pdf'); + + //# 1.map(func, iter) Executes the function on all elements of iterable + println(eg.evalStr('list(map( lambda x: x[0],["red","green","blue"]))')); + + //# 2.map(func, i1,...,Executes the function on all k elements of k iterables + println(eg.evalStr('list(map(lambda x,y: str(x)+" "+y + "s",[0,2,2],'+ + '[ "apple" , "orange" , "banana" ]))')); + + //# 3.string.join(iter), Concatenates iterable elements separated by string + println(eg.evalStr('" marries " .join(list([ "Alice" , "Bob" ]))')); + + //# 4.filter(func,iterable),Filters out elements in iterable for function returns False (or 0) + println(eg.evalStr('list(filter(lambda x: True if x> 17 else False,[1,15,17,18]))')); + + //# 5.string.strip(), Removes leading and trailing whitespaces of string + println(eg.evalStr('( " \n \t 42 \t " .strip())')); + + //# 6.sorted(iter), Sorts iterable in ascending order + println(eg.evalStr('sorted([ 8 , 3 , 2 , 42 , 5 ])')); + + //# 7.sorted(iter,key=key) , Sorts according to the key function in ascending order + println(eg.evalStr('sorted([ 8,3,2,42,5 ], key=lambda x: 0 if x== 42 else x)')); + + //# 8.help(func) , Returns documentation of func + // println(eg.evalStr('help(''print'')')); + saveString(exepath+'pyhelp.py', 'help(''print'')'); + print(getDosOutput('py '+exepath+'pyhelp.py', exePath)); + + //# 9.zip(i1, i2, ...), Groups the i-th elements of iterators i1,i2,...together + println(eg.evalStr('list(zip([''Alice'',''Anna''],[''Bob'',''Jon'',''Frank'']))')); + + //# 10.Unzip, Equal to: 1) unpack the zipped list, 2) zip the result + println(eg.evalStr('list(zip(*[(''Alice'',''Bob''),(''Anna'',''Jon'')]))')); + + //# 11.enumerate(iter), Assigns a counter value to each element of iterable + println(eg.evalStr('list(enumerate(["Alice","Bob","Jon"]))')); + + //# 12.python -m http.server

,Want to share files between PC and phone? + //https://docs.python.org/3/library/http.server.html + //print(getDosOutput('py -m http.server<8080>', exePath)); + //ExecuteShell('py', '-m http.server 8080'); + + //# 13.Read comic Open the comic series xkcd in your web browser + //eg.Execstring('import antigravity'); + + //# 14.Zen of Python import this + eg.execString('from this import *'); + println('14. import this: '+CRLF+ + StringReplace(eg.EvalStr('repr("".join([d.get(c,c) for c in s]))'), + '\n',CR+LF,[rfReplaceAll])); + + //# 15.Swapping numbers, Swapping vars is a breeze in Python. No offense, Java! + eg.execString('a, b = ''Jane'' , ''Alice'''+CRLF+'a, b = b, a'); + println(eg.evalStr('a, b')); + + //# 16.Unpacking arguments, Use a sequence as function arguments! + eg.execString('def f (x, y, z) : return x + y * z'); + println(eg.evalStr('f(*[ 1 , 3 , 4 ])')); + println(eg.evalStr('f(**{ ''z'': 4 , ''x'': 1 , ''y'': 3 })')); + + // eg.Execstring('AudioSegment.from_wav(r"C:\maXbox\soundnvision\01_magix.wav").export(r"C:\maXbox\mX47464\maxbox4\web\G9\G9_magix.mp3", format="mp3")'); + + { eng.Execstring(DEF_RSAKEYS); + eng.Execstring('d=generate_RSA(bits=2048)') + println('RSA Publickey '+eng.evalStr('d[1]')); } + + //# Get the maximum number of complete TODOs. + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a + eg.execString('from faker import Faker'); + eg.execString('fake = Faker()'); + println(eg.evalStr('fake.profile()')); + println(eg.evalStr('fake.credit_card_number()')); + + //https://medium.com/@codedev101/13-advanced-snippets-to-automate-the-cool-stuff-with-python-5d8ea3d389e9 + + //# 17.Get Google Search Result + + eg.execString('from googlesearch import search'); + eg.execString('query = "Medium.com"'); + + eg.execString('lst=[]'+CRLF+'for i in search(query):'+crLF+ + ' lst.append(i)'); + println(eg.evalStr('str(lst)')); + + //# 18. Convert Pdf to Image + // eg.execString('import fitz'); + //Exception: : No module named 'frontend'. + //ERROR: Could not find a version that satisfies the requirement frontend (from versions: none) + + //const filename='maXbox4.exe'; + + //# 19.# Get File Size + println('file size '+eg.evalStr('os.stat("maXbox4.exe").st_size')); + println('file size '+eg.evalStr('os.stat("'+filename+'").st_size')); + + //20_ 9. Get IP Address + eg.execString('import socket'); + eg.execString('s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)'); + println('ip adr '+eg.evalStr('s.connect(("8.8.8.8", 80))')); + println('ip adr '+eg.evalStr('s.getsockname()[0]')); + eg.evalStr('s.close()'); + + except + eg.raiseError; + finally + eg.Free; + //aPythonVersion.Free; + end; + + //GetJSONData; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + mX4 executed: 20/09/2021 19:20:40 Runtime: 0:0:2.782 Memload: 69% use + +C:\maXbox\mX39998\maxbox3>pip3 install -t C:\Users\max\AppData\Local\Programs\Py +thon\Python36-32\Lib pydub +Collecting pydub + Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB) +Installing collected packages: pydub +Successfully installed pydub-0.25.1 + +Then to convert any file from wav to mp3 just use pydub as +import pydub +sound = pydub.AudioSegment.from_wav("D:/example/apple.wav") +sound.export("D:/example/apple.mp3", format="mp3") + +Exception: : Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_MD5.pyd' + +Patterns konkret. +ISBN-13: 9783935042468 ISBN-10: 3935042469 +Author: Kleiner, Max +Binding: Paperback +Publisher: Software + Support +Published: September 2003 + +https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin +----File newtemplate.txt not exists - now saved!---- + + + + + + \ No newline at end of file diff --git a/Demos/pydemo32.htm b/Demos/pydemo32.htm new file mode 100644 index 00000000..0ae6b134 --- /dev/null +++ b/Demos/pydemo32.htm @@ -0,0 +1,141 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000022833 +StartFragment:0000001053 +EndFragment:0000022817 + + + + +mXScriptasHTML + + + + + +

Program Python_Pascal_PrimeTime32_SynDat;
+
+//https://www.programiz.com/python-programming/time/sleep
+//Note: modify PYHOME and PYDLL :  SynDat <make the fake>
+
+Const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\';
+    PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
+    PYDLL  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+    PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py';
+    LB= CR+LF;
+       
+Const PRIME =  'def py_is_prime(n):'+LB+
+               '  import math'+LB+
+               '  """ totally naive implementation """'+LB+
+               '  if n <= 1:'+LB+
+               '    return False'+LB+
+               '  q = math.floor(math.sqrt(n))'+LB+
+               '  for i in range(2, q + 1):'+LB+
+               '    if (n % i == 0):'+LB+
+               '      return False'+LB+
+               '  return True';
+
+      ATIME='while True: '+LB+ 
+            '  localtime = time.localtime()'+LB+ 
+            '  result = time.strftime("%I:%M:%S %p", localtime)'+LB+ 
+            '  print(result, end="", flush=True)'+LB+ 
+            '  print("\r", end="", flush=True)'+LB+ 
+            '  time.sleep(1)';                        
+              
+var  PyForm: TForm; pyMemo: TMemo; pyval: variant;
+     eg: TPythonEngine; aPythonVersion: TPythonVersion;
+     apd: TApdMeter; sw: TStopWatch; 
+
+begin  //@main
+  //myloadscript2:= filetostring(PYSCRIPT2);
+  PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_SynDat_Tester_EKON25');
+  pyMemo:= TMemo.create(PyForm);
+  apd:= TApdMeter.create(pyform);
+  //apd.color:= clyellow;
+  apd.parent:= pyform;
+  apd.barcolor:= clred;
+  apd.position:= 30;
+  apd.SetBounds(10,100, 150, 150);
+  apd.visible:= true;
+  pyMemo.parent:= PyForm
+  PyForm.show;
+  
+  //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); 
+  //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a
+  //PYLaz_P4D_Demo2;   EKON25 - explicit better than implicit
+  eg:= TPythonEngine.Create(Nil);
+  try
+    eg.pythonhome:= PYHOME;
+    eg.loadDLL;
+    println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)'));
+    println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)'));  
+    //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a
+    apd.position:= 60;
+    pyMemo.lines.add('call test with execStr() from faker import Faker');
+    sw:= TStopWatch.Create();
+    sw.Start;
+    eg.execStr('from faker import Faker');
+    eg.execStr('import simplejson as json');  // # instead of import json
+    eg.execStr('fake = Faker()');
+    println(eg.evalStr('fake.profile()'));
+    //println(eg.evalStr('json.dumps(fake.profile(),indent=4)'));
+    println(eg.evalStr('fake.credit_card_number()')); //}
+    sw.Stop;
+    //sw.ElapsedMilliseconds;
+    writeln('Stop Watch Faker Tester1: '+sw.getValueStr)
+  except
+    eg.raiseError;
+    writeln(ExceptionToString(ExceptionType, ExceptionParam));  
+  finally
+    eg.Free;
+    sw.Free;
+    sw:= Nil;
+    apd.position:= 100;
+  end;  
+End.
+
+Ref: https://towardsdatascience.com/build-a-data-streaming-job-in-5-mins-with-pyspark-faker-a4f3d2420384
+     https://www.codespeedy.com/faker-library-in-python/
+{'job': 'Research officer, political party', 'company': 'Davis-Perez', 'ssn': '520-11-9286', 'residence': '18365 Katherine Plains\nAliceville, OK 31762', 'current_location': (Decimal('47.667757'), Decimal('14.943272')), 'blood_group': 'O-', 'website': ['https://www.thompson.com/', 'https://graham.com/', 'http://www.thomas.com/'], 'username': 'hbass', 'name': 'Tammy Crane', 'sex': 'F', 'address': '3144 Stephanie Road\nWilliambury, MT 95571', 'mail': 'wthompson@yahoo.com', 'birthdate': datetime.date(1962, 11, 25)}
+4978088480978
+ mX4 executed: 05/12/2021 11:43:04  Runtime: 0:0:2.197  Memload: 36% use
+
+Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable.
+writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion));
+https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib
+
+import threading 
+  
+def print_hello_three_times():
+  for i in range(3):
+    print("Hello")
+  
+def print_hi_three_times(): 
+    for i in range(3): 
+      print("Hi") 
+
+t1 = threading.Thread(target=print_hello_three_times)  
+t2 = threading.Thread(target=print_hi_three_times)  
+t1.start()
+t2.start()
+
+This package implements JSON support for FPC.
+    
+
+ \ No newline at end of file diff --git a/Demos/pydemo32.txt b/Demos/pydemo32.txt new file mode 100644 index 00000000..7a136f51 --- /dev/null +++ b/Demos/pydemo32.txt @@ -0,0 +1,120 @@ +Program Python_Pascal_PrimeTime32_SynDat_Tutorial91; + +//https://www.programiz.com/python-programming/time/sleep +//Note: modify PYHOME and PYDLL : SynDat +//http://www.softwareschule.ch/download/maxbox_starter91.pdf + +Const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + LB= CR+LF; + +Const PRIME = 'def py_is_prime(n):'+LB+ + ' import math'+LB+ + ' """ totally naive implementation """'+LB+ + ' if n <= 1:'+LB+ + ' return False'+LB+ + ' q = math.floor(math.sqrt(n))'+LB+ + ' for i in range(2, q + 1):'+LB+ + ' if (n % i == 0):'+LB+ + ' return False'+LB+ + ' return True'; + + ATIME='while True: '+LB+ + ' localtime = time.localtime()'+LB+ + ' result = time.strftime("%I:%M:%S %p", localtime)'+LB+ + ' print(result, end="", flush=True)'+LB+ + ' print("\r", end="", flush=True)'+LB+ + ' time.sleep(1)'; + +var PyForm: TForm; pyMemo: TMemo; pyval: variant; + eg: TPythonEngine; aPythonVersion: TPythonVersion; + apd: TApdMeter; sw: TStopWatch; + +begin //@main + //myloadscript2:= filetostring(PYSCRIPT2); + PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_SynDat_Tester_EKON25'); + pyMemo:= TMemo.create(PyForm); + apd:= TApdMeter.create(pyform); + //apd.color:= clyellow; + apd.parent:= pyform; + apd.barcolor:= clred; + apd.position:= 30; + apd.SetBounds(10,100, 150, 150); + apd.visible:= true; + pyMemo.parent:= PyForm + PyForm.show; + + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a + //PYLaz_P4D_Demo2; EKON25 - explicit better than implicit + eg:= TPythonEngine.Create(Nil); + try + eg.pythonhome:= PYHOME; + eg.loadDLL; + println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); + //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a + apd.position:= 60; + pyMemo.lines.add('call test with execStr() from faker import Faker'); + sw:= TStopWatch.Create(); + sw.Start; + eg.execStr('from faker import Faker'); + eg.execStr('import simplejson as json'); //# instead of import json + eg.execStr('import dumper'); + eg.execStr('fake = Faker()'); + println(eg.evalStr('fake.profile()')); + eg.execStr('profile1 = fake.simple_profile()'); + //eg.execStr('ad= dumper.dump(profile1)'); + //println(eg.evalStr('dumper.dump(profile1)')) + + println(eg.evalStr('f"my profile: {fake.profile()}"')); + //println(eg.evalStr('json.dumps(fake.profile(),indent=4)')); + println(eg.evalStr('fake.credit_card_number()')); //} + sw.Stop; + //sw.ElapsedMilliseconds; + writeln('Stop Watch Faker Tester1: '+sw.getValueStr) + except + eg.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eg.Free; + sw.Free; + sw:= Nil; + apd.position:= 100; + end; +End. + +Ref: https://towardsdatascience.com/build-a-data-streaming-job-in-5-mins-with-pyspark-faker-a4f3d2420384 + https://www.codespeedy.com/faker-library-in-python/ +{'job': 'Research officer, political party', 'company': 'Davis-Perez', 'ssn': '520-11-9286', 'residence': '18365 Katherine Plains\nAliceville, OK 31762', 'current_location': (Decimal('47.667757'), Decimal('14.943272')), 'blood_group': 'O-', 'website': ['https://www.thompson.com/', 'https://graham.com/', 'http://www.thomas.com/'], 'username': 'hbass', 'name': 'Tammy Crane', 'sex': 'F', 'address': '3144 Stephanie Road\nWilliambury, MT 95571', 'mail': 'wthompson@yahoo.com', 'birthdate': datetime.date(1962, 11, 25)} +4978088480978 + mX4 executed: 05/12/2021 11:43:04 Runtime: 0:0:2.197 Memload: 36% use + + +Optimizations + +The Faker constructor takes a performance-related argument called use_weighting. It specifies whether to attempt to have the frequency of values match real-world frequencies (e.g. the English name Gary would be much more frequent than the name Lorimer). If use_weighting is False, then all items have an equal chance of being selected, and the selection process is much faster. The default is True. + +Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable. +writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion)); +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) +t1.start() +t2.start() + +This package implements JSON support for FPC. + \ No newline at end of file diff --git a/Demos/pydemo32_2.rtf b/Demos/pydemo32_2.rtf new file mode 100644 index 00000000..833e3f30 --- /dev/null +++ b/Demos/pydemo32_2.rtf @@ -0,0 +1,164 @@ +{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fmodern Courier New;}} +{\colortbl\red0\green0\blue128;\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue128;\red0\green255\blue0;} +{\info{\comment Generated by the SynEdit RTF exporter} +{\title Untitled}} +\deflang1033\pard\plain\f0\fs20 \cf0\b Program\b0\cf1 Python_Pascal_PrimeTime32_SynDat_Tutorial91\cf2 ; +\par +\par \cf0\i //https://www.programiz.com/python-programming/time/sleep +\par //Note: modify PYHOME and PYDLL : SynDat +\par //http://www.softwareschule.ch/download/maxbox_starter91.pdf +\par +\par \i0\b Const\b0\cf1 \cf0\i //PYHOME = 'C:\\Users\\breitsch\\AppData\\Local\\Programs\\Python\\Python37-32\\'; +\par \i0\cf1 PYHOME \cf2 =\cf1 \cf3 'C:\\Users\\max\\AppData\\Local\\Programs\\Python\\Python36-32\\'\cf2 ; +\par \cf1 PYDLL \cf2 =\cf1 \cf3 'C:\\Users\\max\\AppData\\Local\\Programs\\Python\\Python36-32\\python36.dll'\cf2 ;\cf1 +\par PYSCRIPT \cf2 =\cf1 \cf3 'C:\\maXbox\\maxbox3\\maxbox3\\maXbox3\\examples\\module1maxbox1.py'\cf2 ; +\par \cf1 LB\cf2 =\cf1 CR\cf2 +\cf1 LF\cf2 ; +\par \cf1 +\par \cf0\b Const\b0\cf1 PRIME \cf2 =\cf1 \cf3 'def py_is_prime(n):'\cf2 +\cf1 LB\cf2 + +\par \cf1 \cf3 ' import math'\cf2 +\cf1 LB\cf2 + +\par \cf1 \cf3 ' """ totally naive implementation """'\cf2 +\cf1 LB\cf2 + +\par \cf1 \cf3 ' if n <= 1:'\cf2 +\cf1 LB\cf2 + +\par \cf1 \cf3 ' return False'\cf2 +\cf1 LB\cf2 + +\par \cf1 \cf3 ' q = math.floor(math.sqrt(n))'\cf2 +\cf1 LB\cf2 + +\par \cf1 \cf3 ' for i in range(2, q + 1):'\cf2 +\cf1 LB\cf2 + +\par \cf1 \cf3 ' if (n % i == 0):'\cf2 +\cf1 LB\cf2 + +\par \cf1 \cf3 ' return False'\cf2 +\cf1 LB\cf2 + +\par \cf1 \cf3 ' return True'\cf2 ; +\par +\par \cf1 ATIME\cf2 =\cf3 'while True: '\cf2 +\cf1 LB\cf2 +\cf1 +\par \cf3 ' localtime = time.localtime()'\cf2 +\cf1 LB\cf2 +\cf1 +\par \cf3 ' result = time.strftime("%I:%M:%S %p", localtime)'\cf2 +\cf1 LB\cf2 +\cf1 +\par \cf3 ' print(result, end="", flush=True)'\cf2 +\cf1 LB\cf2 +\cf1 +\par \cf3 ' print("\\r", end="", flush=True)'\cf2 +\cf1 LB\cf2 +\cf1 +\par \cf3 ' time.sleep(1)'\cf2 ;\cf1 +\par +\par \cf0\b var\b0\cf1 PyForm\cf2 :\cf1 TForm\cf2 ;\cf1 pyMemo\cf2 :\cf1 TMemo\cf2 ;\cf1 pyval\cf2 :\cf1 variant\cf2 ;\cf1 fprofile\cf2 :\cf1 \cf0\b string\b0\cf2 ; +\par \cf1 eg\cf2 :\cf1 TPythonEngine\cf2 ;\cf1 aPythonVersion\cf2 :\cf1 TPythonVersion\cf2 ; +\par \cf1 apd\cf2 :\cf1 TApdMeter\cf2 ;\cf1 sw\cf2 :\cf1 TStopWatch\cf2 ;\cf1 +\par ajt\cf2 :\cf1 TJson\cf2 ;\cf1 JObj\cf2 :\cf1 TJsonObject2\cf2 ;\cf1 JArr\cf2 :\cf1 TJsonArray2\cf2 ;\cf1 +\par +\par +\par \cf0\b procedure\b0\cf1 dumpJSON\cf2 (\cf1 response\cf2 :\cf1 \cf0\b string\b0\cf2 ); +\par \cf0\b var\b0\cf1 cnt\cf2 :\cf1 integer\cf2 ;\cf1 clb\cf2 :\cf1 \cf0\b string\b0\cf2 ; +\par \cf0\b begin +\par \b0\cf1 ajt\cf2 :=\cf1 TJson\cf2 .\cf1 create\cf2 (); +\par \cf1 \cf0\b try +\par \b0\cf1 response\cf2 :=\cf1 \cf3 '\{'\cf2 +\cf1 response\cf2 +\cf3 '\}'\cf2 ;\cf1 \cf0\i //*) +\par \i0\cf1 ajt\cf2 .\cf1 parse\cf2 (\cf1 response\cf2 ); +\par \cf1 \cf0\b except +\par \b0\cf1 writeln\cf2 (\cf1 \cf3 'Exception: "" parse error: \{'\cf2 + +\par \cf1 exceptiontostring\cf2 (\cf1 exceptiontype\cf2 ,\cf1 exceptionparam\cf2 ))\cf1 +\par \cf0\b end\b0\cf2 ; +\par \cf1 JObj\cf2 :=\cf1 ajt\cf2 .\cf1 JsonObject\cf2 ; +\par \cf1 \cf0\i //JArr:= ajt.values[''].asarray; +\par \i0\cf1 \cf0\i //for cnt:= 0 to jarr.count-1 do begin +\par \i0\cf1 \cf0\b for\b0\cf1 cnt\cf2 :=\cf1 \cf2 0\cf1 \cf0\b to\b0\cf1 jobj\cf2 .\cf1 count\cf2 -1\cf1 \cf0\b do\b0\cf1 \cf0\b begin +\par \b0\cf1 clb\cf2 :=\cf1 jobj\cf2 .\cf1 items\cf2 [\cf1 cnt\cf2 ].\cf1 name\cf2 ; +\par \cf1 writeln\cf2 (\cf3 'this '\cf2 +\cf1 clb\cf2 ) +\par \cf1 \cf0\b end\b0\cf2 ;\cf1 \cf0\i //\} +\par \i0\cf1 ajt\cf2 .\cf1 Free\cf2 ; +\par \cf0\b end\b0\cf2 ;\cf1 +\par +\par \cf0\b begin\b0\cf1 \cf0\i //@main +\par \i0\cf1 \cf0\i //myloadscript2:= filetostring(PYSCRIPT2); +\par \i0\cf1 PyForm\cf2 :=\cf1 loadForm2\cf2 (200,300,\cf1 clgreen\cf2 ,\cf3 'PyFrm4D_SynDat_Tester_EKON25'\cf2 ); +\par \cf1 pyMemo\cf2 :=\cf1 TMemo\cf2 .\cf1 create\cf2 (\cf1 PyForm\cf2 ); +\par \cf1 apd\cf2 :=\cf1 TApdMeter\cf2 .\cf1 create\cf2 (\cf1 pyform\cf2 ); +\par \cf1 \cf0\i //apd.color:= clyellow; +\par \i0\cf1 apd\cf2 .\cf1 parent\cf2 :=\cf1 pyform\cf2 ; +\par \cf1 apd\cf2 .\cf1 barcolor\cf2 :=\cf1 clred\cf2 ; +\par \cf1 apd\cf2 .\cf1 position\cf2 :=\cf1 \cf2 30; +\par \cf1 apd\cf2 .\cf1 SetBounds\cf2 (10,100,\cf1 \cf2 150,\cf1 \cf2 150); +\par \cf1 apd\cf2 .\cf1 visible\cf2 :=\cf1 true\cf2 ; +\par \cf1 pyMemo\cf2 .\cf1 parent\cf2 :=\cf1 PyForm +\par PyForm\cf2 .\cf1 show\cf2 ; +\par \cf1 +\par \cf0\i //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); +\par \i0\cf1 \cf0\i //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a +\par \i0\cf1 \cf0\i //PYLaz_P4D_Demo2; EKON25 - explicit better than implicit +\par \i0\cf1 eg\cf2 :=\cf1 TPythonEngine\cf2 .\cf1 Create\cf2 (\cf0\b Nil\b0\cf2 ); +\par \cf1 \cf0\b try +\par \b0\cf1 eg\cf2 .\cf1 pythonhome\cf2 :=\cf1 PYHOME\cf2 ; +\par \cf1 eg\cf2 .\cf1 loadDLL\cf2 ; +\par \cf1 println\cf2 (\cf3 'test import '\cf2 +\cf1 GetPythonEngine\cf2 .\cf1 EvalStr\cf2 (\cf3 '__import__("decimal").Decimal(0.1)'\cf2 )); +\par \cf1 println\cf2 (\cf3 'test import '\cf2 +\cf1 eg\cf2 .\cf1 EvalStr\cf2 (\cf3 '__import__("decimal").Decimal(0.1)'\cf2 ));\cf1 +\par writeln\cf2 (\cf3 ''\cf2 )\cf1 +\par \cf0\i //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a +\par \i0\cf1 apd\cf2 .\cf1 position\cf2 :=\cf1 \cf2 60; +\par \cf1 pyMemo\cf2 .\cf1 lines\cf2 .\cf1 add\cf2 (\cf3 'call test with execStr() from faker import Faker'\cf2 ); +\par \cf1 println\cf2 (\cf1 eg\cf2 .\cf1 EvalStr\cf2 (\cf3 '__import__("faker").Faker()'\cf2 ));\cf1 +\par sw\cf2 :=\cf1 TStopWatch\cf2 .\cf1 Create\cf2 (); +\par \cf1 sw\cf2 .\cf1 Start\cf2 ; +\par \cf1 eg\cf2 .\cf1 execStr\cf2 (\cf3 'from faker import Faker'\cf2 ); +\par \cf1 eg\cf2 .\cf1 execStr\cf2 (\cf3 'import simplejson as json'\cf2 );\cf1 \cf0\i //# instead of import json +\par \i0\cf1 eg\cf2 .\cf1 execStr\cf2 (\cf3 'import dumper'\cf2 ); +\par \cf1 eg\cf2 .\cf1 execStr\cf2 (\cf3 'fake = Faker()'\cf2 ); +\par \cf1 fprofile\cf2 :=\cf1 eg\cf2 .\cf1 evalStr\cf2 (\cf3 '(fake.profile())'\cf2 ) +\par \cf1 fprofile\cf2 :=\cf1 StringReplace\cf2 (\cf1 fprofile\cf2 ,\cf3 '\\n'\cf2 ,\cf1 CRLF\cf2 ,[\cf1 rfReplaceAll\cf2 ]); +\par \cf1 \cf0\i //fprofile:= eg.evalStr('fake.profile().replace("\\n"," ")'); +\par \i0\cf1 \cf0\i //Exception: : 'dict' object has no attribute 'replace'. +\par \i0\cf1 println\cf2 (\cf3 'fake person profile: '\cf2 +\cf1 CRLF\cf2 +\cf1 fprofile\cf2 +\cf1 CRLF\cf2 ); +\par \cf1 \cf0\i //dumpJSON(fprofile); +\par \i0\cf1 \cf0\i //eg.execStr('profile1 = fake.simple_profile()'); +\par \i0\cf1 \cf0\i //eg.execStr('ad= dumper.dump(profile1)'); +\par \i0\cf1 \cf0\i //println(eg.evalStr('dumper.dump(profile1)')) +\par \i0\cf1 \cf0\i //println(eg.evalStr('f"my profile: \{fake.profile()\}"')); +\par \i0\cf1 \cf0\i //println(eg.evalStr('json.dumps(fake.profile(),indent=4)')); +\par \i0\cf1 println\cf2 (\cf3 'creditcard#: '\cf2 +\cf1 eg\cf2 .\cf1 evalStr\cf2 (\cf3 'fake.credit_card_number()'\cf2 ));\cf1 \cf0\i //\} +\par \i0\cf1 eg\cf2 .\cf1 execStr\cf2 (\cf3 'fake = Faker(["es_MX"])'\cf2 ) +\par \cf1 \cf0\i //for i in range(10): +\par \i0\cf1 \cf0\b for\b0\cf1 \cf0\b it\b0\cf2 :=\cf1 \cf2 1\cf1 \cf0\b to\b0\cf1 \cf2 5\cf1 \cf0\b do\b0\cf1 +\par println\cf2 (\cf1 UTF8toAnsi\cf2 (\cf1 eg\cf2 .\cf1 evalStr\cf2 (\cf3 'fake.name()'\cf2 ))); +\par \cf1 sw\cf2 .\cf1 Stop\cf2 ; +\par \cf1 \cf0\i //sw.ElapsedMilliseconds; +\par \i0\cf1 writeln\cf2 (\cf3 'Stop Watch Faker Tester1: '\cf2 +\cf1 sw\cf2 .\cf1 getValueStr\cf2 ) +\par \cf1 \cf0\b except +\par \b0\cf1 eg\cf2 .\cf1 raiseError\cf2 ; +\par \cf1 writeln\cf2 (\cf1 ExceptionToString\cf2 (\cf1 ExceptionType\cf2 ,\cf1 ExceptionParam\cf2 ));\cf1 +\par \cf0\b finally +\par \b0\cf1 eg\cf2 .\cf1 Free\cf2 ; +\par \cf1 sw\cf2 .\cf1 Free\cf2 ; +\par \cf1 sw\cf2 :=\cf1 \cf0\b Nil\b0\cf2 ; +\par \cf1 apd\cf2 .\cf1 position\cf2 :=\cf1 \cf2 100; +\par \cf1 \cf0\b end\b0\cf2 ;\cf1 +\par \cf0\b End\b0\cf2 . +\par +\par \cf0\b Ref\b0\cf2 :\cf1 https\cf2 :\cf0\i //towardsdatascience.com/build-a-data-streaming-job-in-5-mins-with-pyspark-faker-a4f3d2420384 +\par \i0\cf1 https\cf2 :\cf0\i //www.codespeedy.com/faker-library-in-python/ +\par \{'job': 'Research officer, political party', 'company': 'Davis-Perez', 'ssn': '520-11-9286', 'residence': '18365 Katherine Plains\\nAliceville, OK 31762', 'current_location': (Decimal('47.667757'), Decimal('14.943272')), 'blood_group': 'O-', 'website': ['https://www.thompson.com/', 'https://graham.com/', 'http://www.thomas.com/'], 'username': 'hbass', 'name': 'Tammy Crane', 'sex': 'F', 'address': '3144 Stephanie Road\\nWilliambury, MT 95571', 'mail': 'wthompson@yahoo.com', 'birthdate': datetime.date(1962, 11, 25)\} +\par \i0\cf2 4978088480978 +\par \cf1  mX4 executed\cf2 :\cf1 \cf2 05/12/2021\cf1 \cf2 11:43:04\cf1 Runtime\cf2 :\cf1 \cf2 0:0:\cf4 2.197\cf1 Memload\cf2 :\cf1 \cf2 36%\cf1 use +\par  +\par +\par Optimizations +\par +\par The Faker \cf0\b constructor\b0\cf1 takes a performance\cf2 -\cf1 related argument called use_weighting\cf2 .\cf1 \cf0\b It\b0\cf1 specifies whether \cf0\b to\b0\cf1 attempt \cf0\b to\b0\cf1 have the frequency \cf0\b of\b0\cf1 values match real\cf2 -\cf1 world frequencies \cf2 (\cf1 e\cf2 .\cf1 g\cf2 .\cf1 the English name Gary would be much more frequent than the name Lorimer\cf2 ).\cf1 \cf0\b If\b0\cf1 use_weighting \cf0\b is\b0\cf1 False\cf2 ,\cf1 \cf0\b then\b0\cf1 all items have an equal chance \cf0\b of\b0\cf1 being selected\cf2 ,\cf1 \cf0\b and\b0\cf1 the selection process \cf0\b is\b0\cf1 much faster\cf2 .\cf1 The \cf0\b default\b0\cf1 \cf0\b is\b0\cf1 True\cf2 . +\par +\par \cf1 Santiago Carmona +\par \cf2 �\cf1 ngel Judith Roque Amador +\par Susana Eloy Rocha Blanco +\par Rodolfo Urbina Su\cf2 �\cf1 rez +\par Juana Irma de la Torre Mares +\par +\par \cf0\b Doc\b0\cf2 :\cf1 One thing \cf0\b to\b0\cf1 note \cf0\b is\b0\cf1 that the map\cf2 ()\cf1 \cf0\b function\b0\cf1 returns an iterable \cf0\b object\b0\cf2 ,\cf1 \cf0\b and\b0\cf1 thus we can use the list\cf2 ()\cf1 \cf0\b function\b0\cf1 \cf0\b to\b0\cf1 generate a list from this iterable\cf2 . +\par \cf1 writeln\cf2 (\cf3 'RegVersion: '\cf2 +\cf1 itoa\cf2 (\cf1 TPythonEngine\cf2 (\cf1 eng\cf2 ).\cf1 RegVersion\cf2 )); +\par \cf1 https\cf2 :\cf0\i //stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib +\par +\par \i0\cf1 import threading +\par +\par \cf0\b def\b0\cf1 print_hello_three_times\cf2 (): +\par \cf1 \cf0\b for\b0\cf1 i \cf0\b in\b0\cf1 range\cf2 (3): +\par \cf1 print\cf2 ("\cf1 Hello\cf2 ") +\par \cf1 +\par \cf0\b def\b0\cf1 print_hi_three_times\cf2 ():\cf1 +\par \cf0\b for\b0\cf1 i \cf0\b in\b0\cf1 range\cf2 (3):\cf1 +\par print\cf2 ("\cf1 Hi\cf2 ")\cf1 +\par +\par t1 \cf2 =\cf1 threading\cf2 .\cf1 Thread\cf2 (\cf1 target\cf2 =\cf1 print_hello_three_times\cf2 )\cf1 +\par t2 \cf2 =\cf1 threading\cf2 .\cf1 Thread\cf2 (\cf1 target\cf2 =\cf1 print_hi_three_times\cf2 )\cf1 +\par t1\cf2 .\cf1 start\cf2 () +\par \cf1 t2\cf2 .\cf1 start\cf2 () +\par +\par \cf1 This \cf0\b package\b0\cf1 implements JSON support \cf0\b for\b0\cf1 FPC\cf2 . +\par \cf1 +\par } \ No newline at end of file diff --git a/Demos/pydemo32_2.txt b/Demos/pydemo32_2.txt new file mode 100644 index 00000000..b916ca7e --- /dev/null +++ b/Demos/pydemo32_2.txt @@ -0,0 +1,159 @@ +Program Python_Pascal_PrimeTime32_SynDat_Tutorial91; + +//https://www.programiz.com/python-programming/time/sleep +//Note: modify PYHOME and PYDLL : SynDat +//http://www.softwareschule.ch/download/maxbox_starter91.pdf + +Const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + LB= CR+LF; + +Const PRIME = 'def py_is_prime(n):'+LB+ + ' import math'+LB+ + ' """ totally naive implementation """'+LB+ + ' if n <= 1:'+LB+ + ' return False'+LB+ + ' q = math.floor(math.sqrt(n))'+LB+ + ' for i in range(2, q + 1):'+LB+ + ' if (n % i == 0):'+LB+ + ' return False'+LB+ + ' return True'; + + ATIME='while True: '+LB+ + ' localtime = time.localtime()'+LB+ + ' result = time.strftime("%I:%M:%S %p", localtime)'+LB+ + ' print(result, end="", flush=True)'+LB+ + ' print("\r", end="", flush=True)'+LB+ + ' time.sleep(1)'; + +var PyForm: TForm; pyMemo: TMemo; pyval: variant; fprofile: string; + eg: TPythonEngine; aPythonVersion: TPythonVersion; + apd: TApdMeter; sw: TStopWatch; + ajt: TJson; JObj: TJsonObject2; JArr: TJsonArray2; + + +procedure dumpJSON(response: string); +var cnt: integer; clb: string; +begin +ajt:= TJson.create(); + try + response:= '{'+response+'}'; //*) + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JObj:= ajt.JsonObject; + //JArr:= ajt.values[''].asarray; + //for cnt:= 0 to jarr.count-1 do begin + for cnt:= 0 to jobj.count-1 do begin + clb:= jobj.items[cnt].name; + writeln('this '+clb) + end; //} + ajt.Free; +end; + +begin //@main + //myloadscript2:= filetostring(PYSCRIPT2); + PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_SynDat_Tester_EKON25'); + pyMemo:= TMemo.create(PyForm); + apd:= TApdMeter.create(pyform); + //apd.color:= clyellow; + apd.parent:= pyform; + apd.barcolor:= clred; + apd.position:= 30; + apd.SetBounds(10,100, 150, 150); + apd.visible:= true; + pyMemo.parent:= PyForm + PyForm.show; + + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a + //PYLaz_P4D_Demo2; EKON25 - explicit better than implicit + eg:= TPythonEngine.Create(Nil); + try + eg.pythonhome:= PYHOME; + eg.loadDLL; + println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); + writeln('') + //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a + apd.position:= 60; + pyMemo.lines.add('call test with execStr() from faker import Faker'); + println(eg.EvalStr('__import__("faker").Faker()')); + sw:= TStopWatch.Create(); + sw.Start; + eg.execStr('from faker import Faker'); + eg.execStr('import simplejson as json'); //# instead of import json + eg.execStr('import dumper'); + eg.execStr('fake = Faker()'); + fprofile:= eg.evalStr('(fake.profile())') + fprofile:= StringReplace(fprofile,'\n',CRLF,[rfReplaceAll]); + //fprofile:= eg.evalStr('fake.profile().replace("\n"," ")'); + //Exception: : 'dict' object has no attribute 'replace'. + println('fake person profile: '+CRLF+fprofile+CRLF); + //dumpJSON(fprofile); + //eg.execStr('profile1 = fake.simple_profile()'); + //eg.execStr('ad= dumper.dump(profile1)'); + //println(eg.evalStr('dumper.dump(profile1)')) + //println(eg.evalStr('f"my profile: {fake.profile()}"')); + //println(eg.evalStr('json.dumps(fake.profile(),indent=4)')); + println('creditcard#: '+eg.evalStr('fake.credit_card_number()')); //} + eg.execStr('fake = Faker(["es_MX"])') + //for i in range(10): + for it:= 1 to 5 do + println(UTF8toAnsi(eg.evalStr('fake.name()'))); + sw.Stop; + //sw.ElapsedMilliseconds; + writeln('Stop Watch Faker Tester1: '+sw.getValueStr) + except + eg.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eg.Free; + sw.Free; + sw:= Nil; + apd.position:= 100; + end; +End. + +Ref: https://towardsdatascience.com/build-a-data-streaming-job-in-5-mins-with-pyspark-faker-a4f3d2420384 + https://www.codespeedy.com/faker-library-in-python/ +{'job': 'Research officer, political party', 'company': 'Davis-Perez', 'ssn': '520-11-9286', 'residence': '18365 Katherine Plains\nAliceville, OK 31762', 'current_location': (Decimal('47.667757'), Decimal('14.943272')), 'blood_group': 'O-', 'website': ['https://www.thompson.com/', 'https://graham.com/', 'http://www.thomas.com/'], 'username': 'hbass', 'name': 'Tammy Crane', 'sex': 'F', 'address': '3144 Stephanie Road\nWilliambury, MT 95571', 'mail': 'wthompson@yahoo.com', 'birthdate': datetime.date(1962, 11, 25)} +4978088480978 + mX4 executed: 05/12/2021 11:43:04 Runtime: 0:0:2.197 Memload: 36% use + + +Optimizations + +The Faker constructor takes a performance-related argument called use_weighting. It specifies whether to attempt to have the frequency of values match real-world frequencies (e.g. the English name Gary would be much more frequent than the name Lorimer). If use_weighting is False, then all items have an equal chance of being selected, and the selection process is much faster. The default is True. + +Santiago Carmona +�ngel Judith Roque Amador +Susana Eloy Rocha Blanco +Rodolfo Urbina Su�rez +Juana Irma de la Torre Mares + +Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable. +writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion)); +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) +t1.start() +t2.start() + +This package implements JSON support for FPC. + \ No newline at end of file diff --git a/Demos/pydemo33.txt b/Demos/pydemo33.txt new file mode 100644 index 00000000..096c9218 --- /dev/null +++ b/Demos/pydemo33.txt @@ -0,0 +1,294 @@ +Program Python_Pascal_PrimeTime32_SynDat_Tutorial91_1; + +//https://www.programiz.com/python-programming/time/sleep +//Note: modify PYHOME and PYDLL : SynDat +//http://www.softwareschule.ch/download/maxbox_starter91_1.pdf +//https://www.section.io/engineering-education/how-to-create-a-blockchain-in-python/ + +Const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + LB= CR+LF; + EmptyStr = ''; + +Const PRIME = 'def py_is_prime(n):'+LB+ + ' import math'+LB+ + ' """ totally naive implementation """'+LB+ + ' if n <= 1:'+LB+ + ' return False'+LB+ + ' q = math.floor(math.sqrt(n))'+LB+ + ' for i in range(2, q + 1):'+LB+ + ' if (n % i == 0):'+LB+ + ' return False'+LB+ + ' return True'; + + ATIME='while True: '+LB+ + ' localtime = time.localtime()'+LB+ + ' result = time.strftime("%I:%M:%S %p", localtime)'+LB+ + ' print(result, end="", flush=True)'+LB+ + ' print("\r", end="", flush=True)'+LB+ + ' time.sleep(1)'; + + BLOCKCH= 'class Blockchain: '+LB+ + ' def __init__(self):'+LB+ + ' self.chain = []'+LB+ + ' self.create_blockchain(proof=1, previous_hash="0")'; + + BHASH= '# generate a hash of an entire block'+LB+ + 'def bhash(self, block):'+LB+ + ' encoded_block = json.dumps(block, sort_keys=True).encode()'+LB+ + ' return hashlib.sha256(encoded_block).hexdigest()'; + BHASH2= '# generate a hash of an entire block'+LB+ + 'def bhash2(self,block):'+LB+ + ' #encoded_block = json.dumps(block, sort_keys=True).encode()'+LB+ + ' return hashlib.sha256(block.encode("utf-8")).hexdigest()'; + + +var PyForm: TForm; pyMemo: TMemo; pyval: variant; fprofile: string; + eg: TPythonEngine; aPythonVersion: TPythonVersion; + apd: TApdMeter; sw: TStopWatch; + ajt: TJson; JObj: TJsonObject2; JArr: TJsonArray2; + + +procedure dumpJSON(response: string); +var cnt: integer; clb: string; +begin +ajt:= TJson.create(); + try + response:= '{'+response+'}'; //*) + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JObj:= ajt.JsonObject; + //JArr:= ajt.values[''].asarray; + //for cnt:= 0 to jarr.count-1 do begin + for cnt:= 0 to jobj.count-1 do begin + clb:= jobj.items[cnt].name; + writeln('this '+clb) + end; //} + ajt.Free; +end; + +//------------------------------------------------------------------------------ +// check if two StringLists contain identical strings +//------------------------------------------------------------------------------ +function ListIdentical(l1,l2:TStringList):Boolean; +var + ix : Integer; +begin + Result := False; + if l1.count = l2.count then begin + for ix := 0 to l1.count-1 do begin + if (l1[ix] <> l2[ix]) then Exit; + end; + Result := True; + end; +end; + +function ReverseHash(Hash: string): string; +var + k: byte; +begin + Result := EmptyStr; + k := 64; + while (k > 0) do begin + Result := Result + Hash[k - 1] + Hash[k]; + k := k - 2; + end; +end; + +const + HEADERSIZE = 80; + +type + ATSHA256HASH = array [0 .. 7] of Cardinal; + //PSHA256HASH = ^TSHA256HASH; + + // To store a 32 bytes + T32 = array [0 .. 31] of byte; + + // To store the block header + ATHeader = array [0 .. HEADERSIZE - 1] of byte; + +function T32ToString(const at32: T32): string; +var + k: Integer; +begin + Result := EmptyStr; + for k := 0 to 31 do begin + //Result := IntToHex(byte(at32[k]),2) + Result; + Result := IntToHex(ord(at32[k]),2) + Result; + end; +end; + + +function GetMemoryStream: TMemoryStream; +var + aMemoryStream: TMemoryStream; +begin + if aMemoryStream = nil then + aMemoryStream := TMemoryStream.Create; + + Result := aMemoryStream; +end; + +begin //@main + //myloadscript2:= filetostring(PYSCRIPT2); + PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_SynDat_Tester_EKON25'); + pyMemo:= TMemo.create(PyForm); + apd:= TApdMeter.create(pyform); + //apd.color:= clyellow; + apd.parent:= pyform; + apd.barcolor:= clred; + apd.position:= 30; + apd.SetBounds(10,100, 150, 150); + apd.visible:= true; + pyMemo.parent:= PyForm + PyForm.show; + + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a + //PYLaz_P4D_Demo2; EKON25 - explicit better than implicit + eg:= TPythonEngine.Create(Nil); + try + eg.pythonhome:= PYHOME; + eg.loadDLL; + println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); + writeln('') + //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a + apd.position:= 60; + pyMemo.lines.add('call test with execStr() from faker import Faker'); + println(eg.EvalStr('__import__("faker").Faker()')); + sw:= TStopWatch.Create(); + sw.Start; + eg.execStr('from faker import Faker'); + eg.execStr('import simplejson as json'); //# instead of import json + eg.execStr('import dumper, hashlib, json'); + eg.execStr('fake = Faker()'); + fprofile:= eg.evalStr('(fake.profile())') + fprofile:= StringReplace(fprofile,'\n',CRLF,[rfReplaceAll]); + //fprofile:= eg.evalStr('fake.profile().replace("\n"," ")'); + //Exception: : 'dict' object has no attribute 'replace'. + println('fake person profile: '+CRLF+fprofile+CRLF); + //dumpJSON(fprofile); + //eg.execStr('profile1 = fake.simple_profile()'); + //eg.execStr('ad= dumper.dump(profile1)'); + //println(eg.evalStr('dumper.dump(profile1)')) + //println(eg.evalStr('f"my profile: {fake.profile()}"')); + //println(eg.evalStr('json.dumps(fake.profile(),indent=4)')); + println('creditcard#: '+eg.evalStr('fake.credit_card_number()')); //} + eg.execStr('fake = Faker(["es_MX"])') + //for i in range(10): + for it:= 1 to 5 do + println(UTF8toAnsi(eg.evalStr('fake.name()'))); + + eg.execStr(BHASH) + println(eg.evalStr('bhash(0,"maXbox4")')); + eg.execStr(BHASH2) + println(eg.evalStr('bhash2(0,"maXbox4")')); + writeln(ReverseHash(eg.evalStr('bhash2(0,"maXbox4")'))); + writeln(eg.evalStr('hash(10**2000)')); + sw.Stop; + //sw.ElapsedMilliseconds; + writeln('Stop Watch Faker Tester1: '+sw.getValueStr) + except + eg.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eg.Free; + sw.Free; + sw:= Nil; + apd.position:= 100; + end; + + with TSectionList.create do begin + //IndexOf(const S: AnsiString): Integer; override; + //IndexOfName(const name: string): Integer; //override; + //SectionItems + free + end; + +End. + +Ref: https://towardsdatascience.com/build-a-data-streaming-job-in-5-mins-with-pyspark-faker-a4f3d2420384 + https://www.codespeedy.com/faker-library-in-python/ +{'job': 'Research officer, political party', 'company': 'Davis-Perez', 'ssn': '520-11-9286', 'residence': '18365 Katherine Plains\nAliceville, OK 31762', 'current_location': (Decimal('47.667757'), Decimal('14.943272')), 'blood_group': 'O-', 'website': ['https://www.thompson.com/', 'https://graham.com/', 'http://www.thomas.com/'], 'username': 'hbass', 'name': 'Tammy Crane', 'sex': 'F', 'address': '3144 Stephanie Road\nWilliambury, MT 95571', 'mail': 'wthompson@yahoo.com', 'birthdate': datetime.date(1962, 11, 25)} +4978088480978 + mX4 executed: 05/12/2021 11:43:04 Runtime: 0:0:2.197 Memload: 36% use + + +Optimizations + +The Faker constructor takes a performance-related argument called use_weighting. It specifies whether to attempt to have the frequency of values match real-world frequencies (e.g. the English name Gary would be much more frequent than the name Lorimer). If use_weighting is False, then all items have an equal chance of being selected, and the selection process is much faster. The default is True. + +Santiago Carmona +�ngel Judith Roque Amador +Susana Eloy Rocha Blanco +Rodolfo Urbina Su�rez +Juana Irma de la Torre Mares + +Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable. +writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion)); +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) +t1.start() +t2.start() + +This package implements JSON support for FPC. + +# check if the blockchain is valid +def is_chain_valid(self, chain): + # get the first block in the chain and it serves as the previous block + previous_block = chain[0] + # an index of the blocks in the chain for iteration + block_index = 1 + while block_index < len(chain): + # get the current block + block = chain[block_index] + # check if current block link to previous block is same as the hash of previous block + if block["previous_hash"] != self.hash(previous_block): + return False + + # get the previous proof from the previous block + previous_proof = previous_block['proof'] + + # get the current proof from the current block + current_proof = block['proof'] + + # run the proof data through the algorithm + hash_operation = hashlib.sha256(str(current_proof ** 2 - + previous_proof ** 2).encode()).hexdigest() + # check if hash operation is invalid + if hash_operation[:4] != '0000': + return False + # set previous block to current block after running validation on current block + previous_block = block + block_index += 1 + return True + +PascalCoin: Cryptocurrecy developed with FreePascal. + + Infinite Scaling � Only keeps the last 100 blocks of the blockchain (the Flow) instead the full history. This keeps the ledger from getting large. + Very high transaction rate � over 100 transactions per second. + Supports Asserts, Sub Tokens and smart contracts. + Wallet available on Windows and Linux. No android and ios support yet. + for Current Pascalcoin Price, check here. + Passion is no replacement for reason +"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins) + \ No newline at end of file diff --git a/Demos/pydemo34.pas b/Demos/pydemo34.pas new file mode 100644 index 00000000..11f8ca87 --- /dev/null +++ b/Demos/pydemo34.pas @@ -0,0 +1,267 @@ +program Pathological_floating_point_problems_Py; +{ + Most programmers are familiar with the inexactness of floating point + calculations in a binary processor. + https://downloads.blaisepascal.eu/BlaisePascalMagazine_99_100_UK.pdf + History: http://www.rosettacode.org/wiki/Pathological_floating_point_problems#Python + http://www.rosettacode.org/wiki/Pathological_floating_point_problems#Delphi +} + +Const PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + +var mykmdict: TKMemoDictionary; + +type + TTBalance = record + e, d: TInteger; //BigInteger; + end; + TTBalance2 = record + e, d: TBigfloat; //BigInteger; + end; + +//{$I logo.p} +PROCEDURE logo; +BEGIN + writeln(''); + writeln(' .-------------------------------------------.'); + writeln(' | The Chaotic PasPy Bank Society |'); + writeln(' | Task2 rosettacode 1988-2021 M.K. |'); + writeln(' .-------------------------------------------.'); + writeln(''); +END; {procedure logo} + + +procedure BankBalance2(); +var balance: TTBalance2; + one, ef, df: TBigfloat; y: integer; + e, b: TBigfloat; m: TInteger; //BigDecimal; +begin + //balance.e := 1; + //RegisterMethod('Constructor Create1( const MaxSig : TMaxSig);'); prec.: 50 + balance.e := TBigfloat.create1(50); + balance.e.assign5(1) + balance.d := TBigfloat.create1(50); + balance.d.assign5(-1); + one :=TBigfloat.create; + one.assignone; + + for {var} y:= 1 to 25 do begin + //m := y; + m:= TInteger.create(y); + //m.assign5(y) + balance.e.mult2(m); + //balance.d := m * balance.d; + balance.d.mult2(m) + //balance.d := balance.d - one; + balance.d.subtract(one); + //balance.d.assign(balance.d); + m.Free; + end; + //writeln(balance.d.ToString(scientific)); + + e:= TBigfloat.Create1(25); + e.assign8('2.7182818284590452353602874713526624977572470936999'); + + //ef := balance.e; + ef:= TBigfloat.create(); + ef.assign(balance.e) + //df := balance.d; + df:= TBigfloat.create(); + df.assign(balance.d) + + //b := e * ef; + //b := b + df; + b:= TBigfloat.Create(); + b.assign(e); + b.mult(ef); + //b.assign4(df); + //b.add1(strtoint64(df.ToString(normal))); + b.add(df) + //writeln(format('Bank balance after 25 years: $%.2f', [b.AsDouble])); + writeln(format('Bank balance after 25 years: $ %s', [b.ToString(normal)])); + writeln(format('Bank balance after 25 years: $ %s', [b.ToString(scientific)])); + b.Free; e.Free; + df.Free; ef.Free; + one.Free; +end; + +Const pybankDEF = + 'def bank(years:int) -> float: ' ++LF+' """ ' ++LF+' Warning: still will diverge, returns incorrect results after 250 years' ++LF+' the higher the precision, the more years will cover ' ++LF+' """ ' ++LF+' getcontext().prec = 500 ' ++LF+' # standard math.e has not enough precision ' ++LF+' e = Decimal("2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056953696770785449969967946864454905987931636889230098793127736178215424999229576351") ' ++LF+' decimal_balance = e - 1 ' ++LF+' for year in range(1, years+1): ' ++LF+' decimal_balance = decimal_balance * year - 1 ' ++LF+' return(float(decimal_balance)) '; + +procedure pyBank; +var eg: TPythonEngine; + sw: TStopWatch; +begin +eg:= TPythonEngine.Create(Nil); + try + eg.pythonhome:= PYHOME; + eg.loadDLL; + println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); + writeln('') + //println(eg.EvalStr('__import__("faker").Faker()')); + sw:= TStopWatch.Create(); + sw.Start; + {eg.execStr('from faker import Faker'); + eg.execStr('import dumper, hashlib, json'); + eg.execStr('fake = Faker()'); + println('creditcard#: '+eg.evalStr('fake.credit_card_number()')); //} + //eg.execStr('fake = Faker(["es_MX"])') + //for i in range(10): + + eg.execStr('from decimal import Decimal, getcontext'); + eg.execStr(pybankDEF) + //"Bank balance after 25 years = ", bank(25) + println('Bank balance after 25 years = '+ + eg.evalStr('bank(25)')); + BankBalance2(); + sw.Stop; + //sw.ElapsedMilliseconds; + writeln('Stop PyBank Tester1: '+sw.getValueStr) + except + eg.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eg.Free; + sw.Free; + sw:= Nil; + end; +end; + +Const UPPERLIMIT = 100; +var cnt,n, precision: NativeUint; + dec_bal: extended; + e, decbal: TBigfloat; + +begin //@main + logo; + //{var} f := flots(v); + //BankBalance(); + BankBalance2(); + pyBank(); + + dec_bal := Euler - 1; + writeln(flots(dec_bal)) + for it:= 1 to 26 do + dec_bal:= (dec_bal * it) - 1; + writeln(flots(dec_bal)); + + e:= TBigfloat.Create1(25); + e.assign8('2.71828182845904523536028747135266249775724709369995957496696762'); + e.subtract1(1); + for it:= 1 to 26 do begin + e.mult3(it) + e.subtract1(1); + end; + writeln(format('Bank balance simple 25 years: $ %s',[e.ToString(normal)])); + e.Free; + +End. + +ref: 0.03993872967323020890367053 + 0.03993872967323020890367053 +PY 0.03993872967323021 + +Bank balance after 25 years = 0.03993872967323021 +Bank balance after 25 years: $ 0.03993872967323020890367053 +Bank balance after 25 years: $ 3.9938729673230208903670531 E -2 +Stop PyBank Tester1: 0:0:0.15 + mX4 executed: 21/12/2021 21:10:25 Runtime: 0:0:1.598 Memload: 39% use + +procedure SIRegister_TBigFloat(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TObject', 'TBigFloat') do + with CL.AddClassN(CL.FindClass('TObject'),'TBigFloat') do begin + RegisterProperty('decpart', 'TFloatInt', iptrw); + RegisterProperty('sigdigits', 'word', iptrw); + RegisterProperty('exponent', 'integer', iptrw); + RegisterMethod('Constructor Create;'); + RegisterMethod('Constructor Create1( const MaxSig : TMaxSig);'); + RegisterMethod('Procedure Assign( A : TBigFloat);'); + RegisterMethod('Procedure Assign3( A : TBigFloat; SigDig : word);'); + RegisterMethod('Procedure Assign4( A : TInteger);'); + RegisterMethod('Procedure Assign5( N : int64);'); + RegisterMethod('Procedure Assign6( N : int64; SigDig : integer);'); + RegisterMethod('Procedure Assign7( d : extended);'); + RegisterMethod('Procedure Assign8( S : string);'); + RegisterMethod('Procedure Assign9( S : string; SigDig : word);'); + RegisterMethod('Procedure AssignZero'); + RegisterMethod('Procedure AssignOne'); + RegisterMethod('Procedure Add( B : TBigFloat);'); + RegisterMethod('Procedure Add1( B : int64);'); + RegisterMethod('Procedure AbsAdd( B : TBigFloat)'); + RegisterMethod('Procedure Subtract( B : TBigFloat);'); + RegisterMethod('Procedure Subtract1( B : int64);'); + RegisterMethod('Procedure Mult( B : TBigFloat);'); + RegisterMethod('Procedure Mult1( B : TBigfloat; const MaxSig : TMaxSig);'); + RegisterMethod('Procedure Mult2( B : TInteger);'); + RegisterMethod('Procedure Mult3( B : int64);'); + RegisterMethod('Procedure MultRaw( B : TBigFloat)'); + RegisterMethod('Procedure Reciprocal( const MaxSig : TMaxSig)'); + RegisterMethod('Procedure Divide( B : TBigFloat; const MaxSig : TMaxSig);'); + RegisterMethod('Procedure Divide1( B : TInteger; const MaxSig : TMaxSig);'); + RegisterMethod('Procedure Divide2( B : int64; const MaxSig : TMaxSig);'); + RegisterMethod('Procedure Square( const MaxSig : TMaxSig)'); + RegisterMethod('Function Compare( B : TBigFloat) : integer'); + RegisterMethod('Function IsZero : boolean'); + RegisterMethod('Procedure MaxBigFloat( B : TBigFloat)'); + RegisterMethod('Procedure MinBigFloat( B : TBigFloat)'); + RegisterMethod('Procedure Sqrt;'); + RegisterMethod('Procedure Sqrt1( const MaxSig : TMaxSig);'); + RegisterMethod('Procedure NRoot( N : integer; const MaxSig : TMaxSig)'); + RegisterMethod('Procedure IntPower( intpower : integer; const MaxSig : TMaxSig)'); + RegisterMethod('Procedure Power( power : TBigfloat; const MaxSig : TMaxSig)'); + RegisterMethod('Procedure Log( const MaxSig : TMaxSig)'); + RegisterMethod('Procedure Log10( const MaxSig : TMaxSig)'); + RegisterMethod('Procedure Exp( const MaxSig : TMaxSig)'); + RegisterMethod('Procedure PiConst( const MaxSig : TMaxSig)'); + RegisterMethod('Procedure Log2Const( const MaxSig : TMaxSig)'); + RegisterMethod('Procedure RoundToPrec( const MaxSig : TMaxSig);'); + RegisterMethod('Procedure RoundToPrec1;'); + RegisterMethod('Procedure Trunc( const x : integer)'); + RegisterMethod('Procedure Floor( const x : integer)'); + RegisterMethod('Procedure Ceiling( const x : integer)'); + RegisterMethod('Procedure Round( const x : integer);'); + RegisterMethod('Procedure AbsoluteValue'); + RegisterMethod('Procedure Negate'); + RegisterMethod('Procedure SetSigDigits( const newsigdigits : integer)'); + RegisterMethod('Function ConvertToString( const View : TView) : string'); + RegisterMethod('Function ToString( const View : TView) : string'); + RegisterMethod('Function ConvertToExtended( var num : extended) : boolean'); + RegisterMethod('Function ConvertToInt64( var N : int64) : boolean'); + RegisterMethod('Function IntPart : int64'); + end; +end; + + +ref: https://github.com/cutec-chris/kcontrols/blob/master/source/kfunctions.pas + + TKObject = class(TObject) + private + FParent: TKObjectList; + procedure SetParent(const Value: TKObjectList); + protected + FUpdateLock: Integer; + procedure CallBeforeUpdate; virtual; + procedure CallAfterUpdate; virtual; + procedure ParentChanged; virtual; + public + constructor Create; virtual; + procedure Assign(ASource: TKObject); virtual; + function EqualProperties(AValue: TKObject): Boolean; virtual; + procedure LockUpdate; virtual; + procedure UnLockUpdate; virtual; + function UpdateUnlocked: Boolean; virtual; + property Parent: TKObjectList read FParent write SetParent; + end; diff --git a/Demos/pydemo35.htm b/Demos/pydemo35.htm new file mode 100644 index 00000000..10fa2e3e --- /dev/null +++ b/Demos/pydemo35.htm @@ -0,0 +1,429 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000066893 +StartFragment:0000001053 +EndFragment:0000066877 + + + + +mXScriptasHTML + + + + + +
Program PyDemo5_Eval_Exec5_Powerliners_2;
+
+//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas
+//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine
+//https://thepythonguru.com/python-builtin-functions/eval/
+//https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/
+//https://stackoverflow.com/questions/359498/how-can-i-unload-a-dll-using-ctypes-in-python
+//https://levelup.gitconnected.com/5-powerful-python-one-liners-you-should-know-469b9c4737c7
+
+//interface   - customize your PY environment first
+{uses
+  Classes, SysUtils,
+  Windows, Messages, Graphics, Controls, Forms, Dialogs,
+  StdCtrls, ComCtrls, ExtCtrls,
+  PythonEngine, Vcl.PythonGUIInputOutput, PythonVersions.pas ;   }  
+  
+procedure PyFinalize();
+      external 
+  //'Py_Finalize@C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll stdcall';
+   'Py_Finalize@C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll stdcall';       
+//Note: modify PYHOME and PYDLL :
+
+//const PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; 
+Const PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
+      PYDLL  = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll'; 
+      PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py';
+      PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py';
+      LB = CR+LF;
+       
+const PyModule =
+              'def printData(data): '+#13#10+
+              '  return data+data+"/n"';       
+         
+const PYCMD = 'print("this is box")'+LB+ 
+              'import sys'+LB+ 
+              'f=open(r"1050pytest21_5powers.txt","w")'+LB+
+              'f.write("Hello PyWorld_mX47580, \n")'+LB+
+              'f.write("This data will be written on the file.")'+LB+ 
+              'f.close()';
+
+//https://pythongui.org/learn-about-powerful-python-decorators-in-a-delphi-windows-gui-app/              
+const DECOR = 'def say_hi():'+LF+
+              ' return "Hello there from maXbox4"';              
+              
+var myloadscript: string;
+     PyForm: TForm; pyMemo: TMemo;
+     avar: string; pyval: variant; pyint: integer;
+
+Procedure PYLaz_P4D_Demo2;
+//https://wiki.freepascal.org/Python4Delphi 
+var eng : TPythonEngine;
+    Out1: TPythonGUIInputOutput;
+    pystrings: TStrings;
+begin
+  eng:= TPythonEngine.Create(Nil);
+  Out1:= TPythonGUIInputOutput.create(nil)
+  Out1.output:= pyMemo; //debugout.output; or memo2;
+  Out1.RawOutput:= False;
+  Out1.UnicodeIO:= False;
+  Out1.maxlines:= 50;
+  out1.displaystring('this string thing draw the line')
+  
+  //writeln(botostr(Isx64(exepath+'examples\python36.dll')));
+  //writeln(botostr(Isx64(pydllpath2)));
+  //eng.dllpath:= exepath;
+  //eng.dllname:='python37.dll';
+  eng.pythonhome:= PYHOME;
+  try
+   //pymod.InitializeForNewInterpreter; //}
+   //pymod.engine:= eng;
+    eng.opendll(PYDLL)
+    eng.IO:= Out1;
+    eng.AutoFinalize:= True; 
+    //eng.AutoUnload:= false; 
+    writeln(eng.dllname);
+    //pymod.engine:= eng;
+    if eng.IsHandleValid then begin
+      writeln('DLLhandle: '+botostr(eng.IsHandleValid))
+      WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]'));
+      WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])'));
+      WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])'));
+      WriteLn('mathstr: '+ eng.EvalStr('"py " * 7'));
+      //WriteLn('builtins: '+ eng.EvalStr('dir(__builtins__)'));
+      WriteLn('upperstr: '+ eng.EvalStr('"hello again".upper()'));
+      pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("os").getcwd()'));
+      writeln('syncheck '+
+      botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])')));
+      
+      WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))'));
+      WriteLn('powerline2: '+ eng.EvalStr('list(map(float, ["1",2,"3.0",4.0,"5",6]))'));
+               eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))');
+      WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)'));
+      
+               eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]');
+               eng.Execstring('transpose_A = [list(i) for i in zip(*A)]');
+      WriteLn('powerline4: '+ eng.EvalStr('transpose_A'));  
+      
+      //We can use dictionary comprehension to swap key-value pairs.
+               eng.Execstring('staff= {"Data Scientist":"John","Django Developer":"Max"}');
+      WriteLn('powerline5: '+ eng.EvalStr('{i:j for j, i in staff.items()}'));                                                   
+      eng.ExecString('print("powers:",[x**2 for x in range(10)])');
+      writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(PYCMD)));
+      eng.ExecString(PYCMD);
+      
+     { pystrings:= TStringlist.create;
+      pystrings.add('import matplotlib.pyplot as plt')
+      pystrings.add('import numpy as np')
+      pystrings.add('np.arange(5, 24, 3)')
+      pystrings.add('fig, ax = plt.subplots(dpi=153)')
+      pystrings.add('plt.plot([1,2,3,4,5,6], [1,2,3,4,9,5], "go")')
+      pystrings.add('plt.show()')
+      eng.ExecStrings4(pystrings);
+      pystrings.free; }
+      
+      //eng.ExecString('import subprocess');  
+      //eng.ExecString('subprocess.call(["pip", "install", "sympy"])')
+      eng.ExecString('from sympy import *');
+      eng.ExecString('from sympy.plotting import plot'); 
+      writeln(eng.EvalStr('list(primerange(7, 150))'));
+      writeln(eng.EvalStr('sum(list(primerange(0, 100)))'));
+      writeln(eng.EvalStr('(list(primerange(0, 101)))'));
+      writeln(eng.EvalStr('len(list(primerange(0, 101)))'));
+      //https://www.tutorialspoint.com/sympy/sympy_solvers.htm
+      avar:= '-2';
+     { eng.ExecString('x=Symbol("x")');
+      eng.ExecString('x,y=symbols("x y")');
+      writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)'));
+      writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)'));
+      writeln(eng.EvalStr('solveset(exp(x),x)'));
+      println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))')); }
+     
+      //eng.ExecString('plot(x**'+avar+', line_color="red")');
+      //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))');
+      {
+      eng.ExecString('from sympy.plotting import plot3d'); 
+      eng.ExecString('x,y=symbols("x y") '); 
+      eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); }
+      
+      pyval:= VarPythonEval('sum([x for x in range(201)])');
+      //writeln('evalvar '+botostr(VarIsPythonList(pyval)));
+      writeln('evalvar '+botostr(VarIsnumeric(pyval)));
+      pyval:= NewPythonDict;
+      writeln(botostr(VarIsPython( pyval)));
+      pyval := (VarPythonEval('2 ** 3'));         
+     { eng.ExecString('import subprocess');  
+      eng.ExecString('subprocess.call(["pip", "install", "langdetect"])')
+      eng.ExecString('from langdetect import detect'); 
+      println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")'));
+      }
+      {eng.ExecString('from array import *');
+      eng.ExecString('import pandas as pd');
+      eng.ExecString('df=pd.read_csv("./examples/submission.csv")');
+      println(eng.EvalStr('df'));
+      //Exception: <class 'RuntimeError'>: Can only map one python type to DType.  }
+      
+      eng.Execstring(DECOR)
+      //eng.ExecString(' return "hello there"');  
+      print(eng.EvalStr('say_hi()'));
+      
+      //os.path.getsize('sample.csv')
+      eng.Execstring('import os')
+      println(eng.EvalStr('os.path.getsize("./maXbox4.exe")'));
+      //eng.Execstring('quit()')
+      
+      //eng.ExecString('import subprocess');  
+      //eng.ExecString('subprocess.call(["pip3", "install", "pysound"])')
+      //eng.ExecString('import subprocess');  
+      //eng.ExecString('subprocess.call(["pip3", "install", "playsound"])')
+      
+      //https://realpython.com/playing-and-recording-sound-python/
+      //eng.Execstring('from playsound import playsound')
+    //eng.Execstring('playsound(r"C:\Program Files\Streaming\maxbox4\maxbox4\airmaxloop3.mp3",0)')
+      
+      //eng.ExecString('import subprocess');  
+      //eng.ExecString('subprocess.call(["pip3", "install", "libROSA"])')
+      //eng.Execstring('import librosa as lr')
+      
+      eng.Execstring('from collections import defaultdict')
+      eng.Execstring('my_default_dict={}')
+      
+      //eng.Execstring('for letter in "the red fox ran as fast as it could":'+LF+
+        //                               ' my_default_dict[letter] += 1')
+      
+      eng.Execstring('set1=[1, 2, 3, 4, 5]'+LF+'set2=[3, 4, 5, 6, 7]')
+      eng.Execstring('set1, set2 = set2, set1');
+      println(eng.EvalStr('set1, set2'));
+      eng.ExecString('import random');
+      println(eng.EvalStr('random.sample(set1, 3)'));
+      //memo2.font.name:= 'courier';
+      
+     { eng.ExecString('import pandas as pd');
+      eng.ExecString('import seaborn as sns');
+      eng.ExecString('diamonds = sns.load_dataset("diamonds")');
+      println(eng.EvalStr('diamonds.describe().T.head(10)'));  }
+  //https://levelup.gitconnected.com/25-python-one-liners-everyone-should-know-8befc13248c3
+  //1. Merge two dictionaries in a single expression
+    eng.Execstring('x = {"a": 1, "b": 2}'+LF+'y = {"c": 3, "d": 4}');
+    println('merge dic(): '+eng.EvalStr('{**x, **y}'));
+  //2. Merge two lists
+    eng.Execstring('x = ["a", "b"]'+LF+'y = ["c", "d", "e"]'+LF+'x.extend(y)');
+    println('merge list(): '+eng.EvalStr('x'));
+  //3. Get the most frequent element
+    eng.ExecString('from collections import Counter');
+    eng.Execstring('my_list = ["a", "b", "b", "a", "a", "a", "c", "c", "b", "d"]');
+    println('counter most: '+eng.EvalStr('Counter(my_list).most_common()[0][0]')); 
+  //4. Get quotient and remainder at the same time  
+    eng.ExecString('quotient, remainder = divmod(37, 5)');
+    println('q+remainder: '+eng.EvalStr('quotient, remainder'));
+  //5. Get the longest string from a list  
+    eng.ExecString('words = ["Python", "is", "naturally", "awesome"]'); 
+    println('longest string: '+eng.EvalStr('max(words, key=len)')); 
+  //6. Get a list in the reverse order 
+    println('reverse: '+eng.EvalStr('words[::-1]')); 
+    eng.ExecString('sentence = "Python is naturally awesome \n"');
+    println('reversesent : '+eng.EvalStr('sentence[::-1]')); 
+  //8. Write into a file  
+    eng.ExecString('with open("file.txt","a",newline="\n") as f: f.write(sentence)');
+    openfile(exepath+'file.txt');
+    out1.displaystring(loadfile(exepath+'file.txt'))
+  //9. Read a file in a single line 
+    println('read file line : '+
+                       eng.EvalStr('[line.strip() for line in open("file.txt")]')); 
+  //12. Find the first n Fibonacci numbers                      
+    eng.ExecString('fib = lambda x: x if x <= 1 else fib(x - 1) + fib(x - 2)');
+    println('fibo select : '+eng.EvalStr('fib(15)')); 
+  //13. Count the number of occurrences of a character in a string  
+    println('count char : '+eng.EvalStr('"I love Python".count("o")'));  
+  //14. Sort in a single line   
+    eng.ExecString('numbers = [5, -3, 428, -102, 4, 1]');     
+    println('sort line : '+eng.EvalStr('numbers.sort()')+eng.Evalstr('numbers'));  
+  //21. Remove duplicate elements from a list
+    println('remove dups : '+eng.EvalStr('list(set(["a","a","b","a","c"]))'));   
+  //22. Convert a list of strings to integers
+    println('convert : '+eng.EvalStr('list(map(int,["1","2","3"]))')); 
+    //Let�s make it in a single line:
+    println('iterators : '+eng.EvalStr('[(*range(1, 16))]'));                   
+      
+    pymemo.update;
+    end
+      else writeln('invalid library handle! '+Getlasterrortext);
+    println('PythonOK: '+botostr(PythonOK));  
+  except
+     eng.raiseError;
+     writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam));
+  //PyErr Exception: Access violation at address 50F49DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000022.
+  finally
+     //eng.close 
+     eng.unloaddll; 
+     //PyFinalize();
+     eng.free;
+     //PyFinalize();
+  end;     
+  out1.free;
+  //pyImport(PyModule);
+end;
+
+begin  //@main
+  //PythonEngine1.Free;
+  //myloadscript2:= filetostring(PYSCRIPT2);
+  
+  PyForm:= loadForm2(300,400, clgreen,'PyFrm4D');
+  pyMemo:= TMemo.create(PyForm);
+  pymemo.height:= 380; pymemo.width:= 250;
+  pyMemo.parent:= PyForm
+  PyForm.show;
+  
+  PYLaz_P4D_Demo2; 
+  
+  //register_PYthonGUI;
+End.
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191
+
+https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib
+
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install sympy
+Collecting sympy
+  Cache entry deserialization failed, entry ignored
+  Downloading https://files.pythonhosted.org/packages/78/43/33c5a5e7fbafbf51520f
+4e09cb0634a1ca1d4cd5469c57967e43183d7a42/sympy-1.9-py3-none-any.whl (6.2MB)
+    100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 6.2MB 186kB/s
+Collecting mpmath>=0.19 (from sympy)
+  Cache entry deserialization failed, entry ignored
+  Downloading https://files.pythonhosted.org/packages/d4/cf/3965bddbb4f1a61c49aa
+cae0e78fd1fe36b5dc36c797b31f30cf07dcbbb7/mpmath-1.2.1-py3-none-any.whl (532kB)
+    100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 542kB 1.0MB/s
+Installing collected packages: mpmath, sympy
+Successfully installed mpmath-1.2.1 sympy-1.9
+You are using pip version 9.0.1, however version 21.3.1 is available.
+You should consider upgrading via the 'python -m pip install --upgrade pip' comm
+and.
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>
+
+Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL.
+Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before.
+
+Evil eval()
+
+You should never pass untrusted source to the eval() directly. As it is quite easy for the malicious user to wreak havoc on your system. For example, the following code can be used to delete all the files from the system.
+
+1 >>>
+2 eval('os.system("RM -RF /")') # command is deliberately capitalized
+3 >>>
+
+
+Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download
+--------------------------------------------------------
+dll EXCEPT Exception: There is already one instance of TPythonEngine running.
+TRUE
+Exception: Python is not properly initialized.
+PascalScript maXbox4 - RemObjects & SynEdit
+
+dll EXCEPT Exception: There is already one instance of TPythonEngine running.
+TRUE
+Exception: Python is not properly initialized.
+
+dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E.
+TRUE
+Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD.
+
+mapdll EXCEPT Exception: There is already one instance of TPythonEngine running.
+PythonOK TRUE
+ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC.
+ mX4 executed: 26/07/2021 13:30:51  Runtime: 0:0:2.48  Memload: 71% use
+ 
+Example 3: Python multithreading
+
+All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program.
+
+
+import threading 
+  
+def print_hello_three_times():
+  for i in range(3):
+    print("Hello")
+  
+def print_hi_three_times(): 
+    for i in range(3): 
+      print("Hi") 
+
+t1 = threading.Thread(target=print_hello_three_times)  
+t2 = threading.Thread(target=print_hi_three_times)  
+
+t1.start()
+t2.start()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                   
+
+
+
+  
+
+
+    
+
+ \ No newline at end of file diff --git a/Demos/pydemo35.txt b/Demos/pydemo35.txt new file mode 100644 index 00000000..db52e26f --- /dev/null +++ b/Demos/pydemo35.txt @@ -0,0 +1,396 @@ +Program PyDemo5_Eval_Exec5_Powerliners_2; + +//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas +//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine +//https://thepythonguru.com/python-builtin-functions/eval/ +//https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/ +//https://stackoverflow.com/questions/359498/how-can-i-unload-a-dll-using-ctypes-in-python +//https://levelup.gitconnected.com/5-powerful-python-one-liners-you-should-know-469b9c4737c7 + +//interface - customize your PY environment first +{uses + Classes, SysUtils, + Windows, Messages, Graphics, Controls, Forms, Dialogs, + StdCtrls, ComCtrls, ExtCtrls, + PythonEngine, Vcl.PythonGUIInputOutput, PythonVersions.pas ; } + +procedure PyFinalize(); + external + //'Py_Finalize@C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll stdcall'; + 'Py_Finalize@C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll stdcall'; +//Note: modify PYHOME and PYDLL : + +//const PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; +Const PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py'; + LB = CR+LF; + +const PyModule = + 'def printData(data): '+#13#10+ + ' return data+data+"/n"'; + +const PYCMD = 'print("this is box")'+LB+ + 'import sys'+LB+ + 'f=open(r"1050pytest21_5powers.txt","w")'+LB+ + 'f.write("Hello PyWorld_mX47580, \n")'+LB+ + 'f.write("This data will be written on the file.")'+LB+ + 'f.close()'; + +//https://pythongui.org/learn-about-powerful-python-decorators-in-a-delphi-windows-gui-app/ +const DECOR = 'def say_hi():'+LF+ + ' return "Hello there from maXbox4"'; + +var myloadscript: string; + PyForm: TForm; pyMemo: TMemo; + avar: string; pyval: variant; pyint: integer; + +Procedure PYLaz_P4D_Demo2; +//https://wiki.freepascal.org/Python4Delphi +var eng : TPythonEngine; + Out1: TPythonGUIInputOutput; + pystrings: TStrings; +begin + eng:= TPythonEngine.Create(Nil); + Out1:= TPythonGUIInputOutput.create(nil) + Out1.output:= pyMemo; //debugout.output; or memo2; + Out1.RawOutput:= False; + Out1.UnicodeIO:= False; + Out1.maxlines:= 50; + out1.displaystring('this string thing draw the line') + + //writeln(botostr(Isx64(exepath+'examples\python36.dll'))); + //writeln(botostr(Isx64(pydllpath2))); + //eng.dllpath:= exepath; + //eng.dllname:='python37.dll'; + eng.pythonhome:= PYHOME; + try + //pymod.InitializeForNewInterpreter; //} + //pymod.engine:= eng; + eng.opendll(PYDLL) + eng.IO:= Out1; + eng.AutoFinalize:= True; + //eng.AutoUnload:= false; + writeln(eng.dllname); + //pymod.engine:= eng; + if eng.IsHandleValid then begin + writeln('DLLhandle: '+botostr(eng.IsHandleValid)) + WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]')); + WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])')); + WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])')); + WriteLn('mathstr: '+ eng.EvalStr('"py " * 7')); + //WriteLn('builtins: '+ eng.EvalStr('dir(__builtins__)')); + WriteLn('upperstr: '+ eng.EvalStr('"hello again".upper()')); + pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("os").getcwd()')); + writeln('syncheck '+ + botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])'))); + + WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))')); + WriteLn('powerline2: '+ eng.EvalStr('list(map(float, ["1",2,"3.0",4.0,"5",6]))')); + eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))'); + WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)')); + + eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]'); + eng.Execstring('transpose_A = [list(i) for i in zip(*A)]'); + WriteLn('powerline4: '+ eng.EvalStr('transpose_A')); + + //We can use dictionary comprehension to swap key-value pairs. + eng.Execstring('staff= {"Data Scientist":"John","Django Developer":"Max"}'); + WriteLn('powerline5: '+ eng.EvalStr('{i:j for j, i in staff.items()}')); + eng.ExecString('print("powers:",[x**2 for x in range(10)])'); + writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(PYCMD))); + eng.ExecString(PYCMD); + + { pystrings:= TStringlist.create; + pystrings.add('import matplotlib.pyplot as plt') + pystrings.add('import numpy as np') + pystrings.add('np.arange(5, 24, 3)') + pystrings.add('fig, ax = plt.subplots(dpi=153)') + pystrings.add('plt.plot([1,2,3,4,5,6], [1,2,3,4,9,5], "go")') + pystrings.add('plt.show()') + eng.ExecStrings4(pystrings); + pystrings.free; } + + //eng.ExecString('import subprocess'); + //eng.ExecString('subprocess.call(["pip", "install", "sympy"])') + eng.ExecString('from sympy import *'); + eng.ExecString('from sympy.plotting import plot'); + writeln(eng.EvalStr('list(primerange(7, 150))')); + writeln(eng.EvalStr('sum(list(primerange(0, 100)))')); + writeln(eng.EvalStr('(list(primerange(0, 101)))')); + writeln(eng.EvalStr('len(list(primerange(0, 101)))')); + //https://www.tutorialspoint.com/sympy/sympy_solvers.htm + avar:= '-2'; + { eng.ExecString('x=Symbol("x")'); + eng.ExecString('x,y=symbols("x y")'); + writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)')); + writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)')); + writeln(eng.EvalStr('solveset(exp(x),x)')); + println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))')); } + + //eng.ExecString('plot(x**'+avar+', line_color="red")'); + //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))'); + { + eng.ExecString('from sympy.plotting import plot3d'); + eng.ExecString('x,y=symbols("x y") '); + eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); } + + pyval:= VarPythonEval('sum([x for x in range(201)])'); + //writeln('evalvar '+botostr(VarIsPythonList(pyval))); + writeln('evalvar '+botostr(VarIsnumeric(pyval))); + pyval:= NewPythonDict; + writeln(botostr(VarIsPython( pyval))); + pyval := (VarPythonEval('2 ** 3')); + { eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "langdetect"])') + eng.ExecString('from langdetect import detect'); + println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")')); + } + {eng.ExecString('from array import *'); + eng.ExecString('import pandas as pd'); + eng.ExecString('df=pd.read_csv("./examples/submission.csv")'); + println(eng.EvalStr('df')); + //Exception: : Can only map one python type to DType. } + + eng.Execstring(DECOR) + //eng.ExecString(' return "hello there"'); + print(eng.EvalStr('say_hi()')); + + //os.path.getsize('sample.csv') + eng.Execstring('import os') + println(eng.EvalStr('os.path.getsize("./maXbox4.exe")')); + //eng.Execstring('quit()') + + //eng.ExecString('import subprocess'); + //eng.ExecString('subprocess.call(["pip3", "install", "pysound"])') + //eng.ExecString('import subprocess'); + //eng.ExecString('subprocess.call(["pip3", "install", "playsound"])') + + //https://realpython.com/playing-and-recording-sound-python/ + //eng.Execstring('from playsound import playsound') + //eng.Execstring('playsound(r"C:\Program Files\Streaming\maxbox4\maxbox4\airmaxloop3.mp3",0)') + + //eng.ExecString('import subprocess'); + //eng.ExecString('subprocess.call(["pip3", "install", "libROSA"])') + //eng.Execstring('import librosa as lr') + + eng.Execstring('from collections import defaultdict') + eng.Execstring('my_default_dict={}') + + //eng.Execstring('for letter in "the red fox ran as fast as it could":'+LF+ + // ' my_default_dict[letter] += 1') + + eng.Execstring('set1=[1, 2, 3, 4, 5]'+LF+'set2=[3, 4, 5, 6, 7]') + eng.Execstring('set1, set2 = set2, set1'); + println(eng.EvalStr('set1, set2')); + eng.ExecString('import random'); + println(eng.EvalStr('random.sample(set1, 3)')); + //memo2.font.name:= 'courier'; + + { eng.ExecString('import pandas as pd'); + eng.ExecString('import seaborn as sns'); + eng.ExecString('diamonds = sns.load_dataset("diamonds")'); + println(eng.EvalStr('diamonds.describe().T.head(10)')); } + //https://levelup.gitconnected.com/25-python-one-liners-everyone-should-know-8befc13248c3 + //1. Merge two dictionaries in a single expression + eng.Execstring('x = {"a": 1, "b": 2}'+LF+'y = {"c": 3, "d": 4}'); + println('merge dic(): '+eng.EvalStr('{**x, **y}')); + //2. Merge two lists + eng.Execstring('x = ["a", "b"]'+LF+'y = ["c", "d", "e"]'+LF+'x.extend(y)'); + println('merge list(): '+eng.EvalStr('x')); + //3. Get the most frequent element + eng.ExecString('from collections import Counter'); + eng.Execstring('my_list = ["a", "b", "b", "a", "a", "a", "c", "c", "b", "d"]'); + println('counter most: '+eng.EvalStr('Counter(my_list).most_common()[0][0]')); + //4. Get quotient and remainder at the same time + eng.ExecString('quotient, remainder = divmod(37, 5)'); + println('q+remainder: '+eng.EvalStr('quotient, remainder')); + //5. Get the longest string from a list + eng.ExecString('words = ["Python", "is", "naturally", "awesome"]'); + println('longest string: '+eng.EvalStr('max(words, key=len)')); + //6. Get a list in the reverse order + println('reverse: '+eng.EvalStr('words[::-1]')); + eng.ExecString('sentence = "Python is naturally awesome \n"'); + println('reversesent : '+eng.EvalStr('sentence[::-1]')); + //8. Write into a file + eng.ExecString('with open("file.txt","a",newline="\n") as f: f.write(sentence)'); + openfile(exepath+'file.txt'); + out1.displaystring(loadfile(exepath+'file.txt')) + //9. Read a file in a single line + println('read file line : '+ + eng.EvalStr('[line.strip() for line in open("file.txt")]')); + //12. Find the first n Fibonacci numbers + eng.ExecString('fib = lambda x: x if x <= 1 else fib(x - 1) + fib(x - 2)'); + println('fibo select : '+eng.EvalStr('fib(15)')); + //13. Count the number of occurrences of a character in a string + println('count char : '+eng.EvalStr('"I love Python".count("o")')); + //14. Sort in a single line + eng.ExecString('numbers = [5, -3, 428, -102, 4, 1]'); + println('sort line : '+eng.EvalStr('numbers.sort()')+eng.Evalstr('numbers')); + //21. Remove duplicate elements from a list + println('remove dups : '+eng.EvalStr('list(set(["a","a","b","a","c"]))')); + //22. Convert a list of strings to integers + println('convert : '+eng.EvalStr('list(map(int,["1","2","3"]))')); + //Let�s make it in a single line: + println('iterators : '+eng.EvalStr('[(*range(1, 16))]')); + + pymemo.update; + end + else writeln('invalid library handle! '+Getlasterrortext); + println('PythonOK: '+botostr(PythonOK)); + except + eng.raiseError; + writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam)); + //PyErr Exception: Access violation at address 50F49DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000022. + finally + //eng.close + eng.unloaddll; + //PyFinalize(); + eng.free; + //PyFinalize(); + end; + out1.free; + //pyImport(PyModule); +end; + +begin //@main + //PythonEngine1.Free; + //myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(300,400, clgreen,'PyFrm4D'); + pyMemo:= TMemo.create(PyForm); + pymemo.height:= 380; pymemo.width:= 250; + pyMemo.parent:= PyForm + PyForm.show; + + PYLaz_P4D_Demo2; + + //register_PYthonGUI; +End. +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + +doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191 + +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install sympy +Collecting sympy + Cache entry deserialization failed, entry ignored + Downloading https://files.pythonhosted.org/packages/78/43/33c5a5e7fbafbf51520f +4e09cb0634a1ca1d4cd5469c57967e43183d7a42/sympy-1.9-py3-none-any.whl (6.2MB) + 100% |��������������������������������| 6.2MB 186kB/s +Collecting mpmath>=0.19 (from sympy) + Cache entry deserialization failed, entry ignored + Downloading https://files.pythonhosted.org/packages/d4/cf/3965bddbb4f1a61c49aa +cae0e78fd1fe36b5dc36c797b31f30cf07dcbbb7/mpmath-1.2.1-py3-none-any.whl (532kB) + 100% |��������������������������������| 542kB 1.0MB/s +Installing collected packages: mpmath, sympy +Successfully installed mpmath-1.2.1 sympy-1.9 +You are using pip version 9.0.1, however version 21.3.1 is available. +You should consider upgrading via the 'python -m pip install --upgrade pip' comm +and. + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32> + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. +Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before. + +Evil eval() + +You should never pass untrusted source to the eval() directly. As it is quite easy for the malicious user to wreak havoc on your system. For example, the following code can be used to delete all the files from the system. + +1 >>> +2 eval('os.system("RM -RF /")') # command is deliberately capitalized +3 >>> + + +Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download +-------------------------------------------------------- +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. +PascalScript maXbox4 - RemObjects & SynEdit + +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. + +dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E. +TRUE +Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD. + +mapdll EXCEPT Exception: There is already one instance of TPythonEngine running. +PythonOK TRUE +ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC. + mX4 executed: 26/07/2021 13:30:51 Runtime: 0:0:2.48 Memload: 71% use + +Example 3: Python multithreading + +All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program. + + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) + +t1.start() +t2.start() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demos/pydemo36.txt b/Demos/pydemo36.txt new file mode 100644 index 00000000..47ddf6af --- /dev/null +++ b/Demos/pydemo36.txt @@ -0,0 +1,446 @@ +Program Python_Pascal_PrimeTime32_SynDat_Tutorial91_1; + +//https://www.programiz.com/python-programming/time/sleep +//Note: modify PYHOME and PYDLL : SynDat +//http://www.softwareschule.ch/download/maxbox_starter91_1.pdf +//https://www.section.io/engineering-education/how-to-create-a-blockchain-in-python/ + +Const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + LB= CR+LF; + EmptyStr = ''; + +Const PRIME = 'def py_is_prime(n):'+LB+ + ' import math'+LB+ + ' """ totally naive implementation """'+LB+ + ' if n <= 1:'+LB+ + ' return False'+LB+ + ' q = math.floor(math.sqrt(n))'+LB+ + ' for i in range(2, q + 1):'+LB+ + ' if (n % i == 0):'+LB+ + ' return False'+LB+ + ' return True'; + + ATIME='while True: '+LB+ + ' localtime = time.localtime()'+LB+ + ' result = time.strftime("%I:%M:%S %p", localtime)'+LB+ + ' print(result, end="", flush=True)'+LB+ + ' print("\r", end="", flush=True)'+LB+ + ' time.sleep(1)'; + + BLOCKCH= 'class Blockchain: '+LB+ + ' def __init__(self):'+LB+ + ' self.chain = []'+LB+ + ' self.create_blockchain(proof=1, previous_hash="0")'; + + BHASH= '# generate a hash of an entire block'+LB+ + 'def bhash(self, block):'+LB+ + ' encoded_block = json.dumps(block, sort_keys=True).encode()'+LB+ + ' return hashlib.sha256(encoded_block).hexdigest()'; + BHASH2= '# generate a hash of an entire block'+LB+ + 'def bhash2(self,block):'+LB+ + ' #encoded_block = json.dumps(block, sort_keys=True).encode()'+LB+ + ' return hashlib.sha256(block.encode("utf-8")).hexdigest()'; + + +var PyForm: TForm; pyMemo: TMemo; pyval: variant; fprofile: string; + eg: TPythonEngine; aPythonVersion: TPythonVersion; + apd: TApdMeter; sw: TStopWatch; + ajt: TJson; JObj: TJsonObject2; JArr: TJsonArray2; + + +procedure dumpJSON(response: string); +var cnt: integer; clb: string; +begin +ajt:= TJson.create(); + try + response:= '{'+response+'}'; //*) + ajt.parse(response); + except + writeln( 'Exception: "" parse error: {'+ + exceptiontostring(exceptiontype, exceptionparam)) + end; + JObj:= ajt.JsonObject; + //JArr:= ajt.values[''].asarray; + //for cnt:= 0 to jarr.count-1 do begin + for cnt:= 0 to jobj.count-1 do begin + clb:= jobj.items[cnt].name; + writeln('this '+clb) + end; //} + ajt.Free; +end; + +//------------------------------------------------------------------------------ +// check if two StringLists contain identical strings +//------------------------------------------------------------------------------ +function ListIdentical(l1,l2:TStringList):Boolean; +var + ix : Integer; +begin + Result := False; + if l1.count = l2.count then begin + for ix := 0 to l1.count-1 do begin + if (l1[ix] <> l2[ix]) then Exit; + end; + Result := True; + end; +end; + +function ReverseHash(Hash: string): string; +var + k: byte; +begin + Result := EmptyStr; + k := 64; + while (k > 0) do begin + Result := Result + Hash[k - 1] + Hash[k]; + k := k - 2; + end; +end; + +const + HEADERSIZE = 80; + +type + ATSHA256HASH = array [0 .. 7] of Cardinal; + //PSHA256HASH = ^TSHA256HASH; + + // To store a 32 bytes + T32 = array [0 .. 31] of byte; + + // To store the block header + ATHeader = array [0 .. HEADERSIZE - 1] of byte; + +function T32ToString(const at32: T32): string; +var + k: Integer; +begin + Result := EmptyStr; + for k := 0 to 31 do begin + //Result := IntToHex(byte(at32[k]),2) + Result; + Result := IntToHex(ord(at32[k]),2) + Result; + end; +end; + + +function GetMemoryStream: TMemoryStream; +var + aMemoryStream: TMemoryStream; +begin + if aMemoryStream = nil then + aMemoryStream := TMemoryStream.Create; + + Result := aMemoryStream; +end; + +function MD5File(const FileName: string): string; +var + IdMD5: TIdHashMessageDigest5; + FS: TFileStream; +begin + IdMD5 := TIdHashMessageDigest5.Create; + FS := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); + try + //Result := IdMD5.HashStreamAsHex(FS) + finally + FS.Free; + IdMD5.Free; + end; +end; + +function getMD5checksum(s: TStream): string; + var + md5: TIdHashMessageDigest5; + hash : T4x4LongWordRecord; + begin + md5 := TIdHashMessageDigest5.Create; + s.Seek(0,0); + hash := md5.HashValue1((s)); + {result := IntToHex(Integer(hash[0]), 4) + + IntToHex(Integer(hash[1]), 4) + + IntToHex(Integer(hash[2]), 4) + + IntToHex(Integer(hash[3]), 4); } + Result:= (md5.AsHex(hash)); + end; + +function MD5WW(aValue: string): string; +var hash : T4x4LongWordRecord; + satt:TStream; +begin + with TIdHashMessageDigest5.Create do begin + satt:= TStringStream.create(''); + stringtostream(avalue, satt) + satt.Seek(0,0); + hash := HashValue1(satt); + Result:= (AsHex(hash)); + Free; + satt.Free; + end; +end; + +function cc_MD5File(const p_fileName : string) : string; +//returns MD5 hash for a file +var + v_idmd5: TIdHashMessageDigest5; + v_fs: TFileStream; + v_hash: T4x4LongWordRecord; +begin + v_idmd5:= TIdHashMessageDigest5.Create; + v_fs:= TFileStream.Create(p_fileName, fmOpenRead OR fmShareDenyWrite); + try + v_hash:= v_idmd5.HashValue1(v_fs); + result:= v_idmd5.AsHex(v_hash); + finally + v_fs.Free; + v_idmd5.Free; + end; +end; + +var stt: TStream; + +begin //@main + //myloadscript2:= filetostring(PYSCRIPT2); + PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_SynDat_Tester_EKON25'); + pyMemo:= TMemo.create(PyForm); + apd:= TApdMeter.create(pyform); + //apd.color:= clyellow; + apd.parent:= pyform; + apd.barcolor:= clred; + apd.position:= 30; + apd.SetBounds(10,100, 150, 150); + apd.visible:= true; + pyMemo.parent:= PyForm + PyForm.show; + + //println('user_max_complete = '+eng.evalStr('top_users[0][1]')); + //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a + //PYLaz_P4D_Demo2; EKON25 - explicit better than implicit + eg:= TPythonEngine.Create(Nil); + try + eg.pythonhome:= PYHOME; + eg.loadDLL; + println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); + writeln('') + //https://medium.com/@swathiarun63/10-fantastic-python-packages-af2a16a1183a + apd.position:= 60; + pyMemo.lines.add('call test with execStr() from faker import Faker'); + println(eg.EvalStr('__import__("faker").Faker()')); + sw:= TStopWatch.Create(); + sw.Start; + eg.execStr('from faker import Faker'); + eg.execStr('import simplejson as json'); //# instead of import json + eg.execStr('import dumper, hashlib, json'); + eg.execStr('fake = Faker()'); + fprofile:= eg.evalStr('(fake.profile())') + fprofile:= StringReplace(fprofile,'\n',CRLF,[rfReplaceAll]); + //fprofile:= eg.evalStr('fake.profile().replace("\n"," ")'); + //Exception: : 'dict' object has no attribute 'replace'. + println('fake person profile: '+CRLF+fprofile+CRLF); + //dumpJSON(fprofile); + //eg.execStr('profile1 = fake.simple_profile()'); + //eg.execStr('ad= dumper.dump(profile1)'); + //println(eg.evalStr('dumper.dump(profile1)')) + //println(eg.evalStr('f"my profile: {fake.profile()}"')); + //println(eg.evalStr('json.dumps(fake.profile(),indent=4)')); + println('creditcard#: '+eg.evalStr('fake.credit_card_number()')); //} + eg.execStr('fake = Faker(["es_MX"])') + //for i in range(10): + for it:= 1 to 5 do + println(UTF8toAnsi(eg.evalStr('fake.name()'))); + + eg.execStr(BHASH) + println(eg.evalStr('bhash(0,"maXbox4")')); + eg.execStr(BHASH2) + println(eg.evalStr('bhash2(0,"maXbox4")')); + writeln(ReverseHash(eg.evalStr('bhash2(0,"maXbox4")'))); + writeln(eg.evalStr('hash(10**2000)')); + sw.Stop; + //sw.ElapsedMilliseconds; + writeln('Stop Watch Faker Tester1: '+sw.getValueStr) + + eg.execStr('import json'); + + eg.execStr('import http.client as httplib'); + eg.execStr('connection = httplib.HTTPSConnection("api.parse.com", 443)'); + eg.execStr('connection.connect()'); + eg.execStr('connection.request("GET","api.parse.com/echo")'); + //writeln(eg.evalStr('json.loads(connection.getresponse().read())')); + + //eg.execStr('connection= httplib.HTTPSConnection("https://api.datamuse.com/",443)'); + //eg.execStr('connection.connect()'); + //eg.execStr('connection.request("GET","words?sp=hipopatamus")'); + + println(eg.evalStr('connection.getresponse().read()')); + + + except + eg.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eg.Free; + sw.Free; + sw:= Nil; + apd.position:= 100; + end; + + with TSectionList.create do begin + //IndexOf(const S: AnsiString): Integer; override; + //IndexOfName(const name: string): Integer; //override; + //SectionItems + free + end; + + //http://www.rosettacode.org/wiki/MD5#Delphi + writeln(sha1tohex((synMD5('The quick brown fox jumped over the lazy dog''s back')))); + writeln(strtohex1((synMD5('The quick brown fox jumped over the lazy dog''s back')))); + //writeln(((md5ww('The quick brown fox jumped over the lazy dog''s back')))); + stt:= TStringStream.create(''); + + stringtostream('The quick brown fox jumped over the lazy dog''s back',stt); + writeln(objtostr(stt)); + writeln((getMD5checksum(stt))); + stt.Free; + //function getMD5checksum(s: TStream): string; + writeln((md5ww('The quick brown fox jumped over the lazy dog''s back'))); + strtofile('The quick brown fox jumped over the lazy dog''s back', + exepath+'foxmd5.txt'); + sleep(500) + writeln(cc_MD5File(exepath+'foxmd5.txt')); + //cc_MD5File(const p_fileName : string) : string; + + writeln(getpython2) + + with TPythonEngine.Create(Nil) do begin + pythonhome:= 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + try + loadDLL; + Println('Decimal: '+ + EvalStr('__import__("decimal").Decimal(0.1)')); + except + raiseError; + finally + free; + end; + end; + + writeln(getpython3) + + with TPythonEngine.Create(Nil) do begin + pythonhome:= 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + try + loadDLL; + execStr('import http.client as httplib'); + execStr('connection= httplib.HTTPSConnection("api.parse.com",443)'); + execStr('connection.connect()'); + execStr('connection.request("GET","api.parse.com/echo")'); + println(evalStr('connection.getresponse().read()')); + except + raiseError; + finally + free; + end; + end; + + with TPythonEngine.Create(Nil) do begin + pythonhome:= 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + try + loadDLL; + execStr('import requests'); + execStr('url="https://api.metadefender.com/v4/file/bzIyMDEwNEtrYWZSSGE3TkgxX3lFNnpCdWg"'); + execStr('headers={"apikey": "38b2c7c223f828f0a500b057a7ed6311" } '); + println(evalStr('requests.request("GET", url, headers=headers).text')); + except + raiseError; + finally + free; + end; + end; + +End. + +Ref: https://towardsdatascience.com/build-a-data-streaming-job-in-5-mins-with-pyspark-faker-a4f3d2420384 + https://www.codespeedy.com/faker-library-in-python/ +{'job': 'Research officer, political party', 'company': 'Davis-Perez', 'ssn': '520-11-9286', 'residence': '18365 Katherine Plains\nAliceville, OK 31762', 'current_location': (Decimal('47.667757'), Decimal('14.943272')), 'blood_group': 'O-', 'website': ['https://www.thompson.com/', 'https://graham.com/', 'http://www.thomas.com/'], 'username': 'hbass', 'name': 'Tammy Crane', 'sex': 'F', 'address': '3144 Stephanie Road\nWilliambury, MT 95571', 'mail': 'wthompson@yahoo.com', 'birthdate': datetime.date(1962, 11, 25)} +4978088480978 + mX4 executed: 05/12/2021 11:43:04 Runtime: 0:0:2.197 Memload: 36% use + + +fake person profile: +{'job': 'Legal secretary', 'company': 'Dixon-Fowler', 'ssn': '066-04-0047', 'residence': 'PSC 2835, Box 4921 +APO AA 40255', 'current_location': (Decimal('7.0670085'), Decimal('117.638907')), 'blood_group': 'AB-', 'website': ['https://www.white.com/', 'https://www.arnold.org/', 'https://www.miller.com/', 'http://pope.biz/'], 'username': 'nguyenchristopher', 'name': 'Thomas Alexander', 'sex': 'M', 'address': '00176 Mary Point +North Laura, GA 45319', 'mail': 'bthompson@yahoo.com', 'birthdate': datetime.date(2019, 12, 16)} + +Optimizations + +The Faker constructor takes a performance-related argument called use_weighting. It specifies whether to attempt to have the frequency of values match real-world frequencies (e.g. the English name Gary would be much more frequent than the name Lorimer). If use_weighting is False, then all items have an equal chance of being selected, and the selection process is much faster. The default is True. + +Santiago Carmona +�ngel Judith Roque Amador +Susana Eloy Rocha Blanco +Rodolfo Urbina Su�rez +Juana Irma de la Torre Mares + +Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable. +writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion)); +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) +t1.start() +t2.start() + +This package implements JSON support for FPC. + +# check if the blockchain is valid +def is_chain_valid(self, chain): + # get the first block in the chain and it serves as the previous block + previous_block = chain[0] + # an index of the blocks in the chain for iteration + block_index = 1 + while block_index < len(chain): + # get the current block + block = chain[block_index] + # check if current block link to previous block is same as the hash of previous block + if block["previous_hash"] != self.hash(previous_block): + return False + + # get the previous proof from the previous block + previous_proof = previous_block['proof'] + + # get the current proof from the current block + current_proof = block['proof'] + + # run the proof data through the algorithm + hash_operation = hashlib.sha256(str(current_proof ** 2 - + previous_proof ** 2).encode()).hexdigest() + # check if hash operation is invalid + if hash_operation[:4] != '0000': + return False + # set previous block to current block after running validation on current block + previous_block = block + block_index += 1 + return True + +PascalCoin: Cryptocurrecy developed with FreePascal. + + Infinite Scaling � Only keeps the last 100 blocks of the blockchain (the Flow) instead the full history. This keeps the ledger from getting large. + Very high transaction rate � over 100 transactions per second. + Supports Asserts, Sub Tokens and smart contracts. + Wallet available on Windows and Linux. No android and ios support yet. + for Current Pascalcoin Price, check here. + Passion is no replacement for reason +"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins) + \ No newline at end of file diff --git a/Demos/pydemo4.htm b/Demos/pydemo4.htm new file mode 100644 index 00000000..e80f451e --- /dev/null +++ b/Demos/pydemo4.htm @@ -0,0 +1,613 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000094441 +StartFragment:0000001053 +EndFragment:0000094425 + + + + +mXScriptasHTML + + + + + +
Program PyDemo7_Eval_IOEvents;
+
+//https://github.com/Alexey-T/Python-for-Lazarus/blob/master/python4lazarus/PythonEngine.pas
+//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas
+//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine
+//https://thepythonguru.com/python-builtin-functions/eval/
+//https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/
+//https://stackoverflow.com/questions/359498/how-can-i-unload-a-dll-using-ctypes-in-python
+//https://levelup.gitconnected.com/5-powerful-python-one-liners-you-should-know-469b9c4737c7
+
+//interface   - customize your PY environment first
+{uses
+  Classes, SysUtils,
+  Windows, Messages, Graphics, Controls, Forms, Dialogs,
+  StdCtrls, ComCtrls, ExtCtrls,
+  PythonEngine, Vcl.PythonGUIInputOutput, PythonVersions.pas ;   }  
+  
+{procedure PyFinalize();
+      external 
+  'Py_Finalize@C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll stdcall';   }    
+//Note: modify PYHOME and PYDLL :
+
+const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\';
+    PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
+    PYDLL  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+    PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py';
+    PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py';
+    LB = CR+LF;
+       
+const PyModule =
+              'def printData(data): '+#13#10+
+              '  return data+data+"/n"';       
+         
+const PYCMD = 'print("this is box")'+LB+ 
+              'import sys'+LB+ 
+              'f=open(r"1050pytest21_5powers.txt","w")'+LB+
+              'f.write("Hello PyWorld_mX47580, \n")'+LB+
+              'f.write("This data will be written on the file.")'+LB+ 
+              'f.close()';
+
+//https://stackoverflow.com/questions/9771261/python4delphi-returning-a-python-object-in-a-function-delphiwrapper
+              
+const PYCMD2 = 'print("this is box2")'+LF+ 
+              'import sys'+LF+ 
+              '#import pyio'+LF+ 
+              'f=open(r"1050pytest21_5powers.txt","w")'+LF+
+              'f.write("Hello PyWorld_mX47580_2_pyIO, \n")'+LF+
+              'f.write("This data will be written on the file.")'+LF+ 
+              'print("this is box4fromPyscript")'+LF+ 
+              'print(2+2)'+LF+
+              '12+200'+LF+
+              '#print(sys.argv[1])'+LF+ 
+              '#val = input("Enter your value: ")'+LF+
+              'f.close()';              
+              
+var  PyForm: TForm; pyMemo: TMemo;
+     avar: string; pyval: variant; pyint: integer;
+     
+ 
+
+Procedure PYLaz_P4D_Demo2;
+//https://wiki.freepascal.org/Python4Delphi 
+var eng : TPythonEngine;
+    Out1: TPythonGUIInputOutput;
+    pystrings: TStrings;
+begin
+
+// FIOPythonModule := TPythonModule.Create( Self );
+    //with  TPythonModule.Create( Self ) do
+      //AddMethod(
+      
+  eng:= TPythonEngine.Create(Nil);
+  Out1:= TPythonGUIInputOutput.create(eng)
+  pystrings:= TStringlist.create;
+  Out1.output:= pyMemo; //debugout.output; or memo2;
+  //eng.IO:= Out1;
+  Out1.RawOutput:= True;
+  Out1.UnicodeIO:= False;
+  //eng.IO:= Out1;
+  Out1.maxlines:= 40;
+  out1.DelayWrites:= False;
+  out1.displaystring('this string thing draw the line')
+  out1.write('YXthis write string thing draw the line');
+  //eng.IO:= Out1;
+  writeln(botostr(Isx64(PYDLL)));
+  //writeln(botostr(Isx64(pydllpath2)));
+  //eng.dllpath:= exepath;
+  //eng.dllname:='python37.dll';
+  eng.pythonhome:= PYHOME;
+  pystrings.add(PYCMD2);
+  eng.InitScript:= pystrings;
+  try
+   //pymod.InitializeForNewInterpreter; //}
+   //pymod.engine:= eng;
+   //eng.IO:= Out1;
+   eng.RedirectIO:= true;
+    eng.opendll(PYDLL)
+    //eng.loadDLL;
+    eng.RedirectIO:= true;
+    eng.IO:= Out1;
+    Out1.output:= pyMemo; 
+    //eng.traceback
+    eng.AutoFinalize:= True; 
+    //eng.RedirectIO:= true;
+    //eng.AutoUnload:= false; 
+    writeln(eng.dllname);
+    //pymod.engine:= eng;
+    if eng.IsHandleValid then begin
+      writeln('DLLhandle: '+botostr(eng.IsHandleValid))
+      WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]'));
+      WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])'));
+      WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])'));
+      WriteLn('mathstr: '+ eng.EvalStr('"py " * 7'));
+      WriteLn('builtins: '+ eng.EvalStr('dir(__builtins__)'));
+      WriteLn('upperstr: '+ eng.EvalStr('"hello again".upper()'));
+      pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("os").getcwd()'));
+      writeln('syncheck '+
+      botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])')));
+      
+      WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))'));
+      WriteLn('powerline2: '+ 
+               eng.EvalStr('list(map(float,["1",2,"3.0",4.0,"5",6]))'));
+               eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))');
+      WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)'));
+      
+               eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]');
+               eng.Execstring('transpose_A = [list(i) for i in zip(*A)]');
+      WriteLn('powerline4: '+ eng.EvalStr('transpose_A'));  
+      
+      //We can use dictionary comprehension to swap key-value pairs.
+               eng.Execstring('staff={"Data Scientist":"John","Django Developer":"Max"}');
+      WriteLn('powerline5: '+ eng.EvalStr('{i:j for j, i in staff.items()}'));                                                   
+      eng.ExecString('print("powers:",[x**2 for x in range(10)])');
+      
+      writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(PYCMD2)));
+      //eng.ExecString(PYCMD2+'parainput');
+      eng.ExecString(PYCMD2+'');
+      eng.CheckError(true);
+      
+     { pystrings:= TStringlist.create;
+      pystrings.add('import matplotlib.pyplot as plt')
+      pystrings.add('import numpy as np')
+      pystrings.add('np.arange(5, 24, 3)')
+      pystrings.add('fig, ax = plt.subplots(dpi=153)')
+      pystrings.add('plt.plot([1,2,3,4,5,6], [1,2,3,4,9,5], "go")')
+      pystrings.add('plt.show()')
+      eng.ExecStrings4(pystrings);
+      pystrings.free; }
+      
+     (* eng.ExecString('import subprocess');  
+      eng.ExecString('subprocess.call(["pip", "install", "sympy"])')
+      eng.ExecString('from sympy import *');
+      eng.ExecString('from sympy.plotting import plot'); 
+      writeln(eng.EvalStr('list(primerange(7, 150))'));
+      writeln(eng.EvalStr('sum(list(primerange(0, 100)))'));
+      writeln(eng.EvalStr('(list(primerange(0, 101)))'));
+      writeln(eng.EvalStr('len(list(primerange(0, 101)))'));
+      //https://www.tutorialspoint.com/sympy/sympy_solvers.htm
+      avar:= '-2';
+      eng.ExecString('x=Symbol("x")');
+      eng.ExecString('x,y=symbols("x y")');
+      writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)'));
+      writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)'));
+      writeln(eng.EvalStr('solveset(exp(x),x)'));
+      println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))'));
+       *)
+     
+      //eng.ExecString('plot(x**'+avar+', line_color="red")');
+      //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))');
+      {
+      eng.ExecString('from sympy.plotting import plot3d'); 
+      eng.ExecString('x,y=symbols("x y") '); 
+      eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); }
+      
+      WriteLn('powerline6: '+ eng.EvalStr('len(str(2**4096))'));
+      pymemo.lines.add('Decimal: '+ 
+              eng.EvalStr('__import__("decimal").Decimal((0,(3,1,4),-2))'));
+      pymemo.lines.add('Decimal: '+ 
+              eng.EvalStr('__import__("decimal").Decimal(0.1)')); 
+      eng.ExecString('import decimal')  
+      //https://www.w3schools.com/python/python_ref_functions.asp      
+      writeln('is instance: '+eng.EvalStr('isinstance(decimal.Decimal,'+
+                    '(float, int, str, list, dict, tuple, type))')); 
+      writeln('is type: '+eng.EvalStr('type(str(decimal.Decimal(0.1)))'));
+      writeln('is type: '+eng.EvalStr('type(float(decimal.Decimal(0.1)))'));
+      writeln('is type: '+eng.EvalStr('type(decimal.Decimal)')); 
+      writeln('is type: '+eng.EvalStr('type(decimal)'));                    
+      //eng.ExecString('from spacy import *');
+      //eng.ExecString('from nltk.classify import MaxentClassifier')          
+      //eng.ExecString('import tensorflow')  
+      
+      eng.ExecString('print("2*4")');        
+      
+      pyval:= VarPythonEval('sum([x for x in range(201)])');
+      //writeln('evalvar '+botostr(VarIsPythonList(pyval)));
+      writeln('evalvar '+botostr(VarIsnumeric(pyval)));
+      pyval:= NewPythonDict;
+      writeln(botostr(VarIsPython( pyval)));
+      pyval := (VarPythonEval('2 ** 3'));         
+     { eng.ExecString('import subprocess');  
+      eng.ExecString('subprocess.call(["pip", "install", "langdetect"])')
+      eng.ExecString('from langdetect import detect'); 
+      println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")'));
+      }
+      Out1.output:= pyMemo; 
+      pymemo.update;
+    end
+      else writeln('invalid library handle! '+Getlasterrortext);
+    println('PythonOK: '+botostr(PythonOK));  
+  except
+     eng.raiseError;
+     writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam));
+  //PyErr Exception: Access violation at address 50F49DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000022.
+  finally
+     //eng.close 
+     eng.unloaddll; 
+     //PyFinalize();
+     out1.free;
+     eng.free;
+     //PyFinalize();
+     pystrings.Free;
+  end;     
+  //out1.free;
+  //pyImport(PyModule);
+end;
+
+procedure PythonInputOutput_SendData(sender: tobject; const data: ansistring);
+Var
+  S : string;
+begin
+  { if Assigned(FOnSendData) then
+    inherited
+  else
+    DisplayString( string(Data) );}
+    
+  showmessage('event second sended...')
+  println(itoa(length(data)));
+  for it:= 1 to length(data) do begin
+    s:= s+data[it];
+    //write(s)
+    end;
+  println('event send data '+s)
+  println('event2 send data '+data)
+end;  
+
+procedure PythonInputOutput_ReceiveData(sender: tobject; var data: ansistring);
+Var
+  S : string;
+begin
+  {if Assigned( FOnReceiveData ) then
+    Result := inherited ReceiveData
+  else
+  begin
+    InputQuery( 'Query from Python', 'Enter text', S);
+    Result := AnsiString(S);
+  end;  }
+  showmessage('second received...')
+  println('event send data '+data)
+end;  
+
+function SysVersionFromDLLName2(const DLLFileName : string): string;
+var
+  Minor, Major: integer;
+begin
+  PythonVersionFromDLLName(DLLFileName, Major, Minor);
+  Result := Format('%d.%d', [Major, Minor]);
+end;
+
+//https://stackoverflow.com/questions/64324481/delphi-4-python/69123825#69123825
+procedure callDynPy;
+var
+  PyEngine_netA: TPythonEngine;
+  PyInpOut_netA: TPythonInputOutput;
+  FIOPythonModule : TPythonModule;
+  pystrings: TStrings;
+begin
+  PyEngine_netA := TPythonEngine.Create(Self);
+  PyInpOut_netA := TPythonInputOutput.Create(Self);
+  FIOPythonModule := TPythonModule.Create( Self );
+  pystrings:= TStringlist.create;
+  
+  pystrings.text:=
+   'import sys'+LF+
+   'import os'+LF+
+   'pylist = []'+LF+
+   'print("Python path =", sys.path)         '+LF+
+   'print()                                  '+LF+
+   'print("Python modules already imported:")'+LF+
+   'for m in sys.modules.values():           '+LF+
+   '    if m:                                '+LF+
+   '        print(" ", m,"\n")               '+LF+
+   '        pylist.append(m)                 '+LF+
+   '        pylist.append("\n")              '+LF+
+   'print()                                  '+LF+
+   '#pylist = "\n".join(pylist)              '+LF+ 
+   '#PYTHONHOME=os.getenv(r"'+PYHOME+'\"))   '+LF+
+   'pylist.append(os.getenv("PYTHONHOME"))   '+LF+
+   '#print("PYTHONPATH =", os.getenv("PYTHONPATH"))';
+   
+  try
+    ///  configure the components
+    //saveString(exepath+'pystrings.py', pystrings.text);
+    //writeln(getDosOutput('py '+exepath+'pystrings.py', exePath));
+    PyEngine_netA.DllName:= PYDLL;
+    PyEngine_netA.pythonhome:= PYHOME;
+    //writeln(TPythonModule(PyEngine_netA.IOPythonModule).modulename); 
+              {TPythonModule}
+    writeln(FIOPythonModule.modulename);
+    writeln(objtostr(PyEngine_netA.IOPythonModule)); 
+    //PyEngine_netA.modulename 
+   
+    //PyEngine_netA.IO := PyInpOut_netA;
+    PyEngine_netA.UseLastKnownVersion := True;
+    writeln('SysVersionFromDLLName2: '+SysVersionFromDLLName2(PYDLL));
+    //PyEngine_netA.opendll(PYDLL)
+    PyEngine_netA.LoadDll;
+    //PyEngine_netA.CheckPython;
+    PyEngine_netA.IO := PyInpOut_netA;
+    PyEngine_netA.redirectio := true;
+
+    PyInpOut_netA.OnSendData:= @PythonInputOutput_SendData;
+    PyInpOut_netA.OnReceiveData:= @PythonInputOutput_ReceiveData;
+    PyInpOut_netA.UnicodeIO := false;
+    PyInpOut_netA.RawOutput := true;
+    //PyInpOut_netA.Write('print(49+78,"\n")');
+    //PyEngine_netA.ExecString('import pyio');
+    PyInpOut_netA.Writeline('print(49+78+23,"\n")');
+    PyEngine_netA.ExecString(UTF8Encode(PYCMD2));
+    
+    {with PyEngine_netA do begin
+      ExecString('import subprocess');  
+      ExecString('subprocess.call(["pip", "install", "pyio"])')
+    end; } 
+    //  println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")'));
+          
+    println('CheckExecSyntax:'+botostr(PyEngine_netA.CheckExecSyntax(pystrings.text)));
+    PyEngine_netA.ExecStrings4(pystrings);
+    //synStringReplace(const S, OldPattern,NewPattern:str;Flags:TReplaceFlags):str
+    println('module list detect: '+
+             StringReplace(PyEngine_netA.EvalStr('pylist'),'\n',CR+LF,[rfReplaceAll]));
+    //PyInpOut_netA.Read('print(49+78,"\n")');
+    //PyInpOut_netA.output:= pyMemo;     
+    //PyEngine_netA.IO:= PyInpOut_netA;
+
+    ///  execute  the script
+    //PyEngine_netA.ExecString(UTF8Encode(mmo_pythoncode.text));
+//https://stackoverflow.com/questions/49599004/how-to-convert-a-python-datetime-to-a-delphi-tdatetime#49599145
+    PyEngine_netA.ExecString(UTF8Encode('print(49+78),"\n"'));
+    PyEngine_netA.ExecString(('from datetime import datetime, timedelta'));
+    PyEngine_netA.ExecString(UTF8Encode('DELPHI_EPOCH=datetime(1899,12,30)'));
+    PyEngine_netA.ExecString('def datetime_fromdelphi(dvalue):'+LF+
+                                 '  return DELPHI_EPOCH + timedelta(days=dvalue)');
+    println(PyEngine_netA.EvalStr(('datetime_fromdelphi(43191.68205925926)')));
+                                 
+    //PyEngine_netA.ExecString(('49+78'));
+    println(PyEngine_netA.EvalStr(('(49+78+2**5),"\n"'+LF)));
+    println(PyEngine_netA.EvalStr(('__import__("sys").version')));
+  except
+    PyEngine_netA.raiseError;  
+  finally
+    PyEngine_netA.free;
+    PyInpOut_netA.free;
+    FIOPythonModule.Free;
+    pystrings.Free;
+  end;
+end;  
+
+begin  //@main
+  //PythonEngine1.Free;
+  //myloadscript2:= filetostring(PYSCRIPT2);
+  //Memo1.beginUpdate;
+  PyForm:= loadForm2(300,200, clgreen,'PyFrm4D');
+  pyMemo:= TMemo.create(PyForm);
+  pyMemo.parent:= PyForm
+  pymemo.align:= albottom;
+  PyForm.show;
+  
+  PYLaz_P4D_Demo2; 
+  //Memo1.EndUpdate;
+  
+  callDynPy;
+  
+  //register_PYthonGUI;
+End.
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191
+
+https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib
+
+maXbox_Starter86_3_Python4maXbox
+
+Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL.
+Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before.
+
+Evil eval()
+
+You should never pass untrusted source to the eval() directly. As it is quite easy for the malicious user to wreak havoc on your system. For example, the following code can be used to delete all the files from the system.
+
+1 >>>
+2 eval('os.system("RM -RF /")') # command is deliberately capitalized
+3 >>>
+
+#  demo script
+import matplotlib.pyplot as plt
+import numpy as np
+x = np.arange(0,8*np.pi,0.1)   # start,stop,step
+y = np.cos(x) *1/(1+x)
+plt.plot(x,y)
+plt.show()
+
+
+Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download
+--------------------------------------------------------
+dll EXCEPT Exception: There is already one instance of TPythonEngine running.
+TRUE
+Exception: Python is not properly initialized.
+PascalScript maXbox4 - RemObjects & SynEdit
+
+dll EXCEPT Exception: There is already one instance of TPythonEngine running.
+TRUE
+Exception: Python is not properly initialized.
+
+dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E.
+TRUE
+Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD.
+
+mapdll EXCEPT Exception: There is already one instance of TPythonEngine running.
+PythonOK TRUE
+ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC.
+ mX4 executed: 26/07/2021 13:30:51  Runtime: 0:0:2.48  Memload: 71% use
+ 
+Example 3: Python multithreading
+
+All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program.
+
+
+import threading 
+  
+def print_hello_three_times():
+  for i in range(3):
+    print("Hello")
+  
+def print_hi_three_times(): 
+    for i in range(3): 
+      print("Hi") 
+
+t1 = threading.Thread(target=print_hello_three_times)  
+t2 = threading.Thread(target=print_hi_three_times)  
+
+t1.start()
+t2.start()
+
+This package implements JSON support for FPC.
+
+You might want to have a look at the lazarus jsonviewer tool, written using
+fpJSON (see lazarus/tools/jsonviewer). It visualizes the fpJSON data and
+shows how to program using fpjson.
+
+JSON support consists of 3 parts:
+
+unit fpJSON contains the data representation. Basically, it defines a set of
+classes:
+
+TJSONData
++- TJSONNumber
+   +- TJSONIntegerNumber
+   +- TJSONFloatNumber
+   +- TJSONInt64Number
++- TJSONString
++- TJSONBoolean
++- TJSONNull
++- TJSONObject
++- TJSONArray
+
+The TJSONData.JSONType property is an enumerated:
+TJSONtype = (jtUnknown, jtNumber, jtString, jtBoolean, jtNull, jtArray, jtObject);
+
+Which allows to determine the type of a value.
+
+Page 7: But the eval-uation of -> But the evaluation of
+page 8: Ans here's the -> And here's the
+page 10: The mentioned windows dll file for Python. > The mentioned windows dll file from Python.
+page 10: (I'll show that in the Tutor III). -> (I'll show that in the Part 3).
+page 14: so we use the same inter-preter as from a shell -> so we use the same  from a shell
+
+procedure TPythonEngine.DoRedirectIO;
+const
+  code = 'import sys'+LF+
+         'class DebugOutput:'+LF+
+         '  pyio = __import__("pyio")'+LF+
+         '  softspace=0'+LF+
+         '  encoding=None'+LF+
+         '  def write(self,message):'+LF+
+         '     self.pyio.write(message)'+LF+
+         '  def readline(self, size=None):'+LF+
+         '     return self.pyio.read(size)'+LF+
+         '  def flush(self):' + LF +
+         '     pass' + LF +
+         '  def isatty(self):' + LF +
+         '     return True' + LF +
+         'sys.old_stdin=sys.stdin'+LF+
+         'sys.old_stdout=sys.stdout'+LF+
+         'sys.old_stderr=sys.stderr'+LF+
+         'sys.stdin=sys.stderr=sys.stdout=DebugOutput()'+LF+#0;
+begin
+  if csDesigning in ComponentState then
+    Exit;
+  CheckPython;
+  if not Assigned(FIOPythonModule) then
+  begin
+    // create a new module called pyio
+    FIOPythonModule := TPythonModule.Create( Self );
+    with FIOPythonModule as TPythonModule do
+      begin
+        Engine := Self;
+        ModuleName := 'pyio';
+        AddMethod( 'write', pyio_write, 'write(String) -> None' );
+        AddMethod( 'read',  pyio_read,  'read() -> String' );
+        AddMethod( 'SetDelayWrites',  pyio_SetDelayWrites,  'SetDelayWrites(Boolean) -> None' );
+        AddMethod( 'SetMaxLines',  pyio_SetMaxLines,  'SetMaxLines(Integer) -> None' );
+        AddMethod( 'GetTypesStats',  pyio_GetTypesStats,  'GetTypesStats( [type name] ) -> a list of tuple (TypeName, InstanceCount, CreateHits, DeleteHits)' );
+      end;
+  end;
+  with FIOPythonModule as TPythonModule do
+    if not Initialized then
+      Initialize;
+  // execute the code
+  ExecString(code);
+  FIORedirected := True;
+end;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                   
+
+
+
+  
+
+
+    
+
+ \ No newline at end of file diff --git a/Demos/pydemo4.txt b/Demos/pydemo4.txt new file mode 100644 index 00000000..e222b1e8 --- /dev/null +++ b/Demos/pydemo4.txt @@ -0,0 +1,580 @@ +Program PyDemo7_Eval_IOEvents; + +//https://github.com/Alexey-T/Python-for-Lazarus/blob/master/python4lazarus/PythonEngine.pas +//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas +//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine +//https://thepythonguru.com/python-builtin-functions/eval/ +//https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/ +//https://stackoverflow.com/questions/359498/how-can-i-unload-a-dll-using-ctypes-in-python +//https://levelup.gitconnected.com/5-powerful-python-one-liners-you-should-know-469b9c4737c7 + +//interface - customize your PY environment first +{uses + Classes, SysUtils, + Windows, Messages, Graphics, Controls, Forms, Dialogs, + StdCtrls, ComCtrls, ExtCtrls, + PythonEngine, Vcl.PythonGUIInputOutput, PythonVersions.pas ; } + +{procedure PyFinalize(); + external + 'Py_Finalize@C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll stdcall'; } +//Note: modify PYHOME and PYDLL : + +const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py'; + LB = CR+LF; + +const PyModule = + 'def printData(data): '+#13#10+ + ' return data+data+"/n"'; + +const PYCMD = 'print("this is box")'+LB+ + 'import sys'+LB+ + 'f=open(r"1050pytest21_5powers.txt","w")'+LB+ + 'f.write("Hello PyWorld_mX47580, \n")'+LB+ + 'f.write("This data will be written on the file.")'+LB+ + 'f.close()'; + +//https://stackoverflow.com/questions/9771261/python4delphi-returning-a-python-object-in-a-function-delphiwrapper + +const PYCMD2 = 'print("this is box2")'+LF+ + 'import sys'+LF+ + '#import pyio'+LF+ + 'f=open(r"1050pytest21_5powers.txt","w")'+LF+ + 'f.write("Hello PyWorld_mX47580_2_pyIO, \n")'+LF+ + 'f.write("This data will be written on the file.")'+LF+ + 'print("this is box4fromPyscript")'+LF+ + 'print(2+2)'+LF+ + '12+200'+LF+ + '#print(sys.argv[1])'+LF+ + '#val = input("Enter your value: ")'+LF+ + 'f.close()'; + +var PyForm: TForm; pyMemo: TMemo; + avar: string; pyval: variant; pyint: integer; + + + +Procedure PYLaz_P4D_Demo2; +//https://wiki.freepascal.org/Python4Delphi +var eng : TPythonEngine; + Out1: TPythonGUIInputOutput; + pystrings: TStrings; +begin + +// FIOPythonModule := TPythonModule.Create( Self ); + //with TPythonModule.Create( Self ) do + //AddMethod( + + eng:= TPythonEngine.Create(Nil); + Out1:= TPythonGUIInputOutput.create(eng) + pystrings:= TStringlist.create; + Out1.output:= pyMemo; //debugout.output; or memo2; + //eng.IO:= Out1; + Out1.RawOutput:= True; + Out1.UnicodeIO:= False; + //eng.IO:= Out1; + Out1.maxlines:= 40; + out1.DelayWrites:= False; + out1.displaystring('this string thing draw the line') + out1.write('YXthis write string thing draw the line'); + //eng.IO:= Out1; + writeln(botostr(Isx64(PYDLL))); + //writeln(botostr(Isx64(pydllpath2))); + //eng.dllpath:= exepath; + //eng.dllname:='python37.dll'; + eng.pythonhome:= PYHOME; + pystrings.add(PYCMD2); + eng.InitScript:= pystrings; + try + //pymod.InitializeForNewInterpreter; //} + //pymod.engine:= eng; + //eng.IO:= Out1; + eng.RedirectIO:= true; + eng.opendll(PYDLL) + //eng.loadDLL; + eng.RedirectIO:= true; + eng.IO:= Out1; + Out1.output:= pyMemo; + //eng.traceback + eng.AutoFinalize:= True; + //eng.RedirectIO:= true; + //eng.AutoUnload:= false; + writeln(eng.dllname); + //pymod.engine:= eng; + if eng.IsHandleValid then begin + writeln('DLLhandle: '+botostr(eng.IsHandleValid)) + WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]')); + WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])')); + WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])')); + WriteLn('mathstr: '+ eng.EvalStr('"py " * 7')); + WriteLn('builtins: '+ eng.EvalStr('dir(__builtins__)')); + WriteLn('upperstr: '+ eng.EvalStr('"hello again".upper()')); + pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("os").getcwd()')); + writeln('syncheck '+ + botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])'))); + + WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))')); + WriteLn('powerline2: '+ + eng.EvalStr('list(map(float,["1",2,"3.0",4.0,"5",6]))')); + eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))'); + WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)')); + + eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]'); + eng.Execstring('transpose_A = [list(i) for i in zip(*A)]'); + WriteLn('powerline4: '+ eng.EvalStr('transpose_A')); + + //We can use dictionary comprehension to swap key-value pairs. + eng.Execstring('staff={"Data Scientist":"John","Django Developer":"Max"}'); + WriteLn('powerline5: '+ eng.EvalStr('{i:j for j, i in staff.items()}')); + eng.ExecString('print("powers:",[x**2 for x in range(10)])'); + + writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(PYCMD2))); + //eng.ExecString(PYCMD2+'parainput'); + eng.ExecString(PYCMD2+''); + eng.CheckError(true); + + { pystrings:= TStringlist.create; + pystrings.add('import matplotlib.pyplot as plt') + pystrings.add('import numpy as np') + pystrings.add('np.arange(5, 24, 3)') + pystrings.add('fig, ax = plt.subplots(dpi=153)') + pystrings.add('plt.plot([1,2,3,4,5,6], [1,2,3,4,9,5], "go")') + pystrings.add('plt.show()') + eng.ExecStrings4(pystrings); + pystrings.free; } + + (* eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "sympy"])') + eng.ExecString('from sympy import *'); + eng.ExecString('from sympy.plotting import plot'); + writeln(eng.EvalStr('list(primerange(7, 150))')); + writeln(eng.EvalStr('sum(list(primerange(0, 100)))')); + writeln(eng.EvalStr('(list(primerange(0, 101)))')); + writeln(eng.EvalStr('len(list(primerange(0, 101)))')); + //https://www.tutorialspoint.com/sympy/sympy_solvers.htm + avar:= '-2'; + eng.ExecString('x=Symbol("x")'); + eng.ExecString('x,y=symbols("x y")'); + writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)')); + writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)')); + writeln(eng.EvalStr('solveset(exp(x),x)')); + println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))')); + *) + + //eng.ExecString('plot(x**'+avar+', line_color="red")'); + //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))'); + { + eng.ExecString('from sympy.plotting import plot3d'); + eng.ExecString('x,y=symbols("x y") '); + eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); } + + WriteLn('powerline6: '+ eng.EvalStr('len(str(2**4096))')); + pymemo.lines.add('Decimal: '+ + eng.EvalStr('__import__("decimal").Decimal((0,(3,1,4),-2))')); + pymemo.lines.add('Decimal: '+ + eng.EvalStr('__import__("decimal").Decimal(0.1)')); + eng.ExecString('import decimal') + //https://www.w3schools.com/python/python_ref_functions.asp + writeln('is instance: '+eng.EvalStr('isinstance(decimal.Decimal,'+ + '(float, int, str, list, dict, tuple, type))')); + writeln('is type: '+eng.EvalStr('type(str(decimal.Decimal(0.1)))')); + writeln('is type: '+eng.EvalStr('type(float(decimal.Decimal(0.1)))')); + writeln('is type: '+eng.EvalStr('type(decimal.Decimal)')); + writeln('is type: '+eng.EvalStr('type(decimal)')); + //eng.ExecString('from spacy import *'); + //eng.ExecString('from nltk.classify import MaxentClassifier') + //eng.ExecString('import tensorflow') + + eng.ExecString('print("2*4")'); + + pyval:= VarPythonEval('sum([x for x in range(201)])'); + //writeln('evalvar '+botostr(VarIsPythonList(pyval))); + writeln('evalvar '+botostr(VarIsnumeric(pyval))); + pyval:= NewPythonDict; + writeln(botostr(VarIsPython( pyval))); + pyval := (VarPythonEval('2 ** 3')); + { eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "langdetect"])') + eng.ExecString('from langdetect import detect'); + println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")')); + } + Out1.output:= pyMemo; + pymemo.update; + end + else writeln('invalid library handle! '+Getlasterrortext); + println('PythonOK: '+botostr(PythonOK)); + except + eng.raiseError; + writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam)); + //PyErr Exception: Access violation at address 50F49DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000022. + finally + //eng.close + eng.unloaddll; + //PyFinalize(); + out1.free; + eng.free; + //PyFinalize(); + pystrings.Free; + end; + //out1.free; + //pyImport(PyModule); +end; + +procedure PythonInputOutput_SendData(sender: tobject; const data: ansistring); +Var + S : string; +begin + { if Assigned(FOnSendData) then + inherited + else + DisplayString( string(Data) );} + + showmessage('event second sended...') + println(itoa(length(data))); + for it:= 1 to length(data) do begin + s:= s+data[it]; + //write(s) + end; + println('event send data '+s) + println('event2 send data '+data) +end; + +procedure PythonInputOutput_ReceiveData(sender: tobject; var data: ansistring); +Var + S : string; +begin + {if Assigned( FOnReceiveData ) then + Result := inherited ReceiveData + else + begin + InputQuery( 'Query from Python', 'Enter text', S); + Result := AnsiString(S); + end; } + showmessage('second received...') + println('event send data '+data) +end; + +function SysVersionFromDLLName2(const DLLFileName : string): string; +var + Minor, Major: integer; +begin + PythonVersionFromDLLName(DLLFileName, Major, Minor); + Result := Format('%d.%d', [Major, Minor]); +end; + +//https://stackoverflow.com/questions/64324481/delphi-4-python/69123825#69123825 +procedure callDynPy; +var + PyEngine_netA: TPythonEngine; + PyInpOut_netA: TPythonInputOutput; + FIOPythonModule : TPythonModule; + pystrings: TStrings; +begin + PyEngine_netA := TPythonEngine.Create(Self); + PyInpOut_netA := TPythonInputOutput.Create(Self); + FIOPythonModule := TPythonModule.Create( Self ); + pystrings:= TStringlist.create; + + pystrings.text:= + 'import sys'+LF+ + 'import os'+LF+ + 'pylist = []'+LF+ + 'print("Python path =", sys.path) '+LF+ + 'print() '+LF+ + 'print("Python modules already imported:")'+LF+ + 'for m in sys.modules.values(): '+LF+ + ' if m: '+LF+ + ' print(" ", m,"\n") '+LF+ + ' pylist.append(m) '+LF+ + ' pylist.append("\n") '+LF+ + 'print() '+LF+ + '#pylist = "\n".join(pylist) '+LF+ + '#PYTHONHOME=os.getenv(r"'+PYHOME+'\")) '+LF+ + 'pylist.append(os.getenv("PYTHONHOME")) '+LF+ + '#print("PYTHONPATH =", os.getenv("PYTHONPATH"))'; + + try + /// configure the components + //saveString(exepath+'pystrings.py', pystrings.text); + //writeln(getDosOutput('py '+exepath+'pystrings.py', exePath)); + PyEngine_netA.DllName:= PYDLL; + PyEngine_netA.pythonhome:= PYHOME; + //writeln(TPythonModule(PyEngine_netA.IOPythonModule).modulename); + {TPythonModule} + writeln(FIOPythonModule.modulename); + writeln(objtostr(PyEngine_netA.IOPythonModule)); + //PyEngine_netA.modulename + + //PyEngine_netA.IO := PyInpOut_netA; + PyEngine_netA.UseLastKnownVersion := True; + writeln('SysVersionFromDLLName2: '+SysVersionFromDLLName2(PYDLL)); + //PyEngine_netA.opendll(PYDLL) + PyEngine_netA.LoadDll; + //PyEngine_netA.CheckPython; + PyEngine_netA.IO := PyInpOut_netA; + PyEngine_netA.redirectio := true; + + PyInpOut_netA.OnSendData:= @PythonInputOutput_SendData; + PyInpOut_netA.OnReceiveData:= @PythonInputOutput_ReceiveData; + PyInpOut_netA.UnicodeIO := false; + PyInpOut_netA.RawOutput := true; + //PyInpOut_netA.Write('print(49+78,"\n")'); + //PyEngine_netA.ExecString('import pyio'); + PyInpOut_netA.Writeline('print(49+78+23,"\n")'); + PyEngine_netA.ExecString(UTF8Encode(PYCMD2)); + + {with PyEngine_netA do begin + ExecString('import subprocess'); + ExecString('subprocess.call(["pip", "install", "pyio"])') + end; } + // println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")')); + + println('CheckExecSyntax:'+botostr(PyEngine_netA.CheckExecSyntax(pystrings.text))); + PyEngine_netA.ExecStrings4(pystrings); + //synStringReplace(const S, OldPattern,NewPattern:str;Flags:TReplaceFlags):str + println('module list detect: '+ + StringReplace(PyEngine_netA.EvalStr('pylist'),'\n',CR+LF,[rfReplaceAll])); + //PyInpOut_netA.Read('print(49+78,"\n")'); + //PyInpOut_netA.output:= pyMemo; + //PyEngine_netA.IO:= PyInpOut_netA; + + /// execute the script + //PyEngine_netA.ExecString(UTF8Encode(mmo_pythoncode.text)); +//https://stackoverflow.com/questions/49599004/how-to-convert-a-python-datetime-to-a-delphi-tdatetime#49599145 + PyEngine_netA.ExecString(UTF8Encode('print(49+78),"\n"')); + PyEngine_netA.ExecString(('from datetime import datetime, timedelta')); + PyEngine_netA.ExecString(UTF8Encode('DELPHI_EPOCH=datetime(1899,12,30)')); + PyEngine_netA.ExecString('def datetime_fromdelphi(dvalue):'+LF+ + ' return DELPHI_EPOCH + timedelta(days=dvalue)'); + println(PyEngine_netA.EvalStr(('datetime_fromdelphi(43191.68205925926)'))); + + //PyEngine_netA.ExecString(('49+78')); + println(PyEngine_netA.EvalStr(('(49+78+2**5),"\n"'+LF))); + println(PyEngine_netA.EvalStr(('__import__("sys").version'))); + except + PyEngine_netA.raiseError; + finally + PyEngine_netA.free; + PyInpOut_netA.free; + FIOPythonModule.Free; + pystrings.Free; + end; +end; + +begin //@main + //PythonEngine1.Free; + //myloadscript2:= filetostring(PYSCRIPT2); + //Memo1.beginUpdate; + PyForm:= loadForm2(300,200, clgreen,'PyFrm4D'); + pyMemo:= TMemo.create(PyForm); + pyMemo.parent:= PyForm + pymemo.align:= albottom; + PyForm.show; + + PYLaz_P4D_Demo2; + //Memo1.EndUpdate; + + callDynPy; + + //register_PYthonGUI; +End. +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + +doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191 + +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +maXbox_Starter86_3_Python4maXbox + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. +Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before. + +Evil eval() + +You should never pass untrusted source to the eval() directly. As it is quite easy for the malicious user to wreak havoc on your system. For example, the following code can be used to delete all the files from the system. + +1 >>> +2 eval('os.system("RM -RF /")') # command is deliberately capitalized +3 >>> + +# demo script +import matplotlib.pyplot as plt +import numpy as np +x = np.arange(0,8*np.pi,0.1) # start,stop,step +y = np.cos(x) *1/(1+x) +plt.plot(x,y) +plt.show() + + +Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download +-------------------------------------------------------- +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. +PascalScript maXbox4 - RemObjects & SynEdit + +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. + +dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E. +TRUE +Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD. + +mapdll EXCEPT Exception: There is already one instance of TPythonEngine running. +PythonOK TRUE +ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC. + mX4 executed: 26/07/2021 13:30:51 Runtime: 0:0:2.48 Memload: 71% use + +Example 3: Python multithreading + +All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program. + + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) + +t1.start() +t2.start() + +This package implements JSON support for FPC. + +You might want to have a look at the lazarus jsonviewer tool, written using +fpJSON (see lazarus/tools/jsonviewer). It visualizes the fpJSON data and +shows how to program using fpjson. + +JSON support consists of 3 parts: + +unit fpJSON contains the data representation. Basically, it defines a set of +classes: + +TJSONData ++- TJSONNumber + +- TJSONIntegerNumber + +- TJSONFloatNumber + +- TJSONInt64Number ++- TJSONString ++- TJSONBoolean ++- TJSONNull ++- TJSONObject ++- TJSONArray + +The TJSONData.JSONType property is an enumerated: +TJSONtype = (jtUnknown, jtNumber, jtString, jtBoolean, jtNull, jtArray, jtObject); + +Which allows to determine the type of a value. + +Page 7: But the eval-uation of -> But the evaluation of +page 8: Ans here's the -> And here's the +page 10: The mentioned windows dll file for Python. > The mentioned windows dll file from Python. +page 10: (I'll show that in the Tutor III). -> (I'll show that in the Part 3). +page 14: so we use the same inter-preter as from a shell -> so we use the same from a shell + +procedure TPythonEngine.DoRedirectIO; +const + code = 'import sys'+LF+ + 'class DebugOutput:'+LF+ + ' pyio = __import__("pyio")'+LF+ + ' softspace=0'+LF+ + ' encoding=None'+LF+ + ' def write(self,message):'+LF+ + ' self.pyio.write(message)'+LF+ + ' def readline(self, size=None):'+LF+ + ' return self.pyio.read(size)'+LF+ + ' def flush(self):' + LF + + ' pass' + LF + + ' def isatty(self):' + LF + + ' return True' + LF + + 'sys.old_stdin=sys.stdin'+LF+ + 'sys.old_stdout=sys.stdout'+LF+ + 'sys.old_stderr=sys.stderr'+LF+ + 'sys.stdin=sys.stderr=sys.stdout=DebugOutput()'+LF+#0; +begin + if csDesigning in ComponentState then + Exit; + CheckPython; + if not Assigned(FIOPythonModule) then + begin + // create a new module called pyio + FIOPythonModule := TPythonModule.Create( Self ); + with FIOPythonModule as TPythonModule do + begin + Engine := Self; + ModuleName := 'pyio'; + AddMethod( 'write', pyio_write, 'write(String) -> None' ); + AddMethod( 'read', pyio_read, 'read() -> String' ); + AddMethod( 'SetDelayWrites', pyio_SetDelayWrites, 'SetDelayWrites(Boolean) -> None' ); + AddMethod( 'SetMaxLines', pyio_SetMaxLines, 'SetMaxLines(Integer) -> None' ); + AddMethod( 'GetTypesStats', pyio_GetTypesStats, 'GetTypesStats( [type name] ) -> a list of tuple (TypeName, InstanceCount, CreateHits, DeleteHits)' ); + end; + end; + with FIOPythonModule as TPythonModule do + if not Initialized then + Initialize; + // execute the code + ExecString(code); + FIORedirected := True; +end; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demos/pydemo5.txt b/Demos/pydemo5.txt new file mode 100644 index 00000000..48744ed3 --- /dev/null +++ b/Demos/pydemo5.txt @@ -0,0 +1,204 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_PyCryptoDome_Bitcoin; +//https://pycryptodome.readthedocs.io/en/latest/src/examples.html +//https://medium.com/coinmonks/bitcoin-with-python-6595588c2fcf +//https://www.blockchain.com/explorer +//https://bitcointools.site/tool/pubkey-to-address + +// +{TYPE +} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; + PYDLL64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// +// + +//Generate public key and private key + +Const PYCMD = 'key = RSA.generate(2048)'+LF+ + 'private_key = key.export_key()'+LF+ + 'file_out = open("privatekey.pem", "wb")'+LF+ + 'file_out.write(private_key)'+LF+ + 'file_out.close()'; + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +BEGIN //@Main +// + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'); + //eng.Execstring('import Crypto'); + + //eng.ExecString('import subprocess'); + //eng.ExecString('subprocess.call(["pip3","install -t '+PYHOME32+'Lib", "bitcoin"])') + //eng.ExecString('subprocess.call(["pip3","install", "bitcoin"])') + //eng.ExecString('from sympy import *');*) + + eng.Execstring('from bitcoin import *'); + println(eng.evalstr('random_key()')); + + eng.Execstring('from Crypto.Signature import PKCS1_v1_5'); + + eng.Execstring('from Crypto.PublicKey import RSA'+LF+ + 'from Crypto.Random import get_random_bytes'); + //'from Crypto.Cipher import AES, PKCS1_OAEP'); + ////Generate public key and private key + // eng.Execstring(PYCMD); + println(eng.evalstr('dir("PKCS1_v1_5")')); + println(eng.evalstr('dir("RSA")')); + + //from Crypto.PublicKey import RSA + //from Crypto.PublicKey import RSA + //from Crypto import Random + println('bitcoinprikey0: '+ + eng.evalstr('__import__("bitcoin").random_key()')); + + println('bitcoinprikey: '+eng.evalstr('random_key()')); + println('bitcoinpubkey: '+eng.evalstr('privtopub(random_key())')); + println('bitcoinaddress: '+ + eng.evalstr('pubtoaddr(privtopub(random_key()))')); + + eng.Execstring(PYBC); + println('bitcoinaddress script: '+eng.evalstr('my_bitcoin_addr')); + + println(SHA256ToStr(CalcDoubleSHA256(eng.evalstr('random_key()')))); + //println(SHA256ToStr(CalcSHA256('1Hif9bgGKbgnksAtc9hsbbHB3rPLAWBZAd'))); + + eng.Execstring('with open(r"'+exepath+'maXbox4.exe","rb") as afile:'+ + ' fbuf = afile.read()'); + println(eng.evalstr('__import__("hashlib").sha512('+ + 'fbuf).hexdigest().upper()')); + except + eng.raiseError; + finally + eng.Free; + //aPythonVersion.Free; + end; + //maXcalcF('2^64 /(60*60*24*365)') +// +END. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Ref code: +from Crypto.Hash import SHA256 +from Crypto.PublicKey import RSA +from Crypto import Random + +bitcoinprikey: 3aa0dc740d42f06c7fe179a594137b3b71a7d5ca39e4ecf41c91b3c648fc9731 +bitcoinpubkey: 0495fdee31242b9edb91f69591ebb96194072ee5d4b7e277c9acc4d6cf34498c2dc0b425ce1be6e72536af6c78c5b1a12d104aea1d01e47bde7bf05a96810927fd +bitcoinaddress: 1Hif9bgGKbgnksAtc9hsbbHB3rPLAWBZAd + +random_generator = Random.new().read + +#used to generate a keypair which contain a public and private key +keyPair = RSA.generate(1024,random_generator) +pubKey = keyPair.publicKey() + +plainText = 'Hello World' +hashA = SHA256.new(plainText).digest() +digitalSignature = keyPair.sign(hashA,'') + +print("Hash A: "+repr(hashA) + "\n"); +print("Digital Signature: " + repr(digitalSignature) + "\n") + +#Bob receives the plainText and digitalSignature from Alice +#plainTextChanged ='Hello World' +hashB =SHA256.new(plainText).digest() +print("Hash B: " + repr(hashB) + "\n") + +if(pubKey.verify(hashB, digitalSignature)): + print("Match") +else: + print("No Match") + + C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h( +83): error C2143: syntax error: missing '{' before '__cdecl' + C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h( +90): error C2143: syntax error: missing '{' before '__cdecl' + C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h( +96): error C2143: syntax error: missing '{' before '__cdecl' + error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\B +IN\\x86_amd64\\cl.exe' failed with exit status 2 + ---------------------------------------- +ERROR: Command errored out with exit status 1: 'c:\users\max\appdata\local\progr +ams\python\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.arg +v[0] = '"'"'C:\\Users\\max\\AppData\\Local\\Temp\\pip-install-yf3lh10u\\pycrypto +\\setup.py'"'"'; __file__='"'"'C:\\Users\\max\\AppData\\Local\\Temp\\pip-install +-yf3lh10u\\pycrypto\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__f +ile__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compil +e(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\max\AppData\Local +\Temp\pip-record-7gjehywl\install-record.txt' --single-version-externally-manage +d --compile --install-headers 'C:\Users\max\AppData\Local\Programs\Python\Python +36\Include\pycrypto' Check the logs for full command output. +WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available. + +You should consider upgrading via the 'c:\users\max\appdata\local\programs\pytho +n\python36\python.exe -m pip install --upgrade pip' command. + +Solution: It require installation of Microsoft Visual C++ 14.0) + +I have made a simple python script and built a 64-bit Windows executable from it via pyinstaller. However, most computers at my office run 32-bit Windows operating systems, thus my program does not work. From what I have read, it is possible to make an executable for 32-bit systems as long as I use the 32-bit version of python. So I went ahead and installed the 32-bit version of python 3.5, but I can't find the way to link pip to the 32-bit version of python so I can install all the necessary modules. Every time I call pip it displays all the modules that are installed on the 64-bit version, even though by default I am running the 32-bit version python. + +https://pypi.org/project/pycryptodome/#filespydemo5crypto.txt + +C:\Users\max\AppData\Local\Programs\Python>C:\Users\max\AppData\Local\Programs\P +ython\Python36\Scripts\pip3.exe install -t C:\Users\max\AppData\Local\Programs\P +ython\Python36-32\lib\ https://files.pythonhosted.org/packages/b2/0c/1cfc4700b15 +bc155c76a42f504379ec15483bf57dbf41c3825147cbf5865/pycryptodome-3.10.1-pp36-pypy3 +6_pp73-win32.whl +Collecting pycryptodome==3.10.1 + Using cached pycryptodome-3.10.1-pp36-pypy36_pp73-win32.whl (1.6 MB) +Installing collected packages: pycryptodome +Successfully installed pycryptodome-3.10.1 +WARNING: Target directory C:\Users\max\AppData\Local\Programs\Python\Python36-32 +\lib\Crypto already exists. Specify --upgrade to force replacement. +WARNING: Target directory C:\Users\max\AppData\Local\Programs\Python\Python36-32 +\lib\pycryptodome-3.10.1.dist-info already exists. Specify --upgrade to force re +placement. +WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available. + +You should consider upgrading via the 'c:\users\max\appdata\local\programs\pytho +n\python36\python.exe -m pip install --upgrade pip' command. + +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin +Collecting bitcoin + Downloading bitcoin-1.1.42.tar.gz (36 kB) +Building wheels for collected packages: bitcoin + Building wheel for bitcoin (setup.py) ... done + Created wheel for bitcoin: filename=bitcoin-1.1.42-py3-none-any.whl size=43514 + sha256=9373bd6ea351dfa409f33c27014c0d6377ae3b8b76a71da1fa75de92e30655b8 + Stored in directory: c:\users\max\appdata\local\pip\cache\wheels\27\b0\82\9b3b +630ec2952871a415a2c8083b5998d81528fee2815fc0ac +Successfully built bitcoin +Installing collected packages: bitcoin +Successfully installed bitcoin-1.1.42 + +Exception: : Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_raw_ecb.pyd': [WinError 126] The specified module could not be found. + +C:\Users\max\AppData\Local\Programs\Python> + +If you have both the 64 and 32 bit versions installed and ever need to install to the 32 bit version, you have to enter both the major and minor revision numbers as part of the command and add '-32' to the command argument. "py -3.5-32 -m pip install [package]" will install to the 32 bit version. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- \ No newline at end of file diff --git a/Demos/pydemo6.htm b/Demos/pydemo6.htm new file mode 100644 index 00000000..c9846646 --- /dev/null +++ b/Demos/pydemo6.htm @@ -0,0 +1,237 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000056776 +StartFragment:0000001053 +EndFragment:0000056760 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo_App_mX4_PythonTemplate_PyCryptoDome_Bitcoin;
+//https://pycryptodome.readthedocs.io/en/latest/src/examples.html
+//https://medium.com/coinmonks/bitcoin-with-python-6595588c2fcf
+//https://www.blockchain.com/explorer
+//https://bitcointools.site/tool/pubkey-to-address
+
+//<Constant declarations> 
+{TYPE 
+<Type declarations>} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+      PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; 
+      PYDLL64  = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; 
+
+Var 
+//<Variable declarations>
+  i: integer; eng: TPythonEngine;
+
+//<FUNCTION>
+//<PROCEDURE> 
+
+//Generate public key and private key
+
+Const PYCMD = 'key = RSA.generate(2048)'+LF+ 
+              'private_key = key.export_key()'+LF+ 
+              'file_out = open("privatekey.pem", "wb")'+LF+
+              'file_out.write(private_key)'+LF+
+              'file_out.close()';
+              
+Const PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+
+BEGIN  //@Main
+//<Executable statements>
+  eng:= TPythonEngine.Create(Nil);
+  eng.pythonhome:= PYHOME32;
+  eng.opendll(PYDLL32)
+  //eng.IO:= pyMemo;
+    try
+      eng.Execstring('import base64');
+      //eng.Execstring('import Crypto');
+      
+      //eng.ExecString('import subprocess');  
+      //eng.ExecString('subprocess.call(["pip3","install -t '+PYHOME32+'Lib", "bitcoin"])')
+      //eng.ExecString('subprocess.call(["pip3","install", "bitcoin"])')
+      //eng.ExecString('from sympy import *');*)
+      
+      eng.Execstring('from bitcoin import *');
+      println(eng.evalstr('random_key()'));
+      
+      eng.Execstring('from Crypto.Signature import PKCS1_v1_5');
+      
+      eng.Execstring('from Crypto.PublicKey import RSA'+LF+
+                     'from Crypto.Random import get_random_bytes');
+                     //'from Crypto.Cipher import AES, PKCS1_OAEP');
+      ////Generate public key and private key               
+      // eng.Execstring(PYCMD); 
+      println(eng.evalstr('dir("PKCS1_v1_5")')); 
+      println(eng.evalstr('dir("RSA")'));             
+      
+      //from Crypto.PublicKey import RSA
+      //from Crypto.PublicKey import RSA
+      //from Crypto import Random
+      println('bitcoinprikey0: '+
+                           eng.evalstr('__import__("bitcoin").random_key()'));
+     
+      println('bitcoinprikey: '+eng.evalstr('random_key()'));
+      println('bitcoinpubkey: '+eng.evalstr('privtopub(random_key())'));
+      println('bitcoinaddress: '+
+                           eng.evalstr('pubtoaddr(privtopub(random_key()))'));
+      
+      eng.Execstring(PYBC);
+      println('bitcoinaddress script: '+eng.evalstr('my_bitcoin_addr'));
+      
+      println(SHA256ToStr(CalcDoubleSHA256(eng.evalstr('random_key()'))));
+      //println(SHA256ToStr(CalcSHA256('1Hif9bgGKbgnksAtc9hsbbHB3rPLAWBZAd')));
+      
+      eng.Execstring('with open(r"'+exepath+'maXbox4.exe","rb") as afile:'+
+                              ' fbuf = afile.read()');
+      println(eng.evalstr('__import__("hashlib").sha512('+
+                                    'fbuf).hexdigest().upper()')); 
+    except
+      eng.raiseError;
+    finally
+      eng.Free;
+      //aPythonVersion.Free;
+    end;    
+  //maXcalcF('2^64 /(60*60*24*365)')  
+//<Definitions>  
+END. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+
+Ref code:
+from Crypto.Hash import SHA256
+from Crypto.PublicKey import RSA
+from Crypto import Random
+
+bitcoinprikey: 3aa0dc740d42f06c7fe179a594137b3b71a7d5ca39e4ecf41c91b3c648fc9731
+bitcoinpubkey: 0495fdee31242b9edb91f69591ebb96194072ee5d4b7e277c9acc4d6cf34498c2dc0b425ce1be6e72536af6c78c5b1a12d104aea1d01e47bde7bf05a96810927fd
+bitcoinaddress: 1Hif9bgGKbgnksAtc9hsbbHB3rPLAWBZAd
+
+random_generator = Random.new().read
+
+#used to generate a keypair which contain a public and private key
+keyPair = RSA.generate(1024,random_generator)
+pubKey = keyPair.publicKey()
+
+plainText = 'Hello World'
+hashA = SHA256.new(plainText).digest()
+digitalSignature = keyPair.sign(hashA,'')
+
+print("Hash A: "+repr(hashA) + "\n");
+print("Digital Signature: " + repr(digitalSignature) + "\n")
+
+#Bob receives the plainText and digitalSignature from Alice 
+#plainTextChanged ='Hello World'
+hashB =SHA256.new(plainText).digest()
+print("Hash B: " + repr(hashB) + "\n")
+
+if(pubKey.verify(hashB, digitalSignature)):
+    print("Match")
+else:
+    print("No Match")
+
+    C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
+83): error C2143: syntax error: missing '{' before '__cdecl'
+    C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
+90): error C2143: syntax error: missing '{' before '__cdecl'
+    C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
+96): error C2143: syntax error: missing '{' before '__cdecl'
+    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\B
+IN\\x86_amd64\\cl.exe' failed with exit status 2
+    ----------------------------------------
+ERROR: Command errored out with exit status 1: 'c:\users\max\appdata\local\progr
+ams\python\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.arg
+v[0] = '"'"'C:\\Users\\max\\AppData\\Local\\Temp\\pip-install-yf3lh10u\\pycrypto
+\\setup.py'"'"'; __file__='"'"'C:\\Users\\max\\AppData\\Local\\Temp\\pip-install
+-yf3lh10u\\pycrypto\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__f
+ile__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compil
+e(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\max\AppData\Local
+\Temp\pip-record-7gjehywl\install-record.txt' --single-version-externally-manage
+d --compile --install-headers 'C:\Users\max\AppData\Local\Programs\Python\Python
+36\Include\pycrypto' Check the logs for full command output.
+WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available.
+
+You should consider upgrading via the 'c:\users\max\appdata\local\programs\pytho
+n\python36\python.exe -m pip install --upgrade pip' command.
+
+Solution: It require installation of Microsoft Visual C++ 14.0)
+
+I have made a simple python script and built a 64-bit Windows executable from it via pyinstaller. However, most computers at my office run 32-bit Windows operating systems, thus my program does not work. From what I have read, it is possible to make an executable for 32-bit systems as long as I use the 32-bit version of python. So I went ahead and installed the 32-bit version of python 3.5, but I can't find the way to link pip to the 32-bit version of python so I can install all the necessary modules. Every time I call pip it displays all the modules that are installed on the 64-bit version, even though by default I am running the 32-bit version python.
+
+https://pypi.org/project/pycryptodome/#filesto.txpydemo6.txtt
+
+C:\Users\max\AppData\Local\Programs\Python>C:\Users\max\AppData\Local\Programs\P
+ython\Python36\Scripts\pip3.exe install -t C:\Users\max\AppData\Local\Programs\P
+ython\Python36-32\lib\ https://files.pythonhosted.org/packages/b2/0c/1cfc4700b15
+bc155c76a42f504379ec15483bf57dbf41c3825147cbf5865/pycryptodome-3.10.1-pp36-pypy3
+6_pp73-win32.whl
+Collecting pycryptodome==3.10.1
+  Using cached pycryptodome-3.10.1-pp36-pypy36_pp73-win32.whl (1.6 MB)
+Installing collected packages: pycryptodome
+Successfully installed pycryptodome-3.10.1
+WARNING: Target directory C:\Users\max\AppData\Local\Programs\Python\Python36-32
+\lib\Crypto already exists. Specify --upgrade to force replacement.
+WARNING: Target directory C:\Users\max\AppData\Local\Programs\Python\Python36-32
+\lib\pycryptodome-3.10.1.dist-info already exists. Specify --upgrade to force re
+placement.
+WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available.
+
+You should consider upgrading via the 'c:\users\max\appdata\local\programs\pytho
+n\python36\python.exe -m pip install --upgrade pip' command.
+
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+Collecting bitcoin
+  Downloading bitcoin-1.1.42.tar.gz (36 kB)
+Building wheels for collected packages: bitcoin
+  Building wheel for bitcoin (setup.py) ... done
+  Created wheel for bitcoin: filename=bitcoin-1.1.42-py3-none-any.whl size=43514
+ sha256=9373bd6ea351dfa409f33c27014c0d6377ae3b8b76a71da1fa75de92e30655b8
+  Stored in directory: c:\users\max\appdata\local\pip\cache\wheels\27\b0\82\9b3b
+630ec2952871a415a2c8083b5998d81528fee2815fc0ac
+Successfully built bitcoin
+Installing collected packages: bitcoin
+Successfully installed bitcoin-1.1.42
+
+Exception: <class 'OSError'>: Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_raw_ecb.pyd': [WinError 126] The specified module could not be found.
+
+C:\Users\max\AppData\Local\Programs\Python>
+
+If you have both the 64 and 32 bit versions installed and ever need to install to the 32 bit version, you have to enter both the major and minor revision numbers as part of the command and add '-32' to the command argument. "py -3.5-32 -m pip install [package]" will install to the 32 bit version.
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+ 
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+ \ No newline at end of file diff --git a/Demos/pydemo6.txt b/Demos/pydemo6.txt new file mode 100644 index 00000000..e14438f1 --- /dev/null +++ b/Demos/pydemo6.txt @@ -0,0 +1,210 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_PyCryptoDome_Bitcoin; +//https://pycryptodome.readthedocs.io/en/latest/src/examples.html +//https://medium.com/coinmonks/bitcoin-with-python-6595588c2fcf +//https://www.blockchain.com/explorer +//https://bitcointools.site/tool/pubkey-to-address + +// +{TYPE +} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; + PYDLL64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// +// + +//Generate public key and private key + + + +Const PYCMD = 'key = RSA.generate(2048)'+LF+ + 'private_key = key.export_key()'+LF+ + 'file_out = open("privatekey.pem", "wb")'+LF+ + 'file_out.write(private_key)'+LF+ + 'file_out.close()'; + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +BEGIN //@Main +// + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'); + //eng.Execstring('import Crypto'); + + //eng.ExecString('import subprocess'); + //eng.ExecString('subprocess.call(["pip3","install -t '+PYHOME32+'Lib", "bitcoin"])') + //eng.ExecString('subprocess.call(["pip3","install", "bitcoin"])') + //eng.ExecString('from sympy import *');*) + + eng.Execstring('from bitcoin import *'); + println(eng.evalstr('random_key()')); + + eng.Execstring('from Crypto.Signature import PKCS1_v1_5'); + + eng.Execstring('from Crypto.PublicKey import RSA'+LF+ + 'from Crypto.Random import get_random_bytes'); + //'from Crypto.Cipher import AES, PKCS1_OAEP'); + ////Generate public key and private key + // eng.Execstring(PYCMD); + println(eng.evalstr('dir("PKCS1_v1_5")')); + println(eng.evalstr('dir("RSA")')); + + //from Crypto.PublicKey import RSA + //from Crypto.PublicKey import RSA + //from Crypto import Random + println('bitcoinprikey0: '+ + eng.evalstr('__import__("bitcoin").random_key()')); + + println('bitcoinprikey: '+eng.evalstr('random_key()')); + println('bitcoinpubkey: '+eng.evalstr('privtopub(random_key())')); + println('bitcoinaddress: '+ + eng.evalstr('pubtoaddr(privtopub(random_key()))')); + + eng.Execstring(PYBC); + println('bitcoinaddress script: '+eng.evalstr('my_bitcoin_addr')); + + println(SHA256ToStr(CalcDoubleSHA256(eng.evalstr('random_key()')))); + //println(SHA256ToStr(CalcSHA256('1Hif9bgGKbgnksAtc9hsbbHB3rPLAWBZAd'))); + + eng.Execstring('with open(r"'+exepath+'maXbox4.exe","rb") as afile:'+ + ' fbuf = afile.read()'); + println(eng.evalstr('__import__("hashlib").sha512('+ + 'fbuf).hexdigest().upper()')); + + eng.Execstring('import sys, os'); + println('scriptPath: '+eng.evalstr('os.path.abspath("firstdemo.txt")')); + + except + eng.raiseError; + finally + eng.Free; + //aPythonVersion.Free; + end; + //maXcalcF('2^64 /(60*60*24*365)') +// +END. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Ref code: +from Crypto.Hash import SHA256 +from Crypto.PublicKey import RSA +from Crypto import Random + +bitcoinprikey: 3aa0dc740d42f06c7fe179a594137b3b71a7d5ca39e4ecf41c91b3c648fc9731 +bitcoinpubkey: 0495fdee31242b9edb91f69591ebb96194072ee5d4b7e277c9acc4d6cf34498c2dc0b425ce1be6e72536af6c78c5b1a12d104aea1d01e47bde7bf05a96810927fd +bitcoinaddress: 1Hif9bgGKbgnksAtc9hsbbHB3rPLAWBZAd + +random_generator = Random.new().read + +#used to generate a keypair which contain a public and private key +keyPair = RSA.generate(1024,random_generator) +pubKey = keyPair.publicKey() + +plainText = 'Hello World' +hashA = SHA256.new(plainText).digest() +digitalSignature = keyPair.sign(hashA,'') + +print("Hash A: "+repr(hashA) + "\n"); +print("Digital Signature: " + repr(digitalSignature) + "\n") + +#Bob receives the plainText and digitalSignature from Alice +#plainTextChanged ='Hello World' +hashB =SHA256.new(plainText).digest() +print("Hash B: " + repr(hashB) + "\n") + +if(pubKey.verify(hashB, digitalSignature)): + print("Match") +else: + print("No Match") + + C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h( +83): error C2143: syntax error: missing '{' before '__cdecl' + C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h( +90): error C2143: syntax error: missing '{' before '__cdecl' + C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h( +96): error C2143: syntax error: missing '{' before '__cdecl' + error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\B +IN\\x86_amd64\\cl.exe' failed with exit status 2 + ---------------------------------------- +ERROR: Command errored out with exit status 1: 'c:\users\max\appdata\local\progr +ams\python\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.arg +v[0] = '"'"'C:\\Users\\max\\AppData\\Local\\Temp\\pip-install-yf3lh10u\\pycrypto +\\setup.py'"'"'; __file__='"'"'C:\\Users\\max\\AppData\\Local\\Temp\\pip-install +-yf3lh10u\\pycrypto\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__f +ile__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compil +e(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\max\AppData\Local +\Temp\pip-record-7gjehywl\install-record.txt' --single-version-externally-manage +d --compile --install-headers 'C:\Users\max\AppData\Local\Programs\Python\Python +36\Include\pycrypto' Check the logs for full command output. +WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available. + +You should consider upgrading via the 'c:\users\max\appdata\local\programs\pytho +n\python36\python.exe -m pip install --upgrade pip' command. + +Solution: It require installation of Microsoft Visual C++ 14.0) + +I have made a simple python script and built a 64-bit Windows executable from it via pyinstaller. However, most computers at my office run 32-bit Windows operating systems, thus my program does not work. From what I have read, it is possible to make an executable for 32-bit systems as long as I use the 32-bit version of python. So I went ahead and installed the 32-bit version of python 3.5, but I can't find the way to link pip to the 32-bit version of python so I can install all the necessary modules. Every time I call pip it displays all the modules that are installed on the 64-bit version, even though by default I am running the 32-bit version python. + +https://pypi.org/project/pycryptodome/#files6.txtpydemo6.txtt + +C:\Users\max\AppData\Local\Programs\Python>C:\Users\max\AppData\Local\Programs\P +ython\Python36\Scripts\pip3.exe install -t C:\Users\max\AppData\Local\Programs\P +ython\Python36-32\lib\ https://files.pythonhosted.org/packages/b2/0c/1cfc4700b15 +bc155c76a42f504379ec15483bf57dbf41c3825147cbf5865/pycryptodome-3.10.1-pp36-pypy3 +6_pp73-win32.whl +Collecting pycryptodome==3.10.1 + Using cached pycryptodome-3.10.1-pp36-pypy36_pp73-win32.whl (1.6 MB) +Installing collected packages: pycryptodome +Successfully installed pycryptodome-3.10.1 +WARNING: Target directory C:\Users\max\AppData\Local\Programs\Python\Python36-32 +\lib\Crypto already exists. Specify --upgrade to force replacement. +WARNING: Target directory C:\Users\max\AppData\Local\Programs\Python\Python36-32 +\lib\pycryptodome-3.10.1.dist-info already exists. Specify --upgrade to force re +placement. +WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available. + +You should consider upgrading via the 'c:\users\max\appdata\local\programs\pytho +n\python36\python.exe -m pip install --upgrade pip' command. + +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin +Collecting bitcoin + Downloading bitcoin-1.1.42.tar.gz (36 kB) +Building wheels for collected packages: bitcoin + Building wheel for bitcoin (setup.py) ... done + Created wheel for bitcoin: filename=bitcoin-1.1.42-py3-none-any.whl size=43514 + sha256=9373bd6ea351dfa409f33c27014c0d6377ae3b8b76a71da1fa75de92e30655b8 + Stored in directory: c:\users\max\appdata\local\pip\cache\wheels\27\b0\82\9b3b +630ec2952871a415a2c8083b5998d81528fee2815fc0ac +Successfully built bitcoin +Installing collected packages: bitcoin +Successfully installed bitcoin-1.1.42 + +Exception: : Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_raw_ecb.pyd': [WinError 126] The specified module could not be found. + +C:\Users\max\AppData\Local\Programs\Python> + +If you have both the 64 and 32 bit versions installed and ever need to install to the 32 bit version, you have to enter both the major and minor revision numbers as part of the command and add '-32' to the command argument. "py -3.5-32 -m pip install [package]" will install to the 32 bit version. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- \ No newline at end of file diff --git a/Demos/pydemo7.htm b/Demos/pydemo7.htm new file mode 100644 index 00000000..b6872dad --- /dev/null +++ b/Demos/pydemo7.htm @@ -0,0 +1,181 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000043855 +StartFragment:0000001053 +EndFragment:0000043839 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo_App_mX4_PythonTemplate_Translator;
+//https://techvidvan.com/tutorials/python-language-translator/
+//https://www.tutorialspoint.com/python_text_processing/python_text_translation.htm
+//https://translate-python.readthedocs.io/en/latest/providers.html
+
+//<Constant declarations> 
+//Please check providers list below: ['mymemory', 'microsoft', 'deepl', 'libre'].
+{TYPE 
+<Type declarations>} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+      PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; 
+      PYDLL64  = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; 
+
+Var 
+//<Variable declarations>
+  i: integer; eng: TPythonEngine;
+
+//<FUNCTION>
+//<PROCEDURE> 
+
+//Generate public key and private key
+
+Const PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+
+Begin  //@Main
+//<Executable statements>
+  eng:= TPythonEngine.Create(Nil);
+  eng.pythonhome:= PYHOME32;
+  eng.opendll(PYDLL32)
+  //eng.IO:= pyMemo;
+    try
+      eng.Execstring('import base64');
+      //eng.Execstring('import Crypto');
+      
+      //eng.ExecString('import subprocess');  
+      //eng.ExecString('subprocess.call(["pip3","install -t '+PYHOME32+'Lib", "translate"])')
+      //eng.ExecString('subprocess.call(["pip3","install", "translate"])')
+      
+      eng.Execstring('from translate import Translator');
+      eng.Execstring('translator= Translator(provider="mymemory",'+
+                                             'from_lang="german",to_lang="spanish")');
+      println(UTF8Decode(eng.EvalStr('translator.translate("Guten Morgen Programmierer")')));
+      
+      //eng.Execstring('with open(r"'+exepath+'999_lesmiserable_135-0.txt","rb") as afile:'+
+      //MAX ALLOWED QUERY : 500 CHARS QUERY LENGTH LIMIT EXCEDEED. 
+      eng.Execstring('with open(r"'+exepath+'test.txt","rb") as afile:'+
+                                            ' ftrans = afile.read().decode("utf-8")');
+      println(UTF8Decode(eng.EvalStr('translator.translate(ftrans)')));
+        
+      eng.Execstring('with open(r"'+exepath+'maXbox4.exe","rb") as afile:'+
+                              ' fbuf = afile.read()');
+      println(eng.evalstr('__import__("hashlib").sha512('+
+                                    'fbuf).hexdigest().upper()')); 
+    except
+      eng.raiseError;
+    finally
+      eng.Free;
+      //aPythonVersion.Free;
+    end;    
+  //maXcalcF('2^64 /(60*60*24*365)')  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+
+Ref code:  https://mymemory.translated.net/doc/spec.php
+MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN  02
+ HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
+
+C:\maXbox\mX47464\maxbox4>pip3 install -t C:\Users\max\AppData\Local\Programs\Py
+thon\Python36-32\Lib translate
+Collecting translate
+  Downloading translate-3.6.1-py2.py3-none-any.whl (12 kB)
+Collecting libretranslatepy==2.1.1
+  Downloading libretranslatepy-2.1.1-py3-none-any.whl (3.2 kB)
+Collecting click
+  Downloading click-8.0.1-py3-none-any.whl (97 kB)
+     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 97 kB 277 kB/s
+Collecting lxml
+  Downloading lxml-4.6.3-cp36-cp36m-win_amd64.whl (3.5 MB)
+     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 3.5 MB 2.2 MB/s
+Collecting requests
+  Downloading requests-2.26.0-py2.py3-none-any.whl (62 kB)
+     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 62 kB 44 kB/s
+Collecting colorama; platform_system == "Windows"
+  Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB)
+Collecting importlib-metadata; python_version < "3.8"
+  Downloading importlib_metadata-4.8.1-py3-none-any.whl (17 kB)
+Collecting idna<4,>=2.5; python_version >= "3"
+  Downloading idna-3.2-py3-none-any.whl (59 kB)
+     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 59 kB 673 kB/s
+Collecting certifi>=2017.4.17
+  Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
+     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 145 kB 3.3 MB/s
+Collecting urllib3<1.27,>=1.21.1
+  Downloading urllib3-1.26.6-py2.py3-none-any.whl (138 kB)
+     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 138 kB 3.2 MB/s
+Collecting charset-normalizer~=2.0.0; python_version >= "3"
+  Downloading charset_normalizer-2.0.4-py3-none-any.whl (36 kB)
+Collecting zipp>=0.5 Downloading zipp-3.5.0-py3-none-any.whl (5.7 kB)
+Collecting typing-extensions>=3.6.4; python_version < "3.8"
+  Downloading typing_extensions-3.10.0.2-py3-none-any.whl (26 kB)
+ERROR: yahoo 0.1 has requirement beautifulsoup4==4.3.2, but you'll have beautifu
+lsoup4 4.6.0 which is incompatible.
+ERROR: yahoo 0.1 has requirement requests==1.1.0, but you'll have requests 2.26.
+0 which is incompatible.
+ERROR: tensorboard 2.3.0 has requirement grpcio>=1.24.3, but you'll have grpcio
+1.11.0 which is incompatible.
+ERROR: mondrian 0.8.0 has requirement colorama~=0.3.7, but you'll have colorama
+0.4.4 which is incompatible.
+ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl
+oudpickle 0.5.3 which is incompatible.
+Installing collected packages: libretranslatepy, colorama, zipp, typing-extensio
+ns, importlib-metadata, click, lxml, idna, certifi, urllib3, charset-normalizer,
+ requests, translate
+Successfully installed certifi-2021.5.30 charset-normalizer-2.0.4 click-8.0.1 co
+lorama-0.4.4 idna-3.2 importlib-metadata-4.8.1 libretranslatepy-2.1.1 lxml-4.6.3
+ requests-2.26.0 translate-3.6.1 typing-extensions-3.10.0.2 urllib3-1.26.6 zipp-
+3.5.0  WARNING: Target directory C:\Users\max\AppData\Local\Programs\Python\Python36-32
+\Lib\__pycache__ already exists. Specify --upgrade to force replacement.
+WARNING: Target directory C:\Users\max\AppData\Local\Programs\Python\Python36-32
+\Lib\bin already exists. Specify --upgrade to force replacement.
+WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available.
+
+C:\maXbox\mX47464\maxbox4>pip3 install -t C:\Users\max\AppData\Local\Programs\Py
+thon\Python36-32\Lib install
+Collecting install
+  Using cached install-1.3.4-py3-none-any.whl (3.1 kB)
+Installing collected packages: install
+Successfully installed install-1.3.4
+
+Exception: <class 'OSError'>: Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_raw_ecb.pyd': [WinError 126] The specified module could not be found.
+
+C:\Users\max\AppData\Local\Programs\Python>
+If you have both the 64 and 32 bit versions installed and ever need to install to the 32 bit version, you have to enter both the major and minor revision numbers as part of the command and add '-32' to the command argument. "py -3.5-32 -m pip install [package]" will install to the 32 bit version.
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+ 
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+ \ No newline at end of file diff --git a/Demos/pydemo7.txt b/Demos/pydemo7.txt new file mode 100644 index 00000000..6356a5e4 --- /dev/null +++ b/Demos/pydemo7.txt @@ -0,0 +1,148 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_Translator; +//https://techvidvan.com/tutorials/python-language-translator/ +//https://www.tutorialspoint.com/python_text_processing/python_text_translation.htm +//https://translate-python.readthedocs.io/en/latest/providers.html + +// +//Please check providers list below: ['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE +} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; + PYDLL64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// +// + +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Begin //@Main +// + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'); + //eng.Execstring('import Crypto'); + + //eng.ExecString('import subprocess'); + //eng.ExecString('subprocess.call(["pip3","install -t '+PYHOME32+'Lib", "translate"])') + //eng.ExecString('subprocess.call(["pip3","install", "translate"])') + + eng.Execstring('from translate import Translator'); + eng.Execstring('translator= Translator(provider="mymemory",'+ + 'from_lang="german",to_lang="spanish")'); + println(UTF8Decode(eng.EvalStr('translator.translate("Guten Morgen Programmierer")'))); + + //eng.Execstring('with open(r"'+exepath+'999_lesmiserable_135-0.txt","rb") as afile:'+ + //MAX ALLOWED QUERY : 500 CHARS QUERY LENGTH LIMIT EXCEDEED. + eng.Execstring('with open(r"'+exepath+'test.txt","rb") as afile:'+ + ' ftrans = afile.read().decode("utf-8")'); + println(UTF8Decode(eng.EvalStr('translator.translate(ftrans)'))); + + eng.Execstring('with open(r"'+exepath+'maXbox4.exe","rb") as afile:'+ + ' fbuf = afile.read()'); + println(eng.evalstr('__import__("hashlib").sha512('+ + 'fbuf).hexdigest().upper()')); + except + eng.raiseError; + finally + eng.Free; + //aPythonVersion.Free; + end; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Ref code: https://mymemory.translated.net/doc/spec.php +MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 02 + HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE + +C:\maXbox\mX47464\maxbox4>pip3 install -t C:\Users\max\AppData\Local\Programs\Py +thon\Python36-32\Lib translate +Collecting translate + Downloading translate-3.6.1-py2.py3-none-any.whl (12 kB) +Collecting libretranslatepy==2.1.1 + Downloading libretranslatepy-2.1.1-py3-none-any.whl (3.2 kB) +Collecting click + Downloading click-8.0.1-py3-none-any.whl (97 kB) + |��������������������������������| 97 kB 277 kB/s +Collecting lxml + Downloading lxml-4.6.3-cp36-cp36m-win_amd64.whl (3.5 MB) + |��������������������������������| 3.5 MB 2.2 MB/s +Collecting requests + Downloading requests-2.26.0-py2.py3-none-any.whl (62 kB) + |��������������������������������| 62 kB 44 kB/s +Collecting colorama; platform_system == "Windows" + Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB) +Collecting importlib-metadata; python_version < "3.8" + Downloading importlib_metadata-4.8.1-py3-none-any.whl (17 kB) +Collecting idna<4,>=2.5; python_version >= "3" + Downloading idna-3.2-py3-none-any.whl (59 kB) + |��������������������������������| 59 kB 673 kB/s +Collecting certifi>=2017.4.17 + Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB) + |��������������������������������| 145 kB 3.3 MB/s +Collecting urllib3<1.27,>=1.21.1 + Downloading urllib3-1.26.6-py2.py3-none-any.whl (138 kB) + |��������������������������������| 138 kB 3.2 MB/s +Collecting charset-normalizer~=2.0.0; python_version >= "3" + Downloading charset_normalizer-2.0.4-py3-none-any.whl (36 kB) +Collecting zipp>=0.5 Downloading zipp-3.5.0-py3-none-any.whl (5.7 kB) +Collecting typing-extensions>=3.6.4; python_version < "3.8" + Downloading typing_extensions-3.10.0.2-py3-none-any.whl (26 kB) +ERROR: yahoo 0.1 has requirement beautifulsoup4==4.3.2, but you'll have beautifu +lsoup4 4.6.0 which is incompatible. +ERROR: yahoo 0.1 has requirement requests==1.1.0, but you'll have requests 2.26. +0 which is incompatible. +ERROR: tensorboard 2.3.0 has requirement grpcio>=1.24.3, but you'll have grpcio +1.11.0 which is incompatible. +ERROR: mondrian 0.8.0 has requirement colorama~=0.3.7, but you'll have colorama +0.4.4 which is incompatible. +ERROR: distributed 2.22.0 has requirement cloudpickle>=1.5.0, but you'll have cl +oudpickle 0.5.3 which is incompatible. +Installing collected packages: libretranslatepy, colorama, zipp, typing-extensio +ns, importlib-metadata, click, lxml, idna, certifi, urllib3, charset-normalizer, + requests, translate +Successfully installed certifi-2021.5.30 charset-normalizer-2.0.4 click-8.0.1 co +lorama-0.4.4 idna-3.2 importlib-metadata-4.8.1 libretranslatepy-2.1.1 lxml-4.6.3 + requests-2.26.0 translate-3.6.1 typing-extensions-3.10.0.2 urllib3-1.26.6 zipp- +3.5.0 WARNING: Target directory C:\Users\max\AppData\Local\Programs\Python\Python36-32 +\Lib\__pycache__ already exists. Specify --upgrade to force replacement. +WARNING: Target directory C:\Users\max\AppData\Local\Programs\Python\Python36-32 +\Lib\bin already exists. Specify --upgrade to force replacement. +WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available. + +C:\maXbox\mX47464\maxbox4>pip3 install -t C:\Users\max\AppData\Local\Programs\Py +thon\Python36-32\Lib install +Collecting install + Using cached install-1.3.4-py3-none-any.whl (3.1 kB) +Installing collected packages: install +Successfully installed install-1.3.4 + +Exception: : Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.cp36-win32.pyd': [WinError 126] The specified module could not be found, Trying '_raw_ecb.pyd': [WinError 126] The specified module could not be found. + +C:\Users\max\AppData\Local\Programs\Python> +If you have both the 64 and 32 bit versions installed and ever need to install to the 32 bit version, you have to enter both the major and minor revision numbers as part of the command and add '-32' to the command argument. "py -3.5-32 -m pip install [package]" will install to the 32 bit version. + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- \ No newline at end of file diff --git a/Demos/pydemo8.htm b/Demos/pydemo8.htm new file mode 100644 index 00000000..06160d46 --- /dev/null +++ b/Demos/pydemo8.htm @@ -0,0 +1,140 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000018220 +StartFragment:0000001053 +EndFragment:0000018204 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo_App_mX4_PythonTemplate_Turtle;
+//https://docs.python.org/3/library/turtle.html
+
+//https://techvidvan.com/tutorials/python-language-translator/
+//https://www.tutorialspoint.com/python_text_processing/python_text_translation.htm
+//https://translate-python.readthedocs.io/en/latest/providers.html
+
+//<Constant declarations> 
+//Please check providers list below: ['mymemory', 'microsoft', 'deepl', 'libre'].
+{TYPE 
+<Type declarations>} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+      PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; 
+      PYDLL64  = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; 
+
+Var 
+//<Variable declarations>
+  i: integer; eng: TPythonEngine;
+
+//<FUNCTION>
+//<PROCEDURE> 
+
+//Generate public key and private key
+
+Const PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+              
+Const PYTURTLE = 'from turtle import *      '+LF+
+                 'color("red", "yellow")    '+LF+
+                 's = Screen()              '+LF+
+                 's.setup(700,500)          '+LF+
+                 's.bgcolor("black")        '+LF+
+                 '#speed(5)                  '+LF+
+                 'begin_fill()              '+LF+
+                 'while True:               '+LF+
+                 '    forward(250)          '+LF+
+                 '    left(170)             '+LF+
+                 '    if abs(pos()) < 1:    '+LF+
+                 '         break            '+LF+
+                 'end_fill()                '+LF+
+                 'done()                    ';  
+                 
+Const REFTXT = 'Hola PyWorld_,&#10; Estos datos se escribirán en el archivo.';                             
+Begin  //@Main
+//<Executable statements>
+  eng:= TPythonEngine.Create(Nil);
+  eng.pythonhome:= PYHOME32;
+  eng.opendll(PYDLL32)
+  //eng.IO:= pyMemo;
+    try
+      eng.Execstring('import base64');
+      //eng.Execstring('import Crypto');
+      //eng.ExecString('import subprocess');  
+      //eng.ExecString('subprocess.call(["pip3","install -t '+PYHOME32+'Lib", "translate"])')
+      //eng.ExecString('subprocess.call(["pip3","install", "translate"])')
+      
+     (* eng.Execstring('from translate import Translator');
+      eng.Execstring('translator= Translator(provider="mymemory",'+
+                                             'from_lang="german",to_lang="spanish")');
+      println(UTF8Decode(eng.EvalStr('translator.translate("Guten Morgen Programmierer")')));
+      
+      //eng.Execstring('with open(r"'+exepath+'999_lesmiserable_135-0.txt","rb") as afile:'+
+      //MAX ALLOWED QUERY : 500 CHARS QUERY LENGTH LIMIT EXCEDEED. 
+      eng.Execstring('with open(r"'+exepath+'test.txt","rb") as afile:'+
+                                            ' ftrans = afile.read().decode("utf-8")');
+      println(UTF8Decode(eng.EvalStr('translator.translate(ftrans)')));
+      //StringReplace(StringReplace(Trim(address),#13,' ',[rfReplaceAll]),#10,' ',[rfReplaceAll]);
+      *)
+      //println(((REFTXT)));
+      eng.Execstring(PYTURTLE);
+      println(StringReplace((REFTXT),'#10',#13#10,[rfReplaceAll]));
+        
+      eng.Execstring('with open(r"'+exepath+'maXbox4.exe","rb") as afile:'+
+                              ' fbuf = afile.read()');
+      println(eng.evalstr('__import__("hashlib").sha512('+
+                                    'fbuf).hexdigest().upper()')); 
+    except
+      eng.raiseError;
+    finally
+      eng.Free;
+      //aPythonVersion.Free;
+    end;    
+  //maXcalcF('2^64 /(60*60*24*365)')  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+
+Ref code:  https://mymemory.translated.net/doc/spec.php
+Hello PyWorld_, 
+This data will be written on the file.
+Hola PyWorld_,&#10; Estos datos se escribirán en el archivo.
+
+MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN  02
+ HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+ 
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+ \ No newline at end of file diff --git a/Demos/pydemo8.txt b/Demos/pydemo8.txt new file mode 100644 index 00000000..931a0793 --- /dev/null +++ b/Demos/pydemo8.txt @@ -0,0 +1,107 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_Turtle; +//https://docs.python.org/3/library/turtle.html + +//https://techvidvan.com/tutorials/python-language-translator/ +//https://www.tutorialspoint.com/python_text_processing/python_text_translation.htm +//https://translate-python.readthedocs.io/en/latest/providers.html + +// +//Please check providers list below: ['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE +} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; + PYDLL64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// +// + +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const PYTURTLE = 'from turtle import * '+LF+ + 'color("red", "yellow") '+LF+ + 's = Screen() '+LF+ + 's.setup(700,500) '+LF+ + 's.bgcolor("black") '+LF+ + '#speed(5) '+LF+ + 'begin_fill() '+LF+ + 'while True: '+LF+ + ' forward(250) '+LF+ + ' left(170) '+LF+ + ' if abs(pos()) < 1: '+LF+ + ' break '+LF+ + 'end_fill() '+LF+ + 'done() '; + +Const REFTXT = 'Hola PyWorld_, Estos datos se escribir�n en el archivo.'; +Begin //@Main +// + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'); + //eng.Execstring('import Crypto'); + //eng.ExecString('import subprocess'); + //eng.ExecString('subprocess.call(["pip3","install -t '+PYHOME32+'Lib", "translate"])') + //eng.ExecString('subprocess.call(["pip3","install", "translate"])') + + (* eng.Execstring('from translate import Translator'); + eng.Execstring('translator= Translator(provider="mymemory",'+ + 'from_lang="german",to_lang="spanish")'); + println(UTF8Decode(eng.EvalStr('translator.translate("Guten Morgen Programmierer")'))); + + //eng.Execstring('with open(r"'+exepath+'999_lesmiserable_135-0.txt","rb") as afile:'+ + //MAX ALLOWED QUERY : 500 CHARS QUERY LENGTH LIMIT EXCEDEED. + eng.Execstring('with open(r"'+exepath+'test.txt","rb") as afile:'+ + ' ftrans = afile.read().decode("utf-8")'); + println(UTF8Decode(eng.EvalStr('translator.translate(ftrans)'))); + //StringReplace(StringReplace(Trim(address),#13,' ',[rfReplaceAll]),#10,' ',[rfReplaceAll]); + *) + //println(((REFTXT))); + eng.Execstring(PYTURTLE); + println(StringReplace((REFTXT),'#10',#13#10,[rfReplaceAll])); + + eng.Execstring('with open(r"'+exepath+'maXbox4.exe","rb") as afile:'+ + ' fbuf = afile.read()'); + println(eng.evalstr('__import__("hashlib").sha512('+ + 'fbuf).hexdigest().upper()')); + except + eng.raiseError; + finally + eng.Free; + //aPythonVersion.Free; + end; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Ref code: https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, +This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 02 + HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- \ No newline at end of file diff --git a/Demos/pydemo9.htm b/Demos/pydemo9.htm new file mode 100644 index 00000000..43775775 --- /dev/null +++ b/Demos/pydemo9.htm @@ -0,0 +1,134 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000019221 +StartFragment:0000001053 +EndFragment:0000019205 + + + + +mXScriptasHTML + + + + + +
PROGRAM SEPDemo_App_mX4_PythonTemplate_URLLib_Agent;
+//https://pythonprogramming.net/urllib-tutorial-python-3/
+
+//<Constant declarations> 
+//Please check providers list below: ['mymemory', 'microsoft', 'deepl', 'libre'].
+{TYPE 
+<Type declarations>} 
+
+Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; 
+      PYDLL32  = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; 
+      PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; 
+      PYDLL64  = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; 
+
+Var 
+//<Variable declarations>
+  i: integer; eng: TPythonEngine;
+
+//<FUNCTION>
+//<PROCEDURE> 
+//Generate public key and private key
+
+Const PYBC =  'from bitcoin import *'+LF+
+              'my_private_key = random_key()'+LF+
+              'my_public_key = privtopub(my_private_key)'+LF+
+              'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+
+              'print(my_bitcoin_addr)';
+              
+Const PYTURTLE = 'from turtle import *      '+LF+
+                 'color("red", "yellow")    '+LF+
+                 's = Screen()              '+LF+
+                 's.setup(700,500)          '+LF+
+                 's.bgcolor("black")        '+LF+
+                 '#speed(5)                  '+LF+
+                 'begin_fill()              '+LF+
+                 'while True:               '+LF+
+                 '    forward(250)          '+LF+
+                 '    left(170)             '+LF+
+                 '    if abs(pos()) < 1:    '+LF+
+                 '         break            '+LF+
+                 'end_fill()                '+LF+
+                 'done()                    ';  
+                 
+Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17';   
+
+Const REXDEF = 'def striphtml(data):      '+LF+
+               '  p = re.compile(r"<.*?>")'+LF+
+               '  return p.sub("", data)  ';       
+                         
+Begin  //@Main
+//<Executable statements>
+  eng:= TPythonEngine.Create(Nil);
+  eng.pythonhome:= PYHOME32;
+  eng.opendll(PYDLL32)
+  //eng.IO:= pyMemo;
+  try
+    eng.Execstring('import base64'+LF+'import urllib.parse');
+    eng.Execstring('import urllib.request'+LF+'import os, re');
+    eng.Execstring(REXDEF);
+ 
+    eng.Execstring('url = "https://www.google.com/search"'+LF+
+                   'url2= "https://www.google.com/search?q=python+maxbox"'+LF+
+                   'values = {"q" : "python programming tutorials"}'+LF+
+                   'uheaders = {}');
+                              
+    eng.Execstring('data = urllib.parse.urlencode(values)'+LF+
+                   'data = data.encode("utf-8") # data should be bytes'+LF+
+                   'uheaders["User-Agent"] = "'+USERAGENT+'"'+LF+
+                // 'req= urllib.request.Request(url,data,headers=uheaders)'+LF+
+                   'req = urllib.request.Request(url2, headers= uheaders)'+LF+
+                   'resp = urllib.request.urlopen(req)'); 
+                     
+    println(eng.evalStr('striphtml(str(resp.read()))'));               
+
+//Turns out Google will return a 405, method not allowed. Google is not happy with request!
+                                         
+  except
+    eng.raiseError;
+  finally
+    eng.Free;
+    //aPythonVersion.Free;
+  end;    
+  //maXcalcF('2^64 /(60*60*24*365)')  
+//<Definitions>  
+End. 
+
+Ref:  https://www.sonarqube.org/features/multi-languages/python/
+
+Ref code:  https://mymemory.translated.net/doc/spec.php
+Hello PyWorld_, 
+This data will be written on the file.
+Hola PyWorld_,&#10; Estos datos se escribirán en el archivo.
+
+MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN  02
+ HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
+
+Install a 32-bit package with a 64 pip installer -t (Target)
+C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\
+max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin
+ 
+----app_template_loaded_code----
+----File newtemplate.txt not exists - now saved!----
+
+ \ No newline at end of file diff --git a/Demos/pydemo9.txt b/Demos/pydemo9.txt new file mode 100644 index 00000000..9ef469ed --- /dev/null +++ b/Demos/pydemo9.txt @@ -0,0 +1,101 @@ +PROGRAM SEPDemo_App_mX4_PythonTemplate_URLLib_Agent; +//https://pythonprogramming.net/urllib-tutorial-python-3/ + +// +//Please check providers list below: ['mymemory', 'microsoft', 'deepl', 'libre']. +{TYPE +} + +Const PYHOME32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL32 = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYHOME64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; + PYDLL64 = 'C:\Users\max\AppData\Local\Programs\Python\Python36\python36.dll'; + +Var +// + i: integer; eng: TPythonEngine; + +// +// +//Generate public key and private key + +Const PYBC = 'from bitcoin import *'+LF+ + 'my_private_key = random_key()'+LF+ + 'my_public_key = privtopub(my_private_key)'+LF+ + 'my_bitcoin_addr = pubtoaddr(my_public_key)'+LF+ + 'print(my_bitcoin_addr)'; + +Const PYTURTLE = 'from turtle import * '+LF+ + 'color("red", "yellow") '+LF+ + 's = Screen() '+LF+ + 's.setup(700,500) '+LF+ + 's.bgcolor("black") '+LF+ + '#speed(5) '+LF+ + 'begin_fill() '+LF+ + 'while True: '+LF+ + ' forward(250) '+LF+ + ' left(170) '+LF+ + ' if abs(pos()) < 1: '+LF+ + ' break '+LF+ + 'end_fill() '+LF+ + 'done() '; + +Const USERAGENT = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, maXbox4) Chrome/24.0.1312.27 Safari/537.17'; + +Const REXDEF = 'def striphtml(data): '+LF+ + ' p = re.compile(r"<.*?>")'+LF+ + ' return p.sub("", data) '; + +Begin //@Main +// + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME32; + eng.opendll(PYDLL32) + //eng.IO:= pyMemo; + try + eng.Execstring('import base64'+LF+'import urllib.parse'); + eng.Execstring('import urllib.request'+LF+'import os, re'); + eng.Execstring(REXDEF); + + eng.Execstring('url = "https://www.google.com/search"'+LF+ + 'url2= "https://www.google.com/search?q=python+maxbox"'+LF+ + 'values = {"q" : "python programming tutorials"}'+LF+ + 'uheaders = {}'); + + eng.Execstring('data = urllib.parse.urlencode(values)'+LF+ + 'data = data.encode("utf-8") # data should be bytes'+LF+ + 'uheaders["User-Agent"] = "'+USERAGENT+'"'+LF+ + // 'req= urllib.request.Request(url,data,headers=uheaders)'+LF+ + 'req = urllib.request.Request(url2, headers= uheaders)'+LF+ + 'resp = urllib.request.urlopen(req)'); + + println(eng.evalStr('striphtml(str(resp.read()))')); + +//Turns out Google will return a 405, method not allowed. Google is not happy with request! + + except + eng.raiseError; + finally + eng.Free; + //aPythonVersion.Free; + end; + //maXcalcF('2^64 /(60*60*24*365)') +// +End. + +Ref: https://www.sonarqube.org/features/multi-languages/python/ + +Ref code: https://mymemory.translated.net/doc/spec.php +Hello PyWorld_, +This data will be written on the file. +Hola PyWorld_, Estos datos se escribir�n en el archivo. + +MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 02 + HOURS 49 MINUTES 44 SECONDSVISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE + +Install a 32-bit package with a 64 pip installer -t (Target) +C:\Users\max\AppData\Local\Programs\Python\Python36-32>pip3 install -t C:\Users\ +max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin + +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- \ No newline at end of file diff --git a/Demos/pydemo_26.txt b/Demos/pydemo_26.txt new file mode 100644 index 00000000..6a4a691a --- /dev/null +++ b/Demos/pydemo_26.txt @@ -0,0 +1,145 @@ +Program Python_ThreadsDemo26; + +//https://www.programiz.com/python-programming/time/sleep +//Note: modify PYHOME and PYDLL : + +const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + LB= CR+LF; + +const TH1 = 'def print_hello_three_times(): '+LB+ + ' for i in range(3): '+LB+ + ' winsound.Beep(540, 500) '+LB+ + ' #time.sleep(1.4) '+LB+ + ' return "Hello"'; + +const TH2 = 'def print_hi_three_times(): '+LB+ + ' for i in range(3): '+LB+ + ' print("\a") '+LB+ + ' winsound.Beep(440, 500) '+LB+ + ' return "Hi"'; + +const ATIME='while True: '+LB+ + ' localtime = time.localtime()'+LB+ + ' result = time.strftime("%I:%M:%S %p", localtime)'+LB+ + ' print(result, end="", flush=True)'+LB+ + ' print("\r", end="", flush=True)'+LB+ + ' time.sleep(1)'; + +var myloadscript: string; + PyForm: TForm; pyMemo: TMemo; + pyval: variant; + + +var eng: TPythonEngine; aPythonVersion: TPythonVersion; + PythonVersions: TPythonVersions; AllUserInstall: Boolean; + apd: TApdMeter; + +begin //@main + //PythonEngine1.Free; + //myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(200,300, clgreen,'PyFrm4D_VersionThread_Tester_EKON25'); + pyMemo:= TMemo.create(PyForm); + apd:= TApdMeter.create(pyform); + //apd.color:= clyellow; + apd.parent:= pyform; + apd.barcolor:= clred; + apd.position:= 30; + apd.SetBounds(10,100, 150, 150); + apd.visible:= true; + pyMemo.parent:= PyForm + PyForm.show; + aPythonVersion:= TPythonVersion.create; + + //3. replace maps demo + //https://betterprogramming.pub/9-things-to-know-to-master-list-comprehensions-in-python-8bc0411ec2ed + eng:= TPythonEngine.Create(Nil); + eng.pythonhome:= PYHOME; + eng.opendll(PYDLL) + //eng.IO:= pyMemo; + try + eng.Execstring('pets= ("bird","snake","dog","turtle","cat","hamster")'); + // eng.Execstring('val.sort(key=lambda x: x[2],reverse=False)'); + eng.Execstring('uppercased_pets = list(map(str.upper, pets))'); + println('Tip replace maps: '+eng.EvalStr('uppercased_pets')); + pyMemo.lines.add(eng.EvalStr('list(map(str.upper, pets))')); + + //# syntax for set comprehension {expression for item in iterable} + eng.Execstring('numbers = (1, 34, 5, 8, 10, 12, 3, 90, 70, 70, 90)'); + println('Set comprehension: '+ + eng.EvalStr('{number for number in numbers if number%2 == 0}')); + eng.Execstr('import threading, winsound, time'); + eng.Execstr(TH1+CRLF+TH2); + + eng.Execstring('t1 = threading.Thread(target=print_hello_three_times)'); + eng.Execstring('t2 = threading.Thread(target=print_hi_three_times)'); + eng.EvalStr('t1.start()'); + eng.EvalStr('t2.start()'); + println('thread target1: '+eng.EvalStr('t1')); + println('thread target2: '+eng.EvalStr('t2')); + //println('def call: '+eng.EvalStr('print_hello_three_times()')); + + //eng.Execstring(ATIME); + if PythonVersionFromPath(PYHOME, aPythonVersion, false) then begin + aPythonVersion.AssignTo(eng) ; + writeln('Version from path: '+TPythonEngine(eng).RegVersion); + writeln('DLL from path: '+TPythonEngine(eng).DLLName); + end; + for it:= 10 to 50 do begin + sleep(100) + apd.position:= it; + end; + except + //eng.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eng.Free; + aPythonVersion.Free; + end; + + //PYLaz_P4D_Demo2; + //register_PYthonGUI; +End. + +Doc: One thing to note is that the map() function returns an iterable object, and thus we can use the list() function to generate a list from this iterable. +writeln('RegVersion: '+itoa(TPythonEngine(eng).RegVersion)); + +doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191 + +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. +Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before. + +Example 3: Python multithreading + +All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program. + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) +t1.start() +t2.start() + +This package implements JSON support for FPC. + +You might want to have a look at the lazarus jsonviewer tool, written using +fpJSON (see lazarus/tools/jsonviewer). It visualizes the fpJSON data and +shows how to program using fpjson. + + + + + \ No newline at end of file diff --git a/Demos/pydemo_51.txt b/Demos/pydemo_51.txt new file mode 100644 index 00000000..fd70c901 --- /dev/null +++ b/Demos/pydemo_51.txt @@ -0,0 +1,223 @@ +program PyDemo21_Eval_Exec4; + +//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas +//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine +//https://thepythonguru.com/python-builtin-functions/eval/ +//https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/ + +//interface - customize your PY environment first +{uses + Classes, SysUtils, + Windows, Messages, Graphics, Controls, Forms, Dialogs, + StdCtrls, ComCtrls, ExtCtrls, + PythonEngine, Vcl.PythonGUIInputOutput, PythonVersions.pas ; } + +const PYDLLNAME = 'python36.dll'; + PSCRIPTNAME = 'initpy.py'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py'; + LB = CR+LF; + +const PyModule = + 'def printData(data): '+#13#10+ + ' return data+data+"/n"'; + +const PYCMD = 'print("this is box")'+LB+ + 'import sys'+LB+ + 'f=open(r"1050pytest21.txt","w")'+LB+ + 'f.write("Hello PyWorld_mX4, \n")'+LB+ + 'f.write("This data will be written on the file.")'+LB+ + 'f.close()'; + + +const PYWEATHER= 'import json'+LB+ + 'import urllib.request'+LB+ + 'urlData = "http://api.openweathermap.org/data/2.5/weather?q=Boras,SE"'+LB+ + 'webURL = urllib.request.urlopen(urlData)'+LB+ + 'data = webURL.read()'+LB+ + 'JSON_object = json.loads(data.decode("utf-8"))'+LB+ + 'print(JSON_object)'; + +const urlData= 'http://api.openweathermap.org/data/2.5/weather?q=Kiruna,SE'+ + '&units=metric'+ + '&APPID=55013bf3d09cfb0619989a00ed5bed09'; +//Please set your own API Key! APPID------------------------------------------- +//const urlData = 'http://api.openweathermap.org/'; +//const urldata = 'https://openweathermap.org/api'; + +// pydllpath= 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll'; + //pyhome:= 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + pydllpath2='C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + //C:\Users\max\AppData\Local\Programs\Python\Python36-32 + + +var myloadscript: string; + PyForm: TForm; pyMemo: TMemo; + +Procedure PYLaz_P4D_Demo2; +//https://wiki.freepascal.org/Python4Delphi +var eng : TPythonEngine; + Out1: TPythonGUIInputOutput; +begin + eng:= TPythonEngine.Create(Nil); + Out1:= TPythonGUIInputOutput.create(nil) + Out1.output:= pyMemo; //debugout.output; or memo2; + Out1.RawOutput:= False; + Out1.UnicodeIO:= False; + Out1.maxlines:= 20; + out1.displaystring('this string thing') + + //"C:\Users\breitsch\AppData\Local\Programs\Python\Python38\python38.dll" + //eng.IO:= Out1; + {eng.dllpath:= 'C:\maXbox\EKON24' + eng.dllname:= 'python37.dll';//} + //eng.dllname:='C:\Users\breitsch\AppData\Local\Programs\Python\Python38\python38.dll'; writeln(botostr(Isx64('C:\Users\breitsch\AppData\Local\Programs\Python\Python38\python38.dll'))); + //writeln(botostr(Isx64(exepath+'examples\python37.dll'))); + //writeln(botostr(Isx64(pydllpath2))); + eng.pythonhome:= PYHOME; + //eng.dllpath:= exepath; + //eng.dllname:='python379.dll'; + Out1.writeline('draw the line'); + try + //eng.unloaddll; + //eng.LoadDll; + // eng.opendll(exepath+'examples\python37.dll') + eng.opendll(pydllpath2) + eng.IO:= Out1; + writeln(eng.dllname); + if eng.IsHandleValid then begin + writeln('DLLhandle: '+botostr(eng.IsHandleValid)) + WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]')); + WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])')); + WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])')); + WriteLn('mathstr: '+ eng.EvalStr('"py " * 7')); + WriteLn('builtins: '+ eng.EvalStr('dir(__builtins__)')); + WriteLn('upperstr: '+ eng.EvalStr('"hello again".upper()')); + pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("os").getcwd()')); + //pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("time").sleep(5)')); + writeln('syncheck '+ + botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])'))); + + eng.ExecString('print("powers:",[x**2 for x in range(10)])'); + writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(PYCMD))); + eng.ExecString(PYCMD); + {writeln('ExecSynCheck2 '+ + botostr(eng.CheckExecSyntax(filetostring(PYSCRIPT)))); + eng.ExecString(filetostring(PYSCRIPT)); } + writeln(eng.Run_CommandAsString('print("powers:",[x**2 for x in range(10)])',eval_input)); + writeln(eng.Run_CommandAsString('sum([x for x in range(201)])',eval_input)); + eng.ExecString('import math'); + printLn('evalexec: '+eng.EvalStr('dir(math)')); + //writeln('wget: '+ eng.EvalStr('__import__("urllib")')); + writeln('wget_like: '+ eng.EvalStr('__import__("urllib.request").request.urlretrieve("http://google.com/index.html", filename="indexg.html")')); + //writeln('pandas: '+ eng.EvalStr('__import__("scipy")')); + //openfile(exepath+ 'indexg.html') + //openweb(exepath+ 'indexg.html') + // WriteLn('numpy eval: '+ + // eng.EvalStr('__import__("numpy").array((1,2,3,4,5))')); + + //writeln('wget: '+ eng.EvalStr('__import__("matplotlib")')) + writeln('urll: '); eng.ExecString('import urllib.request'); + writeln('json: '); eng.Execstring('import json'); + //writeln('open: '+ + // eng.EvalStr('(urllib.request.urlopen("'+urlData+'").read())')) + //writeln('open: '+ eng.EvalStr('(urllib.request.urlopen())')) + writeln('open: '+ + eng.EvalStr('json.loads(urllib.request.urlopen("'+ + urlData+'").read().decode("utf-8"))')); + //json.loads(data.decode('utf-8')) + pymemo.update; + end + else writeln('invalid library handle! '+Getlasterrortext); + println('PythonOK: '+botostr(PythonOK)); + except + // Exception: : HTTP Error 401: Unauthorized. + // Please set your own API Key + eng.raiseError; + writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam)); + finally + eng.free; + end; + out1.free; + //pyImport(PyModule); +end; + +begin //@main + //PythonEngine1.Free; + //myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(300,200, clgreen,'PyFrm4D'); + pyMemo:= TMemo.create(PyForm); + pyMemo.parent:= PyForm + PyForm.show; + + PYLaz_P4D_Demo2; + + //register_PYthonGUI; +End. +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. +Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before. + +Apart from forgetting to decode, you can only read the response once. Having called .read() already, the second call returns an empty string. +Call .read() just once, and decode the data to a string: + +Evil eval() + +You should never pass untrusted source to the eval() directly. As it is quite easy for the malicious user to wreak havoc on your system. For example, the following code can be used to delete all the files from the system. + +1 >>> +2 eval('os.system("RM -RF /")') # command is deliberately capitalized +3 >>> + +wants to load a 64bit in a 32bit env: +wget: +Exception: : DLL load failed: %1 is not a valid Win32 application. + +wget: +wget_like: ('indexg.html', ) + + +Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download +-------------------------------------------------------- +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. +PascalScript maXbox4 - RemObjects & SynEdit + +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. + +dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E. +TRUE +Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD. + +mapdll EXCEPT Exception: There is already one instance of TPythonEngine running. +PythonOK TRUE +ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC. + mX4 executed: 26/07/2021 13:30:51 Runtime: 0:0:2.48 Memload: 71% use + +Example 3: Python multithreading + +All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program. + + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) + +t1.start() +t2.start() diff --git a/EKON24_SimpleImageClassificationCPU2021.ipynb b/EKON24_SimpleImageClassificationCPU2021.ipynb new file mode 100644 index 00000000..704dd092 --- /dev/null +++ b/EKON24_SimpleImageClassificationCPU2021.ipynb @@ -0,0 +1,5185 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "EKON24_SimpleImageClassificationCPU.ipynb", + "provenance": [], + "collapsed_sections": [], + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "qAy5FJaX1dsa", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "9af72430-d7c8-4d07-9c32-a38384e891af" + }, + "source": [ + "!apt-get update" + ], + "execution_count": 1, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\r0% [Working]\r \rIgn:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease\n", + "\r0% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com] [Wait\r \rGet:2 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ InRelease [3,626 B]\n", + "\r0% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com] [2 In\r0% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com] [Conn\r \rIgn:3 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 InRelease\n", + "\r0% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com] [Conn\r0% [2 InRelease gpgv 3,626 B] [Connecting to archive.ubuntu.com] [Connecting to\r \rHit:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 Release\n", + "Hit:5 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 Release\n", + "Get:6 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]\n", + "Get:7 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages [67.4 kB]\n", + "Get:8 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic InRelease [15.9 kB]\n", + "Hit:9 http://archive.ubuntu.com/ubuntu bionic InRelease\n", + "Get:11 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]\n", + "Hit:13 http://ppa.launchpad.net/cran/libgit2/ubuntu bionic InRelease\n", + "Get:14 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]\n", + "Hit:15 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease\n", + "Get:16 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [581 kB]\n", + "Hit:17 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease\n", + "Get:18 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1,428 kB]\n", + "Get:19 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic/main Sources [1,802 kB]\n", + "Get:20 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [2,335 kB]\n", + "Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2,202 kB]\n", + "Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [613 kB]\n", + "Get:23 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic/main amd64 Packages [922 kB]\n", + "Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2,770 kB]\n", + "Fetched 13.0 MB in 4s (3,425 kB/s)\n", + "Reading package lists... Done\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "UHZcHLryCbir", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "81239abd-9f9b-4471-ceb0-6209272b0644" + }, + "source": [ + "!apt-get install fpc fpc-source lazarus git subversion" + ], + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Reading package lists... Done\n", + "Building dependency tree \n", + "Reading state information... Done\n", + "git is already the newest version (1:2.17.1-1ubuntu0.9).\n", + "The following additional packages will be installed:\n", + " autoconf automake autopoint autotools-dev debhelper dh-autoreconf\n", + " dh-strip-nondeterminism file fp-compiler-3.0.4 fp-docs-3.0.4 fp-ide-3.0.4\n", + " fp-units-base-3.0.4 fp-units-db-3.0.4 fp-units-fcl-3.0.4 fp-units-fv-3.0.4\n", + " fp-units-gfx-3.0.4 fp-units-gtk2-3.0.4 fp-units-math-3.0.4\n", + " fp-units-misc-3.0.4 fp-units-multimedia-3.0.4 fp-units-net-3.0.4\n", + " fp-units-rtl-3.0.4 fp-utils-3.0.4 fpc-3.0.4 fpc-source-3.0.4 gdb gdbserver\n", + " gettext gettext-base gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0\n", + " gir1.2-gtk-2.0 gir1.2-pango-1.0 intltool-debian lazarus-1.8 lazarus-doc-1.8\n", + " lazarus-ide lazarus-ide-1.8 lazarus-ide-gtk2-1.8 lazarus-src-1.8 lcl-1.8\n", + " lcl-gtk2-1.8 lcl-nogui-1.8 lcl-units-1.8 lcl-utils-1.8 liba52-0.7.4\n", + " liba52-0.7.4-dev libapr1 libaprutil1 libarchive-cpio-perl\n", + " libarchive-zip-perl libatk1.0-dev libbabeltrace1 libc6-dbg libcaca-dev\n", + " libcairo-script-interpreter2 libcairo2-dev libdca-dev libdca0 libdts-dev\n", + " libdw1 libfile-stripnondeterminism-perl libfluidsynth1 libforms-dev\n", + " libforms2 libgail-common libgail18 libgd-dev libgdk-pixbuf2.0-dev libgmp-dev\n", + " libgmpxx4ldbl libgraphviz-dev libgtk2.0-0 libgtk2.0-bin libgtk2.0-common\n", + " libgtk2.0-dev libgvc6-plugins-gtk libmad0 libmad0-dev libmagic-mgc libmagic1\n", + " libmail-sendmail-perl libmikmod-config libmikmod-dev libmikmod3\n", + " libmodplug-dev libmodplug1 libpango1.0-dev libpangoxft-1.0-0 libpixman-1-dev\n", + " libproxy-tools libpulse-dev libpulse-mainloop-glib0 libsdl-mixer1.2\n", + " libsdl-mixer1.2-dev libsdl1.2-dev libsdl1.2debian libserf-1-1 libsigsegv2\n", + " libslang2-dev libsvn1 libsys-hostname-long-perl libtimedate-perl libtool\n", + " libvlc-bin libvlc-dev libvlc5 libvlccore9 libvpx-dev libxcb-shm0-dev\n", + " libxcomposite-dev libxcursor-dev libxdot4 libxinerama-dev libxml2-utils\n", + " libxpm-dev libxrandr-dev libxxf86dga-dev libxxf86dga1 m4 po-debconf\n", + " timgm6mb-soundfont x11proto-composite-dev x11proto-randr-dev\n", + " x11proto-xf86dga-dev x11proto-xinerama-dev\n", + "Suggested packages:\n", + " autoconf-archive gnu-standards autoconf-doc dh-make dwz firebird-dev\n", + " freetds-dev libgdbm-dev pxlib-dev gdb-doc gettext-doc libasprintf-dev\n", + " libgettextpo-dev libcairo2-doc libforms-bin libforms-doc gmp-doc\n", + " libgmp10-doc libmpfr-dev gvfs libgtk2.0-doc imagemagick libpango1.0-doc\n", + " libtool-doc gcj-jdk m4-doc libmail-box-perl db5.3-util libapache2-mod-svn\n", + " subversion-tools fluid-soundfont-gm fluidsynth timidity musescore\n", + "Recommended packages:\n", + " libggi2-dev\n", + "The following NEW packages will be installed:\n", + " autoconf automake autopoint autotools-dev debhelper dh-autoreconf\n", + " dh-strip-nondeterminism file fp-compiler-3.0.4 fp-docs-3.0.4 fp-ide-3.0.4\n", + " fp-units-base-3.0.4 fp-units-db-3.0.4 fp-units-fcl-3.0.4 fp-units-fv-3.0.4\n", + " fp-units-gfx-3.0.4 fp-units-gtk2-3.0.4 fp-units-math-3.0.4\n", + " fp-units-misc-3.0.4 fp-units-multimedia-3.0.4 fp-units-net-3.0.4\n", + " fp-units-rtl-3.0.4 fp-utils-3.0.4 fpc fpc-3.0.4 fpc-source fpc-source-3.0.4\n", + " gdb gdbserver gettext gettext-base gir1.2-atk-1.0 gir1.2-freedesktop\n", + " gir1.2-gdkpixbuf-2.0 gir1.2-gtk-2.0 gir1.2-pango-1.0 intltool-debian lazarus\n", + " lazarus-1.8 lazarus-doc-1.8 lazarus-ide lazarus-ide-1.8 lazarus-ide-gtk2-1.8\n", + " lazarus-src-1.8 lcl-1.8 lcl-gtk2-1.8 lcl-nogui-1.8 lcl-units-1.8\n", + " lcl-utils-1.8 liba52-0.7.4 liba52-0.7.4-dev libapr1 libaprutil1\n", + " libarchive-cpio-perl libarchive-zip-perl libatk1.0-dev libbabeltrace1\n", + " libc6-dbg libcaca-dev libcairo-script-interpreter2 libcairo2-dev libdca-dev\n", + " libdca0 libdts-dev libdw1 libfile-stripnondeterminism-perl libfluidsynth1\n", + " libforms-dev libforms2 libgail-common libgail18 libgd-dev\n", + " libgdk-pixbuf2.0-dev libgmp-dev libgmpxx4ldbl libgraphviz-dev libgtk2.0-0\n", + " libgtk2.0-bin libgtk2.0-common libgtk2.0-dev libgvc6-plugins-gtk libmad0\n", + " libmad0-dev libmagic-mgc libmagic1 libmail-sendmail-perl libmikmod-config\n", + " libmikmod-dev libmikmod3 libmodplug-dev libmodplug1 libpango1.0-dev\n", + " libpangoxft-1.0-0 libpixman-1-dev libproxy-tools libpulse-dev\n", + " libpulse-mainloop-glib0 libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl1.2-dev\n", + " libsdl1.2debian libserf-1-1 libsigsegv2 libslang2-dev libsvn1\n", + " libsys-hostname-long-perl libtimedate-perl libtool libvlc-bin libvlc-dev\n", + " libvlc5 libvlccore9 libvpx-dev libxcb-shm0-dev libxcomposite-dev\n", + " libxcursor-dev libxdot4 libxinerama-dev libxml2-utils libxpm-dev\n", + " libxrandr-dev libxxf86dga-dev libxxf86dga1 m4 po-debconf subversion\n", + " timgm6mb-soundfont x11proto-composite-dev x11proto-randr-dev\n", + " x11proto-xf86dga-dev x11proto-xinerama-dev\n", + "0 upgraded, 131 newly installed, 0 to remove and 61 not upgraded.\n", + "Need to get 166 MB of archives.\n", + "After this operation, 1,259 MB of additional disk space will be used.\n", + "Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxxf86dga1 amd64 2:1.1.4-1 [13.7 kB]\n", + "Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic-mgc amd64 1:5.32-2ubuntu0.4 [184 kB]\n", + "Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.4 [68.6 kB]\n", + "Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 file amd64 1:5.32-2ubuntu0.4 [22.1 kB]\n", + "Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gettext-base amd64 0.19.8.1-6ubuntu0.3 [113 kB]\n", + "Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsigsegv2 amd64 2.12-1 [14.7 kB]\n", + "Get:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 m4 amd64 1.4.18-1 [197 kB]\n", + "Get:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 autoconf all 2.69-11 [322 kB]\n", + "Get:9 http://archive.ubuntu.com/ubuntu bionic/main amd64 autotools-dev all 20180224.1 [39.6 kB]\n", + "Get:10 http://archive.ubuntu.com/ubuntu bionic/main amd64 automake all 1:1.15.1-3ubuntu2 [509 kB]\n", + "Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 autopoint all 0.19.8.1-6ubuntu0.3 [426 kB]\n", + "Get:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtool all 2.4.6-2 [194 kB]\n", + "Get:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 dh-autoreconf all 17 [15.8 kB]\n", + "Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libarchive-zip-perl all 1.60-1ubuntu0.1 [84.6 kB]\n", + "Get:15 http://archive.ubuntu.com/ubuntu bionic/main amd64 libfile-stripnondeterminism-perl all 0.040-1.1~build1 [13.8 kB]\n", + "Get:16 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB]\n", + "Get:17 http://archive.ubuntu.com/ubuntu bionic/main amd64 dh-strip-nondeterminism all 0.040-1.1~build1 [5,208 B]\n", + "Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gettext amd64 0.19.8.1-6ubuntu0.3 [1,293 kB]\n", + "Get:19 http://archive.ubuntu.com/ubuntu bionic/main amd64 intltool-debian all 0.35.0+20060710.4 [24.9 kB]\n", + "Get:20 http://archive.ubuntu.com/ubuntu bionic/main amd64 po-debconf all 1.0.20 [232 kB]\n", + "Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 debhelper all 11.1.6ubuntu2 [902 kB]\n", + "Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-rtl-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [2,039 kB]\n", + "Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-compiler-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,949 kB]\n", + "Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-docs-3.0.4 all 3.0.4+dfsg-18ubuntu2 [882 kB]\n", + "Get:25 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-ide-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,453 kB]\n", + "Get:26 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-base-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,050 kB]\n", + "Get:27 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-db-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [745 kB]\n", + "Get:28 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-fcl-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [4,798 kB]\n", + "Get:29 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-fv-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [297 kB]\n", + "Get:30 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-gfx-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,099 kB]\n", + "Get:31 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-common all 2.24.32-1ubuntu1 [125 kB]\n", + "Get:32 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-0 amd64 2.24.32-1ubuntu1 [1,769 kB]\n", + "Get:33 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-atk-1.0 amd64 2.28.1-1 [17.8 kB]\n", + "Get:34 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-freedesktop amd64 1.56.1-1 [9,080 B]\n", + "Get:35 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-gdkpixbuf-2.0 amd64 2.36.11-2 [7,748 B]\n", + "Get:36 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpangoxft-1.0-0 amd64 1.40.14-1ubuntu0.1 [15.0 kB]\n", + "Get:37 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gir1.2-pango-1.0 amd64 1.40.14-1ubuntu0.1 [21.6 kB]\n", + "Get:38 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-gtk-2.0 amd64 2.24.32-1ubuntu1 [172 kB]\n", + "Get:39 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgdk-pixbuf2.0-dev amd64 2.36.11-2 [46.8 kB]\n", + "Get:40 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcairo-script-interpreter2 amd64 1.15.10-2ubuntu0.1 [53.5 kB]\n", + "Get:41 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpixman-1-dev amd64 0.34.0-2 [244 kB]\n", + "Get:42 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxcb-shm0-dev amd64 1.13-2~ubuntu18.04 [6,684 B]\n", + "Get:43 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcairo2-dev amd64 1.15.10-2ubuntu0.1 [626 kB]\n", + "Get:44 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpango1.0-dev amd64 1.40.14-1ubuntu0.1 [288 kB]\n", + "Get:45 http://archive.ubuntu.com/ubuntu bionic/main amd64 libatk1.0-dev amd64 2.28.1-1 [79.9 kB]\n", + "Get:46 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-xinerama-dev all 2018.4-4 [2,628 B]\n", + "Get:47 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxinerama-dev amd64 2:1.1.3-1 [8,404 B]\n", + "Get:48 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-randr-dev all 2018.4-4 [2,620 B]\n", + "Get:49 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxrandr-dev amd64 2:1.5.1-1 [24.0 kB]\n", + "Get:50 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxcursor-dev amd64 1:1.1.15-1 [26.5 kB]\n", + "Get:51 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-composite-dev all 1:2018.4-4 [2,620 B]\n", + "Get:52 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxcomposite-dev amd64 1:0.4.4-2 [9,136 B]\n", + "Get:53 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxml2-utils amd64 2.9.4+dfsg1-6.1ubuntu1.4 [35.8 kB]\n", + "Get:54 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-dev amd64 2.24.32-1ubuntu1 [2,652 kB]\n", + "Get:55 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-gtk2-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,013 kB]\n", + "Get:56 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-math-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [344 kB]\n", + "Get:57 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-misc-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,087 kB]\n", + "Get:58 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-multimedia-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [208 kB]\n", + "Get:59 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-net-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [5,416 kB]\n", + "Get:60 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc-source-3.0.4 all 3.0.4+dfsg-18ubuntu2 [17.0 MB]\n", + "Get:61 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-utils-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [2,758 kB]\n", + "Get:62 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc-3.0.4 all 3.0.4+dfsg-18ubuntu2 [24.4 kB]\n", + "Get:63 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc all 3.0.4+dfsg-18ubuntu2 [23.9 kB]\n", + "Get:64 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc-source all 3.0.4+dfsg-18ubuntu2 [23.9 kB]\n", + "Get:65 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdw1 amd64 0.170-0.4ubuntu0.1 [203 kB]\n", + "Get:66 http://archive.ubuntu.com/ubuntu bionic/main amd64 libbabeltrace1 amd64 1.5.5-1 [154 kB]\n", + "Get:67 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gdb amd64 8.1.1-0ubuntu1 [2,937 kB]\n", + "Get:68 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gdbserver amd64 8.1.1-0ubuntu1 [282 kB]\n", + "Get:69 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-ide-1.8 amd64 1.8.2+dfsg-3 [8,386 kB]\n", + "Get:70 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-ide-gtk2-1.8 amd64 1.8.2+dfsg-3 [14.1 MB]\n", + "Get:71 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-ide all 1.8.2+dfsg-3 [28.9 kB]\n", + "Get:72 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-src-1.8 all 1.8.2+dfsg-3 [15.6 MB]\n", + "Get:73 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-nogui-1.8 amd64 1.8.2+dfsg-3 [6,637 kB]\n", + "Get:74 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-gtk2-1.8 amd64 1.8.2+dfsg-3 [8,523 kB]\n", + "Get:75 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-units-1.8 amd64 1.8.2+dfsg-3 [14.3 MB]\n", + "Get:76 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-utils-1.8 amd64 1.8.2+dfsg-3 [6,694 kB]\n", + "Get:77 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-1.8 amd64 1.8.2+dfsg-3 [28.9 kB]\n", + "Get:78 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-1.8 all 1.8.2+dfsg-3 [29.4 kB]\n", + "Get:79 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus all 1.8.2+dfsg-3 [28.8 kB]\n", + "Get:80 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-doc-1.8 all 1.8.2+dfsg-3 [15.1 MB]\n", + "Get:81 http://archive.ubuntu.com/ubuntu bionic/universe amd64 liba52-0.7.4 amd64 0.7.4-19 [35.2 kB]\n", + "Get:82 http://archive.ubuntu.com/ubuntu bionic/universe amd64 liba52-0.7.4-dev amd64 0.7.4-19 [47.5 kB]\n", + "Get:83 http://archive.ubuntu.com/ubuntu bionic/main amd64 libapr1 amd64 1.6.3-2 [90.9 kB]\n", + "Get:84 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1 amd64 1.6.1-2 [84.4 kB]\n", + "Get:85 http://archive.ubuntu.com/ubuntu bionic/main amd64 libarchive-cpio-perl all 0.10-1 [9,644 B]\n", + "Get:86 http://archive.ubuntu.com/ubuntu bionic/main amd64 libslang2-dev amd64 2.3.1a-3ubuntu1 [393 kB]\n", + "Get:87 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcaca-dev amd64 0.99.beta19-2ubuntu0.18.04.2 [747 kB]\n", + "Get:88 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libfluidsynth1 amd64 1.1.9-1 [137 kB]\n", + "Get:89 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libforms2 amd64 1.2.3-1.3 [327 kB]\n", + "Get:90 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxpm-dev amd64 1:3.5.12-1 [87.4 kB]\n", + "Get:91 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libforms-dev amd64 1.2.3-1.3 [692 kB]\n", + "Get:92 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgail18 amd64 2.24.32-1ubuntu1 [14.2 kB]\n", + "Get:93 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgail-common amd64 2.24.32-1ubuntu1 [112 kB]\n", + "Get:94 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libvpx-dev amd64 1.7.0-3ubuntu0.18.04.1 [932 kB]\n", + "Get:95 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgd-dev amd64 2.2.5-4ubuntu0.5 [246 kB]\n", + "Get:96 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgmpxx4ldbl amd64 2:6.1.2+dfsg-2 [8,964 B]\n", + "Get:97 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgmp-dev amd64 2:6.1.2+dfsg-2 [316 kB]\n", + "Get:98 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libxdot4 amd64 2.40.1-2 [15.7 kB]\n", + "Get:99 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libgvc6-plugins-gtk amd64 2.40.1-2 [18.2 kB]\n", + "Get:100 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libgraphviz-dev amd64 2.40.1-2 [57.3 kB]\n", + "Get:101 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-bin amd64 2.24.32-1ubuntu1 [7,536 B]\n", + "Get:102 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libmad0 amd64 0.15.1b-9ubuntu18.04.1 [64.6 kB]\n", + "Get:103 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libmad0-dev amd64 0.15.1b-9ubuntu18.04.1 [64.4 kB]\n", + "Get:104 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsys-hostname-long-perl all 1.5-1 [11.7 kB]\n", + "Get:105 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmail-sendmail-perl all 0.80-1 [22.6 kB]\n", + "Get:106 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmikmod-config amd64 3.3.11.1-3 [5,184 B]\n", + "Get:107 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmikmod3 amd64 3.3.11.1-3 [113 kB]\n", + "Get:108 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmikmod-dev amd64 3.3.11.1-3 [196 kB]\n", + "Get:109 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmodplug1 amd64 1:0.8.9.0-1 [150 kB]\n", + "Get:110 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmodplug-dev amd64 1:0.8.9.0-1 [14.6 kB]\n", + "Get:111 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libproxy-tools amd64 0.4.15-1ubuntu0.2 [5,320 B]\n", + "Get:112 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpulse-mainloop-glib0 amd64 1:11.1-1ubuntu7.11 [22.1 kB]\n", + "Get:113 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpulse-dev amd64 1:11.1-1ubuntu7.11 [81.5 kB]\n", + "Get:114 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsdl1.2debian amd64 1.2.15+dfsg2-0.1ubuntu0.1 [175 kB]\n", + "Get:115 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl-mixer1.2 amd64 1.2.12-14 [72.0 kB]\n", + "Get:116 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsdl1.2-dev amd64 1.2.15+dfsg2-0.1ubuntu0.1 [706 kB]\n", + "Get:117 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl-mixer1.2-dev amd64 1.2.12-14 [90.6 kB]\n", + "Get:118 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libserf-1-1 amd64 1.3.9-6 [44.4 kB]\n", + "Get:119 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsvn1 amd64 1.9.7-4ubuntu1 [1,183 kB]\n", + "Get:120 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlccore9 amd64 3.0.8-0ubuntu18.04.1 [434 kB]\n", + "Get:121 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlc5 amd64 3.0.8-0ubuntu18.04.1 [68.0 kB]\n", + "Get:122 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlc-bin amd64 3.0.8-0ubuntu18.04.1 [17.1 kB]\n", + "Get:123 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlc-dev amd64 3.0.8-0ubuntu18.04.1 [60.1 kB]\n", + "Get:124 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-xf86dga-dev all 2018.4-4 [2,624 B]\n", + "Get:125 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxxf86dga-dev amd64 2:1.1.4-1 [17.6 kB]\n", + "Get:126 http://archive.ubuntu.com/ubuntu bionic/universe amd64 subversion amd64 1.9.7-4ubuntu1 [834 kB]\n", + "Get:127 http://archive.ubuntu.com/ubuntu bionic/universe amd64 timgm6mb-soundfont all 1.3-2 [5,423 kB]\n", + "Get:128 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libc6-dbg amd64 2.27-3ubuntu1.4 [5,163 kB]\n", + "Get:129 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libdca0 amd64 0.0.5-10 [100.0 kB]\n", + "Get:130 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libdca-dev amd64 0.0.5-10 [90.2 kB]\n", + "Get:131 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libdts-dev amd64 0.0.5-10 [3,068 B]\n", + "Fetched 166 MB in 11s (15.1 MB/s)\n", + "Extracting templates from packages: 100%\n", + "Preconfiguring packages ...\n", + "Selecting previously unselected package libxxf86dga1:amd64.\n", + "(Reading database ... 155013 files and directories currently installed.)\n", + "Preparing to unpack .../000-libxxf86dga1_2%3a1.1.4-1_amd64.deb ...\n", + "Unpacking libxxf86dga1:amd64 (2:1.1.4-1) ...\n", + "Selecting previously unselected package libmagic-mgc.\n", + "Preparing to unpack .../001-libmagic-mgc_1%3a5.32-2ubuntu0.4_amd64.deb ...\n", + "Unpacking libmagic-mgc (1:5.32-2ubuntu0.4) ...\n", + "Selecting previously unselected package libmagic1:amd64.\n", + "Preparing to unpack .../002-libmagic1_1%3a5.32-2ubuntu0.4_amd64.deb ...\n", + "Unpacking libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\n", + "Selecting previously unselected package file.\n", + "Preparing to unpack .../003-file_1%3a5.32-2ubuntu0.4_amd64.deb ...\n", + "Unpacking file (1:5.32-2ubuntu0.4) ...\n", + "Selecting previously unselected package gettext-base.\n", + "Preparing to unpack .../004-gettext-base_0.19.8.1-6ubuntu0.3_amd64.deb ...\n", + "Unpacking gettext-base (0.19.8.1-6ubuntu0.3) ...\n", + "Selecting previously unselected package libsigsegv2:amd64.\n", + "Preparing to unpack .../005-libsigsegv2_2.12-1_amd64.deb ...\n", + "Unpacking libsigsegv2:amd64 (2.12-1) ...\n", + "Selecting previously unselected package m4.\n", + "Preparing to unpack .../006-m4_1.4.18-1_amd64.deb ...\n", + "Unpacking m4 (1.4.18-1) ...\n", + "Selecting previously unselected package autoconf.\n", + "Preparing to unpack .../007-autoconf_2.69-11_all.deb ...\n", + "Unpacking autoconf (2.69-11) ...\n", + "Selecting previously unselected package autotools-dev.\n", + "Preparing to unpack .../008-autotools-dev_20180224.1_all.deb ...\n", + "Unpacking autotools-dev (20180224.1) ...\n", + "Selecting previously unselected package automake.\n", + "Preparing to unpack .../009-automake_1%3a1.15.1-3ubuntu2_all.deb ...\n", + "Unpacking automake (1:1.15.1-3ubuntu2) ...\n", + "Selecting previously unselected package autopoint.\n", + "Preparing to unpack .../010-autopoint_0.19.8.1-6ubuntu0.3_all.deb ...\n", + "Unpacking autopoint (0.19.8.1-6ubuntu0.3) ...\n", + "Selecting previously unselected package libtool.\n", + "Preparing to unpack .../011-libtool_2.4.6-2_all.deb ...\n", + "Unpacking libtool (2.4.6-2) ...\n", + "Selecting previously unselected package dh-autoreconf.\n", + "Preparing to unpack .../012-dh-autoreconf_17_all.deb ...\n", + "Unpacking dh-autoreconf (17) ...\n", + "Selecting previously unselected package libarchive-zip-perl.\n", + "Preparing to unpack .../013-libarchive-zip-perl_1.60-1ubuntu0.1_all.deb ...\n", + "Unpacking libarchive-zip-perl (1.60-1ubuntu0.1) ...\n", + "Selecting previously unselected package libfile-stripnondeterminism-perl.\n", + "Preparing to unpack .../014-libfile-stripnondeterminism-perl_0.040-1.1~build1_all.deb ...\n", + "Unpacking libfile-stripnondeterminism-perl (0.040-1.1~build1) ...\n", + "Selecting previously unselected package libtimedate-perl.\n", + "Preparing to unpack .../015-libtimedate-perl_2.3000-2_all.deb ...\n", + "Unpacking libtimedate-perl (2.3000-2) ...\n", + "Selecting previously unselected package dh-strip-nondeterminism.\n", + "Preparing to unpack .../016-dh-strip-nondeterminism_0.040-1.1~build1_all.deb ...\n", + "Unpacking dh-strip-nondeterminism (0.040-1.1~build1) ...\n", + "Selecting previously unselected package gettext.\n", + "Preparing to unpack .../017-gettext_0.19.8.1-6ubuntu0.3_amd64.deb ...\n", + "Unpacking gettext (0.19.8.1-6ubuntu0.3) ...\n", + "Selecting previously unselected package intltool-debian.\n", + "Preparing to unpack .../018-intltool-debian_0.35.0+20060710.4_all.deb ...\n", + "Unpacking intltool-debian (0.35.0+20060710.4) ...\n", + "Selecting previously unselected package po-debconf.\n", + "Preparing to unpack .../019-po-debconf_1.0.20_all.deb ...\n", + "Unpacking po-debconf (1.0.20) ...\n", + "Selecting previously unselected package debhelper.\n", + "Preparing to unpack .../020-debhelper_11.1.6ubuntu2_all.deb ...\n", + "Unpacking debhelper (11.1.6ubuntu2) ...\n", + "Selecting previously unselected package fp-units-rtl-3.0.4:amd64.\n", + "Preparing to unpack .../021-fp-units-rtl-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-rtl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-compiler-3.0.4:amd64.\n", + "Preparing to unpack .../022-fp-compiler-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-compiler-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-docs-3.0.4.\n", + "Preparing to unpack .../023-fp-docs-3.0.4_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fp-docs-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-ide-3.0.4.\n", + "Preparing to unpack .../024-fp-ide-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-ide-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-base-3.0.4:amd64.\n", + "Preparing to unpack .../025-fp-units-base-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-base-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-db-3.0.4:amd64.\n", + "Preparing to unpack .../026-fp-units-db-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-db-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-fcl-3.0.4:amd64.\n", + "Preparing to unpack .../027-fp-units-fcl-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-fcl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-fv-3.0.4:amd64.\n", + "Preparing to unpack .../028-fp-units-fv-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-fv-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-gfx-3.0.4:amd64.\n", + "Preparing to unpack .../029-fp-units-gfx-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-gfx-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package libgtk2.0-common.\n", + "Preparing to unpack .../030-libgtk2.0-common_2.24.32-1ubuntu1_all.deb ...\n", + "Unpacking libgtk2.0-common (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libgtk2.0-0:amd64.\n", + "Preparing to unpack .../031-libgtk2.0-0_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgtk2.0-0:amd64 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package gir1.2-atk-1.0:amd64.\n", + "Preparing to unpack .../032-gir1.2-atk-1.0_2.28.1-1_amd64.deb ...\n", + "Unpacking gir1.2-atk-1.0:amd64 (2.28.1-1) ...\n", + "Selecting previously unselected package gir1.2-freedesktop:amd64.\n", + "Preparing to unpack .../033-gir1.2-freedesktop_1.56.1-1_amd64.deb ...\n", + "Unpacking gir1.2-freedesktop:amd64 (1.56.1-1) ...\n", + "Selecting previously unselected package gir1.2-gdkpixbuf-2.0:amd64.\n", + "Preparing to unpack .../034-gir1.2-gdkpixbuf-2.0_2.36.11-2_amd64.deb ...\n", + "Unpacking gir1.2-gdkpixbuf-2.0:amd64 (2.36.11-2) ...\n", + "Selecting previously unselected package libpangoxft-1.0-0:amd64.\n", + "Preparing to unpack .../035-libpangoxft-1.0-0_1.40.14-1ubuntu0.1_amd64.deb ...\n", + "Unpacking libpangoxft-1.0-0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Selecting previously unselected package gir1.2-pango-1.0:amd64.\n", + "Preparing to unpack .../036-gir1.2-pango-1.0_1.40.14-1ubuntu0.1_amd64.deb ...\n", + "Unpacking gir1.2-pango-1.0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Selecting previously unselected package gir1.2-gtk-2.0.\n", + "Preparing to unpack .../037-gir1.2-gtk-2.0_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking gir1.2-gtk-2.0 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libgdk-pixbuf2.0-dev.\n", + "Preparing to unpack .../038-libgdk-pixbuf2.0-dev_2.36.11-2_amd64.deb ...\n", + "Unpacking libgdk-pixbuf2.0-dev (2.36.11-2) ...\n", + "Selecting previously unselected package libcairo-script-interpreter2:amd64.\n", + "Preparing to unpack .../039-libcairo-script-interpreter2_1.15.10-2ubuntu0.1_amd64.deb ...\n", + "Unpacking libcairo-script-interpreter2:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Selecting previously unselected package libpixman-1-dev:amd64.\n", + "Preparing to unpack .../040-libpixman-1-dev_0.34.0-2_amd64.deb ...\n", + "Unpacking libpixman-1-dev:amd64 (0.34.0-2) ...\n", + "Selecting previously unselected package libxcb-shm0-dev:amd64.\n", + "Preparing to unpack .../041-libxcb-shm0-dev_1.13-2~ubuntu18.04_amd64.deb ...\n", + "Unpacking libxcb-shm0-dev:amd64 (1.13-2~ubuntu18.04) ...\n", + "Selecting previously unselected package libcairo2-dev:amd64.\n", + "Preparing to unpack .../042-libcairo2-dev_1.15.10-2ubuntu0.1_amd64.deb ...\n", + "Unpacking libcairo2-dev:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Selecting previously unselected package libpango1.0-dev.\n", + "Preparing to unpack .../043-libpango1.0-dev_1.40.14-1ubuntu0.1_amd64.deb ...\n", + "Unpacking libpango1.0-dev (1.40.14-1ubuntu0.1) ...\n", + "Selecting previously unselected package libatk1.0-dev:amd64.\n", + "Preparing to unpack .../044-libatk1.0-dev_2.28.1-1_amd64.deb ...\n", + "Unpacking libatk1.0-dev:amd64 (2.28.1-1) ...\n", + "Selecting previously unselected package x11proto-xinerama-dev.\n", + "Preparing to unpack .../045-x11proto-xinerama-dev_2018.4-4_all.deb ...\n", + "Unpacking x11proto-xinerama-dev (2018.4-4) ...\n", + "Selecting previously unselected package libxinerama-dev:amd64.\n", + "Preparing to unpack .../046-libxinerama-dev_2%3a1.1.3-1_amd64.deb ...\n", + "Unpacking libxinerama-dev:amd64 (2:1.1.3-1) ...\n", + "Selecting previously unselected package x11proto-randr-dev.\n", + "Preparing to unpack .../047-x11proto-randr-dev_2018.4-4_all.deb ...\n", + "Unpacking x11proto-randr-dev (2018.4-4) ...\n", + "Selecting previously unselected package libxrandr-dev:amd64.\n", + "Preparing to unpack .../048-libxrandr-dev_2%3a1.5.1-1_amd64.deb ...\n", + "Unpacking libxrandr-dev:amd64 (2:1.5.1-1) ...\n", + "Selecting previously unselected package libxcursor-dev:amd64.\n", + "Preparing to unpack .../049-libxcursor-dev_1%3a1.1.15-1_amd64.deb ...\n", + "Unpacking libxcursor-dev:amd64 (1:1.1.15-1) ...\n", + "Selecting previously unselected package x11proto-composite-dev.\n", + "Preparing to unpack .../050-x11proto-composite-dev_1%3a2018.4-4_all.deb ...\n", + "Unpacking x11proto-composite-dev (1:2018.4-4) ...\n", + "Selecting previously unselected package libxcomposite-dev:amd64.\n", + "Preparing to unpack .../051-libxcomposite-dev_1%3a0.4.4-2_amd64.deb ...\n", + "Unpacking libxcomposite-dev:amd64 (1:0.4.4-2) ...\n", + "Selecting previously unselected package libxml2-utils.\n", + "Preparing to unpack .../052-libxml2-utils_2.9.4+dfsg1-6.1ubuntu1.4_amd64.deb ...\n", + "Unpacking libxml2-utils (2.9.4+dfsg1-6.1ubuntu1.4) ...\n", + "Selecting previously unselected package libgtk2.0-dev.\n", + "Preparing to unpack .../053-libgtk2.0-dev_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgtk2.0-dev (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package fp-units-gtk2-3.0.4:amd64.\n", + "Preparing to unpack .../054-fp-units-gtk2-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-gtk2-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-math-3.0.4:amd64.\n", + "Preparing to unpack .../055-fp-units-math-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-math-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-misc-3.0.4:amd64.\n", + "Preparing to unpack .../056-fp-units-misc-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-misc-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-multimedia-3.0.4:amd64.\n", + "Preparing to unpack .../057-fp-units-multimedia-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-multimedia-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-net-3.0.4:amd64.\n", + "Preparing to unpack .../058-fp-units-net-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-net-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc-source-3.0.4.\n", + "Preparing to unpack .../059-fpc-source-3.0.4_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc-source-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-utils-3.0.4.\n", + "Preparing to unpack .../060-fp-utils-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-utils-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc-3.0.4.\n", + "Preparing to unpack .../061-fpc-3.0.4_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc.\n", + "Preparing to unpack .../062-fpc_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc-source.\n", + "Preparing to unpack .../063-fpc-source_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc-source (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package libdw1:amd64.\n", + "Preparing to unpack .../064-libdw1_0.170-0.4ubuntu0.1_amd64.deb ...\n", + "Unpacking libdw1:amd64 (0.170-0.4ubuntu0.1) ...\n", + "Selecting previously unselected package libbabeltrace1:amd64.\n", + "Preparing to unpack .../065-libbabeltrace1_1.5.5-1_amd64.deb ...\n", + "Unpacking libbabeltrace1:amd64 (1.5.5-1) ...\n", + "Selecting previously unselected package gdb.\n", + "Preparing to unpack .../066-gdb_8.1.1-0ubuntu1_amd64.deb ...\n", + "Unpacking gdb (8.1.1-0ubuntu1) ...\n", + "Selecting previously unselected package gdbserver.\n", + "Preparing to unpack .../067-gdbserver_8.1.1-0ubuntu1_amd64.deb ...\n", + "Unpacking gdbserver (8.1.1-0ubuntu1) ...\n", + "Selecting previously unselected package lazarus-ide-1.8.\n", + "Preparing to unpack .../068-lazarus-ide-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lazarus-ide-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-ide-gtk2-1.8.\n", + "Preparing to unpack .../069-lazarus-ide-gtk2-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lazarus-ide-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-ide.\n", + "Preparing to unpack .../070-lazarus-ide_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-ide (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-src-1.8.\n", + "Preparing to unpack .../071-lazarus-src-1.8_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-src-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-nogui-1.8.\n", + "Preparing to unpack .../072-lcl-nogui-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-nogui-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-gtk2-1.8.\n", + "Preparing to unpack .../073-lcl-gtk2-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-units-1.8.\n", + "Preparing to unpack .../074-lcl-units-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-units-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-utils-1.8.\n", + "Preparing to unpack .../075-lcl-utils-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-utils-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-1.8.\n", + "Preparing to unpack .../076-lcl-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-1.8.\n", + "Preparing to unpack .../077-lazarus-1.8_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus.\n", + "Preparing to unpack .../078-lazarus_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-doc-1.8.\n", + "Preparing to unpack .../079-lazarus-doc-1.8_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-doc-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package liba52-0.7.4:amd64.\n", + "Preparing to unpack .../080-liba52-0.7.4_0.7.4-19_amd64.deb ...\n", + "Unpacking liba52-0.7.4:amd64 (0.7.4-19) ...\n", + "Selecting previously unselected package liba52-0.7.4-dev.\n", + "Preparing to unpack .../081-liba52-0.7.4-dev_0.7.4-19_amd64.deb ...\n", + "Unpacking liba52-0.7.4-dev (0.7.4-19) ...\n", + "Selecting previously unselected package libapr1:amd64.\n", + "Preparing to unpack .../082-libapr1_1.6.3-2_amd64.deb ...\n", + "Unpacking libapr1:amd64 (1.6.3-2) ...\n", + "Selecting previously unselected package libaprutil1:amd64.\n", + "Preparing to unpack .../083-libaprutil1_1.6.1-2_amd64.deb ...\n", + "Unpacking libaprutil1:amd64 (1.6.1-2) ...\n", + "Selecting previously unselected package libarchive-cpio-perl.\n", + "Preparing to unpack .../084-libarchive-cpio-perl_0.10-1_all.deb ...\n", + "Unpacking libarchive-cpio-perl (0.10-1) ...\n", + "Selecting previously unselected package libslang2-dev:amd64.\n", + "Preparing to unpack .../085-libslang2-dev_2.3.1a-3ubuntu1_amd64.deb ...\n", + "Unpacking libslang2-dev:amd64 (2.3.1a-3ubuntu1) ...\n", + "Selecting previously unselected package libcaca-dev.\n", + "Preparing to unpack .../086-libcaca-dev_0.99.beta19-2ubuntu0.18.04.2_amd64.deb ...\n", + "Unpacking libcaca-dev (0.99.beta19-2ubuntu0.18.04.2) ...\n", + "Selecting previously unselected package libfluidsynth1:amd64.\n", + "Preparing to unpack .../087-libfluidsynth1_1.1.9-1_amd64.deb ...\n", + "Unpacking libfluidsynth1:amd64 (1.1.9-1) ...\n", + "Selecting previously unselected package libforms2.\n", + "Preparing to unpack .../088-libforms2_1.2.3-1.3_amd64.deb ...\n", + "Unpacking libforms2 (1.2.3-1.3) ...\n", + "Selecting previously unselected package libxpm-dev:amd64.\n", + "Preparing to unpack .../089-libxpm-dev_1%3a3.5.12-1_amd64.deb ...\n", + "Unpacking libxpm-dev:amd64 (1:3.5.12-1) ...\n", + "Selecting previously unselected package libforms-dev.\n", + "Preparing to unpack .../090-libforms-dev_1.2.3-1.3_amd64.deb ...\n", + "Unpacking libforms-dev (1.2.3-1.3) ...\n", + "Selecting previously unselected package libgail18:amd64.\n", + "Preparing to unpack .../091-libgail18_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgail18:amd64 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libgail-common:amd64.\n", + "Preparing to unpack .../092-libgail-common_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgail-common:amd64 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libvpx-dev:amd64.\n", + "Preparing to unpack .../093-libvpx-dev_1.7.0-3ubuntu0.18.04.1_amd64.deb ...\n", + "Unpacking libvpx-dev:amd64 (1.7.0-3ubuntu0.18.04.1) ...\n", + "Selecting previously unselected package libgd-dev:amd64.\n", + "Preparing to unpack .../094-libgd-dev_2.2.5-4ubuntu0.5_amd64.deb ...\n", + "Unpacking libgd-dev:amd64 (2.2.5-4ubuntu0.5) ...\n", + "Selecting previously unselected package libgmpxx4ldbl:amd64.\n", + "Preparing to unpack .../095-libgmpxx4ldbl_2%3a6.1.2+dfsg-2_amd64.deb ...\n", + "Unpacking libgmpxx4ldbl:amd64 (2:6.1.2+dfsg-2) ...\n", + "Selecting previously unselected package libgmp-dev:amd64.\n", + "Preparing to unpack .../096-libgmp-dev_2%3a6.1.2+dfsg-2_amd64.deb ...\n", + "Unpacking libgmp-dev:amd64 (2:6.1.2+dfsg-2) ...\n", + "Selecting previously unselected package libxdot4.\n", + "Preparing to unpack .../097-libxdot4_2.40.1-2_amd64.deb ...\n", + "Unpacking libxdot4 (2.40.1-2) ...\n", + "Selecting previously unselected package libgvc6-plugins-gtk.\n", + "Preparing to unpack .../098-libgvc6-plugins-gtk_2.40.1-2_amd64.deb ...\n", + "Unpacking libgvc6-plugins-gtk (2.40.1-2) ...\n", + "Selecting previously unselected package libgraphviz-dev.\n", + "Preparing to unpack .../099-libgraphviz-dev_2.40.1-2_amd64.deb ...\n", + "Unpacking libgraphviz-dev (2.40.1-2) ...\n", + "Selecting previously unselected package libgtk2.0-bin.\n", + "Preparing to unpack .../100-libgtk2.0-bin_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgtk2.0-bin (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libmad0:amd64.\n", + "Preparing to unpack .../101-libmad0_0.15.1b-9ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libmad0:amd64 (0.15.1b-9ubuntu18.04.1) ...\n", + "Selecting previously unselected package libmad0-dev.\n", + "Preparing to unpack .../102-libmad0-dev_0.15.1b-9ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libmad0-dev (0.15.1b-9ubuntu18.04.1) ...\n", + "Selecting previously unselected package libsys-hostname-long-perl.\n", + "Preparing to unpack .../103-libsys-hostname-long-perl_1.5-1_all.deb ...\n", + "Unpacking libsys-hostname-long-perl (1.5-1) ...\n", + "Selecting previously unselected package libmail-sendmail-perl.\n", + "Preparing to unpack .../104-libmail-sendmail-perl_0.80-1_all.deb ...\n", + "Unpacking libmail-sendmail-perl (0.80-1) ...\n", + "Selecting previously unselected package libmikmod-config.\n", + "Preparing to unpack .../105-libmikmod-config_3.3.11.1-3_amd64.deb ...\n", + "Unpacking libmikmod-config (3.3.11.1-3) ...\n", + "Selecting previously unselected package libmikmod3:amd64.\n", + "Preparing to unpack .../106-libmikmod3_3.3.11.1-3_amd64.deb ...\n", + "Unpacking libmikmod3:amd64 (3.3.11.1-3) ...\n", + "Selecting previously unselected package libmikmod-dev:amd64.\n", + "Preparing to unpack .../107-libmikmod-dev_3.3.11.1-3_amd64.deb ...\n", + "Unpacking libmikmod-dev:amd64 (3.3.11.1-3) ...\n", + "Selecting previously unselected package libmodplug1:amd64.\n", + "Preparing to unpack .../108-libmodplug1_1%3a0.8.9.0-1_amd64.deb ...\n", + "Unpacking libmodplug1:amd64 (1:0.8.9.0-1) ...\n", + "Selecting previously unselected package libmodplug-dev:amd64.\n", + "Preparing to unpack .../109-libmodplug-dev_1%3a0.8.9.0-1_amd64.deb ...\n", + "Unpacking libmodplug-dev:amd64 (1:0.8.9.0-1) ...\n", + "Selecting previously unselected package libproxy-tools.\n", + "Preparing to unpack .../110-libproxy-tools_0.4.15-1ubuntu0.2_amd64.deb ...\n", + "Unpacking libproxy-tools (0.4.15-1ubuntu0.2) ...\n", + "Selecting previously unselected package libpulse-mainloop-glib0:amd64.\n", + "Preparing to unpack .../111-libpulse-mainloop-glib0_1%3a11.1-1ubuntu7.11_amd64.deb ...\n", + "Unpacking libpulse-mainloop-glib0:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Selecting previously unselected package libpulse-dev:amd64.\n", + "Preparing to unpack .../112-libpulse-dev_1%3a11.1-1ubuntu7.11_amd64.deb ...\n", + "Unpacking libpulse-dev:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Selecting previously unselected package libsdl1.2debian:amd64.\n", + "Preparing to unpack .../113-libsdl1.2debian_1.2.15+dfsg2-0.1ubuntu0.1_amd64.deb ...\n", + "Unpacking libsdl1.2debian:amd64 (1.2.15+dfsg2-0.1ubuntu0.1) ...\n", + "Selecting previously unselected package libsdl-mixer1.2:amd64.\n", + "Preparing to unpack .../114-libsdl-mixer1.2_1.2.12-14_amd64.deb ...\n", + "Unpacking libsdl-mixer1.2:amd64 (1.2.12-14) ...\n", + "Selecting previously unselected package libsdl1.2-dev.\n", + "Preparing to unpack .../115-libsdl1.2-dev_1.2.15+dfsg2-0.1ubuntu0.1_amd64.deb ...\n", + "Unpacking libsdl1.2-dev (1.2.15+dfsg2-0.1ubuntu0.1) ...\n", + "Selecting previously unselected package libsdl-mixer1.2-dev:amd64.\n", + "Preparing to unpack .../116-libsdl-mixer1.2-dev_1.2.12-14_amd64.deb ...\n", + "Unpacking libsdl-mixer1.2-dev:amd64 (1.2.12-14) ...\n", + "Selecting previously unselected package libserf-1-1:amd64.\n", + "Preparing to unpack .../117-libserf-1-1_1.3.9-6_amd64.deb ...\n", + "Unpacking libserf-1-1:amd64 (1.3.9-6) ...\n", + "Selecting previously unselected package libsvn1:amd64.\n", + "Preparing to unpack .../118-libsvn1_1.9.7-4ubuntu1_amd64.deb ...\n", + "Unpacking libsvn1:amd64 (1.9.7-4ubuntu1) ...\n", + "Selecting previously unselected package libvlccore9:amd64.\n", + "Preparing to unpack .../119-libvlccore9_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlccore9:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package libvlc5:amd64.\n", + "Preparing to unpack .../120-libvlc5_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlc5:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package libvlc-bin:amd64.\n", + "Preparing to unpack .../121-libvlc-bin_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlc-bin:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package libvlc-dev:amd64.\n", + "Preparing to unpack .../122-libvlc-dev_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlc-dev:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package x11proto-xf86dga-dev.\n", + "Preparing to unpack .../123-x11proto-xf86dga-dev_2018.4-4_all.deb ...\n", + "Unpacking x11proto-xf86dga-dev (2018.4-4) ...\n", + "Selecting previously unselected package libxxf86dga-dev:amd64.\n", + "Preparing to unpack .../124-libxxf86dga-dev_2%3a1.1.4-1_amd64.deb ...\n", + "Unpacking libxxf86dga-dev:amd64 (2:1.1.4-1) ...\n", + "Selecting previously unselected package subversion.\n", + "Preparing to unpack .../125-subversion_1.9.7-4ubuntu1_amd64.deb ...\n", + "Unpacking subversion (1.9.7-4ubuntu1) ...\n", + "Selecting previously unselected package timgm6mb-soundfont.\n", + "Preparing to unpack .../126-timgm6mb-soundfont_1.3-2_all.deb ...\n", + "Unpacking timgm6mb-soundfont (1.3-2) ...\n", + "Selecting previously unselected package libc6-dbg:amd64.\n", + "Preparing to unpack .../127-libc6-dbg_2.27-3ubuntu1.4_amd64.deb ...\n", + "Unpacking libc6-dbg:amd64 (2.27-3ubuntu1.4) ...\n", + "Selecting previously unselected package libdca0:amd64.\n", + "Preparing to unpack .../128-libdca0_0.0.5-10_amd64.deb ...\n", + "Unpacking libdca0:amd64 (0.0.5-10) ...\n", + "Selecting previously unselected package libdca-dev:amd64.\n", + "Preparing to unpack .../129-libdca-dev_0.0.5-10_amd64.deb ...\n", + "Unpacking libdca-dev:amd64 (0.0.5-10) ...\n", + "Selecting previously unselected package libdts-dev:amd64.\n", + "Preparing to unpack .../130-libdts-dev_0.0.5-10_amd64.deb ...\n", + "Unpacking libdts-dev:amd64 (0.0.5-10) ...\n", + "Setting up libapr1:amd64 (1.6.3-2) ...\n", + "Setting up libxcursor-dev:amd64 (1:1.1.15-1) ...\n", + "Setting up libforms2 (1.2.3-1.3) ...\n", + "Setting up gir1.2-atk-1.0:amd64 (2.28.1-1) ...\n", + "Setting up libgtk2.0-common (2.24.32-1ubuntu1) ...\n", + "Setting up libxdot4 (2.40.1-2) ...\n", + "Setting up libc6-dbg:amd64 (2.27-3ubuntu1.4) ...\n", + "Setting up libpulse-mainloop-glib0:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Setting up libpulse-dev:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Setting up libarchive-zip-perl (1.60-1ubuntu0.1) ...\n", + "Setting up libmodplug1:amd64 (1:0.8.9.0-1) ...\n", + "Setting up libdw1:amd64 (0.170-0.4ubuntu0.1) ...\n", + "Setting up libtimedate-perl (2.3000-2) ...\n", + "Setting up libcairo-script-interpreter2:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Setting up libsigsegv2:amd64 (2.12-1) ...\n", + "Setting up gir1.2-freedesktop:amd64 (1.56.1-1) ...\n", + "Setting up libproxy-tools (0.4.15-1ubuntu0.2) ...\n", + "Setting up libxpm-dev:amd64 (1:3.5.12-1) ...\n", + "Setting up libxcb-shm0-dev:amd64 (1.13-2~ubuntu18.04) ...\n", + "Setting up libpangoxft-1.0-0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Setting up libxml2-utils (2.9.4+dfsg1-6.1ubuntu1.4) ...\n", + "Setting up libarchive-cpio-perl (0.10-1) ...\n", + "Setting up gir1.2-gdkpixbuf-2.0:amd64 (2.36.11-2) ...\n", + "Setting up libatk1.0-dev:amd64 (2.28.1-1) ...\n", + "Setting up libsdl1.2debian:amd64 (1.2.15+dfsg2-0.1ubuntu0.1) ...\n", + "Setting up gettext-base (0.19.8.1-6ubuntu0.3) ...\n", + "Setting up m4 (1.4.18-1) ...\n", + "Setting up fp-docs-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libmagic-mgc (1:5.32-2ubuntu0.4) ...\n", + "Setting up gir1.2-pango-1.0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Setting up libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\n", + "Setting up libsys-hostname-long-perl (1.5-1) ...\n", + "Setting up libmikmod3:amd64 (3.3.11.1-3) ...\n", + "Setting up liba52-0.7.4:amd64 (0.7.4-19) ...\n", + "Setting up libvpx-dev:amd64 (1.7.0-3ubuntu0.18.04.1) ...\n", + "Setting up libgdk-pixbuf2.0-dev (2.36.11-2) ...\n", + "Setting up libgd-dev:amd64 (2.2.5-4ubuntu0.5) ...\n", + "Setting up fp-units-rtl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libmail-sendmail-perl (0.80-1) ...\n", + "Setting up libxxf86dga1:amd64 (2:1.1.4-1) ...\n", + "Setting up lazarus-src-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up libvlccore9:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up x11proto-xinerama-dev (2018.4-4) ...\n", + "Setting up fpc-source-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up autotools-dev (20180224.1) ...\n", + "Setting up libpixman-1-dev:amd64 (0.34.0-2) ...\n", + "Setting up libaprutil1:amd64 (1.6.1-2) ...\n", + "Setting up x11proto-randr-dev (2018.4-4) ...\n", + "Setting up libxinerama-dev:amd64 (2:1.1.3-1) ...\n", + "Setting up liba52-0.7.4-dev (0.7.4-19) ...\n", + "Setting up x11proto-xf86dga-dev (2018.4-4) ...\n", + "Setting up libmikmod-config (3.3.11.1-3) ...\n", + "Setting up libxxf86dga-dev:amd64 (2:1.1.4-1) ...\n", + "Setting up gdbserver (8.1.1-0ubuntu1) ...\n", + "Setting up timgm6mb-soundfont (1.3-2) ...\n", + "Setting up libmad0:amd64 (0.15.1b-9ubuntu18.04.1) ...\n", + "Setting up libgmpxx4ldbl:amd64 (2:6.1.2+dfsg-2) ...\n", + "Setting up libdca0:amd64 (0.0.5-10) ...\n", + "Setting up libmodplug-dev:amd64 (1:0.8.9.0-1) ...\n", + "Setting up fp-utils-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "update-alternatives: using /usr/lib/x86_64-linux-gnu/fpc/3.0.4 to provide /usr/lib/x86_64-linux-gnu/fpc/default (fp-utils) in auto mode\n", + "Setting up libslang2-dev:amd64 (2.3.1a-3ubuntu1) ...\n", + "Setting up libfluidsynth1:amd64 (1.1.9-1) ...\n", + "Setting up x11proto-composite-dev (1:2018.4-4) ...\n", + "Setting up lazarus-doc-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up fp-ide-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "update-alternatives: using /usr/bin/fp-3.0.4 to provide /usr/bin/fp (fp) in auto mode\n", + "Setting up libbabeltrace1:amd64 (1.5.5-1) ...\n", + "Setting up autopoint (0.19.8.1-6ubuntu0.3) ...\n", + "Setting up fpc-source (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libfile-stripnondeterminism-perl (0.040-1.1~build1) ...\n", + "Setting up fp-units-base-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgmp-dev:amd64 (2:6.1.2+dfsg-2) ...\n", + "Setting up fp-units-multimedia-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up fp-units-math-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libmad0-dev (0.15.1b-9ubuntu18.04.1) ...\n", + "Setting up libforms-dev (1.2.3-1.3) ...\n", + "Setting up libdca-dev:amd64 (0.0.5-10) ...\n", + "Setting up libgtk2.0-0:amd64 (2.24.32-1ubuntu1) ...\n", + "Setting up libvlc5:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up libgail18:amd64 (2.24.32-1ubuntu1) ...\n", + "Setting up libxrandr-dev:amd64 (2:1.5.1-1) ...\n", + "Setting up libcairo2-dev:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Setting up gettext (0.19.8.1-6ubuntu0.3) ...\n", + "Setting up libxcomposite-dev:amd64 (1:0.4.4-2) ...\n", + "Setting up fp-units-fv-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up fp-compiler-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "update-alternatives: using /usr/bin/x86_64-linux-gnu-fpc-3.0.4 to provide /usr/bin/fpc (fpc) in auto mode\n", + "update-alternatives: using /etc/fpc-3.0.4.cfg to provide /etc/fpc.cfg (fpc.cfg) in auto mode\n", + "update-alternatives: using /usr/bin/fpc to provide /usr/bin/pc (pc) in auto mode\n", + "Setting up fp-units-gfx-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libsdl-mixer1.2:amd64 (1.2.12-14) ...\n", + "Setting up fp-units-fcl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgail-common:amd64 (2.24.32-1ubuntu1) ...\n", + "Setting up autoconf (2.69-11) ...\n", + "Setting up libmikmod-dev:amd64 (3.3.11.1-3) ...\n", + "Setting up fp-units-misc-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgvc6-plugins-gtk (2.40.1-2) ...\n", + "Setting up fp-units-net-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up file (1:5.32-2ubuntu0.4) ...\n", + "Setting up fp-units-db-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgraphviz-dev (2.40.1-2) ...\n", + "Setting up intltool-debian (0.35.0+20060710.4) ...\n", + "Setting up libcaca-dev (0.99.beta19-2ubuntu0.18.04.2) ...\n", + "Setting up libserf-1-1:amd64 (1.3.9-6) ...\n", + "Setting up libvlc-bin:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up lcl-utils-1.8 (1.8.2+dfsg-3) ...\n", + "update-alternatives: using /usr/lib/lazarus/1.8.2 to provide /usr/lib/lazarus/default (lazarus) in auto mode\n", + "Setting up libsdl1.2-dev (1.2.15+dfsg2-0.1ubuntu0.1) ...\n", + "Setting up automake (1:1.15.1-3ubuntu2) ...\n", + "update-alternatives: using /usr/bin/automake-1.15 to provide /usr/bin/automake (automake) in auto mode\n", + "Setting up libvlc-dev:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up libdts-dev:amd64 (0.0.5-10) ...\n", + "Setting up libsvn1:amd64 (1.9.7-4ubuntu1) ...\n", + "Setting up libpango1.0-dev (1.40.14-1ubuntu0.1) ...\n", + "Setting up gdb (8.1.1-0ubuntu1) ...\n", + "Setting up libsdl-mixer1.2-dev:amd64 (1.2.12-14) ...\n", + "Setting up gir1.2-gtk-2.0 (2.24.32-1ubuntu1) ...\n", + "Setting up libgtk2.0-bin (2.24.32-1ubuntu1) ...\n", + "Setting up libtool (2.4.6-2) ...\n", + "Setting up lazarus-ide-1.8 (1.8.2+dfsg-3) ...\n", + "update-alternatives: using /usr/lib/lazarus/1.8.2/startlazarus to provide /usr/bin/lazarus-ide (lazarus-ide) in auto mode\n", + "Setting up po-debconf (1.0.20) ...\n", + "Setting up lcl-nogui-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up libgtk2.0-dev (2.24.32-1ubuntu1) ...\n", + "Setting up lazarus-ide-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "update-alternatives: using /usr/lib/lazarus/1.8.2/lazarus-gtk2 to provide /usr/lib/lazarus/1.8.2/lazarus (lazarus-1.8.2) in auto mode\n", + "Setting up subversion (1.9.7-4ubuntu1) ...\n", + "Setting up fp-units-gtk2-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up lazarus-ide (1.8.2+dfsg-3) ...\n", + "Setting up fpc-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up lcl-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up lcl-units-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up fpc (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up lcl-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up lazarus-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up lazarus (1.8.2+dfsg-3) ...\n", + "Setting up dh-autoreconf (17) ...\n", + "Setting up debhelper (11.1.6ubuntu2) ...\n", + "Setting up dh-strip-nondeterminism (0.040-1.1~build1) ...\n", + "Processing triggers for libc-bin (2.27-3ubuntu1.3) ...\n", + "/sbin/ldconfig.real: /usr/local/lib/python3.7/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link\n", + "\n", + "Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n", + "Processing triggers for mime-support (3.60ubuntu1) ...\n", + "Processing triggers for libvlc-bin:amd64 (3.0.8-0ubuntu18.04.1) ...\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "qhr-tY5c1o3J", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "50345580-b2ab-4722-82c0-318378bb1928" + }, + "source": [ + "!git clone https://github.com/joaopauloschuler/neural-api.git" + ], + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Cloning into 'neural-api'...\n", + "remote: Enumerating objects: 2372, done.\u001b[K\n", + "remote: Counting objects: 100% (494/494), done.\u001b[K\n", + "remote: Compressing objects: 100% (370/370), done.\u001b[K\n", + "remote: Total 2372 (delta 340), reused 236 (delta 124), pack-reused 1878\u001b[K\n", + "Receiving objects: 100% (2372/2372), 4.58 MiB | 10.38 MiB/s, done.\n", + "Resolving deltas: 100% (1585/1585), done.\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "8htgbUo9744q", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "41481d70-ed29-4853-cbf3-c3babd67fb89" + }, + "source": [ + "!svn checkout https://svn.code.sf.net/p/lazarus-ccr/svn/components/multithreadprocs mtprocs" + ], + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "A mtprocs/examples\n", + "A mtprocs/examples/parallelloop1.lpr\n", + "A mtprocs/examples/parallelloop_nested1.lpi\n", + "A mtprocs/examples/parallelloop_nested1.lpr\n", + "A mtprocs/examples/recursivemtp1.lpr\n", + "A mtprocs/examples/simplemtp1.lpr\n", + "A mtprocs/examples/parallelloop1.lpi\n", + "A mtprocs/examples/recursivemtp1.lpi\n", + "A mtprocs/examples/simplemtp1.lpi\n", + "A mtprocs/examples/testmtp1.lpi\n", + "A mtprocs/examples/testmtp1.lpr\n", + "A mtprocs/Readme.txt\n", + "A mtprocs/mtprocs.pas\n", + "A mtprocs/mtpcpu.pas\n", + "A mtprocs/multithreadprocslaz.lpk\n", + "A mtprocs/mtputils.pas\n", + "A mtprocs/multithreadprocslaz.pas\n", + "Checked out revision 8093.\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "NYDMPdbn7W9w", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "49e5e05b-8c6e-4f5b-dd5a-55cfe5013f74" + }, + "source": [ + "!lazbuild mtprocs/multithreadprocslaz.lpk" + ], + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "CopySecondaryConfigFile /etc/lazarus/environmentoptions.xml -> /root/.lazarus/environmentoptions.xml\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"compilertest.pas\"\n", + "Hint: (lazarus) Missing state file of MultiThreadProcsLaz 1.2.1: /content/mtprocs/lib/x86_64-linux/MultiThreadProcsLaz.compiled\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\" \"-Px86_64\" \"-Tlinux\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"-Px86_64\" \"-Tlinux\" \"compilertest.pas\"\n", + "Info: (lazarus) Execute Title=\"Compile package MultiThreadProcsLaz 1.2.1\"\n", + "Info: (lazarus) Working Directory=\"/content/mtprocs/\"\n", + "Info: (lazarus) Executable=\"/usr/bin/fpc\"\n", + "Info: (lazarus) Param[0]=\"-B\"\n", + "Info: (lazarus) Param[1]=\"-MObjFPC\"\n", + "Info: (lazarus) Param[2]=\"-Scghi\"\n", + "Info: (lazarus) Param[3]=\"-Cg\"\n", + "Info: (lazarus) Param[4]=\"-O1\"\n", + "Info: (lazarus) Param[5]=\"-g\"\n", + "Info: (lazarus) Param[6]=\"-gl\"\n", + "Info: (lazarus) Param[7]=\"-l\"\n", + "Info: (lazarus) Param[8]=\"-vewnhibq\"\n", + "Info: (lazarus) Param[9]=\"-Fu/usr/lib/lazarus/1.8.2/packager/units/x86_64-linux\"\n", + "Info: (lazarus) Param[10]=\"-Fu/content/mtprocs/\"\n", + "Info: (lazarus) Param[11]=\"-FU/content/mtprocs/lib/x86_64-linux/\"\n", + "Info: (lazarus) Param[12]=\"multithreadprocslaz.pas\"\n", + "Hint: (11030) Start of reading config file /etc/fpc.cfg\n", + "Hint: (11031) End of reading config file /etc/fpc.cfg\n", + "Free Pascal Compiler version 3.0.4+dfsg-18ubuntu2 [2018/08/29] for x86_64\n", + "Copyright (c) 1993-2017 by Florian Klaempfl and others\n", + "(1002) Target OS: Linux for x86-64\n", + "(3104) Compiling multithreadprocslaz.pas\n", + "(3104) Compiling mtprocs.pas\n", + "(3104) Compiling mtpcpu.pas\n", + "(3104) Compiling mtputils.pas\n", + "/content/mtprocs/mtputils.pas(40,43) Hint: (5024) Parameter \"Data\" not used\n", + "/content/mtprocs/multithreadprocslaz.pas(10,10) Hint: (5023) Unit \"MTPUtils\" not used in MultiThreadProcsLaz\n", + "/content/mtprocs/multithreadprocslaz.pas(10,20) Hint: (5023) Unit \"MTPCPU\" not used in MultiThreadProcsLaz\n", + "(1008) 1215 lines compiled, 0.1 sec\n", + "(1022) 5 hint(s) issued\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "H_mKELt35Hym", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "42785862-c8f2-4c4f-f8f5-a60ad88d51b2" + }, + "source": [ + "!ls -l neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi" + ], + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "-rw-r--r-- 1 root root 5694 Sep 23 08:37 neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "_Xye-mYy2UHP", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "dedb9a91-c464-4cf8-ca6a-d5b9ac3379f6" + }, + "source": [ + "!lazbuild neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi" + ], + "execution_count": 7, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"compilertest.pas\"\n", + "TProject.DoLoadStateFile Statefile not found: /content/neural-api/bin/x86_64-linux/units/SimpleImageClassifier.compiled\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\" \"-Px86_64\" \"-Tlinux\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"-Px86_64\" \"-Tlinux\" \"compilertest.pas\"\n", + "Info: (lazarus) Execute Title=\"Compile Project, Mode: Default, Target: /content/neural-api/bin/x86_64-linux/bin/SimpleImageClassifier\"\n", + "Info: (lazarus) Working Directory=\"/content/neural-api/examples/SimpleImageClassifier/\"\n", + "Info: (lazarus) Executable=\"/usr/bin/fpc\"\n", + "Info: (lazarus) Param[0]=\"-B\"\n", + "Info: (lazarus) Param[1]=\"-MObjFPC\"\n", + "Info: (lazarus) Param[2]=\"-Scghi\"\n", + "Info: (lazarus) Param[3]=\"-Cg\"\n", + "Info: (lazarus) Param[4]=\"-O3\"\n", + "Info: (lazarus) Param[5]=\"-l\"\n", + "Info: (lazarus) Param[6]=\"-vewnhibq\"\n", + "Info: (lazarus) Param[7]=\"-Fi/content/neural-api/neural\"\n", + "Info: (lazarus) Param[8]=\"-Fi/content/neural-api/bin/x86_64-linux/units\"\n", + "Info: (lazarus) Param[9]=\"-Fu/content/neural-api/neural\"\n", + "Info: (lazarus) Param[10]=\"-Fu/usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux\"\n", + "Info: (lazarus) Param[11]=\"-Fu/usr/lib/lazarus/1.8.2/components/lazutils/lib/x86_64-linux\"\n", + "Info: (lazarus) Param[12]=\"-Fu/content/mtprocs/lib/x86_64-linux\"\n", + "Info: (lazarus) Param[13]=\"-Fu/usr/lib/lazarus/1.8.2/packager/units/x86_64-linux\"\n", + "Info: (lazarus) Param[14]=\"-Fu/content/neural-api/examples/SimpleImageClassifier/\"\n", + "Info: (lazarus) Param[15]=\"-FU/content/neural-api/bin/x86_64-linux/units/\"\n", + "Info: (lazarus) Param[16]=\"-FE/content/neural-api/bin/x86_64-linux/bin/\"\n", + "Info: (lazarus) Param[17]=\"-dUseCThreads\"\n", + "Info: (lazarus) Param[18]=\"-dAVX\"\n", + "Info: (lazarus) Param[19]=\"-dRelease\"\n", + "Info: (lazarus) Param[20]=\"SimpleImageClassifier.lpr\"\n", + "Hint: (11030) Start of reading config file /etc/fpc.cfg\n", + "Compiling Release Version\n", + "Hint: (11031) End of reading config file /etc/fpc.cfg\n", + "Free Pascal Compiler version 3.0.4+dfsg-18ubuntu2 [2018/08/29] for x86_64\n", + "Copyright (c) 1993-2017 by Florian Klaempfl and others\n", + "(1002) Target OS: Linux for x86-64\n", + "(3104) Compiling SimpleImageClassifier.lpr\n", + "(3104) Compiling /content/neural-api/neural/neuralnetwork.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralvolume.pas\n", + "/content/neural-api/neural/neuralnetwork.inc(34,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralnetwork.inc(38,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralvolume.pas(464,19) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt;LongInt;LongInt;Boolean=\"TRUE\");\"\n", + "(3104) Compiling /content/neural-api/neural/neuralbit.pas\n", + "/content/neural-api/neural/neuralbit.pas(722,19) Hint: (5058) Variable \"VARS\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(560,31) Hint: (5024) Parameter \"x\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(2076,37) Hint: (5058) Variable \"V\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(398,43) Hint: (5024) Parameter \"S\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(2329,19) Hint: (5058) Variable \"pInput\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(2335,21) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(2353,27) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(3411,16) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(4852,3) Note: (5027) Local variable \"version\" is assigned but never used\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "(3104) Compiling /content/neural-api/neural/neuralgeneric.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralbyteprediction.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralabfun.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralab.pas\n", + "/content/neural-api/neural/neuralabfun.pas(615,71) Hint: (5057) Local variable \"predictState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(702,32) Note: (5027) Local variable \"NonZeroErrorsCount\" is assigned but never used\n", + "/content/neural-api/neural/neuralabfun.pas(1027,9) Warning: (5036) Local variable \"PermissibleErrors\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(1021,83) Hint: (5057) Local variable \"efeito\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(669,3) Note: (5025) Local variable \"csUnitaryTests\" not used\n", + "/content/neural-api/neural/neuralabfun.pas(670,3) Note: (5025) Local variable \"csBinaryTests\" not used\n", + "(3104) Compiling /content/neural-api/neural/neuralcache.pas\n", + "/content/neural-api/neural/neuralcache.pas(206,1) Warning: (5059) Function result variable does not seem to initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(370,1) Warning: (5059) Function result variable does not seem to initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(373,49) Hint: (5058) Variable \"pState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(429,111) Hint: (5057) Local variable \"Effect\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(540,69) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(522,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(724,21) Warning: (5036) Local variable \"idxCache\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(760,43) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(780,69) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(863,3) Note: (5027) Local variable \"version\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(864,3) Note: (5027) Local variable \"evaluation\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(865,3) Note: (5027) Local variable \"pActionLen\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(866,3) Note: (5027) Local variable \"pStatelen\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(965,23) Hint: (5057) Local variable \"PredictedState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(978,36) Hint: (5058) Variable \"NG\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(980,29) Hint: (5057) Local variable \"Effect\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1081,42) Hint: (5024) Parameter \"PredictedBytePos\" not used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1126,35) Hint: (5058) Variable \"PNextStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1129,43) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1129,27) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1126,22) Hint: (5058) Variable \"pred\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1292,35) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1247,37) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1248,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1329,65) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1316,41) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1316,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(50,32) Hint: (5023) Unit \"neuralvolume\" not used in neuralbyteprediction\n", + "/content/neural-api/neural/neuralnetwork.pas(1005,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1072,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1078,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1084,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1615,17) Warning: (3057) An inherited method is hidden by \"constructor Create(TNNet;Word;Word;LongInt);\"\n", + "/content/neural-api/neural/neuralnetwork.pas(6250,3) Note: (5025) Local variable \"I\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7092,3) Note: (5025) Local variable \"OutX\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7092,9) Note: (5025) Local variable \"OutY\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7283,3) Note: (5027) Local variable \"Len\" is assigned but never used\n", + "/content/neural-api/neural/neuralnetwork.pas(9621,65) Warning: (5089) Local variable \"aL\" of a managed type does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(9622,77) Warning: (5089) Local variable \"aIdx\" of a managed type does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(12793,21) Warning: (5036) Local variable \"idxCache\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(12812,34) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "/content/neural-api/neural/neuralnetwork.pas(87,28) Hint: (5023) Unit \"syncobjs\" not used in neuralnetwork\n", + "(3104) Compiling /content/neural-api/neural/neuraldatasets.pas\n", + "/content/neural-api/neural/neuralnetwork.inc(34,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralnetwork.inc(38,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "(3104) Compiling /content/neural-api/neural/neuralthread.pas\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "/content/neural-api/neural/neuraldatasets.pas(151,46) Hint: (5024) Parameter \"FolderName\" not used\n", + "/content/neural-api/neural/neuraldatasets.pas(576,3) Note: (5025) Local variable \"SourceVolume\" not used\n", + "(3104) Compiling /content/neural-api/neural/neuralfit.pas\n", + "/content/neural-api/neural/neuralfit.pas(280,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(281,46) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(282,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(283,44) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(241,33) Hint: (5024) Parameter \"Idx\" not used\n", + "/content/neural-api/neural/neuralfit.pas(242,49) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(243,43) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(175,72) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(217,32) Hint: (5024) Parameter \"Idx\" not used\n", + "/content/neural-api/neural/neuralfit.pas(217,46) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(218,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(219,42) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(192,36) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(193,37) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(276,36) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(277,37) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpr(11,3) Hint: (5023) Unit \"math\" not used in SimpleImageClassifier\n", + "(9015) Linking /content/neural-api/bin/x86_64-linux/bin/SimpleImageClassifier\n", + "/usr/bin/ld.bfd: warning: /content/neural-api/bin/x86_64-linux/bin/link.res contains output sections; did you forget -T?\n", + "(1008) 35358 lines compiled, 1.8 sec\n", + "(1021) 17 warning(s) issued\n", + "(1022) 161 hint(s) issued\n", + "(1023) 13 note(s) issued\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "7xWWg1E1P2pm", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "55c25722-d62e-461c-b283-2c2ee37e776a" + }, + "source": [ + "ls -l neural-api/bin/x86_64-linux/bin/SimpleImageClassifier" + ], + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "-rwxr-xr-x 1 root root 1951024 Sep 23 08:43 \u001b[0m\u001b[01;32mneural-api/bin/x86_64-linux/bin/SimpleImageClassifier\u001b[0m*\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "WBxvm6S4-FtJ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e7b5f828-592e-4df3-87ad-53b017d4fd7c" + }, + "source": [ + "import os\n", + "import urllib.request\n", + "\n", + "if not os.path.isfile('cifar-10-batches-bin/data_batch_1.bin'):\n", + " print(\"Downloading CIFAR-10 Files\")\n", + " url = 'https://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz'\n", + " urllib.request.urlretrieve(url, './file.tar')" + ], + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Downloading CIFAR-10 Files\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "SpfaXVrrKgd0", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "1e92f226-019f-4857-af68-79cd62ddfd19" + }, + "source": [ + "ls -l" + ], + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "total 166080\n", + "-rw-r--r-- 1 root root 170052171 Sep 23 08:46 file.tar\n", + "drwxr-xr-x 5 root root 4096 Sep 23 08:39 \u001b[0m\u001b[01;34mmtprocs\u001b[0m/\n", + "drwxr-xr-x 7 root root 4096 Sep 23 08:42 \u001b[01;34mneural-api\u001b[0m/\n", + "drwxr-xr-x 1 root root 4096 Sep 16 13:40 \u001b[01;34msample_data\u001b[0m/\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "doqZbQkqKy9I", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "844e0f45-1184-49ab-8613-5353f5e8ad5b" + }, + "source": [ + "!tar -xvf ./file.tar" + ], + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "cifar-10-batches-bin/\n", + "cifar-10-batches-bin/data_batch_1.bin\n", + "cifar-10-batches-bin/batches.meta.txt\n", + "cifar-10-batches-bin/data_batch_3.bin\n", + "cifar-10-batches-bin/data_batch_4.bin\n", + "cifar-10-batches-bin/test_batch.bin\n", + "cifar-10-batches-bin/readme.html\n", + "cifar-10-batches-bin/data_batch_5.bin\n", + "cifar-10-batches-bin/data_batch_2.bin\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "VWB54wU5B1I9", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4008e5b2-ae01-4ba6-a548-1fba01228ea4" + }, + "source": [ + "if not os.path.isfile('./data_batch_1.bin'):\n", + " print(\"Copying files to current folder\")\n", + " !cp ./cifar-10-batches-bin/* ./" + ], + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Copying files to current folder\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "X5bpFXiaC_PY", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f7eb3f66-7944-4bed-ee64-1aa4558b3d89" + }, + "source": [ + "if os.path.isfile('./data_batch_1.bin'):\n", + " print(\"RUNNING!\")\n", + " !neural-api/bin/x86_64-linux/bin/SimpleImageClassifier" + ], + "execution_count": 13, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "RUNNING!\n", + "Creating Neural Network...\n", + " Layers: 12\n", + " Neurons:331\n", + " Weights:162498 Sum: -19.536575\n", + "Layer 0 Neurons: 0 Weights: 0 TNNetInput(32,32,3,0,0) Output:32,32,3 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Branches:1\n", + "Layer 1 Neurons: 64 Weights: 4800 TNNetConvolutionLinear(64,5,2,1,1) Output:32,32,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 9.3083 Parent:0 Branches:1\n", + "Layer 2 Neurons: 0 Weights: 0 TNNetMaxPool(4,4,0,0,0) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:1 Branches:1\n", + "Layer 3 Neurons: 1 Weights: 2 TNNetMovingStdNormalization(0,0,0,0,0) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 1.0000 Parent:2 Branches:1\n", + "Layer 4 Neurons: 64 Weights: 36864 TNNetConvolutionReLU(64,3,1,1,1) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum:-16.7340 Parent:3 Branches:1\n", + "Layer 5 Neurons: 64 Weights: 36864 TNNetConvolutionReLU(64,3,1,1,1) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: -2.0621 Parent:4 Branches:1\n", + "Layer 6 Neurons: 64 Weights: 36864 TNNetConvolutionReLU(64,3,1,1,1) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: -3.9453 Parent:5 Branches:1\n", + "Layer 7 Neurons: 64 Weights: 36864 TNNetConvolutionReLU(64,3,1,1,1) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 3.3115 Parent:6 Branches:1\n", + "Layer 8 Neurons: 0 Weights: 0 TNNetDropout(2,1,0,0,0) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:7 Branches:1\n", + "Layer 9 Neurons: 0 Weights: 0 TNNetMaxPool(2,2,0,0,0) Output:4,4,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:8 Branches:1\n", + "Layer 10 Neurons: 10 Weights: 10240 TNNetFullConnectLinear(10,1,1,0,0) Output:10,1,1 Learning Rate:0.0100 Inertia:0.90 Weight Sum:-10.4149 Parent:9 Branches:1\n", + "Layer 11 Neurons: 0 Weights: 0 TNNetSoftMax(0,0,0,0,0) Output:10,1,1 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:10 Branches:0\n", + "Loading 10K images from file \"data_batch_1.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_2.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_3.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_4.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_5.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"test_batch.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "File name is: SimpleImageClassifier-64\n", + "Learning rate:0.001000 L2 decay:0.000010 Inertia:0.900000 Batch size:64 Step size:64 Staircase ephocs:10\n", + "Training images: 40000\n", + "Validation images: 10000\n", + "Test images: 10000\n", + "Computing...\n", + "640 Examples seen. Accuracy: 0.1481 Error: 1.79544 Loss: 2.29493 Threads: 2 Forward time: 0.69s Backward time: 0.52s Step time: 2.55s\n", + "1280 Examples seen. Accuracy: 0.1479 Error: 1.77985 Loss: 2.23596 Threads: 2 Forward time: 0.67s Backward time: 0.52s Step time: 2.50s\n", + "1920 Examples seen. Accuracy: 0.1498 Error: 1.75829 Loss: 2.17276 Threads: 2 Forward time: 0.71s Backward time: 0.53s Step time: 2.50s\n", + "2560 Examples seen. Accuracy: 0.1550 Error: 1.72284 Loss: 2.10358 Threads: 2 Forward time: 0.67s Backward time: 0.53s Step time: 2.50s\n", + "3200 Examples seen. Accuracy: 0.1607 Error: 1.71363 Loss: 2.12127 Threads: 2 Forward time: 0.67s Backward time: 0.53s Step time: 2.54s\n", + "3840 Examples seen. Accuracy: 0.1660 Error: 1.72590 Loss: 2.05349 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.51s\n", + "4480 Examples seen. Accuracy: 0.1770 Error: 1.63273 Loss: 1.86535 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.49s\n", + "5120 Examples seen. Accuracy: 0.1856 Error: 1.63568 Loss: 1.95574 Threads: 2 Forward time: 0.70s Backward time: 0.52s Step time: 2.50s\n", + "5760 Examples seen. Accuracy: 0.1979 Error: 1.62821 Loss: 1.88185 Threads: 2 Forward time: 0.66s Backward time: 0.53s Step time: 2.51s\n", + "6400 Examples seen. Accuracy: 0.2075 Error: 1.66402 Loss: 2.07736 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.50s\n", + "7040 Examples seen. Accuracy: 0.2177 Error: 1.64277 Loss: 2.04907 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.51s\n", + "7680 Examples seen. Accuracy: 0.2264 Error: 1.59409 Loss: 1.79512 Threads: 2 Forward time: 0.70s Backward time: 0.53s Step time: 2.50s\n", + "8320 Examples seen. Accuracy: 0.2360 Error: 1.54550 Loss: 1.85149 Threads: 2 Forward time: 0.69s Backward time: 0.53s Step time: 2.52s\n", + "8960 Examples seen. Accuracy: 0.2456 Error: 1.56664 Loss: 1.77805 Threads: 2 Forward time: 0.70s Backward time: 0.54s Step time: 2.55s\n", + "9600 Examples seen. Accuracy: 0.2541 Error: 1.59044 Loss: 1.93252 Threads: 2 Forward time: 0.69s Backward time: 0.54s Step time: 2.51s\n", + "10240 Examples seen. Accuracy: 0.2597 Error: 1.58854 Loss: 1.81173 Threads: 2 Forward time: 0.68s Backward time: 0.54s Step time: 2.50s\n", + "10880 Examples seen. Accuracy: 0.2660 Error: 1.49855 Loss: 1.64290 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.49s\n", + "11520 Examples seen. Accuracy: 0.2734 Error: 1.47110 Loss: 1.53985 Threads: 2 Forward time: 0.68s Backward time: 0.53s Step time: 2.49s\n", + "12160 Examples seen. Accuracy: 0.2793 Error: 1.43010 Loss: 1.51361 Threads: 2 Forward time: 0.66s Backward time: 0.51s Step time: 2.49s\n", + "12800 Examples seen. Accuracy: 0.2864 Error: 1.54338 Loss: 1.81172 Threads: 2 Forward time: 0.67s Backward time: 0.52s Step time: 2.48s\n", + "13440 Examples seen. Accuracy: 0.2888 Error: 1.56118 Loss: 1.84152 Threads: 2 Forward time: 0.66s Backward time: 0.52s Step time: 2.52s\n", + "14080 Examples seen. Accuracy: 0.2940 Error: 1.45340 Loss: 1.62768 Threads: 2 Forward time: 0.71s Backward time: 0.52s Step time: 2.50s\n", + "14720 Examples seen. Accuracy: 0.2992 Error: 1.53040 Loss: 1.71362 Threads: 2 Forward time: 0.70s Backward time: 0.53s Step time: 2.47s\n", + "15360 Examples seen. Accuracy: 0.3066 Error: 1.53963 Loss: 1.90071 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.45s\n", + "16000 Examples seen. Accuracy: 0.3135 Error: 1.46878 Loss: 1.61237 Threads: 2 Forward time: 0.71s Backward time: 0.56s Step time: 2.49s\n", + "16640 Examples seen. Accuracy: 0.3198 Error: 1.51176 Loss: 1.79796 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.46s\n", + "17280 Examples seen. Accuracy: 0.3235 Error: 1.44523 Loss: 1.63515 Threads: 2 Forward time: 0.67s Backward time: 0.49s Step time: 2.46s\n", + "17920 Examples seen. Accuracy: 0.3291 Error: 1.46046 Loss: 1.47104 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.43s\n", + "18560 Examples seen. Accuracy: 0.3359 Error: 1.48456 Loss: 1.75611 Threads: 2 Forward time: 0.72s Backward time: 0.56s Step time: 2.48s\n", + "19200 Examples seen. Accuracy: 0.3392 Error: 1.43991 Loss: 1.63127 Threads: 2 Forward time: 0.69s Backward time: 0.55s Step time: 2.47s\n", + "19840 Examples seen. Accuracy: 0.3407 Error: 1.46214 Loss: 1.58897 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.50s\n", + "20480 Examples seen. Accuracy: 0.3448 Error: 1.47581 Loss: 1.80389 Threads: 2 Forward time: 0.66s Backward time: 0.52s Step time: 2.46s\n", + "21120 Examples seen. Accuracy: 0.3535 Error: 1.51542 Loss: 1.71892 Threads: 2 Forward time: 0.66s Backward time: 0.53s Step time: 2.45s\n", + "21760 Examples seen. Accuracy: 0.3606 Error: 1.40996 Loss: 1.61076 Threads: 2 Forward time: 0.66s Backward time: 0.51s Step time: 2.46s\n", + "22400 Examples seen. Accuracy: 0.3626 Error: 1.57226 Loss: 2.04786 Threads: 2 Forward time: 0.70s Backward time: 0.52s Step time: 2.46s\n", + "23040 Examples seen. Accuracy: 0.3684 Error: 1.39514 Loss: 1.45001 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.44s\n", + "23680 Examples seen. Accuracy: 0.3742 Error: 1.36091 Loss: 1.61692 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.44s\n", + "24320 Examples seen. Accuracy: 0.3760 Error: 1.46164 Loss: 1.61883 Threads: 2 Forward time: 0.68s Backward time: 0.53s Step time: 2.47s\n", + "24960 Examples seen. Accuracy: 0.3802 Error: 1.38044 Loss: 1.39986 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.50s\n", + "25600 Examples seen. Accuracy: 0.3861 Error: 1.51735 Loss: 1.78022 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.48s\n", + "26240 Examples seen. Accuracy: 0.3902 Error: 1.41811 Loss: 1.61700 Threads: 2 Forward time: 0.69s Backward time: 0.49s Step time: 2.49s\n", + "26880 Examples seen. Accuracy: 0.3887 Error: 1.46899 Loss: 1.56543 Threads: 2 Forward time: 0.66s Backward time: 0.53s Step time: 2.48s\n", + "27520 Examples seen. Accuracy: 0.3936 Error: 1.31012 Loss: 1.30139 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.46s\n", + "28160 Examples seen. Accuracy: 0.3983 Error: 1.39935 Loss: 1.62048 Threads: 2 Forward time: 0.70s Backward time: 0.52s Step time: 2.46s\n", + "28800 Examples seen. Accuracy: 0.3986 Error: 1.41875 Loss: 1.52329 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.44s\n", + "29440 Examples seen. Accuracy: 0.4022 Error: 1.39563 Loss: 1.52202 Threads: 2 Forward time: 0.66s Backward time: 0.51s Step time: 2.47s\n", + "30080 Examples seen. Accuracy: 0.4017 Error: 1.45439 Loss: 1.65365 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.44s\n", + "30720 Examples seen. Accuracy: 0.4051 Error: 1.33340 Loss: 1.45610 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.42s\n", + "31360 Examples seen. Accuracy: 0.4062 Error: 1.43259 Loss: 1.59719 Threads: 2 Forward time: 0.69s Backward time: 0.51s Step time: 2.43s\n", + "32000 Examples seen. Accuracy: 0.4073 Error: 1.41820 Loss: 1.82291 Threads: 2 Forward time: 0.66s Backward time: 0.50s Step time: 2.47s\n", + "32640 Examples seen. Accuracy: 0.4096 Error: 1.47982 Loss: 1.65160 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.45s\n", + "33280 Examples seen. Accuracy: 0.4113 Error: 1.38456 Loss: 1.50167 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.44s\n", + "33920 Examples seen. Accuracy: 0.4124 Error: 1.37090 Loss: 1.55271 Threads: 2 Forward time: 0.66s Backward time: 0.50s Step time: 2.44s\n", + "34560 Examples seen. Accuracy: 0.4161 Error: 1.43860 Loss: 1.73516 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.44s\n", + "35200 Examples seen. Accuracy: 0.4171 Error: 1.39582 Loss: 1.64415 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.45s\n", + "35840 Examples seen. Accuracy: 0.4200 Error: 1.40152 Loss: 1.58708 Threads: 2 Forward time: 0.71s Backward time: 0.50s Step time: 2.45s\n", + "36480 Examples seen. Accuracy: 0.4234 Error: 1.33571 Loss: 1.57454 Threads: 2 Forward time: 0.69s Backward time: 0.54s Step time: 2.53s\n", + "37120 Examples seen. Accuracy: 0.4301 Error: 1.20996 Loss: 1.25736 Threads: 2 Forward time: 0.67s Backward time: 0.53s Step time: 2.52s\n", + "37760 Examples seen. Accuracy: 0.4323 Error: 1.44967 Loss: 1.83971 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.53s\n", + "38400 Examples seen. Accuracy: 0.4334 Error: 1.32567 Loss: 1.47977 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.46s\n", + "39040 Examples seen. Accuracy: 0.4319 Error: 1.34760 Loss: 1.38344 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.47s\n", + "39680 Examples seen. Accuracy: 0.4334 Error: 1.32686 Loss: 1.47318 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.47s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 1 Examples seen:40000 Validation Accuracy: 0.5163 Validation Error: 1.2367 Validation Loss: 1.3394 Total time: 3.66min\n", + "Epoch time: 2.5750 minutes. 50 epochs: 2.1458 hours.\n", + "Epochs: 1. Working time: 0.06 hours.\n", + "40640 Examples seen. Accuracy: 0.4402 Error: 1.39607 Loss: 1.68056 Threads: 2 Forward time: 0.66s Backward time: 0.51s Step time: 2.45s\n", + "41280 Examples seen. Accuracy: 0.4421 Error: 1.25289 Loss: 1.23783 Threads: 2 Forward time: 0.72s Backward time: 0.52s Step time: 2.52s\n", + "41920 Examples seen. Accuracy: 0.4458 Error: 1.22554 Loss: 1.16512 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.56s\n", + "42560 Examples seen. Accuracy: 0.4467 Error: 1.33534 Loss: 1.68178 Threads: 2 Forward time: 0.69s Backward time: 0.53s Step time: 2.49s\n", + "43200 Examples seen. Accuracy: 0.4503 Error: 1.36218 Loss: 1.59631 Threads: 2 Forward time: 0.66s Backward time: 0.51s Step time: 2.46s\n", + "43840 Examples seen. Accuracy: 0.4508 Error: 1.39591 Loss: 1.59698 Threads: 2 Forward time: 0.66s Backward time: 0.53s Step time: 2.47s\n", + "44480 Examples seen. Accuracy: 0.4512 Error: 1.35992 Loss: 1.53007 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.48s\n", + "45120 Examples seen. Accuracy: 0.4494 Error: 1.32980 Loss: 1.38933 Threads: 2 Forward time: 0.70s Backward time: 0.50s Step time: 2.45s\n", + "45760 Examples seen. Accuracy: 0.4512 Error: 1.24250 Loss: 1.40123 Threads: 2 Forward time: 0.67s Backward time: 0.49s Step time: 2.47s\n", + "46400 Examples seen. Accuracy: 0.4528 Error: 1.41063 Loss: 1.56648 Threads: 2 Forward time: 0.65s Backward time: 0.51s Step time: 2.43s\n", + "47040 Examples seen. Accuracy: 0.4542 Error: 1.34692 Loss: 1.58015 Threads: 2 Forward time: 0.74s Backward time: 0.52s Step time: 2.42s\n", + "47680 Examples seen. Accuracy: 0.4582 Error: 1.25918 Loss: 1.29102 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.42s\n", + "48320 Examples seen. Accuracy: 0.4607 Error: 1.31420 Loss: 1.48015 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.42s\n", + "48960 Examples seen. Accuracy: 0.4616 Error: 1.35348 Loss: 1.57047 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.43s\n", + "49600 Examples seen. Accuracy: 0.4612 Error: 1.22624 Loss: 1.37146 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.46s\n", + "50240 Examples seen. Accuracy: 0.4595 Error: 1.40065 Loss: 1.56835 Threads: 2 Forward time: 0.72s Backward time: 0.49s Step time: 2.49s\n", + "50880 Examples seen. Accuracy: 0.4617 Error: 1.36675 Loss: 1.55090 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.43s\n", + "51520 Examples seen. Accuracy: 0.4609 Error: 1.34522 Loss: 1.38099 Threads: 2 Forward time: 0.69s Backward time: 0.52s Step time: 2.44s\n", + "52160 Examples seen. Accuracy: 0.4633 Error: 1.28366 Loss: 1.41689 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.42s\n", + "52800 Examples seen. Accuracy: 0.4679 Error: 1.21513 Loss: 1.42658 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.45s\n", + "53440 Examples seen. Accuracy: 0.4708 Error: 1.30849 Loss: 1.53340 Threads: 2 Forward time: 0.69s Backward time: 0.49s Step time: 2.43s\n", + "54080 Examples seen. Accuracy: 0.4732 Error: 1.40573 Loss: 1.46094 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.42s\n", + "54720 Examples seen. Accuracy: 0.4775 Error: 1.23261 Loss: 1.33425 Threads: 2 Forward time: 0.67s Backward time: 0.49s Step time: 2.42s\n", + "55360 Examples seen. Accuracy: 0.4789 Error: 1.20426 Loss: 1.25272 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.44s\n", + "56000 Examples seen. Accuracy: 0.4824 Error: 1.17741 Loss: 1.18861 Threads: 2 Forward time: 0.67s Backward time: 0.49s Step time: 2.41s\n", + "56640 Examples seen. Accuracy: 0.4804 Error: 1.31370 Loss: 1.48129 Threads: 2 Forward time: 0.70s Backward time: 0.56s Step time: 2.47s\n", + "57280 Examples seen. Accuracy: 0.4816 Error: 1.34587 Loss: 1.58014 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.47s\n", + "57920 Examples seen. Accuracy: 0.4836 Error: 1.21501 Loss: 1.32031 Threads: 2 Forward time: 0.66s Backward time: 0.48s Step time: 2.46s\n", + "58560 Examples seen. Accuracy: 0.4855 Error: 1.25863 Loss: 1.42719 Threads: 2 Forward time: 0.69s Backward time: 0.51s Step time: 2.43s\n", + "59200 Examples seen. Accuracy: 0.4864 Error: 1.25754 Loss: 1.30167 Threads: 2 Forward time: 0.67s Backward time: 0.48s Step time: 2.41s\n", + "59840 Examples seen. Accuracy: 0.4902 Error: 1.18845 Loss: 1.25104 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.40s\n", + "60480 Examples seen. Accuracy: 0.4888 Error: 1.22724 Loss: 1.26680 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.40s\n", + "61120 Examples seen. Accuracy: 0.4858 Error: 1.32534 Loss: 1.66756 Threads: 2 Forward time: 0.67s Backward time: 0.48s Step time: 2.41s\n", + "61760 Examples seen. Accuracy: 0.4867 Error: 1.23665 Loss: 1.31761 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.40s\n", + "62400 Examples seen. Accuracy: 0.4891 Error: 1.37480 Loss: 1.56838 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.45s\n", + "63040 Examples seen. Accuracy: 0.4882 Error: 1.32497 Loss: 1.52067 Threads: 2 Forward time: 0.68s Backward time: 0.48s Step time: 2.43s\n", + "63680 Examples seen. Accuracy: 0.4885 Error: 1.23105 Loss: 1.33264 Threads: 2 Forward time: 0.69s Backward time: 0.51s Step time: 2.44s\n", + "64320 Examples seen. Accuracy: 0.4874 Error: 1.29117 Loss: 1.41264 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.44s\n", + "64960 Examples seen. Accuracy: 0.4905 Error: 1.04727 Loss: 1.08052 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.43s\n", + "65600 Examples seen. Accuracy: 0.4925 Error: 1.16781 Loss: 1.18518 Threads: 2 Forward time: 0.66s Backward time: 0.48s Step time: 2.42s\n", + "66240 Examples seen. Accuracy: 0.4946 Error: 1.32698 Loss: 1.36193 Threads: 2 Forward time: 0.66s Backward time: 0.48s Step time: 2.41s\n", + "66880 Examples seen. Accuracy: 0.4948 Error: 1.21861 Loss: 1.39665 Threads: 2 Forward time: 0.70s Backward time: 0.48s Step time: 2.39s\n", + "67520 Examples seen. Accuracy: 0.4989 Error: 1.13003 Loss: 1.22982 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.38s\n", + "68160 Examples seen. Accuracy: 0.4998 Error: 1.10655 Loss: 1.17619 Threads: 2 Forward time: 0.66s Backward time: 0.48s Step time: 2.38s\n", + "68800 Examples seen. Accuracy: 0.5027 Error: 1.11410 Loss: 1.23831 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.43s\n", + "69440 Examples seen. Accuracy: 0.5021 Error: 1.20098 Loss: 1.40219 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.42s\n", + "70080 Examples seen. Accuracy: 0.5025 Error: 1.28556 Loss: 1.60134 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.39s\n", + "70720 Examples seen. Accuracy: 0.5037 Error: 1.32673 Loss: 1.49878 Threads: 2 Forward time: 0.71s Backward time: 0.47s Step time: 2.37s\n", + "71360 Examples seen. Accuracy: 0.5057 Error: 1.17321 Loss: 1.19003 Threads: 2 Forward time: 0.65s Backward time: 0.49s Step time: 2.39s\n", + "72000 Examples seen. Accuracy: 0.5046 Error: 1.21618 Loss: 1.37591 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.39s\n", + "72640 Examples seen. Accuracy: 0.5064 Error: 1.17879 Loss: 1.23261 Threads: 2 Forward time: 0.70s Backward time: 0.49s Step time: 2.38s\n", + "73280 Examples seen. Accuracy: 0.5059 Error: 1.12521 Loss: 1.21161 Threads: 2 Forward time: 0.67s Backward time: 0.48s Step time: 2.38s\n", + "73920 Examples seen. Accuracy: 0.5061 Error: 1.21973 Loss: 1.37913 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.37s\n", + "74560 Examples seen. Accuracy: 0.5034 Error: 1.34306 Loss: 1.40960 Threads: 2 Forward time: 0.69s Backward time: 0.48s Step time: 2.40s\n", + "75200 Examples seen. Accuracy: 0.5054 Error: 1.28294 Loss: 1.44882 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.40s\n", + "75840 Examples seen. Accuracy: 0.5065 Error: 1.37193 Loss: 1.64460 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.40s\n", + "76480 Examples seen. Accuracy: 0.5065 Error: 1.34023 Loss: 1.53348 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.46s\n", + "77120 Examples seen. Accuracy: 0.5073 Error: 1.26684 Loss: 1.33574 Threads: 2 Forward time: 0.65s Backward time: 0.50s Step time: 2.43s\n", + "77760 Examples seen. Accuracy: 0.5115 Error: 1.19319 Loss: 1.29400 Threads: 2 Forward time: 0.70s Backward time: 0.49s Step time: 2.40s\n", + "78400 Examples seen. Accuracy: 0.5139 Error: 1.18306 Loss: 1.60150 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.43s\n", + "79040 Examples seen. Accuracy: 0.5180 Error: 1.28231 Loss: 1.38482 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.39s\n", + "79680 Examples seen. Accuracy: 0.5198 Error: 1.23234 Loss: 1.17779 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.42s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 2 Examples seen:80000 Validation Accuracy: 0.5280 Validation Error: 1.2106 Validation Loss: 1.2998 Total time: 7.23min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.241 Min Weight: -0.235 Max Output: 3.830 Min Output: -3.955 TNNetConvolutionLinear 32,32,64 Times: 30.20s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.830 Min Output: -1.498 TNNetMaxPool 8,8,64 Times: 7.00s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.902 Min Weight: 0.586 Max Output: 3.596 Min Output: -2.310 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.105 Min Weight: -0.104 Max Output: 4.570 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.05s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.112 Min Weight: -0.114 Max Output: 3.343 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.01s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.117 Min Weight: -0.102 Max Output: 2.087 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.96s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.124 Min Weight: -0.108 Max Output: 1.748 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.08s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.748 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.748 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.43s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.184 Min Weight: -0.146 Max Output: 2.421 Min Output: -2.251 TNNetFullConnectLinear 10,1,1 Times: 0.08s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.578 Min Output: 0.005 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.5208 minutes. 50 epochs: 2.1007 hours.\n", + "Epochs: 2. Working time: 0.12 hours.\n", + "80640 Examples seen. Accuracy: 0.5217 Error: 1.25977 Loss: 1.32582 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.42s\n", + "81280 Examples seen. Accuracy: 0.5215 Error: 1.23738 Loss: 1.46194 Threads: 2 Forward time: 0.74s Backward time: 0.53s Step time: 2.50s\n", + "81920 Examples seen. Accuracy: 0.5240 Error: 1.36221 Loss: 1.65249 Threads: 2 Forward time: 0.72s Backward time: 0.54s Step time: 2.64s\n", + "82560 Examples seen. Accuracy: 0.5249 Error: 1.08699 Loss: 1.05420 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.50s\n", + "83200 Examples seen. Accuracy: 0.5256 Error: 1.22711 Loss: 1.34938 Threads: 2 Forward time: 0.72s Backward time: 0.49s Step time: 2.44s\n", + "83840 Examples seen. Accuracy: 0.5265 Error: 1.22419 Loss: 1.33143 Threads: 2 Forward time: 0.69s Backward time: 0.48s Step time: 2.45s\n", + "84480 Examples seen. Accuracy: 0.5255 Error: 1.28435 Loss: 1.42781 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.44s\n", + "85120 Examples seen. Accuracy: 0.5273 Error: 1.11672 Loss: 1.16786 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.46s\n", + "85760 Examples seen. Accuracy: 0.5265 Error: 1.11195 Loss: 1.16223 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.49s\n", + "86400 Examples seen. Accuracy: 0.5271 Error: 1.18559 Loss: 1.20379 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.49s\n", + "87040 Examples seen. Accuracy: 0.5304 Error: 1.06645 Loss: 1.06041 Threads: 2 Forward time: 0.67s Backward time: 0.49s Step time: 2.44s\n", + "87680 Examples seen. Accuracy: 0.5291 Error: 1.06728 Loss: 1.12536 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.44s\n", + "88320 Examples seen. Accuracy: 0.5284 Error: 1.36197 Loss: 1.49824 Threads: 2 Forward time: 0.69s Backward time: 0.48s Step time: 2.46s\n", + "88960 Examples seen. Accuracy: 0.5286 Error: 1.33446 Loss: 1.53771 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.44s\n", + "89600 Examples seen. Accuracy: 0.5299 Error: 1.20436 Loss: 1.29304 Threads: 2 Forward time: 0.71s Backward time: 0.52s Step time: 2.49s\n", + "90240 Examples seen. Accuracy: 0.5322 Error: 1.13818 Loss: 1.20439 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.48s\n", + "90880 Examples seen. Accuracy: 0.5321 Error: 1.18145 Loss: 1.34056 Threads: 2 Forward time: 0.70s Backward time: 0.50s Step time: 2.46s\n", + "91520 Examples seen. Accuracy: 0.5338 Error: 1.18489 Loss: 1.25516 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.39s\n", + "92160 Examples seen. Accuracy: 0.5332 Error: 1.06375 Loss: 1.23520 Threads: 2 Forward time: 0.68s Backward time: 0.48s Step time: 2.38s\n", + "92800 Examples seen. Accuracy: 0.5353 Error: 1.20202 Loss: 1.41078 Threads: 2 Forward time: 0.74s Backward time: 0.51s Step time: 2.40s\n", + "93440 Examples seen. Accuracy: 0.5402 Error: 1.10855 Loss: 1.23545 Threads: 2 Forward time: 0.67s Backward time: 0.48s Step time: 2.40s\n", + "94080 Examples seen. Accuracy: 0.5418 Error: 1.23072 Loss: 1.32038 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.40s\n", + "94720 Examples seen. Accuracy: 0.5421 Error: 1.19074 Loss: 1.50945 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.45s\n", + "95360 Examples seen. Accuracy: 0.5426 Error: 1.26900 Loss: 1.37056 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.42s\n", + "96000 Examples seen. Accuracy: 0.5407 Error: 1.26377 Loss: 1.49441 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.42s\n", + "96640 Examples seen. Accuracy: 0.5392 Error: 1.28611 Loss: 1.47267 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.40s\n", + "97280 Examples seen. Accuracy: 0.5416 Error: 1.18893 Loss: 1.39908 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.43s\n", + "97920 Examples seen. Accuracy: 0.5405 Error: 1.18357 Loss: 1.29477 Threads: 2 Forward time: 0.69s Backward time: 0.49s Step time: 2.40s\n", + "98560 Examples seen. Accuracy: 0.5421 Error: 1.12833 Loss: 1.16271 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.39s\n", + "99200 Examples seen. Accuracy: 0.5448 Error: 1.18661 Loss: 1.23381 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.38s\n", + "99840 Examples seen. Accuracy: 0.5451 Error: 1.13116 Loss: 1.27461 Threads: 2 Forward time: 0.70s Backward time: 0.48s Step time: 2.40s\n", + "100480 Examples seen. Accuracy: 0.5438 Error: 1.19824 Loss: 1.33744 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.42s\n", + "101120 Examples seen. Accuracy: 0.5435 Error: 1.26597 Loss: 1.40315 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.43s\n", + "101760 Examples seen. Accuracy: 0.5447 Error: 1.14179 Loss: 1.22289 Threads: 2 Forward time: 0.71s Backward time: 0.50s Step time: 2.42s\n", + "102400 Examples seen. Accuracy: 0.5426 Error: 1.16172 Loss: 1.28683 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.45s\n", + "103040 Examples seen. Accuracy: 0.5464 Error: 1.12014 Loss: 1.14475 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.46s\n", + "103680 Examples seen. Accuracy: 0.5469 Error: 1.19354 Loss: 1.35633 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.40s\n", + "104320 Examples seen. Accuracy: 0.5503 Error: 1.09195 Loss: 1.17948 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.38s\n", + "104960 Examples seen. Accuracy: 0.5537 Error: 1.13195 Loss: 1.23216 Threads: 2 Forward time: 0.70s Backward time: 0.48s Step time: 2.39s\n", + "105600 Examples seen. Accuracy: 0.5542 Error: 1.17438 Loss: 1.25003 Threads: 2 Forward time: 0.65s Backward time: 0.47s Step time: 2.38s\n", + "106240 Examples seen. Accuracy: 0.5558 Error: 1.06134 Loss: 1.15410 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.38s\n", + "106880 Examples seen. Accuracy: 0.5553 Error: 1.14725 Loss: 1.23581 Threads: 2 Forward time: 0.72s Backward time: 0.47s Step time: 2.45s\n", + "107520 Examples seen. Accuracy: 0.5565 Error: 1.02141 Loss: 1.04104 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.35s\n", + "108160 Examples seen. Accuracy: 0.5562 Error: 1.09003 Loss: 1.10040 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.35s\n", + "108800 Examples seen. Accuracy: 0.5555 Error: 1.19926 Loss: 1.41436 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.38s\n", + "109440 Examples seen. Accuracy: 0.5555 Error: 1.13296 Loss: 1.32973 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.38s\n", + "110080 Examples seen. Accuracy: 0.5564 Error: 1.19110 Loss: 1.43251 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.35s\n", + "110720 Examples seen. Accuracy: 0.5594 Error: 1.14849 Loss: 1.27873 Threads: 2 Forward time: 0.69s Backward time: 0.52s Step time: 2.38s\n", + "111360 Examples seen. Accuracy: 0.5613 Error: 1.11265 Loss: 1.26440 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.42s\n", + "112000 Examples seen. Accuracy: 0.5588 Error: 1.05700 Loss: 1.13769 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.39s\n", + "112640 Examples seen. Accuracy: 0.5605 Error: 1.04210 Loss: 1.11334 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.36s\n", + "113280 Examples seen. Accuracy: 0.5577 Error: 1.08367 Loss: 1.09816 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.34s\n", + "113920 Examples seen. Accuracy: 0.5577 Error: 1.10999 Loss: 1.16392 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.35s\n", + "114560 Examples seen. Accuracy: 0.5576 Error: 1.12588 Loss: 1.15112 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.35s\n", + "115200 Examples seen. Accuracy: 0.5564 Error: 1.14632 Loss: 1.30112 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.38s\n", + "115840 Examples seen. Accuracy: 0.5592 Error: 1.13579 Loss: 1.28841 Threads: 2 Forward time: 0.66s Backward time: 0.48s Step time: 2.35s\n", + "116480 Examples seen. Accuracy: 0.5598 Error: 1.14585 Loss: 1.20761 Threads: 2 Forward time: 0.65s Backward time: 0.48s Step time: 2.35s\n", + "117120 Examples seen. Accuracy: 0.5603 Error: 1.03519 Loss: 1.08286 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.39s\n", + "117760 Examples seen. Accuracy: 0.5624 Error: 1.03469 Loss: 1.14592 Threads: 2 Forward time: 0.65s Backward time: 0.48s Step time: 2.37s\n", + "118400 Examples seen. Accuracy: 0.5621 Error: 1.12518 Loss: 1.22586 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.35s\n", + "119040 Examples seen. Accuracy: 0.5648 Error: 1.06442 Loss: 1.03027 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.36s\n", + "119680 Examples seen. Accuracy: 0.5632 Error: 1.14389 Loss: 1.19306 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.34s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 3 Examples seen:120000 Validation Accuracy: 0.5486 Validation Error: 1.1838 Validation Loss: 1.2516 Total time: 10.79min\n", + "Epoch time: 2.4354 minutes. 50 epochs: 2.0295 hours.\n", + "Epochs: 3. Working time: 0.18 hours.\n", + "120640 Examples seen. Accuracy: 0.5678 Error: 1.15427 Loss: 1.31939 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.36s\n", + "121280 Examples seen. Accuracy: 0.5715 Error: 1.17294 Loss: 1.40640 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.37s\n", + "121920 Examples seen. Accuracy: 0.5726 Error: 1.23617 Loss: 1.31894 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.37s\n", + "122560 Examples seen. Accuracy: 0.5752 Error: 1.14357 Loss: 1.25303 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.34s\n", + "123200 Examples seen. Accuracy: 0.5775 Error: 1.09119 Loss: 1.19887 Threads: 2 Forward time: 0.65s Backward time: 0.46s Step time: 2.35s\n", + "123840 Examples seen. Accuracy: 0.5796 Error: 0.94131 Loss: 1.00081 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.40s\n", + "124480 Examples seen. Accuracy: 0.5807 Error: 1.01060 Loss: 1.14257 Threads: 2 Forward time: 0.68s Backward time: 0.48s Step time: 2.39s\n", + "125120 Examples seen. Accuracy: 0.5856 Error: 1.07786 Loss: 1.16765 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.36s\n", + "125760 Examples seen. Accuracy: 0.5845 Error: 1.03366 Loss: 1.01894 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.41s\n", + "126400 Examples seen. Accuracy: 0.5819 Error: 1.14479 Loss: 1.12500 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.34s\n", + "127040 Examples seen. Accuracy: 0.5790 Error: 1.11493 Loss: 1.27241 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.32s\n", + "127680 Examples seen. Accuracy: 0.5763 Error: 1.20491 Loss: 1.40975 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.33s\n", + "128320 Examples seen. Accuracy: 0.5772 Error: 1.05885 Loss: 1.15720 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.34s\n", + "128960 Examples seen. Accuracy: 0.5772 Error: 1.25268 Loss: 1.32778 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.36s\n", + "129600 Examples seen. Accuracy: 0.5773 Error: 1.08535 Loss: 1.18995 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.35s\n", + "130240 Examples seen. Accuracy: 0.5787 Error: 1.03734 Loss: 1.07496 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.34s\n", + "130880 Examples seen. Accuracy: 0.5809 Error: 1.09932 Loss: 1.21523 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.35s\n", + "131520 Examples seen. Accuracy: 0.5821 Error: 0.99388 Loss: 0.99963 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.38s\n", + "132160 Examples seen. Accuracy: 0.5808 Error: 1.14672 Loss: 1.22018 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.36s\n", + "132800 Examples seen. Accuracy: 0.5827 Error: 1.11488 Loss: 1.23393 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.35s\n", + "133440 Examples seen. Accuracy: 0.5825 Error: 1.05946 Loss: 1.21389 Threads: 2 Forward time: 0.71s Backward time: 0.45s Step time: 2.37s\n", + "134080 Examples seen. Accuracy: 0.5834 Error: 1.05712 Loss: 1.07691 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.39s\n", + "134720 Examples seen. Accuracy: 0.5837 Error: 1.10804 Loss: 1.18131 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.36s\n", + "135360 Examples seen. Accuracy: 0.5829 Error: 1.10233 Loss: 1.17018 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.35s\n", + "136000 Examples seen. Accuracy: 0.5827 Error: 1.17012 Loss: 1.17661 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.36s\n", + "136640 Examples seen. Accuracy: 0.5824 Error: 1.11954 Loss: 1.15826 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.36s\n", + "137280 Examples seen. Accuracy: 0.5859 Error: 0.87084 Loss: 0.88198 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.37s\n", + "137920 Examples seen. Accuracy: 0.5853 Error: 1.03737 Loss: 1.08369 Threads: 2 Forward time: 0.70s Backward time: 0.48s Step time: 2.36s\n", + "138560 Examples seen. Accuracy: 0.5849 Error: 1.15893 Loss: 1.14778 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.35s\n", + "139200 Examples seen. Accuracy: 0.5793 Error: 1.18279 Loss: 1.34970 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.35s\n", + "139840 Examples seen. Accuracy: 0.5813 Error: 1.14796 Loss: 1.35672 Threads: 2 Forward time: 0.69s Backward time: 0.47s Step time: 2.38s\n", + "140480 Examples seen. Accuracy: 0.5845 Error: 1.14214 Loss: 1.26108 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.35s\n", + "141120 Examples seen. Accuracy: 0.5847 Error: 1.01864 Loss: 1.15375 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.36s\n", + "141760 Examples seen. Accuracy: 0.5884 Error: 0.91631 Loss: 0.91500 Threads: 2 Forward time: 0.70s Backward time: 0.45s Step time: 2.35s\n", + "142400 Examples seen. Accuracy: 0.5892 Error: 0.97186 Loss: 1.09613 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.40s\n", + "143040 Examples seen. Accuracy: 0.5880 Error: 1.14412 Loss: 1.22655 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.39s\n", + "143680 Examples seen. Accuracy: 0.5862 Error: 1.07820 Loss: 1.13345 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.40s\n", + "144320 Examples seen. Accuracy: 0.5867 Error: 1.04732 Loss: 1.10469 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.37s\n", + "144960 Examples seen. Accuracy: 0.5884 Error: 1.08661 Loss: 1.40247 Threads: 2 Forward time: 0.69s Backward time: 0.47s Step time: 2.35s\n", + "145600 Examples seen. Accuracy: 0.5886 Error: 1.07829 Loss: 1.27540 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.51s\n", + "146240 Examples seen. Accuracy: 0.5902 Error: 1.03226 Loss: 1.03883 Threads: 2 Forward time: 0.70s Backward time: 0.49s Step time: 2.46s\n", + "146880 Examples seen. Accuracy: 0.5899 Error: 1.12810 Loss: 1.28696 Threads: 2 Forward time: 0.73s Backward time: 0.47s Step time: 2.44s\n", + "147520 Examples seen. Accuracy: 0.5928 Error: 1.01543 Loss: 1.00434 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.39s\n", + "148160 Examples seen. Accuracy: 0.5915 Error: 1.11240 Loss: 1.34505 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.38s\n", + "148800 Examples seen. Accuracy: 0.5906 Error: 1.02513 Loss: 1.01837 Threads: 2 Forward time: 0.70s Backward time: 0.48s Step time: 2.37s\n", + "149440 Examples seen. Accuracy: 0.5902 Error: 0.98376 Loss: 0.96761 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.34s\n", + "150080 Examples seen. Accuracy: 0.5931 Error: 0.96226 Loss: 1.04849 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.35s\n", + "150720 Examples seen. Accuracy: 0.5935 Error: 1.10129 Loss: 1.17258 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.38s\n", + "151360 Examples seen. Accuracy: 0.5923 Error: 1.02696 Loss: 1.02534 Threads: 2 Forward time: 0.72s Backward time: 0.47s Step time: 2.40s\n", + "152000 Examples seen. Accuracy: 0.5943 Error: 1.00840 Loss: 1.04701 Threads: 2 Forward time: 0.67s Backward time: 0.48s Step time: 2.41s\n", + "152640 Examples seen. Accuracy: 0.5934 Error: 1.05954 Loss: 1.14086 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.35s\n", + "153280 Examples seen. Accuracy: 0.5957 Error: 1.05938 Loss: 1.15342 Threads: 2 Forward time: 0.73s Backward time: 0.44s Step time: 2.38s\n", + "153920 Examples seen. Accuracy: 0.5931 Error: 0.98127 Loss: 1.00095 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.37s\n", + "154560 Examples seen. Accuracy: 0.5938 Error: 0.97991 Loss: 1.05079 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.34s\n", + "155200 Examples seen. Accuracy: 0.5955 Error: 1.07636 Loss: 1.25756 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.39s\n", + "155840 Examples seen. Accuracy: 0.5973 Error: 0.92489 Loss: 0.95511 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.36s\n", + "156480 Examples seen. Accuracy: 0.5995 Error: 0.98247 Loss: 1.04234 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.40s\n", + "157120 Examples seen. Accuracy: 0.5993 Error: 1.02203 Loss: 1.08866 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.38s\n", + "157760 Examples seen. Accuracy: 0.6029 Error: 0.92700 Loss: 0.94507 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.34s\n", + "158400 Examples seen. Accuracy: 0.6019 Error: 1.04495 Loss: 1.01813 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.34s\n", + "159040 Examples seen. Accuracy: 0.6036 Error: 0.88928 Loss: 1.08346 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.37s\n", + "159680 Examples seen. Accuracy: 0.6046 Error: 1.04162 Loss: 1.01996 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.33s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 4 Examples seen:160000 Validation Accuracy: 0.5712 Validation Error: 1.1551 Validation Loss: 1.2014 Total time: 14.30min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.252 Min Weight: -0.242 Max Output: 3.777 Min Output: -3.985 TNNetConvolutionLinear 32,32,64 Times: 30.15s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.777 Min Output: -1.254 TNNetMaxPool 8,8,64 Times: 6.89s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.861 Min Weight: 0.596 Max Output: 3.696 Min Output: -2.149 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.107 Min Weight: -0.110 Max Output: 4.717 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.03s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.114 Min Weight: -0.116 Max Output: 3.411 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.10s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.124 Min Weight: -0.108 Max Output: 1.954 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.91s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.127 Min Weight: -0.113 Max Output: 1.609 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.11s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.609 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.609 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.48s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.186 Min Weight: -0.146 Max Output: 2.576 Min Output: -2.644 TNNetFullConnectLinear 10,1,1 Times: 0.10s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.554 Min Output: 0.003 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.4229 minutes. 50 epochs: 2.0191 hours.\n", + "Epochs: 4. Working time: 0.24 hours.\n", + "160640 Examples seen. Accuracy: 0.6022 Error: 1.02820 Loss: 1.13428 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.38s\n", + "161280 Examples seen. Accuracy: 0.6022 Error: 1.05159 Loss: 1.05270 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.33s\n", + "161920 Examples seen. Accuracy: 0.6058 Error: 1.00540 Loss: 1.10244 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.36s\n", + "162560 Examples seen. Accuracy: 0.6051 Error: 0.97309 Loss: 0.98486 Threads: 2 Forward time: 0.72s Backward time: 0.45s Step time: 2.32s\n", + "163200 Examples seen. Accuracy: 0.6049 Error: 1.02378 Loss: 1.09324 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.32s\n", + "163840 Examples seen. Accuracy: 0.6050 Error: 0.98171 Loss: 1.05447 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.38s\n", + "164480 Examples seen. Accuracy: 0.6063 Error: 1.08927 Loss: 1.17961 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.36s\n", + "165120 Examples seen. Accuracy: 0.6057 Error: 1.07732 Loss: 1.12248 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "165760 Examples seen. Accuracy: 0.6063 Error: 0.92235 Loss: 0.98999 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.32s\n", + "166400 Examples seen. Accuracy: 0.6082 Error: 1.01425 Loss: 1.06065 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.32s\n", + "167040 Examples seen. Accuracy: 0.6063 Error: 1.04411 Loss: 1.14851 Threads: 2 Forward time: 0.74s Backward time: 0.47s Step time: 2.36s\n", + "167680 Examples seen. Accuracy: 0.6105 Error: 0.84269 Loss: 0.85942 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.38s\n", + "168320 Examples seen. Accuracy: 0.6112 Error: 1.09453 Loss: 1.24523 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.32s\n", + "168960 Examples seen. Accuracy: 0.6112 Error: 0.96294 Loss: 1.00242 Threads: 2 Forward time: 0.71s Backward time: 0.45s Step time: 2.32s\n", + "169600 Examples seen. Accuracy: 0.6121 Error: 1.07545 Loss: 1.16168 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.37s\n", + "170240 Examples seen. Accuracy: 0.6138 Error: 1.01232 Loss: 1.10694 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.36s\n", + "170880 Examples seen. Accuracy: 0.6122 Error: 1.10105 Loss: 1.30855 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.37s\n", + "171520 Examples seen. Accuracy: 0.6142 Error: 1.06088 Loss: 1.04755 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.35s\n", + "172160 Examples seen. Accuracy: 0.6199 Error: 0.83291 Loss: 1.01911 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.31s\n", + "172800 Examples seen. Accuracy: 0.6223 Error: 0.85590 Loss: 0.78383 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.36s\n", + "173440 Examples seen. Accuracy: 0.6198 Error: 1.06112 Loss: 1.14728 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.34s\n", + "174080 Examples seen. Accuracy: 0.6217 Error: 0.97505 Loss: 0.93777 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.33s\n", + "174720 Examples seen. Accuracy: 0.6211 Error: 0.97522 Loss: 1.03195 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.36s\n", + "175360 Examples seen. Accuracy: 0.6228 Error: 0.87507 Loss: 0.88380 Threads: 2 Forward time: 0.72s Backward time: 0.46s Step time: 2.37s\n", + "176000 Examples seen. Accuracy: 0.6212 Error: 1.16597 Loss: 1.20718 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.35s\n", + "176640 Examples seen. Accuracy: 0.6230 Error: 1.01122 Loss: 1.18690 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.34s\n", + "177280 Examples seen. Accuracy: 0.6185 Error: 1.02248 Loss: 0.98817 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.35s\n", + "177920 Examples seen. Accuracy: 0.6188 Error: 1.06655 Loss: 1.06127 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.33s\n", + "178560 Examples seen. Accuracy: 0.6180 Error: 0.97312 Loss: 1.14437 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.38s\n", + "179200 Examples seen. Accuracy: 0.6215 Error: 1.03910 Loss: 1.08587 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.34s\n", + "179840 Examples seen. Accuracy: 0.6208 Error: 0.98562 Loss: 1.01533 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.34s\n", + "180480 Examples seen. Accuracy: 0.6212 Error: 1.02901 Loss: 1.27258 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.34s\n", + "181120 Examples seen. Accuracy: 0.6230 Error: 0.83415 Loss: 0.82829 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.37s\n", + "181760 Examples seen. Accuracy: 0.6233 Error: 0.97535 Loss: 0.99595 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.34s\n", + "182400 Examples seen. Accuracy: 0.6225 Error: 0.87811 Loss: 0.85344 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.35s\n", + "183040 Examples seen. Accuracy: 0.6225 Error: 0.85728 Loss: 0.80623 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.32s\n", + "183680 Examples seen. Accuracy: 0.6218 Error: 0.92311 Loss: 0.95655 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.37s\n", + "184320 Examples seen. Accuracy: 0.6234 Error: 0.94198 Loss: 0.93368 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.38s\n", + "184960 Examples seen. Accuracy: 0.6222 Error: 0.94934 Loss: 0.99408 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.40s\n", + "185600 Examples seen. Accuracy: 0.6199 Error: 0.90684 Loss: 1.01579 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.37s\n", + "186240 Examples seen. Accuracy: 0.6204 Error: 0.95989 Loss: 1.00655 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.33s\n", + "186880 Examples seen. Accuracy: 0.6219 Error: 0.96921 Loss: 1.03707 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.33s\n", + "187520 Examples seen. Accuracy: 0.6229 Error: 1.06548 Loss: 1.11824 Threads: 2 Forward time: 0.69s Backward time: 0.48s Step time: 2.37s\n", + "188160 Examples seen. Accuracy: 0.6253 Error: 1.05412 Loss: 1.07881 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.33s\n", + "188800 Examples seen. Accuracy: 0.6247 Error: 1.00579 Loss: 1.13074 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.33s\n", + "189440 Examples seen. Accuracy: 0.6280 Error: 0.94236 Loss: 0.97535 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.36s\n", + "190080 Examples seen. Accuracy: 0.6275 Error: 1.01475 Loss: 1.00532 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.33s\n", + "190720 Examples seen. Accuracy: 0.6283 Error: 0.91269 Loss: 0.97482 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.33s\n", + "191360 Examples seen. Accuracy: 0.6280 Error: 0.92642 Loss: 1.02756 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.34s\n", + "192000 Examples seen. Accuracy: 0.6243 Error: 0.82342 Loss: 0.87881 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.33s\n", + "192640 Examples seen. Accuracy: 0.6259 Error: 0.93359 Loss: 1.03371 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.36s\n", + "193280 Examples seen. Accuracy: 0.6257 Error: 1.01015 Loss: 1.11906 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.37s\n", + "193920 Examples seen. Accuracy: 0.6241 Error: 0.92462 Loss: 0.98118 Threads: 2 Forward time: 0.70s Backward time: 0.45s Step time: 2.34s\n", + "194560 Examples seen. Accuracy: 0.6237 Error: 1.00565 Loss: 1.07568 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.32s\n", + "195200 Examples seen. Accuracy: 0.6277 Error: 0.80101 Loss: 0.83433 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.32s\n", + "195840 Examples seen. Accuracy: 0.6305 Error: 0.94517 Loss: 1.12437 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.32s\n", + "196480 Examples seen. Accuracy: 0.6321 Error: 1.04707 Loss: 1.12696 Threads: 2 Forward time: 0.71s Backward time: 0.46s Step time: 2.33s\n", + "197120 Examples seen. Accuracy: 0.6312 Error: 0.92833 Loss: 0.96707 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.32s\n", + "197760 Examples seen. Accuracy: 0.6345 Error: 0.87504 Loss: 0.87752 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.33s\n", + "198400 Examples seen. Accuracy: 0.6382 Error: 0.97443 Loss: 0.97866 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.32s\n", + "199040 Examples seen. Accuracy: 0.6379 Error: 1.00369 Loss: 1.13482 Threads: 2 Forward time: 0.69s Backward time: 0.47s Step time: 2.36s\n", + "199680 Examples seen. Accuracy: 0.6357 Error: 0.79795 Loss: 0.78376 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.36s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 5 Examples seen:200000 Validation Accuracy: 0.5977 Validation Error: 1.1206 Validation Loss: 1.1437 Total time: 17.79min\n", + "Epoch time: 2.4615 minutes. 50 epochs: 2.0512 hours.\n", + "Epochs: 5. Working time: 0.30 hours.\n", + "200640 Examples seen. Accuracy: 0.6340 Error: 0.92656 Loss: 1.00299 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.33s\n", + "201280 Examples seen. Accuracy: 0.6319 Error: 0.95938 Loss: 1.14827 Threads: 2 Forward time: 0.69s Backward time: 0.49s Step time: 2.35s\n", + "201920 Examples seen. Accuracy: 0.6293 Error: 1.06460 Loss: 1.11463 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.32s\n", + "202560 Examples seen. Accuracy: 0.6257 Error: 0.99327 Loss: 1.10830 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.33s\n", + "203200 Examples seen. Accuracy: 0.6257 Error: 0.89696 Loss: 0.90306 Threads: 2 Forward time: 0.71s Backward time: 0.47s Step time: 2.36s\n", + "203840 Examples seen. Accuracy: 0.6308 Error: 0.81209 Loss: 0.86287 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.36s\n", + "204480 Examples seen. Accuracy: 0.6313 Error: 0.88187 Loss: 0.90381 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.34s\n", + "205120 Examples seen. Accuracy: 0.6372 Error: 0.82707 Loss: 0.79100 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.36s\n", + "205760 Examples seen. Accuracy: 0.6351 Error: 0.96984 Loss: 1.02852 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.31s\n", + "206400 Examples seen. Accuracy: 0.6350 Error: 0.95105 Loss: 0.96745 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.29s\n", + "207040 Examples seen. Accuracy: 0.6359 Error: 0.97298 Loss: 0.95440 Threads: 2 Forward time: 0.65s Backward time: 0.46s Step time: 2.29s\n", + "207680 Examples seen. Accuracy: 0.6369 Error: 0.95721 Loss: 1.03644 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.34s\n", + "208320 Examples seen. Accuracy: 0.6389 Error: 0.77683 Loss: 0.88934 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.33s\n", + "208960 Examples seen. Accuracy: 0.6370 Error: 0.84208 Loss: 0.83019 Threads: 2 Forward time: 0.69s Backward time: 0.47s Step time: 2.33s\n", + "209600 Examples seen. Accuracy: 0.6378 Error: 0.92404 Loss: 0.92688 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.32s\n", + "210240 Examples seen. Accuracy: 0.6371 Error: 0.91755 Loss: 0.93381 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.31s\n", + "210880 Examples seen. Accuracy: 0.6349 Error: 1.07281 Loss: 1.23049 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.37s\n", + "211520 Examples seen. Accuracy: 0.6344 Error: 0.88252 Loss: 0.87913 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.32s\n", + "212160 Examples seen. Accuracy: 0.6370 Error: 0.78111 Loss: 0.80427 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.29s\n", + "212800 Examples seen. Accuracy: 0.6374 Error: 0.80105 Loss: 0.83192 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.31s\n", + "213440 Examples seen. Accuracy: 0.6397 Error: 0.87028 Loss: 0.82421 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.29s\n", + "214080 Examples seen. Accuracy: 0.6382 Error: 1.02596 Loss: 1.48838 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.30s\n", + "214720 Examples seen. Accuracy: 0.6414 Error: 0.99155 Loss: 1.09154 Threads: 2 Forward time: 0.69s Backward time: 0.47s Step time: 2.32s\n", + "215360 Examples seen. Accuracy: 0.6396 Error: 0.92797 Loss: 0.98854 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.31s\n", + "216000 Examples seen. Accuracy: 0.6380 Error: 1.10293 Loss: 1.22358 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.38s\n", + "216640 Examples seen. Accuracy: 0.6399 Error: 1.02033 Loss: 1.33986 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.32s\n", + "217280 Examples seen. Accuracy: 0.6402 Error: 0.97859 Loss: 1.13347 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.34s\n", + "217920 Examples seen. Accuracy: 0.6403 Error: 1.07421 Loss: 1.19600 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "218560 Examples seen. Accuracy: 0.6415 Error: 1.01226 Loss: 1.23750 Threads: 2 Forward time: 0.71s Backward time: 0.46s Step time: 2.31s\n", + "219200 Examples seen. Accuracy: 0.6431 Error: 0.93929 Loss: 1.00604 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.30s\n", + "219840 Examples seen. Accuracy: 0.6442 Error: 1.01110 Loss: 1.01819 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.34s\n", + "220480 Examples seen. Accuracy: 0.6451 Error: 1.04194 Loss: 1.14600 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.33s\n", + "221120 Examples seen. Accuracy: 0.6445 Error: 0.86636 Loss: 0.92328 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.30s\n", + "221760 Examples seen. Accuracy: 0.6457 Error: 0.94119 Loss: 1.10345 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.31s\n", + "222400 Examples seen. Accuracy: 0.6417 Error: 1.01641 Loss: 1.17796 Threads: 2 Forward time: 0.65s Backward time: 0.44s Step time: 2.30s\n", + "223040 Examples seen. Accuracy: 0.6434 Error: 0.92372 Loss: 1.09811 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.29s\n", + "223680 Examples seen. Accuracy: 0.6424 Error: 0.87976 Loss: 0.83098 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.31s\n", + "224320 Examples seen. Accuracy: 0.6400 Error: 0.97100 Loss: 0.93698 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "224960 Examples seen. Accuracy: 0.6404 Error: 0.94412 Loss: 1.03400 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.36s\n", + "225600 Examples seen. Accuracy: 0.6386 Error: 0.96877 Loss: 1.09604 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.37s\n", + "226240 Examples seen. Accuracy: 0.6413 Error: 0.68084 Loss: 0.68411 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.35s\n", + "226880 Examples seen. Accuracy: 0.6399 Error: 1.01626 Loss: 1.09217 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.31s\n", + "227520 Examples seen. Accuracy: 0.6425 Error: 0.94883 Loss: 1.13541 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.30s\n", + "228160 Examples seen. Accuracy: 0.6426 Error: 0.90699 Loss: 1.01289 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.29s\n", + "228800 Examples seen. Accuracy: 0.6450 Error: 0.96422 Loss: 1.22883 Threads: 2 Forward time: 0.72s Backward time: 0.46s Step time: 2.34s\n", + "229440 Examples seen. Accuracy: 0.6438 Error: 0.88007 Loss: 0.82281 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.30s\n", + "230080 Examples seen. Accuracy: 0.6428 Error: 0.91463 Loss: 1.09818 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.32s\n", + "230720 Examples seen. Accuracy: 0.6405 Error: 1.00789 Loss: 1.14272 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.31s\n", + "231360 Examples seen. Accuracy: 0.6418 Error: 0.96387 Loss: 0.99789 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.33s\n", + "232000 Examples seen. Accuracy: 0.6426 Error: 0.99947 Loss: 1.00277 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.33s\n", + "232640 Examples seen. Accuracy: 0.6425 Error: 0.99527 Loss: 1.03264 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.31s\n", + "233280 Examples seen. Accuracy: 0.6431 Error: 1.01942 Loss: 1.32953 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.31s\n", + "233920 Examples seen. Accuracy: 0.6430 Error: 0.91747 Loss: 0.95371 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "234560 Examples seen. Accuracy: 0.6425 Error: 0.94861 Loss: 0.99667 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.33s\n", + "235200 Examples seen. Accuracy: 0.6414 Error: 0.96205 Loss: 1.11025 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.30s\n", + "235840 Examples seen. Accuracy: 0.6411 Error: 0.96424 Loss: 1.07136 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.32s\n", + "236480 Examples seen. Accuracy: 0.6402 Error: 0.83694 Loss: 0.84988 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.29s\n", + "237120 Examples seen. Accuracy: 0.6417 Error: 0.83658 Loss: 0.84442 Threads: 2 Forward time: 0.71s Backward time: 0.48s Step time: 2.33s\n", + "237760 Examples seen. Accuracy: 0.6438 Error: 0.83238 Loss: 0.87519 Threads: 2 Forward time: 0.71s Backward time: 0.48s Step time: 2.43s\n", + "238400 Examples seen. Accuracy: 0.6467 Error: 0.81255 Loss: 0.89347 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.38s\n", + "239040 Examples seen. Accuracy: 0.6485 Error: 1.01966 Loss: 1.11521 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.32s\n", + "239680 Examples seen. Accuracy: 0.6502 Error: 0.85513 Loss: 0.85761 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 6 Examples seen:240000 Validation Accuracy: 0.6216 Validation Error: 1.0832 Validation Loss: 1.0860 Total time: 21.25min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.267 Min Weight: -0.266 Max Output: 3.712 Min Output: -4.069 TNNetConvolutionLinear 32,32,64 Times: 30.14s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.712 Min Output: -1.107 TNNetMaxPool 8,8,64 Times: 7.06s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.809 Min Weight: 0.611 Max Output: 3.833 Min Output: -2.124 TNNetMovingStdNormalization 8,8,64 Times: 0.13s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.113 Min Weight: -0.118 Max Output: 5.113 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.98s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.128 Min Weight: -0.121 Max Output: 3.537 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.97s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.132 Min Weight: -0.118 Max Output: 2.158 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.09s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.129 Min Weight: -0.119 Max Output: 1.431 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.13s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.431 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.431 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.45s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.188 Min Weight: -0.155 Max Output: 2.511 Min Output: -3.327 TNNetFullConnectLinear 10,1,1 Times: 0.08s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.482 Min Output: 0.001 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.4021 minutes. 50 epochs: 2.0017 hours.\n", + "Epochs: 6. Working time: 0.35 hours.\n", + "240640 Examples seen. Accuracy: 0.6514 Error: 1.05593 Loss: 1.24585 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "241280 Examples seen. Accuracy: 0.6528 Error: 1.00934 Loss: 1.21984 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.29s\n", + "241920 Examples seen. Accuracy: 0.6512 Error: 0.98645 Loss: 0.99501 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.28s\n", + "242560 Examples seen. Accuracy: 0.6503 Error: 0.97602 Loss: 1.06098 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.29s\n", + "243200 Examples seen. Accuracy: 0.6483 Error: 0.93434 Loss: 0.93540 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "243840 Examples seen. Accuracy: 0.6486 Error: 0.87679 Loss: 0.86060 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.27s\n", + "244480 Examples seen. Accuracy: 0.6480 Error: 0.90356 Loss: 0.97229 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.30s\n", + "245120 Examples seen. Accuracy: 0.6462 Error: 1.09681 Loss: 1.24257 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "245760 Examples seen. Accuracy: 0.6484 Error: 0.80445 Loss: 0.87402 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "246400 Examples seen. Accuracy: 0.6497 Error: 0.89923 Loss: 0.95752 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.34s\n", + "247040 Examples seen. Accuracy: 0.6525 Error: 0.93155 Loss: 0.95608 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.31s\n", + "247680 Examples seen. Accuracy: 0.6504 Error: 0.92839 Loss: 0.87156 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "248320 Examples seen. Accuracy: 0.6497 Error: 0.97887 Loss: 1.11965 Threads: 2 Forward time: 0.65s Backward time: 0.45s Step time: 2.27s\n", + "248960 Examples seen. Accuracy: 0.6520 Error: 0.86699 Loss: 0.92019 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "249600 Examples seen. Accuracy: 0.6523 Error: 0.90719 Loss: 1.00199 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.27s\n", + "250240 Examples seen. Accuracy: 0.6530 Error: 0.90950 Loss: 1.07124 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "250880 Examples seen. Accuracy: 0.6544 Error: 0.80067 Loss: 0.80112 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "251520 Examples seen. Accuracy: 0.6582 Error: 0.74866 Loss: 0.74906 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.28s\n", + "252160 Examples seen. Accuracy: 0.6592 Error: 0.89516 Loss: 0.91860 Threads: 2 Forward time: 0.73s Backward time: 0.44s Step time: 2.32s\n", + "252800 Examples seen. Accuracy: 0.6594 Error: 0.81464 Loss: 0.81126 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.32s\n", + "253440 Examples seen. Accuracy: 0.6575 Error: 0.94119 Loss: 1.14373 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.31s\n", + "254080 Examples seen. Accuracy: 0.6591 Error: 0.72000 Loss: 0.73080 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.28s\n", + "254720 Examples seen. Accuracy: 0.6598 Error: 0.89996 Loss: 0.99644 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.29s\n", + "255360 Examples seen. Accuracy: 0.6626 Error: 0.71628 Loss: 0.80722 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "256000 Examples seen. Accuracy: 0.6633 Error: 0.87480 Loss: 0.90962 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "256640 Examples seen. Accuracy: 0.6648 Error: 0.71119 Loss: 0.71887 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "257280 Examples seen. Accuracy: 0.6637 Error: 0.81723 Loss: 0.85206 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "257920 Examples seen. Accuracy: 0.6626 Error: 1.09709 Loss: 1.18089 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.32s\n", + "258560 Examples seen. Accuracy: 0.6639 Error: 1.02364 Loss: 1.12581 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.37s\n", + "259200 Examples seen. Accuracy: 0.6655 Error: 0.71246 Loss: 0.77271 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.36s\n", + "259840 Examples seen. Accuracy: 0.6642 Error: 0.94031 Loss: 1.10884 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.34s\n", + "260480 Examples seen. Accuracy: 0.6633 Error: 0.95615 Loss: 1.12876 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "261120 Examples seen. Accuracy: 0.6620 Error: 0.88772 Loss: 1.07373 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "261760 Examples seen. Accuracy: 0.6620 Error: 0.98767 Loss: 1.01650 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.33s\n", + "262400 Examples seen. Accuracy: 0.6634 Error: 0.83257 Loss: 0.82805 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.32s\n", + "263040 Examples seen. Accuracy: 0.6635 Error: 0.90364 Loss: 0.98802 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.32s\n", + "263680 Examples seen. Accuracy: 0.6633 Error: 0.79628 Loss: 1.09021 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.32s\n", + "264320 Examples seen. Accuracy: 0.6649 Error: 0.85204 Loss: 0.94030 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.30s\n", + "264960 Examples seen. Accuracy: 0.6628 Error: 0.86950 Loss: 0.95321 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.26s\n", + "265600 Examples seen. Accuracy: 0.6644 Error: 0.85000 Loss: 0.96080 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "266240 Examples seen. Accuracy: 0.6613 Error: 0.93168 Loss: 1.06479 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "266880 Examples seen. Accuracy: 0.6585 Error: 0.93783 Loss: 0.95848 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "267520 Examples seen. Accuracy: 0.6588 Error: 1.06285 Loss: 1.23863 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.32s\n", + "268160 Examples seen. Accuracy: 0.6592 Error: 0.91578 Loss: 0.92424 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.32s\n", + "268800 Examples seen. Accuracy: 0.6577 Error: 0.80375 Loss: 0.81949 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.31s\n", + "269440 Examples seen. Accuracy: 0.6588 Error: 0.90486 Loss: 1.01750 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.30s\n", + "270080 Examples seen. Accuracy: 0.6619 Error: 0.94658 Loss: 1.00524 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.25s\n", + "270720 Examples seen. Accuracy: 0.6604 Error: 0.87354 Loss: 0.95574 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "271360 Examples seen. Accuracy: 0.6600 Error: 0.88130 Loss: 1.03322 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.28s\n", + "272000 Examples seen. Accuracy: 0.6568 Error: 0.99213 Loss: 0.98421 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "272640 Examples seen. Accuracy: 0.6519 Error: 0.96752 Loss: 0.98813 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.31s\n", + "273280 Examples seen. Accuracy: 0.6512 Error: 1.09135 Loss: 1.28151 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.30s\n", + "273920 Examples seen. Accuracy: 0.6534 Error: 0.81518 Loss: 0.76397 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "274560 Examples seen. Accuracy: 0.6545 Error: 0.81300 Loss: 0.84880 Threads: 2 Forward time: 0.70s Backward time: 0.45s Step time: 2.29s\n", + "275200 Examples seen. Accuracy: 0.6529 Error: 0.85933 Loss: 0.85624 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.37s\n", + "275840 Examples seen. Accuracy: 0.6539 Error: 1.01306 Loss: 1.04145 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.30s\n", + "276480 Examples seen. Accuracy: 0.6572 Error: 0.95905 Loss: 1.08669 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "277120 Examples seen. Accuracy: 0.6537 Error: 0.86275 Loss: 0.91495 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.36s\n", + "277760 Examples seen. Accuracy: 0.6540 Error: 0.92852 Loss: 0.86510 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.33s\n", + "278400 Examples seen. Accuracy: 0.6537 Error: 0.94450 Loss: 1.03397 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.31s\n", + "279040 Examples seen. Accuracy: 0.6558 Error: 0.83445 Loss: 1.00823 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.30s\n", + "279680 Examples seen. Accuracy: 0.6608 Error: 0.93242 Loss: 1.11469 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.34s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 7 Examples seen:280000 Validation Accuracy: 0.6468 Validation Error: 1.0372 Validation Loss: 1.0213 Total time: 24.69min\n", + "Epoch time: 2.4375 minutes. 50 epochs: 2.0313 hours.\n", + "Epochs: 7. Working time: 0.41 hours.\n", + "280640 Examples seen. Accuracy: 0.6595 Error: 0.82600 Loss: 0.94376 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "281280 Examples seen. Accuracy: 0.6623 Error: 0.90251 Loss: 0.96588 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.26s\n", + "281920 Examples seen. Accuracy: 0.6631 Error: 0.89004 Loss: 0.82104 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "282560 Examples seen. Accuracy: 0.6635 Error: 0.88271 Loss: 1.00724 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.30s\n", + "283200 Examples seen. Accuracy: 0.6644 Error: 0.62600 Loss: 0.60408 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.29s\n", + "283840 Examples seen. Accuracy: 0.6698 Error: 0.71501 Loss: 0.73127 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.32s\n", + "284480 Examples seen. Accuracy: 0.6680 Error: 0.92484 Loss: 1.00859 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.29s\n", + "285120 Examples seen. Accuracy: 0.6687 Error: 0.93158 Loss: 1.05683 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "285760 Examples seen. Accuracy: 0.6653 Error: 1.02391 Loss: 1.05976 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "286400 Examples seen. Accuracy: 0.6670 Error: 0.69469 Loss: 0.70708 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "287040 Examples seen. Accuracy: 0.6678 Error: 0.72668 Loss: 0.71559 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.29s\n", + "287680 Examples seen. Accuracy: 0.6666 Error: 0.91634 Loss: 0.93299 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "288320 Examples seen. Accuracy: 0.6669 Error: 0.88425 Loss: 0.84828 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "288960 Examples seen. Accuracy: 0.6679 Error: 0.83965 Loss: 0.85687 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "289600 Examples seen. Accuracy: 0.6701 Error: 0.79211 Loss: 0.77677 Threads: 2 Forward time: 0.70s Backward time: 0.45s Step time: 2.29s\n", + "290240 Examples seen. Accuracy: 0.6729 Error: 0.70112 Loss: 0.80414 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "290880 Examples seen. Accuracy: 0.6745 Error: 0.99169 Loss: 1.07779 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.27s\n", + "291520 Examples seen. Accuracy: 0.6764 Error: 0.85950 Loss: 0.89610 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "292160 Examples seen. Accuracy: 0.6765 Error: 0.76061 Loss: 0.80193 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.24s\n", + "292800 Examples seen. Accuracy: 0.6762 Error: 0.86220 Loss: 0.92161 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.28s\n", + "293440 Examples seen. Accuracy: 0.6778 Error: 0.80205 Loss: 0.74136 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "294080 Examples seen. Accuracy: 0.6748 Error: 0.91620 Loss: 0.92760 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.25s\n", + "294720 Examples seen. Accuracy: 0.6746 Error: 0.82923 Loss: 0.84221 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "295360 Examples seen. Accuracy: 0.6760 Error: 1.05348 Loss: 1.27101 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "296000 Examples seen. Accuracy: 0.6771 Error: 0.85328 Loss: 0.85372 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "296640 Examples seen. Accuracy: 0.6754 Error: 0.99165 Loss: 1.20119 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "297280 Examples seen. Accuracy: 0.6734 Error: 0.94531 Loss: 1.10762 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "297920 Examples seen. Accuracy: 0.6716 Error: 1.00206 Loss: 1.22243 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "298560 Examples seen. Accuracy: 0.6709 Error: 0.95735 Loss: 0.95216 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.27s\n", + "299200 Examples seen. Accuracy: 0.6697 Error: 0.94498 Loss: 1.03192 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.30s\n", + "299840 Examples seen. Accuracy: 0.6730 Error: 0.84626 Loss: 0.89177 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "300480 Examples seen. Accuracy: 0.6747 Error: 0.81766 Loss: 0.88894 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.29s\n", + "301120 Examples seen. Accuracy: 0.6755 Error: 0.80451 Loss: 0.83018 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.25s\n", + "301760 Examples seen. Accuracy: 0.6763 Error: 0.92576 Loss: 0.93402 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.25s\n", + "302400 Examples seen. Accuracy: 0.6737 Error: 0.96477 Loss: 1.09257 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.24s\n", + "303040 Examples seen. Accuracy: 0.6722 Error: 0.81764 Loss: 0.80887 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.26s\n", + "303680 Examples seen. Accuracy: 0.6756 Error: 0.84041 Loss: 0.91604 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "304320 Examples seen. Accuracy: 0.6732 Error: 0.93256 Loss: 1.09922 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.32s\n", + "304960 Examples seen. Accuracy: 0.6754 Error: 0.81657 Loss: 0.87520 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "305600 Examples seen. Accuracy: 0.6736 Error: 0.98567 Loss: 1.02651 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.26s\n", + "306240 Examples seen. Accuracy: 0.6728 Error: 0.72973 Loss: 0.62668 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.26s\n", + "306880 Examples seen. Accuracy: 0.6743 Error: 0.73370 Loss: 0.72145 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.26s\n", + "307520 Examples seen. Accuracy: 0.6746 Error: 0.67468 Loss: 0.72256 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "308160 Examples seen. Accuracy: 0.6740 Error: 1.03030 Loss: 1.14193 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "308800 Examples seen. Accuracy: 0.6775 Error: 0.92522 Loss: 1.11043 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "309440 Examples seen. Accuracy: 0.6768 Error: 0.93354 Loss: 0.96485 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "310080 Examples seen. Accuracy: 0.6762 Error: 0.88760 Loss: 1.01510 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.27s\n", + "310720 Examples seen. Accuracy: 0.6761 Error: 0.94432 Loss: 0.95214 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "311360 Examples seen. Accuracy: 0.6773 Error: 0.88861 Loss: 1.00425 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "312000 Examples seen. Accuracy: 0.6761 Error: 0.79803 Loss: 0.98969 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "312640 Examples seen. Accuracy: 0.6750 Error: 0.77377 Loss: 0.81355 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "313280 Examples seen. Accuracy: 0.6705 Error: 0.82089 Loss: 0.87615 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.23s\n", + "313920 Examples seen. Accuracy: 0.6723 Error: 0.91588 Loss: 1.01952 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "314560 Examples seen. Accuracy: 0.6731 Error: 0.75757 Loss: 0.79069 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "315200 Examples seen. Accuracy: 0.6756 Error: 0.70881 Loss: 0.64134 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "315840 Examples seen. Accuracy: 0.6778 Error: 0.93236 Loss: 1.04414 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.25s\n", + "316480 Examples seen. Accuracy: 0.6742 Error: 0.86207 Loss: 0.91547 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "317120 Examples seen. Accuracy: 0.6736 Error: 0.93038 Loss: 0.92133 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "317760 Examples seen. Accuracy: 0.6761 Error: 0.77638 Loss: 0.82470 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.27s\n", + "318400 Examples seen. Accuracy: 0.6778 Error: 0.67504 Loss: 0.59215 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.27s\n", + "319040 Examples seen. Accuracy: 0.6788 Error: 0.79351 Loss: 0.85345 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "319680 Examples seen. Accuracy: 0.6771 Error: 0.80269 Loss: 0.78314 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 8 Examples seen:320000 Validation Accuracy: 0.6726 Validation Error: 0.9813 Validation Loss: 0.9495 Total time: 28.09min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.286 Min Weight: -0.305 Max Output: 3.617 Min Output: -4.113 TNNetConvolutionLinear 32,32,64 Times: 30.22s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.617 Min Output: -0.971 TNNetMaxPool 8,8,64 Times: 6.94s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.757 Min Weight: 0.632 Max Output: 3.945 Min Output: -2.119 TNNetMovingStdNormalization 8,8,64 Times: 0.13s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.128 Min Weight: -0.137 Max Output: 5.824 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.22s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.143 Min Weight: -0.129 Max Output: 3.624 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.06s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.143 Min Weight: -0.127 Max Output: 2.186 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.15s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.150 Min Weight: -0.126 Max Output: 1.446 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.16s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.446 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.446 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.43s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.207 Min Weight: -0.173 Max Output: 2.373 Min Output: -3.884 TNNetFullConnectLinear 10,1,1 Times: 0.11s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.399 Min Output: 0.001 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3333 minutes. 50 epochs: 1.9444 hours.\n", + "Epochs: 8. Working time: 0.47 hours.\n", + "320640 Examples seen. Accuracy: 0.6746 Error: 0.80608 Loss: 0.88726 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "321280 Examples seen. Accuracy: 0.6750 Error: 0.92418 Loss: 1.04939 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.33s\n", + "321920 Examples seen. Accuracy: 0.6750 Error: 0.80783 Loss: 0.73848 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.32s\n", + "322560 Examples seen. Accuracy: 0.6746 Error: 0.83216 Loss: 0.78996 Threads: 2 Forward time: 0.73s Backward time: 0.41s Step time: 2.29s\n", + "323200 Examples seen. Accuracy: 0.6768 Error: 0.78246 Loss: 0.79558 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.27s\n", + "323840 Examples seen. Accuracy: 0.6779 Error: 0.85623 Loss: 0.93316 Threads: 2 Forward time: 0.64s Backward time: 0.44s Step time: 2.26s\n", + "324480 Examples seen. Accuracy: 0.6772 Error: 0.86815 Loss: 0.94828 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "325120 Examples seen. Accuracy: 0.6745 Error: 0.86923 Loss: 1.04023 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.33s\n", + "325760 Examples seen. Accuracy: 0.6766 Error: 0.90301 Loss: 1.10009 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.27s\n", + "326400 Examples seen. Accuracy: 0.6792 Error: 0.72691 Loss: 0.73168 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "327040 Examples seen. Accuracy: 0.6798 Error: 0.83889 Loss: 0.93271 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "327680 Examples seen. Accuracy: 0.6773 Error: 0.91944 Loss: 0.92991 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.33s\n", + "328320 Examples seen. Accuracy: 0.6739 Error: 0.98521 Loss: 1.20311 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "328960 Examples seen. Accuracy: 0.6734 Error: 0.82776 Loss: 0.93424 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.25s\n", + "329600 Examples seen. Accuracy: 0.6719 Error: 0.90022 Loss: 0.94998 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "330240 Examples seen. Accuracy: 0.6735 Error: 0.75942 Loss: 0.70869 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.24s\n", + "330880 Examples seen. Accuracy: 0.6734 Error: 0.93974 Loss: 1.01319 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "331520 Examples seen. Accuracy: 0.6745 Error: 0.88273 Loss: 0.91846 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "332160 Examples seen. Accuracy: 0.6739 Error: 0.80025 Loss: 0.86264 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "332800 Examples seen. Accuracy: 0.6765 Error: 0.89051 Loss: 1.07191 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "333440 Examples seen. Accuracy: 0.6777 Error: 0.85595 Loss: 0.97014 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.25s\n", + "334080 Examples seen. Accuracy: 0.6810 Error: 0.80774 Loss: 0.86967 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "334720 Examples seen. Accuracy: 0.6841 Error: 0.76323 Loss: 0.77481 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.24s\n", + "335360 Examples seen. Accuracy: 0.6841 Error: 0.86440 Loss: 1.06786 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "336000 Examples seen. Accuracy: 0.6855 Error: 0.79173 Loss: 0.99724 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "336640 Examples seen. Accuracy: 0.6845 Error: 0.84526 Loss: 0.94543 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.29s\n", + "337280 Examples seen. Accuracy: 0.6844 Error: 0.79016 Loss: 0.87642 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.32s\n", + "337920 Examples seen. Accuracy: 0.6837 Error: 0.71374 Loss: 0.72188 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.32s\n", + "338560 Examples seen. Accuracy: 0.6824 Error: 0.79755 Loss: 0.92635 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "339200 Examples seen. Accuracy: 0.6830 Error: 1.01271 Loss: 1.12879 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.26s\n", + "339840 Examples seen. Accuracy: 0.6837 Error: 0.84140 Loss: 1.00001 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.25s\n", + "340480 Examples seen. Accuracy: 0.6818 Error: 0.94872 Loss: 1.09921 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "341120 Examples seen. Accuracy: 0.6773 Error: 0.84342 Loss: 0.84416 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.24s\n", + "341760 Examples seen. Accuracy: 0.6745 Error: 0.89283 Loss: 0.92712 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.32s\n", + "342400 Examples seen. Accuracy: 0.6721 Error: 0.90393 Loss: 0.84787 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "343040 Examples seen. Accuracy: 0.6718 Error: 0.81913 Loss: 0.84188 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "343680 Examples seen. Accuracy: 0.6717 Error: 0.78402 Loss: 0.90977 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "344320 Examples seen. Accuracy: 0.6725 Error: 0.90614 Loss: 0.91631 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.24s\n", + "344960 Examples seen. Accuracy: 0.6743 Error: 0.69912 Loss: 0.66666 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.24s\n", + "345600 Examples seen. Accuracy: 0.6750 Error: 0.74682 Loss: 0.75126 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "346240 Examples seen. Accuracy: 0.6769 Error: 0.85479 Loss: 0.94110 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "346880 Examples seen. Accuracy: 0.6768 Error: 0.74779 Loss: 0.74923 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "347520 Examples seen. Accuracy: 0.6806 Error: 0.72227 Loss: 0.74978 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "348160 Examples seen. Accuracy: 0.6817 Error: 0.72984 Loss: 0.80529 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.24s\n", + "348800 Examples seen. Accuracy: 0.6797 Error: 0.99660 Loss: 1.03470 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "349440 Examples seen. Accuracy: 0.6812 Error: 0.70780 Loss: 0.69271 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "350080 Examples seen. Accuracy: 0.6846 Error: 0.85745 Loss: 1.07135 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "350720 Examples seen. Accuracy: 0.6839 Error: 0.79216 Loss: 0.85529 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "351360 Examples seen. Accuracy: 0.6832 Error: 0.90750 Loss: 0.93023 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "352000 Examples seen. Accuracy: 0.6845 Error: 0.87822 Loss: 0.98398 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "352640 Examples seen. Accuracy: 0.6866 Error: 0.75723 Loss: 0.90549 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "353280 Examples seen. Accuracy: 0.6860 Error: 0.91905 Loss: 0.96732 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "353920 Examples seen. Accuracy: 0.6878 Error: 0.75457 Loss: 0.75893 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "354560 Examples seen. Accuracy: 0.6896 Error: 0.89470 Loss: 0.99602 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "355200 Examples seen. Accuracy: 0.6871 Error: 0.83453 Loss: 0.77940 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.23s\n", + "355840 Examples seen. Accuracy: 0.6843 Error: 0.75824 Loss: 0.65149 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "356480 Examples seen. Accuracy: 0.6833 Error: 0.79836 Loss: 0.81279 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "357120 Examples seen. Accuracy: 0.6859 Error: 0.79211 Loss: 0.92599 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.26s\n", + "357760 Examples seen. Accuracy: 0.6888 Error: 0.93717 Loss: 1.04447 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.26s\n", + "358400 Examples seen. Accuracy: 0.6894 Error: 0.73993 Loss: 0.80377 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.31s\n", + "359040 Examples seen. Accuracy: 0.6881 Error: 0.91732 Loss: 1.03610 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "359680 Examples seen. Accuracy: 0.6873 Error: 0.82041 Loss: 0.84118 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.26s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 9 Examples seen:360000 Validation Accuracy: 0.7005 Validation Error: 0.9130 Validation Loss: 0.8731 Total time: 31.49min\n", + "Epoch time: 2.3542 minutes. 50 epochs: 1.9618 hours.\n", + "Epochs: 9. Working time: 0.52 hours.\n", + "360640 Examples seen. Accuracy: 0.6870 Error: 0.99102 Loss: 1.13030 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.32s\n", + "361280 Examples seen. Accuracy: 0.6879 Error: 0.98226 Loss: 1.10132 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "361920 Examples seen. Accuracy: 0.6861 Error: 0.81048 Loss: 0.78015 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.31s\n", + "362560 Examples seen. Accuracy: 0.6853 Error: 0.82575 Loss: 0.85574 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "363200 Examples seen. Accuracy: 0.6874 Error: 0.82046 Loss: 0.92182 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.29s\n", + "363840 Examples seen. Accuracy: 0.6900 Error: 0.72060 Loss: 0.67072 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.29s\n", + "364480 Examples seen. Accuracy: 0.6878 Error: 0.90538 Loss: 0.99555 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.31s\n", + "365120 Examples seen. Accuracy: 0.6880 Error: 0.75652 Loss: 0.82947 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "365760 Examples seen. Accuracy: 0.6917 Error: 0.87550 Loss: 1.02521 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.29s\n", + "366400 Examples seen. Accuracy: 0.6939 Error: 0.98520 Loss: 0.97981 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.29s\n", + "367040 Examples seen. Accuracy: 0.6948 Error: 0.83249 Loss: 0.84764 Threads: 2 Forward time: 0.71s Backward time: 0.46s Step time: 2.31s\n", + "367680 Examples seen. Accuracy: 0.6947 Error: 0.87921 Loss: 0.98406 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "368320 Examples seen. Accuracy: 0.6986 Error: 0.81887 Loss: 0.91101 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.31s\n", + "368960 Examples seen. Accuracy: 0.6977 Error: 0.73057 Loss: 0.74258 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.28s\n", + "369600 Examples seen. Accuracy: 0.6968 Error: 0.77150 Loss: 0.79038 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.30s\n", + "370240 Examples seen. Accuracy: 0.6972 Error: 0.91387 Loss: 0.93440 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.31s\n", + "370880 Examples seen. Accuracy: 0.6979 Error: 0.69506 Loss: 0.75387 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.35s\n", + "371520 Examples seen. Accuracy: 0.6938 Error: 0.82977 Loss: 0.82222 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "372160 Examples seen. Accuracy: 0.6922 Error: 0.74130 Loss: 0.63260 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "372800 Examples seen. Accuracy: 0.6919 Error: 0.61393 Loss: 0.54026 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "373440 Examples seen. Accuracy: 0.6929 Error: 0.82919 Loss: 0.84779 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.26s\n", + "374080 Examples seen. Accuracy: 0.6925 Error: 0.77389 Loss: 0.90815 Threads: 2 Forward time: 0.71s Backward time: 0.47s Step time: 2.36s\n", + "374720 Examples seen. Accuracy: 0.6948 Error: 0.76773 Loss: 0.75683 Threads: 2 Forward time: 0.72s Backward time: 0.46s Step time: 2.40s\n", + "375360 Examples seen. Accuracy: 0.6925 Error: 0.92700 Loss: 0.93701 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.34s\n", + "376000 Examples seen. Accuracy: 0.6938 Error: 0.64868 Loss: 0.58159 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.33s\n", + "376640 Examples seen. Accuracy: 0.6944 Error: 0.76134 Loss: 0.77990 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.30s\n", + "377280 Examples seen. Accuracy: 0.6940 Error: 0.90245 Loss: 1.03077 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.31s\n", + "377920 Examples seen. Accuracy: 0.6931 Error: 0.92095 Loss: 1.01853 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.31s\n", + "378560 Examples seen. Accuracy: 0.6948 Error: 0.76422 Loss: 0.81965 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "379200 Examples seen. Accuracy: 0.6941 Error: 0.84171 Loss: 0.84435 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.31s\n", + "379840 Examples seen. Accuracy: 0.6933 Error: 0.83652 Loss: 0.84591 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.31s\n", + "380480 Examples seen. Accuracy: 0.6922 Error: 0.86241 Loss: 0.93829 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.28s\n", + "381120 Examples seen. Accuracy: 0.6919 Error: 0.84401 Loss: 0.83420 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.30s\n", + "381760 Examples seen. Accuracy: 0.6923 Error: 0.87555 Loss: 0.96276 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.29s\n", + "382400 Examples seen. Accuracy: 0.6915 Error: 0.82004 Loss: 0.84103 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.27s\n", + "383040 Examples seen. Accuracy: 0.6932 Error: 0.76874 Loss: 0.81044 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "383680 Examples seen. Accuracy: 0.6942 Error: 0.80235 Loss: 0.84572 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.32s\n", + "384320 Examples seen. Accuracy: 0.6967 Error: 0.75182 Loss: 0.83043 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.30s\n", + "384960 Examples seen. Accuracy: 0.6957 Error: 0.87272 Loss: 1.08511 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.31s\n", + "385600 Examples seen. Accuracy: 0.6940 Error: 0.88422 Loss: 0.95285 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "386240 Examples seen. Accuracy: 0.6937 Error: 0.78533 Loss: 0.90082 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "386880 Examples seen. Accuracy: 0.6957 Error: 0.83891 Loss: 0.91819 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "387520 Examples seen. Accuracy: 0.6966 Error: 0.80963 Loss: 0.82660 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.29s\n", + "388160 Examples seen. Accuracy: 0.6980 Error: 0.70199 Loss: 0.66609 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "388800 Examples seen. Accuracy: 0.6981 Error: 0.71472 Loss: 0.78854 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.31s\n", + "389440 Examples seen. Accuracy: 0.6977 Error: 0.76907 Loss: 0.79745 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.34s\n", + "390080 Examples seen. Accuracy: 0.6988 Error: 0.97835 Loss: 0.93827 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.29s\n", + "390720 Examples seen. Accuracy: 0.6979 Error: 0.81469 Loss: 0.84105 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.27s\n", + "391360 Examples seen. Accuracy: 0.6984 Error: 0.80755 Loss: 0.79055 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.32s\n", + "392000 Examples seen. Accuracy: 0.6970 Error: 0.72795 Loss: 0.81478 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.26s\n", + "392640 Examples seen. Accuracy: 0.6965 Error: 0.86454 Loss: 0.92939 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "393280 Examples seen. Accuracy: 0.6944 Error: 0.87080 Loss: 1.07583 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "393920 Examples seen. Accuracy: 0.6955 Error: 0.66071 Loss: 0.66657 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "394560 Examples seen. Accuracy: 0.6972 Error: 0.74985 Loss: 0.83199 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "395200 Examples seen. Accuracy: 0.6959 Error: 0.81379 Loss: 0.86817 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.31s\n", + "395840 Examples seen. Accuracy: 0.6987 Error: 0.66327 Loss: 0.64872 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "396480 Examples seen. Accuracy: 0.6970 Error: 0.79263 Loss: 0.83147 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.30s\n", + "397120 Examples seen. Accuracy: 0.6972 Error: 0.85795 Loss: 0.87358 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "397760 Examples seen. Accuracy: 0.6999 Error: 0.77065 Loss: 0.75524 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.26s\n", + "398400 Examples seen. Accuracy: 0.6987 Error: 0.69937 Loss: 0.74557 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.24s\n", + "399040 Examples seen. Accuracy: 0.6975 Error: 0.85826 Loss: 0.92526 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "399680 Examples seen. Accuracy: 0.6950 Error: 0.85978 Loss: 0.99050 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 10 Examples seen:400000 Validation Accuracy: 0.7264 Validation Error: 0.8392 Validation Loss: 0.8016 Total time: 34.92min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.307 Min Weight: -0.349 Max Output: 3.490 Min Output: -4.198 TNNetConvolutionLinear 32,32,64 Times: 30.11s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.490 Min Output: -0.836 TNNetMaxPool 8,8,64 Times: 6.86s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.706 Min Weight: 0.659 Max Output: 4.007 Min Output: -2.116 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.150 Min Weight: -0.160 Max Output: 6.938 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.14s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.162 Min Weight: -0.144 Max Output: 4.198 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.00s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.159 Min Weight: -0.147 Max Output: 2.281 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.99s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.169 Min Weight: -0.134 Max Output: 1.555 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.555 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.555 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.44s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.232 Min Weight: -0.196 Max Output: 2.282 Min Output: -4.570 TNNetFullConnectLinear 10,1,1 Times: 0.08s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.297 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Starting Testing.\n", + "Epochs: 10 Examples seen:400000 Test Accuracy: 0.7196 Test Error: 0.8487 Test Loss: 0.8175 Total time: 35.96min\n", + "Epoch time: 2.3594 minutes. 50 epochs: 1.9661 hours.\n", + "Epochs: 10. Working time: 0.60 hours.\n", + "Learning rate set to: 0.00090\n", + "400640 Examples seen. Accuracy: 0.6944 Error: 0.79827 Loss: 0.88313 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "401280 Examples seen. Accuracy: 0.6946 Error: 0.96281 Loss: 1.07937 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.26s\n", + "401920 Examples seen. Accuracy: 0.6956 Error: 0.71811 Loss: 0.77069 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "402560 Examples seen. Accuracy: 0.6964 Error: 0.83718 Loss: 0.84177 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.27s\n", + "403200 Examples seen. Accuracy: 0.6996 Error: 0.56462 Loss: 0.53864 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "403840 Examples seen. Accuracy: 0.6994 Error: 0.83586 Loss: 0.90140 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "404480 Examples seen. Accuracy: 0.6980 Error: 0.78890 Loss: 0.89494 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "405120 Examples seen. Accuracy: 0.6971 Error: 0.75002 Loss: 0.78461 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.27s\n", + "405760 Examples seen. Accuracy: 0.6962 Error: 0.79677 Loss: 0.79444 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "406400 Examples seen. Accuracy: 0.6990 Error: 0.83953 Loss: 0.86807 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.26s\n", + "407040 Examples seen. Accuracy: 0.6980 Error: 0.78360 Loss: 0.76686 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "407680 Examples seen. Accuracy: 0.7035 Error: 0.57692 Loss: 0.54299 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.25s\n", + "408320 Examples seen. Accuracy: 0.7040 Error: 0.87694 Loss: 1.10601 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.25s\n", + "408960 Examples seen. Accuracy: 0.7013 Error: 0.78070 Loss: 0.89345 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "409600 Examples seen. Accuracy: 0.7008 Error: 0.84706 Loss: 0.95418 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "410240 Examples seen. Accuracy: 0.7025 Error: 0.88677 Loss: 0.96750 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "410880 Examples seen. Accuracy: 0.7013 Error: 0.82835 Loss: 1.09910 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "411520 Examples seen. Accuracy: 0.7004 Error: 0.79865 Loss: 0.83026 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "412160 Examples seen. Accuracy: 0.7011 Error: 0.82756 Loss: 0.83940 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "412800 Examples seen. Accuracy: 0.7013 Error: 0.66509 Loss: 0.71769 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.24s\n", + "413440 Examples seen. Accuracy: 0.7007 Error: 0.84655 Loss: 0.93009 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.31s\n", + "414080 Examples seen. Accuracy: 0.7012 Error: 0.88743 Loss: 0.96724 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "414720 Examples seen. Accuracy: 0.7030 Error: 0.88924 Loss: 1.10586 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.27s\n", + "415360 Examples seen. Accuracy: 0.7045 Error: 0.76330 Loss: 0.69952 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.24s\n", + "416000 Examples seen. Accuracy: 0.7021 Error: 0.84887 Loss: 0.91870 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "416640 Examples seen. Accuracy: 0.7033 Error: 0.78722 Loss: 0.81782 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "417280 Examples seen. Accuracy: 0.7044 Error: 0.74771 Loss: 0.87205 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "417920 Examples seen. Accuracy: 0.7026 Error: 0.90083 Loss: 0.91435 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "418560 Examples seen. Accuracy: 0.7016 Error: 0.85048 Loss: 0.92828 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "419200 Examples seen. Accuracy: 0.7026 Error: 0.76385 Loss: 0.77123 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "419840 Examples seen. Accuracy: 0.7051 Error: 0.72022 Loss: 0.73595 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "420480 Examples seen. Accuracy: 0.7050 Error: 0.70890 Loss: 0.72313 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.30s\n", + "421120 Examples seen. Accuracy: 0.7060 Error: 0.77504 Loss: 0.85528 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "421760 Examples seen. Accuracy: 0.7046 Error: 0.67149 Loss: 0.80695 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "422400 Examples seen. Accuracy: 0.7044 Error: 0.81298 Loss: 0.79828 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "423040 Examples seen. Accuracy: 0.7105 Error: 0.61800 Loss: 0.61740 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.26s\n", + "423680 Examples seen. Accuracy: 0.7128 Error: 0.66715 Loss: 0.75963 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.34s\n", + "424320 Examples seen. Accuracy: 0.7139 Error: 0.82122 Loss: 0.95315 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.34s\n", + "424960 Examples seen. Accuracy: 0.7130 Error: 0.78074 Loss: 0.86985 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.30s\n", + "425600 Examples seen. Accuracy: 0.7158 Error: 0.78785 Loss: 0.77041 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.27s\n", + "426240 Examples seen. Accuracy: 0.7149 Error: 0.88856 Loss: 0.92326 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "426880 Examples seen. Accuracy: 0.7123 Error: 0.74013 Loss: 0.73850 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "427520 Examples seen. Accuracy: 0.7164 Error: 0.67271 Loss: 0.65382 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "428160 Examples seen. Accuracy: 0.7174 Error: 0.84550 Loss: 0.80292 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "428800 Examples seen. Accuracy: 0.7183 Error: 0.89275 Loss: 0.98121 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "429440 Examples seen. Accuracy: 0.7163 Error: 0.90404 Loss: 0.97022 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.29s\n", + "430080 Examples seen. Accuracy: 0.7144 Error: 0.79728 Loss: 0.86836 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.30s\n", + "430720 Examples seen. Accuracy: 0.7118 Error: 0.75183 Loss: 0.75944 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "431360 Examples seen. Accuracy: 0.7122 Error: 0.78443 Loss: 0.72462 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "432000 Examples seen. Accuracy: 0.7138 Error: 0.79717 Loss: 0.77412 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "432640 Examples seen. Accuracy: 0.7118 Error: 0.74848 Loss: 0.84423 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "433280 Examples seen. Accuracy: 0.7093 Error: 0.78267 Loss: 0.75609 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "433920 Examples seen. Accuracy: 0.7094 Error: 0.67661 Loss: 0.68525 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.26s\n", + "434560 Examples seen. Accuracy: 0.7062 Error: 0.81234 Loss: 0.83494 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.31s\n", + "435200 Examples seen. Accuracy: 0.7068 Error: 0.75373 Loss: 0.80960 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.27s\n", + "435840 Examples seen. Accuracy: 0.7102 Error: 0.81008 Loss: 0.83170 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "436480 Examples seen. Accuracy: 0.7063 Error: 1.02774 Loss: 1.30178 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "437120 Examples seen. Accuracy: 0.7077 Error: 0.84527 Loss: 0.91554 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "437760 Examples seen. Accuracy: 0.7067 Error: 0.79582 Loss: 1.01987 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "438400 Examples seen. Accuracy: 0.7058 Error: 0.86893 Loss: 1.03800 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.22s\n", + "439040 Examples seen. Accuracy: 0.7061 Error: 0.80982 Loss: 0.95561 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "439680 Examples seen. Accuracy: 0.7109 Error: 0.70675 Loss: 0.84404 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 11 Examples seen:440000 Validation Accuracy: 0.7459 Validation Error: 0.7620 Validation Loss: 0.7395 Total time: 39.36min\n", + "Epoch time: 2.3490 minutes. 50 epochs: 1.9575 hours.\n", + "Epochs: 11. Working time: 0.66 hours.\n", + "440640 Examples seen. Accuracy: 0.7112 Error: 0.75090 Loss: 0.73681 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.31s\n", + "441280 Examples seen. Accuracy: 0.7147 Error: 0.79958 Loss: 0.90243 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "441920 Examples seen. Accuracy: 0.7154 Error: 0.72568 Loss: 0.81930 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "442560 Examples seen. Accuracy: 0.7181 Error: 0.62918 Loss: 0.64142 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "443200 Examples seen. Accuracy: 0.7159 Error: 0.85248 Loss: 0.90539 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "443840 Examples seen. Accuracy: 0.7166 Error: 0.81171 Loss: 0.88727 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.25s\n", + "444480 Examples seen. Accuracy: 0.7146 Error: 0.77190 Loss: 0.88780 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "445120 Examples seen. Accuracy: 0.7140 Error: 0.70516 Loss: 0.82153 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "445760 Examples seen. Accuracy: 0.7121 Error: 0.78639 Loss: 0.78645 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.26s\n", + "446400 Examples seen. Accuracy: 0.7114 Error: 0.78763 Loss: 0.80618 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "447040 Examples seen. Accuracy: 0.7098 Error: 0.81796 Loss: 0.82348 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.32s\n", + "447680 Examples seen. Accuracy: 0.7123 Error: 0.69137 Loss: 0.77521 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "448320 Examples seen. Accuracy: 0.7124 Error: 0.69026 Loss: 0.63380 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.27s\n", + "448960 Examples seen. Accuracy: 0.7136 Error: 0.68528 Loss: 0.75157 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "449600 Examples seen. Accuracy: 0.7131 Error: 0.73661 Loss: 0.72990 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.24s\n", + "450240 Examples seen. Accuracy: 0.7125 Error: 0.70364 Loss: 0.70550 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "450880 Examples seen. Accuracy: 0.7147 Error: 0.79971 Loss: 0.83212 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.24s\n", + "451520 Examples seen. Accuracy: 0.7123 Error: 0.89665 Loss: 1.07015 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.27s\n", + "452160 Examples seen. Accuracy: 0.7096 Error: 0.75705 Loss: 0.77934 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "452800 Examples seen. Accuracy: 0.7127 Error: 0.71722 Loss: 0.75133 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "453440 Examples seen. Accuracy: 0.7139 Error: 0.70605 Loss: 0.74962 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.30s\n", + "454080 Examples seen. Accuracy: 0.7143 Error: 0.82519 Loss: 0.87374 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.28s\n", + "454720 Examples seen. Accuracy: 0.7135 Error: 0.64336 Loss: 0.62676 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "455360 Examples seen. Accuracy: 0.7164 Error: 0.68913 Loss: 0.68072 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "456000 Examples seen. Accuracy: 0.7137 Error: 0.94645 Loss: 1.38585 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "456640 Examples seen. Accuracy: 0.7120 Error: 0.77201 Loss: 0.72073 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.24s\n", + "457280 Examples seen. Accuracy: 0.7141 Error: 0.87116 Loss: 0.94200 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.27s\n", + "457920 Examples seen. Accuracy: 0.7166 Error: 0.65593 Loss: 0.77803 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "458560 Examples seen. Accuracy: 0.7169 Error: 0.67448 Loss: 0.71479 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.27s\n", + "459200 Examples seen. Accuracy: 0.7149 Error: 0.67725 Loss: 0.77081 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.26s\n", + "459840 Examples seen. Accuracy: 0.7161 Error: 0.79945 Loss: 0.74566 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "460480 Examples seen. Accuracy: 0.7143 Error: 0.95533 Loss: 1.12959 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.24s\n", + "461120 Examples seen. Accuracy: 0.7101 Error: 0.88571 Loss: 0.90288 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "461760 Examples seen. Accuracy: 0.7135 Error: 0.62519 Loss: 0.82394 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.24s\n", + "462400 Examples seen. Accuracy: 0.7144 Error: 0.59951 Loss: 0.51216 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "463040 Examples seen. Accuracy: 0.7135 Error: 0.69531 Loss: 0.82922 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.27s\n", + "463680 Examples seen. Accuracy: 0.7121 Error: 0.66156 Loss: 0.67263 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "464320 Examples seen. Accuracy: 0.7101 Error: 0.69165 Loss: 0.66978 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.30s\n", + "464960 Examples seen. Accuracy: 0.7061 Error: 0.85761 Loss: 0.84206 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "465600 Examples seen. Accuracy: 0.7108 Error: 0.72666 Loss: 0.75573 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.27s\n", + "466240 Examples seen. Accuracy: 0.7118 Error: 0.66336 Loss: 0.70712 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.25s\n", + "466880 Examples seen. Accuracy: 0.7065 Error: 0.85893 Loss: 0.97865 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "467520 Examples seen. Accuracy: 0.7082 Error: 0.80851 Loss: 0.92579 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "468160 Examples seen. Accuracy: 0.7101 Error: 0.91147 Loss: 1.07881 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "468800 Examples seen. Accuracy: 0.7112 Error: 0.79746 Loss: 0.81371 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "469440 Examples seen. Accuracy: 0.7112 Error: 0.83633 Loss: 0.92174 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "470080 Examples seen. Accuracy: 0.7107 Error: 0.72029 Loss: 0.64677 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "470720 Examples seen. Accuracy: 0.7111 Error: 0.74078 Loss: 0.78597 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "471360 Examples seen. Accuracy: 0.7116 Error: 0.69620 Loss: 0.68358 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "472000 Examples seen. Accuracy: 0.7140 Error: 0.69758 Loss: 0.66707 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "472640 Examples seen. Accuracy: 0.7161 Error: 0.75355 Loss: 0.79558 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "473280 Examples seen. Accuracy: 0.7152 Error: 0.85246 Loss: 0.90928 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "473920 Examples seen. Accuracy: 0.7119 Error: 0.79664 Loss: 0.81882 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "474560 Examples seen. Accuracy: 0.7130 Error: 0.76626 Loss: 0.82618 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.31s\n", + "475200 Examples seen. Accuracy: 0.7139 Error: 0.85440 Loss: 1.05641 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "475840 Examples seen. Accuracy: 0.7159 Error: 0.71368 Loss: 0.75263 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.22s\n", + "476480 Examples seen. Accuracy: 0.7149 Error: 0.80042 Loss: 0.87887 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "477120 Examples seen. Accuracy: 0.7160 Error: 0.74688 Loss: 0.81990 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.22s\n", + "477760 Examples seen. Accuracy: 0.7135 Error: 0.84378 Loss: 0.92690 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "478400 Examples seen. Accuracy: 0.7118 Error: 0.74229 Loss: 0.82712 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "479040 Examples seen. Accuracy: 0.7128 Error: 0.75876 Loss: 0.75832 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.22s\n", + "479680 Examples seen. Accuracy: 0.7115 Error: 0.82783 Loss: 0.87476 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 12 Examples seen:480000 Validation Accuracy: 0.7610 Validation Error: 0.7096 Validation Loss: 0.6954 Total time: 42.74min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.326 Min Weight: -0.396 Max Output: 3.709 Min Output: -4.359 TNNetConvolutionLinear 32,32,64 Times: 30.11s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.709 Min Output: -0.780 TNNetMaxPool 8,8,64 Times: 6.93s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.686 Min Weight: 0.670 Max Output: 4.509 Min Output: -2.187 TNNetMovingStdNormalization 8,8,64 Times: 0.16s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.171 Min Weight: -0.184 Max Output: 8.144 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.04s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.186 Min Weight: -0.165 Max Output: 5.154 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.94s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.189 Min Weight: -0.170 Max Output: 2.682 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.08s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.184 Min Weight: -0.151 Max Output: 1.856 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.00s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.856 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.856 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.42s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.252 Min Weight: -0.215 Max Output: 2.958 Min Output: -5.466 TNNetFullConnectLinear 10,1,1 Times: 0.09s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.384 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3146 minutes. 50 epochs: 1.9288 hours.\n", + "Epochs: 12. Working time: 0.71 hours.\n", + "480640 Examples seen. Accuracy: 0.7132 Error: 0.74584 Loss: 0.84714 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "481280 Examples seen. Accuracy: 0.7152 Error: 0.69531 Loss: 0.72907 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "481920 Examples seen. Accuracy: 0.7155 Error: 0.77983 Loss: 0.81069 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.23s\n", + "482560 Examples seen. Accuracy: 0.7128 Error: 0.60650 Loss: 0.66012 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.29s\n", + "483200 Examples seen. Accuracy: 0.7132 Error: 0.64428 Loss: 0.60381 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.26s\n", + "483840 Examples seen. Accuracy: 0.7111 Error: 0.73992 Loss: 0.77452 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "484480 Examples seen. Accuracy: 0.7121 Error: 0.77070 Loss: 0.69173 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "485120 Examples seen. Accuracy: 0.7148 Error: 0.75463 Loss: 0.69089 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.23s\n", + "485760 Examples seen. Accuracy: 0.7156 Error: 0.85348 Loss: 0.97100 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "486400 Examples seen. Accuracy: 0.7125 Error: 0.71897 Loss: 0.69074 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "487040 Examples seen. Accuracy: 0.7134 Error: 0.76211 Loss: 0.74753 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "487680 Examples seen. Accuracy: 0.7167 Error: 0.53856 Loss: 0.67373 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.23s\n", + "488320 Examples seen. Accuracy: 0.7150 Error: 0.68174 Loss: 0.77533 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "488960 Examples seen. Accuracy: 0.7163 Error: 0.80288 Loss: 0.83149 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "489600 Examples seen. Accuracy: 0.7163 Error: 0.82511 Loss: 0.96139 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "490240 Examples seen. Accuracy: 0.7171 Error: 0.76451 Loss: 0.78677 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "490880 Examples seen. Accuracy: 0.7198 Error: 0.59256 Loss: 0.56093 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "491520 Examples seen. Accuracy: 0.7202 Error: 0.57008 Loss: 0.58644 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.34s\n", + "492160 Examples seen. Accuracy: 0.7180 Error: 0.84067 Loss: 0.86652 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.33s\n", + "492800 Examples seen. Accuracy: 0.7159 Error: 0.77086 Loss: 0.72474 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "493440 Examples seen. Accuracy: 0.7180 Error: 0.60613 Loss: 0.72534 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.32s\n", + "494080 Examples seen. Accuracy: 0.7195 Error: 0.75677 Loss: 0.72396 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.26s\n", + "494720 Examples seen. Accuracy: 0.7211 Error: 0.65503 Loss: 0.71134 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "495360 Examples seen. Accuracy: 0.7202 Error: 0.65776 Loss: 0.67718 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "496000 Examples seen. Accuracy: 0.7174 Error: 0.94382 Loss: 1.02258 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "496640 Examples seen. Accuracy: 0.7176 Error: 0.63724 Loss: 0.63861 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.32s\n", + "497280 Examples seen. Accuracy: 0.7185 Error: 0.65614 Loss: 0.63748 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "497920 Examples seen. Accuracy: 0.7169 Error: 0.77385 Loss: 0.78622 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "498560 Examples seen. Accuracy: 0.7177 Error: 0.94953 Loss: 1.06829 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "499200 Examples seen. Accuracy: 0.7165 Error: 0.71451 Loss: 0.76900 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "499840 Examples seen. Accuracy: 0.7129 Error: 0.94714 Loss: 1.04725 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "500480 Examples seen. Accuracy: 0.7138 Error: 0.78324 Loss: 0.95934 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "501120 Examples seen. Accuracy: 0.7170 Error: 0.72326 Loss: 0.69125 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "501760 Examples seen. Accuracy: 0.7181 Error: 0.79261 Loss: 0.90189 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "502400 Examples seen. Accuracy: 0.7169 Error: 0.84751 Loss: 0.84283 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "503040 Examples seen. Accuracy: 0.7142 Error: 0.70957 Loss: 0.70398 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.24s\n", + "503680 Examples seen. Accuracy: 0.7165 Error: 0.75362 Loss: 0.79541 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "504320 Examples seen. Accuracy: 0.7217 Error: 0.65437 Loss: 0.55792 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "504960 Examples seen. Accuracy: 0.7259 Error: 0.62734 Loss: 0.63808 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "505600 Examples seen. Accuracy: 0.7281 Error: 0.77873 Loss: 0.90384 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.29s\n", + "506240 Examples seen. Accuracy: 0.7282 Error: 0.66170 Loss: 0.63120 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.30s\n", + "506880 Examples seen. Accuracy: 0.7292 Error: 0.58860 Loss: 0.59531 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "507520 Examples seen. Accuracy: 0.7260 Error: 0.87351 Loss: 1.00996 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.24s\n", + "508160 Examples seen. Accuracy: 0.7263 Error: 0.71529 Loss: 0.70644 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "508800 Examples seen. Accuracy: 0.7249 Error: 0.71136 Loss: 0.80688 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "509440 Examples seen. Accuracy: 0.7257 Error: 0.75468 Loss: 0.82708 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "510080 Examples seen. Accuracy: 0.7266 Error: 0.73600 Loss: 0.82209 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "510720 Examples seen. Accuracy: 0.7267 Error: 0.64450 Loss: 0.60830 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "511360 Examples seen. Accuracy: 0.7283 Error: 0.65405 Loss: 0.61811 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "512000 Examples seen. Accuracy: 0.7270 Error: 0.45728 Loss: 0.43486 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "512640 Examples seen. Accuracy: 0.7258 Error: 0.78040 Loss: 0.84160 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "513280 Examples seen. Accuracy: 0.7254 Error: 0.72081 Loss: 0.65352 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "513920 Examples seen. Accuracy: 0.7248 Error: 0.63449 Loss: 0.59896 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "514560 Examples seen. Accuracy: 0.7228 Error: 0.61914 Loss: 0.57322 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "515200 Examples seen. Accuracy: 0.7226 Error: 0.63302 Loss: 0.65841 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "515840 Examples seen. Accuracy: 0.7226 Error: 0.60485 Loss: 0.66033 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "516480 Examples seen. Accuracy: 0.7242 Error: 0.78215 Loss: 0.91657 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "517120 Examples seen. Accuracy: 0.7205 Error: 0.73882 Loss: 0.84812 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "517760 Examples seen. Accuracy: 0.7216 Error: 0.85210 Loss: 0.94369 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.23s\n", + "518400 Examples seen. Accuracy: 0.7223 Error: 0.69614 Loss: 0.67126 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "519040 Examples seen. Accuracy: 0.7207 Error: 0.81899 Loss: 0.83598 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "519680 Examples seen. Accuracy: 0.7223 Error: 0.66769 Loss: 0.63915 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 13 Examples seen:520000 Validation Accuracy: 0.7688 Validation Error: 0.6684 Validation Loss: 0.6639 Total time: 46.13min\n", + "Epoch time: 2.3344 minutes. 50 epochs: 1.9453 hours.\n", + "Epochs: 13. Working time: 0.77 hours.\n", + "520640 Examples seen. Accuracy: 0.7212 Error: 0.76382 Loss: 0.80789 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.24s\n", + "521280 Examples seen. Accuracy: 0.7223 Error: 0.72920 Loss: 0.82963 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.21s\n", + "521920 Examples seen. Accuracy: 0.7199 Error: 0.80229 Loss: 0.81868 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "522560 Examples seen. Accuracy: 0.7204 Error: 0.86225 Loss: 0.89131 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "523200 Examples seen. Accuracy: 0.7233 Error: 0.59301 Loss: 0.60349 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "523840 Examples seen. Accuracy: 0.7214 Error: 0.66773 Loss: 0.80849 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "524480 Examples seen. Accuracy: 0.7198 Error: 0.96479 Loss: 1.00542 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.22s\n", + "525120 Examples seen. Accuracy: 0.7226 Error: 0.67815 Loss: 0.83707 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.20s\n", + "525760 Examples seen. Accuracy: 0.7245 Error: 0.69012 Loss: 0.68533 Threads: 2 Forward time: 0.65s Backward time: 0.44s Step time: 2.28s\n", + "526400 Examples seen. Accuracy: 0.7256 Error: 0.68813 Loss: 0.77270 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "527040 Examples seen. Accuracy: 0.7259 Error: 0.50937 Loss: 0.43279 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "527680 Examples seen. Accuracy: 0.7229 Error: 0.63795 Loss: 0.60759 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.24s\n", + "528320 Examples seen. Accuracy: 0.7234 Error: 0.52090 Loss: 0.50386 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "528960 Examples seen. Accuracy: 0.7238 Error: 0.81742 Loss: 0.77372 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "529600 Examples seen. Accuracy: 0.7213 Error: 0.87822 Loss: 0.85913 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "530240 Examples seen. Accuracy: 0.7218 Error: 0.76327 Loss: 0.75705 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "530880 Examples seen. Accuracy: 0.7215 Error: 0.82403 Loss: 0.81884 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "531520 Examples seen. Accuracy: 0.7233 Error: 0.83089 Loss: 0.92845 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.23s\n", + "532160 Examples seen. Accuracy: 0.7231 Error: 0.83531 Loss: 0.83064 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "532800 Examples seen. Accuracy: 0.7237 Error: 0.76910 Loss: 0.82441 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "533440 Examples seen. Accuracy: 0.7273 Error: 0.61633 Loss: 0.60771 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "534080 Examples seen. Accuracy: 0.7250 Error: 0.78924 Loss: 0.94726 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "534720 Examples seen. Accuracy: 0.7228 Error: 0.77237 Loss: 0.83175 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.24s\n", + "535360 Examples seen. Accuracy: 0.7199 Error: 0.79900 Loss: 0.92404 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.21s\n", + "536000 Examples seen. Accuracy: 0.7219 Error: 0.82467 Loss: 0.88878 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.22s\n", + "536640 Examples seen. Accuracy: 0.7211 Error: 0.75859 Loss: 0.95874 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.21s\n", + "537280 Examples seen. Accuracy: 0.7239 Error: 0.64664 Loss: 0.75680 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "537920 Examples seen. Accuracy: 0.7244 Error: 0.75934 Loss: 0.81481 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.22s\n", + "538560 Examples seen. Accuracy: 0.7244 Error: 0.86391 Loss: 0.86154 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.22s\n", + "539200 Examples seen. Accuracy: 0.7252 Error: 0.67938 Loss: 0.70893 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "539840 Examples seen. Accuracy: 0.7273 Error: 0.62804 Loss: 0.62618 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.21s\n", + "540480 Examples seen. Accuracy: 0.7246 Error: 0.89304 Loss: 0.96264 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.31s\n", + "541120 Examples seen. Accuracy: 0.7248 Error: 0.95614 Loss: 1.10903 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.35s\n", + "541760 Examples seen. Accuracy: 0.7293 Error: 0.54207 Loss: 0.48875 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.27s\n", + "542400 Examples seen. Accuracy: 0.7292 Error: 0.73790 Loss: 0.70872 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.23s\n", + "543040 Examples seen. Accuracy: 0.7286 Error: 0.83263 Loss: 0.94727 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "543680 Examples seen. Accuracy: 0.7283 Error: 0.66514 Loss: 0.61452 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "544320 Examples seen. Accuracy: 0.7273 Error: 0.65210 Loss: 0.63786 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.23s\n", + "544960 Examples seen. Accuracy: 0.7270 Error: 0.95984 Loss: 1.06722 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.27s\n", + "545600 Examples seen. Accuracy: 0.7275 Error: 0.65816 Loss: 0.61876 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.33s\n", + "546240 Examples seen. Accuracy: 0.7269 Error: 0.72152 Loss: 0.73718 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.28s\n", + "546880 Examples seen. Accuracy: 0.7247 Error: 0.64205 Loss: 0.63491 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.30s\n", + "547520 Examples seen. Accuracy: 0.7224 Error: 0.85589 Loss: 1.13951 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "548160 Examples seen. Accuracy: 0.7230 Error: 0.69306 Loss: 0.71370 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "548800 Examples seen. Accuracy: 0.7254 Error: 0.78880 Loss: 0.93733 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "549440 Examples seen. Accuracy: 0.7248 Error: 0.79678 Loss: 0.97227 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "550080 Examples seen. Accuracy: 0.7241 Error: 0.64468 Loss: 0.63939 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.29s\n", + "550720 Examples seen. Accuracy: 0.7250 Error: 0.66852 Loss: 0.69237 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "551360 Examples seen. Accuracy: 0.7238 Error: 0.57138 Loss: 0.68234 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "552000 Examples seen. Accuracy: 0.7244 Error: 0.70917 Loss: 0.89323 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "552640 Examples seen. Accuracy: 0.7247 Error: 0.67273 Loss: 0.59706 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "553280 Examples seen. Accuracy: 0.7234 Error: 0.79465 Loss: 0.82839 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.27s\n", + "553920 Examples seen. Accuracy: 0.7273 Error: 0.71642 Loss: 0.73077 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "554560 Examples seen. Accuracy: 0.7284 Error: 0.71214 Loss: 0.77101 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "555200 Examples seen. Accuracy: 0.7297 Error: 0.60608 Loss: 0.56877 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "555840 Examples seen. Accuracy: 0.7279 Error: 0.79744 Loss: 0.95453 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "556480 Examples seen. Accuracy: 0.7289 Error: 0.95153 Loss: 1.01603 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "557120 Examples seen. Accuracy: 0.7272 Error: 0.86453 Loss: 0.96938 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "557760 Examples seen. Accuracy: 0.7276 Error: 0.82442 Loss: 0.89380 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "558400 Examples seen. Accuracy: 0.7266 Error: 0.61843 Loss: 0.57421 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.24s\n", + "559040 Examples seen. Accuracy: 0.7282 Error: 0.72495 Loss: 0.84566 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "559680 Examples seen. Accuracy: 0.7292 Error: 0.75060 Loss: 0.83603 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 14 Examples seen:560000 Validation Accuracy: 0.7765 Validation Error: 0.6387 Validation Loss: 0.6414 Total time: 49.50min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.351 Min Weight: -0.432 Max Output: 3.874 Min Output: -4.535 TNNetConvolutionLinear 32,32,64 Times: 30.17s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.874 Min Output: -0.801 TNNetMaxPool 8,8,64 Times: 6.85s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.710 Min Weight: 0.669 Max Output: 4.732 Min Output: -2.261 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.196 Min Weight: -0.202 Max Output: 8.743 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.07s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.205 Min Weight: -0.177 Max Output: 5.602 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.03s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.209 Min Weight: -0.186 Max Output: 3.182 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.00s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.191 Min Weight: -0.164 Max Output: 2.272 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.08s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.272 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.272 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.42s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.267 Min Weight: -0.230 Max Output: 3.686 Min Output: -6.240 TNNetFullConnectLinear 10,1,1 Times: 0.09s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.471 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3271 minutes. 50 epochs: 1.9392 hours.\n", + "Epochs: 14. Working time: 0.83 hours.\n", + "560640 Examples seen. Accuracy: 0.7306 Error: 0.80351 Loss: 0.87696 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "561280 Examples seen. Accuracy: 0.7304 Error: 0.64158 Loss: 0.59135 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.23s\n", + "561920 Examples seen. Accuracy: 0.7278 Error: 0.88604 Loss: 0.91336 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "562560 Examples seen. Accuracy: 0.7257 Error: 0.59453 Loss: 0.59496 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "563200 Examples seen. Accuracy: 0.7234 Error: 0.78538 Loss: 1.03088 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.26s\n", + "563840 Examples seen. Accuracy: 0.7228 Error: 0.80699 Loss: 1.04114 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "564480 Examples seen. Accuracy: 0.7247 Error: 0.80023 Loss: 0.80287 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.27s\n", + "565120 Examples seen. Accuracy: 0.7246 Error: 0.69403 Loss: 0.69507 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "565760 Examples seen. Accuracy: 0.7251 Error: 0.59034 Loss: 0.64138 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "566400 Examples seen. Accuracy: 0.7241 Error: 0.69445 Loss: 0.68190 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "567040 Examples seen. Accuracy: 0.7246 Error: 0.52389 Loss: 0.52861 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "567680 Examples seen. Accuracy: 0.7247 Error: 0.66098 Loss: 0.72401 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.24s\n", + "568320 Examples seen. Accuracy: 0.7244 Error: 0.69488 Loss: 0.61237 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "568960 Examples seen. Accuracy: 0.7249 Error: 0.77336 Loss: 0.85342 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.26s\n", + "569600 Examples seen. Accuracy: 0.7238 Error: 0.88228 Loss: 1.22315 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.27s\n", + "570240 Examples seen. Accuracy: 0.7264 Error: 0.68647 Loss: 0.66992 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "570880 Examples seen. Accuracy: 0.7285 Error: 0.61368 Loss: 0.58891 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "571520 Examples seen. Accuracy: 0.7297 Error: 0.73747 Loss: 0.74279 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "572160 Examples seen. Accuracy: 0.7280 Error: 0.77270 Loss: 0.86834 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "572800 Examples seen. Accuracy: 0.7264 Error: 0.86754 Loss: 0.98843 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "573440 Examples seen. Accuracy: 0.7277 Error: 0.86382 Loss: 0.91161 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "574080 Examples seen. Accuracy: 0.7273 Error: 0.82721 Loss: 0.98299 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "574720 Examples seen. Accuracy: 0.7259 Error: 0.63012 Loss: 0.67063 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.23s\n", + "575360 Examples seen. Accuracy: 0.7240 Error: 0.85158 Loss: 0.90515 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "576000 Examples seen. Accuracy: 0.7233 Error: 0.83303 Loss: 0.85841 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "576640 Examples seen. Accuracy: 0.7258 Error: 0.87603 Loss: 1.08411 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.22s\n", + "577280 Examples seen. Accuracy: 0.7252 Error: 0.64026 Loss: 0.64775 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "577920 Examples seen. Accuracy: 0.7278 Error: 0.64054 Loss: 0.61645 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.21s\n", + "578560 Examples seen. Accuracy: 0.7333 Error: 0.68802 Loss: 0.70049 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "579200 Examples seen. Accuracy: 0.7323 Error: 0.73008 Loss: 0.69514 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "579840 Examples seen. Accuracy: 0.7328 Error: 0.70623 Loss: 0.80600 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "580480 Examples seen. Accuracy: 0.7313 Error: 0.76681 Loss: 0.98736 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "581120 Examples seen. Accuracy: 0.7316 Error: 0.66294 Loss: 0.64105 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.22s\n", + "581760 Examples seen. Accuracy: 0.7331 Error: 0.59241 Loss: 0.63014 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.21s\n", + "582400 Examples seen. Accuracy: 0.7327 Error: 0.69372 Loss: 0.67690 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.21s\n", + "583040 Examples seen. Accuracy: 0.7316 Error: 0.87871 Loss: 0.94061 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "583680 Examples seen. Accuracy: 0.7322 Error: 0.67386 Loss: 0.69274 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "584320 Examples seen. Accuracy: 0.7317 Error: 0.68296 Loss: 0.66084 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "584960 Examples seen. Accuracy: 0.7303 Error: 0.77688 Loss: 0.84082 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.23s\n", + "585600 Examples seen. Accuracy: 0.7300 Error: 0.80486 Loss: 0.80401 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "586240 Examples seen. Accuracy: 0.7299 Error: 0.58914 Loss: 0.58735 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "586880 Examples seen. Accuracy: 0.7306 Error: 0.74473 Loss: 0.68488 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "587520 Examples seen. Accuracy: 0.7289 Error: 0.71507 Loss: 0.91941 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "588160 Examples seen. Accuracy: 0.7287 Error: 0.82115 Loss: 0.86644 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "588800 Examples seen. Accuracy: 0.7308 Error: 0.63042 Loss: 0.61971 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "589440 Examples seen. Accuracy: 0.7299 Error: 0.82658 Loss: 0.99962 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "590080 Examples seen. Accuracy: 0.7264 Error: 0.70545 Loss: 0.74360 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.21s\n", + "590720 Examples seen. Accuracy: 0.7289 Error: 0.67823 Loss: 0.59907 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.21s\n", + "591360 Examples seen. Accuracy: 0.7278 Error: 0.86924 Loss: 0.91082 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "592000 Examples seen. Accuracy: 0.7291 Error: 0.70767 Loss: 0.79358 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.25s\n", + "592640 Examples seen. Accuracy: 0.7309 Error: 0.55643 Loss: 0.54535 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.26s\n", + "593280 Examples seen. Accuracy: 0.7294 Error: 0.84435 Loss: 0.91779 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "593920 Examples seen. Accuracy: 0.7291 Error: 0.80799 Loss: 0.81080 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "594560 Examples seen. Accuracy: 0.7303 Error: 0.83026 Loss: 0.82174 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.25s\n", + "595200 Examples seen. Accuracy: 0.7307 Error: 0.88218 Loss: 1.01781 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "595840 Examples seen. Accuracy: 0.7326 Error: 0.63130 Loss: 0.79850 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.26s\n", + "596480 Examples seen. Accuracy: 0.7312 Error: 0.85629 Loss: 0.84790 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.24s\n", + "597120 Examples seen. Accuracy: 0.7323 Error: 0.60323 Loss: 0.59276 Threads: 2 Forward time: 0.74s Backward time: 0.40s Step time: 2.25s\n", + "597760 Examples seen. Accuracy: 0.7303 Error: 0.71906 Loss: 0.91518 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.25s\n", + "598400 Examples seen. Accuracy: 0.7298 Error: 0.63105 Loss: 0.56186 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.25s\n", + "599040 Examples seen. Accuracy: 0.7280 Error: 0.81189 Loss: 1.02724 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "599680 Examples seen. Accuracy: 0.7262 Error: 0.76338 Loss: 0.71589 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 15 Examples seen:600000 Validation Accuracy: 0.7838 Validation Error: 0.6131 Validation Loss: 0.6218 Total time: 52.87min\n", + "Epoch time: 2.3292 minutes. 50 epochs: 1.9410 hours.\n", + "Epochs: 15. Working time: 0.88 hours.\n", + "600640 Examples seen. Accuracy: 0.7284 Error: 0.81994 Loss: 0.85169 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "601280 Examples seen. Accuracy: 0.7295 Error: 0.63513 Loss: 0.69268 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "601920 Examples seen. Accuracy: 0.7287 Error: 0.75240 Loss: 0.78298 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "602560 Examples seen. Accuracy: 0.7309 Error: 0.64375 Loss: 0.63940 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "603200 Examples seen. Accuracy: 0.7339 Error: 0.68932 Loss: 0.71015 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "603840 Examples seen. Accuracy: 0.7345 Error: 0.60915 Loss: 0.62535 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "604480 Examples seen. Accuracy: 0.7343 Error: 0.74622 Loss: 0.79655 Threads: 2 Forward time: 0.71s Backward time: 0.38s Step time: 2.25s\n", + "605120 Examples seen. Accuracy: 0.7365 Error: 0.65867 Loss: 0.75340 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "605760 Examples seen. Accuracy: 0.7325 Error: 0.83955 Loss: 1.09509 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "606400 Examples seen. Accuracy: 0.7329 Error: 0.68075 Loss: 0.74307 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "607040 Examples seen. Accuracy: 0.7348 Error: 0.72267 Loss: 0.98237 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "607680 Examples seen. Accuracy: 0.7368 Error: 0.64895 Loss: 0.57925 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.24s\n", + "608320 Examples seen. Accuracy: 0.7386 Error: 0.59484 Loss: 0.67471 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "608960 Examples seen. Accuracy: 0.7376 Error: 0.92837 Loss: 1.08551 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "609600 Examples seen. Accuracy: 0.7332 Error: 0.74487 Loss: 0.72064 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.24s\n", + "610240 Examples seen. Accuracy: 0.7330 Error: 0.61891 Loss: 0.60612 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "610880 Examples seen. Accuracy: 0.7345 Error: 0.68090 Loss: 0.70807 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "611520 Examples seen. Accuracy: 0.7347 Error: 0.71821 Loss: 0.72071 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "612160 Examples seen. Accuracy: 0.7347 Error: 0.67727 Loss: 0.79103 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "612800 Examples seen. Accuracy: 0.7346 Error: 0.64321 Loss: 0.71347 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "613440 Examples seen. Accuracy: 0.7354 Error: 0.86482 Loss: 1.03235 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "614080 Examples seen. Accuracy: 0.7345 Error: 0.79361 Loss: 0.89498 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.29s\n", + "614720 Examples seen. Accuracy: 0.7313 Error: 0.75310 Loss: 0.85220 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "615360 Examples seen. Accuracy: 0.7311 Error: 0.80142 Loss: 0.85136 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "616000 Examples seen. Accuracy: 0.7319 Error: 0.85156 Loss: 0.92874 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "616640 Examples seen. Accuracy: 0.7325 Error: 0.71977 Loss: 0.92685 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "617280 Examples seen. Accuracy: 0.7308 Error: 0.63902 Loss: 0.66988 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.23s\n", + "617920 Examples seen. Accuracy: 0.7308 Error: 0.74319 Loss: 0.80647 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "618560 Examples seen. Accuracy: 0.7323 Error: 0.68184 Loss: 0.73890 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "619200 Examples seen. Accuracy: 0.7325 Error: 0.81646 Loss: 0.97258 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.23s\n", + "619840 Examples seen. Accuracy: 0.7334 Error: 0.67333 Loss: 0.61803 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.26s\n", + "620480 Examples seen. Accuracy: 0.7344 Error: 0.74474 Loss: 0.86607 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "621120 Examples seen. Accuracy: 0.7341 Error: 0.61966 Loss: 0.65237 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.22s\n", + "621760 Examples seen. Accuracy: 0.7330 Error: 0.74581 Loss: 0.71640 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "622400 Examples seen. Accuracy: 0.7339 Error: 0.66135 Loss: 0.79537 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "623040 Examples seen. Accuracy: 0.7365 Error: 0.58393 Loss: 0.52766 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "623680 Examples seen. Accuracy: 0.7352 Error: 0.77711 Loss: 0.85853 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.22s\n", + "624320 Examples seen. Accuracy: 0.7343 Error: 0.73479 Loss: 0.76162 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.26s\n", + "624960 Examples seen. Accuracy: 0.7345 Error: 0.65527 Loss: 0.64969 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "625600 Examples seen. Accuracy: 0.7370 Error: 0.74948 Loss: 0.82470 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "626240 Examples seen. Accuracy: 0.7369 Error: 0.90981 Loss: 1.05147 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "626880 Examples seen. Accuracy: 0.7373 Error: 0.66287 Loss: 0.80990 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "627520 Examples seen. Accuracy: 0.7359 Error: 0.73969 Loss: 0.81561 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.22s\n", + "628160 Examples seen. Accuracy: 0.7375 Error: 0.79360 Loss: 0.84161 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "628800 Examples seen. Accuracy: 0.7365 Error: 0.72637 Loss: 0.88804 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "629440 Examples seen. Accuracy: 0.7359 Error: 0.72532 Loss: 0.76928 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.26s\n", + "630080 Examples seen. Accuracy: 0.7339 Error: 0.57431 Loss: 0.51671 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "630720 Examples seen. Accuracy: 0.7336 Error: 0.62127 Loss: 0.61188 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.23s\n", + "631360 Examples seen. Accuracy: 0.7341 Error: 0.70153 Loss: 0.74808 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "632000 Examples seen. Accuracy: 0.7343 Error: 0.71181 Loss: 0.77254 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "632640 Examples seen. Accuracy: 0.7333 Error: 0.66034 Loss: 0.62480 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "633280 Examples seen. Accuracy: 0.7344 Error: 0.71350 Loss: 0.66858 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "633920 Examples seen. Accuracy: 0.7314 Error: 0.76506 Loss: 0.98048 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.20s\n", + "634560 Examples seen. Accuracy: 0.7327 Error: 0.74348 Loss: 0.81963 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.19s\n", + "635200 Examples seen. Accuracy: 0.7361 Error: 0.73710 Loss: 0.84706 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.22s\n", + "635840 Examples seen. Accuracy: 0.7375 Error: 0.52457 Loss: 0.48535 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "636480 Examples seen. Accuracy: 0.7363 Error: 0.79605 Loss: 0.85576 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.18s\n", + "637120 Examples seen. Accuracy: 0.7340 Error: 0.72260 Loss: 0.85414 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "637760 Examples seen. Accuracy: 0.7327 Error: 0.94315 Loss: 1.11068 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "638400 Examples seen. Accuracy: 0.7327 Error: 0.80111 Loss: 0.81753 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "639040 Examples seen. Accuracy: 0.7333 Error: 0.63148 Loss: 0.62587 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "639680 Examples seen. Accuracy: 0.7328 Error: 0.70743 Loss: 0.76274 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 16 Examples seen:640000 Validation Accuracy: 0.7886 Validation Error: 0.5938 Validation Loss: 0.6055 Total time: 56.24min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.376 Min Weight: -0.457 Max Output: 3.971 Min Output: -4.654 TNNetConvolutionLinear 32,32,64 Times: 30.17s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.971 Min Output: -0.845 TNNetMaxPool 8,8,64 Times: 6.98s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.731 Min Weight: 0.680 Max Output: 4.762 Min Output: -2.316 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.217 Min Weight: -0.216 Max Output: 9.054 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.02s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.218 Min Weight: -0.187 Max Output: 5.782 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.226 Min Weight: -0.198 Max Output: 3.523 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.00s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.193 Min Weight: -0.176 Max Output: 2.450 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.13s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.450 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.450 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.40s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.274 Min Weight: -0.236 Max Output: 4.063 Min Output: -6.511 TNNetFullConnectLinear 10,1,1 Times: 0.10s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.533 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3135 minutes. 50 epochs: 1.9280 hours.\n", + "Epochs: 16. Working time: 0.94 hours.\n", + "640640 Examples seen. Accuracy: 0.7309 Error: 0.82638 Loss: 0.92494 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "641280 Examples seen. Accuracy: 0.7325 Error: 0.91600 Loss: 0.94810 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "641920 Examples seen. Accuracy: 0.7340 Error: 0.57504 Loss: 0.58877 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "642560 Examples seen. Accuracy: 0.7361 Error: 0.70371 Loss: 0.66729 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.24s\n", + "643200 Examples seen. Accuracy: 0.7349 Error: 0.59611 Loss: 0.55064 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "643840 Examples seen. Accuracy: 0.7356 Error: 0.68335 Loss: 0.72285 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "644480 Examples seen. Accuracy: 0.7354 Error: 0.79125 Loss: 0.81970 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.21s\n", + "645120 Examples seen. Accuracy: 0.7341 Error: 0.62963 Loss: 0.66480 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.22s\n", + "645760 Examples seen. Accuracy: 0.7348 Error: 0.63267 Loss: 0.68203 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "646400 Examples seen. Accuracy: 0.7334 Error: 0.77634 Loss: 0.77292 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "647040 Examples seen. Accuracy: 0.7340 Error: 0.68604 Loss: 0.74443 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "647680 Examples seen. Accuracy: 0.7323 Error: 0.84024 Loss: 0.88229 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "648320 Examples seen. Accuracy: 0.7335 Error: 0.64345 Loss: 0.62506 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "648960 Examples seen. Accuracy: 0.7369 Error: 0.67470 Loss: 0.64669 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.22s\n", + "649600 Examples seen. Accuracy: 0.7390 Error: 0.73256 Loss: 0.85692 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "650240 Examples seen. Accuracy: 0.7400 Error: 0.73254 Loss: 0.79751 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "650880 Examples seen. Accuracy: 0.7407 Error: 0.62521 Loss: 0.64345 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "651520 Examples seen. Accuracy: 0.7369 Error: 0.68342 Loss: 0.63963 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.19s\n", + "652160 Examples seen. Accuracy: 0.7377 Error: 0.68928 Loss: 0.77645 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "652800 Examples seen. Accuracy: 0.7373 Error: 0.64143 Loss: 0.56451 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "653440 Examples seen. Accuracy: 0.7380 Error: 0.72414 Loss: 0.73863 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "654080 Examples seen. Accuracy: 0.7420 Error: 0.54171 Loss: 0.52409 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "654720 Examples seen. Accuracy: 0.7420 Error: 0.74278 Loss: 0.77258 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "655360 Examples seen. Accuracy: 0.7423 Error: 0.66121 Loss: 0.72188 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "656000 Examples seen. Accuracy: 0.7432 Error: 0.82239 Loss: 0.94187 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "656640 Examples seen. Accuracy: 0.7427 Error: 0.64885 Loss: 0.68349 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "657280 Examples seen. Accuracy: 0.7437 Error: 0.71814 Loss: 0.74520 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "657920 Examples seen. Accuracy: 0.7453 Error: 0.64737 Loss: 0.62897 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "658560 Examples seen. Accuracy: 0.7464 Error: 0.70529 Loss: 0.81118 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.21s\n", + "659200 Examples seen. Accuracy: 0.7449 Error: 0.76477 Loss: 1.09963 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "659840 Examples seen. Accuracy: 0.7471 Error: 0.64581 Loss: 0.68587 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.30s\n", + "660480 Examples seen. Accuracy: 0.7464 Error: 0.65515 Loss: 0.56691 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "661120 Examples seen. Accuracy: 0.7461 Error: 0.70373 Loss: 0.77010 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.29s\n", + "661760 Examples seen. Accuracy: 0.7470 Error: 0.52837 Loss: 0.51442 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "662400 Examples seen. Accuracy: 0.7482 Error: 0.67102 Loss: 0.58382 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "663040 Examples seen. Accuracy: 0.7493 Error: 0.72828 Loss: 0.79608 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "663680 Examples seen. Accuracy: 0.7502 Error: 0.66922 Loss: 0.78517 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "664320 Examples seen. Accuracy: 0.7477 Error: 0.65005 Loss: 0.62998 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "664960 Examples seen. Accuracy: 0.7478 Error: 0.72008 Loss: 0.77701 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "665600 Examples seen. Accuracy: 0.7495 Error: 0.62754 Loss: 0.72530 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "666240 Examples seen. Accuracy: 0.7461 Error: 0.71913 Loss: 0.76676 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "666880 Examples seen. Accuracy: 0.7466 Error: 0.61662 Loss: 0.64074 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "667520 Examples seen. Accuracy: 0.7455 Error: 0.61484 Loss: 0.64118 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "668160 Examples seen. Accuracy: 0.7463 Error: 0.80282 Loss: 0.86444 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "668800 Examples seen. Accuracy: 0.7447 Error: 0.71970 Loss: 0.75942 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "669440 Examples seen. Accuracy: 0.7445 Error: 0.65272 Loss: 0.62319 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.22s\n", + "670080 Examples seen. Accuracy: 0.7454 Error: 0.70711 Loss: 0.83477 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "670720 Examples seen. Accuracy: 0.7454 Error: 0.66471 Loss: 0.64513 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.23s\n", + "671360 Examples seen. Accuracy: 0.7447 Error: 0.57398 Loss: 0.54833 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "672000 Examples seen. Accuracy: 0.7429 Error: 0.62394 Loss: 0.56139 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.23s\n", + "672640 Examples seen. Accuracy: 0.7434 Error: 0.75827 Loss: 0.80341 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.26s\n", + "673280 Examples seen. Accuracy: 0.7425 Error: 0.62356 Loss: 0.59256 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.27s\n", + "673920 Examples seen. Accuracy: 0.7451 Error: 0.64164 Loss: 0.54813 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.24s\n", + "674560 Examples seen. Accuracy: 0.7429 Error: 0.78330 Loss: 0.82028 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.22s\n", + "675200 Examples seen. Accuracy: 0.7451 Error: 0.54920 Loss: 0.46735 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.26s\n", + "675840 Examples seen. Accuracy: 0.7441 Error: 0.76564 Loss: 0.83251 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "676480 Examples seen. Accuracy: 0.7445 Error: 0.58589 Loss: 0.55629 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.22s\n", + "677120 Examples seen. Accuracy: 0.7452 Error: 0.72955 Loss: 0.75121 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.22s\n", + "677760 Examples seen. Accuracy: 0.7426 Error: 0.75823 Loss: 0.81646 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "678400 Examples seen. Accuracy: 0.7427 Error: 0.77147 Loss: 0.91921 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.26s\n", + "679040 Examples seen. Accuracy: 0.7439 Error: 0.80838 Loss: 0.76238 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "679680 Examples seen. Accuracy: 0.7443 Error: 0.63170 Loss: 0.62603 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.28s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 17 Examples seen:680000 Validation Accuracy: 0.7973 Validation Error: 0.5764 Validation Loss: 0.5915 Total time: 59.61min\n", + "Epoch time: 2.3740 minutes. 50 epochs: 1.9783 hours.\n", + "Epochs: 17. Working time: 0.99 hours.\n", + "680640 Examples seen. Accuracy: 0.7444 Error: 0.76471 Loss: 0.85697 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "681280 Examples seen. Accuracy: 0.7440 Error: 0.63860 Loss: 0.62789 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "681920 Examples seen. Accuracy: 0.7461 Error: 0.70501 Loss: 0.67998 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "682560 Examples seen. Accuracy: 0.7463 Error: 0.67425 Loss: 0.66258 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.23s\n", + "683200 Examples seen. Accuracy: 0.7457 Error: 0.82548 Loss: 0.93123 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "683840 Examples seen. Accuracy: 0.7447 Error: 0.76277 Loss: 0.79113 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "684480 Examples seen. Accuracy: 0.7462 Error: 0.60808 Loss: 0.65183 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "685120 Examples seen. Accuracy: 0.7474 Error: 0.68330 Loss: 0.79063 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "685760 Examples seen. Accuracy: 0.7478 Error: 0.62325 Loss: 0.73712 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.23s\n", + "686400 Examples seen. Accuracy: 0.7448 Error: 0.75919 Loss: 0.78990 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "687040 Examples seen. Accuracy: 0.7424 Error: 0.69270 Loss: 0.80321 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "687680 Examples seen. Accuracy: 0.7432 Error: 0.59096 Loss: 0.65548 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "688320 Examples seen. Accuracy: 0.7419 Error: 0.62345 Loss: 0.58529 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.19s\n", + "688960 Examples seen. Accuracy: 0.7423 Error: 0.69672 Loss: 0.71657 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "689600 Examples seen. Accuracy: 0.7398 Error: 0.81346 Loss: 0.97869 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.23s\n", + "690240 Examples seen. Accuracy: 0.7425 Error: 0.64256 Loss: 0.70856 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.26s\n", + "690880 Examples seen. Accuracy: 0.7439 Error: 0.57510 Loss: 0.54927 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "691520 Examples seen. Accuracy: 0.7435 Error: 0.65889 Loss: 0.68224 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "692160 Examples seen. Accuracy: 0.7444 Error: 0.70932 Loss: 0.69278 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "692800 Examples seen. Accuracy: 0.7469 Error: 0.76683 Loss: 0.81982 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "693440 Examples seen. Accuracy: 0.7489 Error: 0.57121 Loss: 0.58941 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "694080 Examples seen. Accuracy: 0.7503 Error: 0.65543 Loss: 0.64369 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "694720 Examples seen. Accuracy: 0.7507 Error: 0.59517 Loss: 0.71840 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "695360 Examples seen. Accuracy: 0.7505 Error: 0.64793 Loss: 0.70247 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "696000 Examples seen. Accuracy: 0.7514 Error: 0.54395 Loss: 0.54845 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "696640 Examples seen. Accuracy: 0.7524 Error: 0.45395 Loss: 0.43116 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.24s\n", + "697280 Examples seen. Accuracy: 0.7508 Error: 0.58586 Loss: 0.66098 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "697920 Examples seen. Accuracy: 0.7504 Error: 0.68551 Loss: 0.68534 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "698560 Examples seen. Accuracy: 0.7500 Error: 0.67417 Loss: 0.63803 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "699200 Examples seen. Accuracy: 0.7515 Error: 0.72931 Loss: 0.82549 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "699840 Examples seen. Accuracy: 0.7498 Error: 0.72527 Loss: 0.73511 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "700480 Examples seen. Accuracy: 0.7501 Error: 0.71699 Loss: 0.83645 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.21s\n", + "701120 Examples seen. Accuracy: 0.7497 Error: 0.69301 Loss: 0.84705 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "701760 Examples seen. Accuracy: 0.7515 Error: 0.61931 Loss: 0.71229 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "702400 Examples seen. Accuracy: 0.7481 Error: 0.67687 Loss: 0.66375 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "703040 Examples seen. Accuracy: 0.7480 Error: 0.66191 Loss: 0.66811 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "703680 Examples seen. Accuracy: 0.7476 Error: 0.54325 Loss: 0.52029 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.21s\n", + "704320 Examples seen. Accuracy: 0.7478 Error: 0.66869 Loss: 0.73869 Threads: 2 Forward time: 0.71s Backward time: 0.38s Step time: 2.19s\n", + "704960 Examples seen. Accuracy: 0.7475 Error: 0.66700 Loss: 0.70041 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "705600 Examples seen. Accuracy: 0.7458 Error: 0.58845 Loss: 0.60085 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "706240 Examples seen. Accuracy: 0.7441 Error: 0.67111 Loss: 0.69219 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "706880 Examples seen. Accuracy: 0.7458 Error: 0.84117 Loss: 0.96418 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "707520 Examples seen. Accuracy: 0.7439 Error: 0.69631 Loss: 0.85907 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "708160 Examples seen. Accuracy: 0.7423 Error: 0.73660 Loss: 0.76291 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "708800 Examples seen. Accuracy: 0.7433 Error: 0.61974 Loss: 0.54191 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "709440 Examples seen. Accuracy: 0.7443 Error: 0.68206 Loss: 0.72189 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "710080 Examples seen. Accuracy: 0.7427 Error: 0.63347 Loss: 0.74007 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.21s\n", + "710720 Examples seen. Accuracy: 0.7406 Error: 0.81315 Loss: 0.86407 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "711360 Examples seen. Accuracy: 0.7426 Error: 0.67010 Loss: 0.69347 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "712000 Examples seen. Accuracy: 0.7440 Error: 0.61678 Loss: 0.59234 Threads: 2 Forward time: 0.71s Backward time: 0.38s Step time: 2.21s\n", + "712640 Examples seen. Accuracy: 0.7461 Error: 0.78602 Loss: 0.85127 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "713280 Examples seen. Accuracy: 0.7470 Error: 0.62901 Loss: 0.65326 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "713920 Examples seen. Accuracy: 0.7466 Error: 0.72594 Loss: 0.72941 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "714560 Examples seen. Accuracy: 0.7476 Error: 0.60528 Loss: 0.52597 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.19s\n", + "715200 Examples seen. Accuracy: 0.7481 Error: 0.56867 Loss: 0.62178 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.22s\n", + "715840 Examples seen. Accuracy: 0.7491 Error: 0.69793 Loss: 0.85806 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.21s\n", + "716480 Examples seen. Accuracy: 0.7496 Error: 0.61443 Loss: 0.68154 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "717120 Examples seen. Accuracy: 0.7459 Error: 0.70307 Loss: 0.72271 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.20s\n", + "717760 Examples seen. Accuracy: 0.7427 Error: 0.75862 Loss: 0.80682 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "718400 Examples seen. Accuracy: 0.7406 Error: 0.77899 Loss: 0.76672 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "719040 Examples seen. Accuracy: 0.7371 Error: 0.77070 Loss: 0.89312 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "719680 Examples seen. Accuracy: 0.7384 Error: 0.68532 Loss: 0.77363 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.20s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 18 Examples seen:720000 Validation Accuracy: 0.8013 Validation Error: 0.5615 Validation Loss: 0.5810 Total time: 62.96min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.401 Min Weight: -0.477 Max Output: 4.046 Min Output: -4.851 TNNetConvolutionLinear 32,32,64 Times: 30.15s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.046 Min Output: -0.858 TNNetMaxPool 8,8,64 Times: 6.94s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.749 Min Weight: 0.696 Max Output: 4.736 Min Output: -2.308 TNNetMovingStdNormalization 8,8,64 Times: 0.12s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.233 Min Weight: -0.228 Max Output: 9.352 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.03s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.230 Min Weight: -0.197 Max Output: 6.127 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.05s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.239 Min Weight: -0.207 Max Output: 3.796 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.96s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.196 Min Weight: -0.185 Max Output: 2.495 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.10s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.495 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.495 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.40s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.277 Min Weight: -0.243 Max Output: 4.363 Min Output: -6.905 TNNetFullConnectLinear 10,1,1 Times: 0.08s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.525 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.2948 minutes. 50 epochs: 1.9123 hours.\n", + "Epochs: 18. Working time: 1.05 hours.\n", + "720640 Examples seen. Accuracy: 0.7384 Error: 0.81479 Loss: 0.86477 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.23s\n", + "721280 Examples seen. Accuracy: 0.7369 Error: 0.67019 Loss: 0.67882 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.21s\n", + "721920 Examples seen. Accuracy: 0.7353 Error: 0.71617 Loss: 0.81941 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "722560 Examples seen. Accuracy: 0.7355 Error: 0.78681 Loss: 0.94953 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.20s\n", + "723200 Examples seen. Accuracy: 0.7355 Error: 0.59769 Loss: 0.64527 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "723840 Examples seen. Accuracy: 0.7370 Error: 0.67503 Loss: 0.75800 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "724480 Examples seen. Accuracy: 0.7363 Error: 0.67807 Loss: 0.70894 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "725120 Examples seen. Accuracy: 0.7359 Error: 0.68503 Loss: 0.70721 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "725760 Examples seen. Accuracy: 0.7349 Error: 0.81691 Loss: 0.85376 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "726400 Examples seen. Accuracy: 0.7354 Error: 0.69860 Loss: 0.84943 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "727040 Examples seen. Accuracy: 0.7392 Error: 0.60966 Loss: 0.59020 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "727680 Examples seen. Accuracy: 0.7426 Error: 0.60382 Loss: 0.73869 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "728320 Examples seen. Accuracy: 0.7448 Error: 0.67780 Loss: 0.67395 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "728960 Examples seen. Accuracy: 0.7438 Error: 0.79227 Loss: 0.86053 Threads: 2 Forward time: 0.71s Backward time: 0.38s Step time: 2.24s\n", + "729600 Examples seen. Accuracy: 0.7463 Error: 0.54816 Loss: 0.49878 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.23s\n", + "730240 Examples seen. Accuracy: 0.7495 Error: 0.59373 Loss: 0.73298 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "730880 Examples seen. Accuracy: 0.7479 Error: 0.66296 Loss: 0.65091 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "731520 Examples seen. Accuracy: 0.7503 Error: 0.63504 Loss: 0.61188 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "732160 Examples seen. Accuracy: 0.7494 Error: 0.69592 Loss: 0.78318 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "732800 Examples seen. Accuracy: 0.7530 Error: 0.68255 Loss: 0.68436 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.30s\n", + "733440 Examples seen. Accuracy: 0.7548 Error: 0.63731 Loss: 0.62985 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.30s\n", + "734080 Examples seen. Accuracy: 0.7564 Error: 0.58715 Loss: 0.62825 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.24s\n", + "734720 Examples seen. Accuracy: 0.7562 Error: 0.68128 Loss: 0.78043 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "735360 Examples seen. Accuracy: 0.7534 Error: 0.80153 Loss: 0.81774 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "736000 Examples seen. Accuracy: 0.7551 Error: 0.64163 Loss: 0.60553 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "736640 Examples seen. Accuracy: 0.7525 Error: 0.66038 Loss: 0.72153 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "737280 Examples seen. Accuracy: 0.7538 Error: 0.80220 Loss: 1.03444 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "737920 Examples seen. Accuracy: 0.7535 Error: 0.65068 Loss: 0.72064 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.28s\n", + "738560 Examples seen. Accuracy: 0.7521 Error: 0.72063 Loss: 0.80066 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "739200 Examples seen. Accuracy: 0.7522 Error: 0.75485 Loss: 0.69329 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.23s\n", + "739840 Examples seen. Accuracy: 0.7534 Error: 0.47387 Loss: 0.40322 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "740480 Examples seen. Accuracy: 0.7523 Error: 0.57351 Loss: 0.60010 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "741120 Examples seen. Accuracy: 0.7529 Error: 0.57557 Loss: 0.60500 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "741760 Examples seen. Accuracy: 0.7528 Error: 0.73074 Loss: 0.84120 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "742400 Examples seen. Accuracy: 0.7515 Error: 0.79246 Loss: 0.84883 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "743040 Examples seen. Accuracy: 0.7504 Error: 0.56091 Loss: 0.58200 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.30s\n", + "743680 Examples seen. Accuracy: 0.7513 Error: 0.72926 Loss: 0.91264 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.27s\n", + "744320 Examples seen. Accuracy: 0.7518 Error: 0.60331 Loss: 0.53953 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "744960 Examples seen. Accuracy: 0.7500 Error: 0.62054 Loss: 0.62459 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.23s\n", + "745600 Examples seen. Accuracy: 0.7474 Error: 0.90180 Loss: 0.91301 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "746240 Examples seen. Accuracy: 0.7437 Error: 0.71330 Loss: 0.63391 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "746880 Examples seen. Accuracy: 0.7424 Error: 0.64487 Loss: 0.63013 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "747520 Examples seen. Accuracy: 0.7414 Error: 0.71003 Loss: 0.79684 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.21s\n", + "748160 Examples seen. Accuracy: 0.7399 Error: 0.79718 Loss: 1.08230 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.31s\n", + "748800 Examples seen. Accuracy: 0.7414 Error: 0.57249 Loss: 0.49681 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.26s\n", + "749440 Examples seen. Accuracy: 0.7428 Error: 0.65894 Loss: 0.59739 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "750080 Examples seen. Accuracy: 0.7411 Error: 0.77658 Loss: 0.92213 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "750720 Examples seen. Accuracy: 0.7390 Error: 0.64206 Loss: 0.67396 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "751360 Examples seen. Accuracy: 0.7382 Error: 0.61305 Loss: 0.64371 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "752000 Examples seen. Accuracy: 0.7392 Error: 0.56364 Loss: 0.58881 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "752640 Examples seen. Accuracy: 0.7416 Error: 0.68479 Loss: 0.67162 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "753280 Examples seen. Accuracy: 0.7419 Error: 0.68147 Loss: 0.71788 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "753920 Examples seen. Accuracy: 0.7415 Error: 0.81534 Loss: 0.92658 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "754560 Examples seen. Accuracy: 0.7403 Error: 0.84757 Loss: 0.84771 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.21s\n", + "755200 Examples seen. Accuracy: 0.7426 Error: 0.61342 Loss: 0.61207 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "755840 Examples seen. Accuracy: 0.7454 Error: 0.59487 Loss: 0.54379 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "756480 Examples seen. Accuracy: 0.7465 Error: 0.68374 Loss: 0.61202 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "757120 Examples seen. Accuracy: 0.7472 Error: 0.68763 Loss: 0.79570 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "757760 Examples seen. Accuracy: 0.7487 Error: 0.62339 Loss: 0.53550 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "758400 Examples seen. Accuracy: 0.7468 Error: 0.73641 Loss: 0.82330 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "759040 Examples seen. Accuracy: 0.7467 Error: 0.73017 Loss: 0.76498 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "759680 Examples seen. Accuracy: 0.7465 Error: 0.78027 Loss: 0.87566 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 19 Examples seen:760000 Validation Accuracy: 0.8041 Validation Error: 0.5506 Validation Loss: 0.5727 Total time: 66.33min\n", + "Epoch time: 2.3094 minutes. 50 epochs: 1.9245 hours.\n", + "Epochs: 19. Working time: 1.11 hours.\n", + "760640 Examples seen. Accuracy: 0.7455 Error: 0.76612 Loss: 0.65207 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "761280 Examples seen. Accuracy: 0.7450 Error: 0.65331 Loss: 0.60922 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "761920 Examples seen. Accuracy: 0.7421 Error: 0.69570 Loss: 0.79371 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "762560 Examples seen. Accuracy: 0.7440 Error: 0.62391 Loss: 0.65246 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.30s\n", + "763200 Examples seen. Accuracy: 0.7443 Error: 0.65916 Loss: 0.72765 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.23s\n", + "763840 Examples seen. Accuracy: 0.7428 Error: 0.73183 Loss: 0.81312 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "764480 Examples seen. Accuracy: 0.7430 Error: 0.59290 Loss: 0.64103 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "765120 Examples seen. Accuracy: 0.7456 Error: 0.63603 Loss: 0.78334 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "765760 Examples seen. Accuracy: 0.7441 Error: 0.77148 Loss: 0.74225 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "766400 Examples seen. Accuracy: 0.7441 Error: 0.57005 Loss: 0.55999 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.26s\n", + "767040 Examples seen. Accuracy: 0.7447 Error: 0.59310 Loss: 0.60814 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "767680 Examples seen. Accuracy: 0.7456 Error: 0.58268 Loss: 0.55473 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "768320 Examples seen. Accuracy: 0.7465 Error: 0.65579 Loss: 0.66358 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.22s\n", + "768960 Examples seen. Accuracy: 0.7464 Error: 0.66301 Loss: 0.75138 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "769600 Examples seen. Accuracy: 0.7473 Error: 0.68843 Loss: 0.66562 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "770240 Examples seen. Accuracy: 0.7483 Error: 0.64479 Loss: 0.59848 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.21s\n", + "770880 Examples seen. Accuracy: 0.7474 Error: 0.68483 Loss: 0.76079 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.23s\n", + "771520 Examples seen. Accuracy: 0.7471 Error: 0.66196 Loss: 0.55847 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "772160 Examples seen. Accuracy: 0.7460 Error: 0.59508 Loss: 0.75376 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "772800 Examples seen. Accuracy: 0.7444 Error: 0.68392 Loss: 0.67414 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "773440 Examples seen. Accuracy: 0.7450 Error: 0.62442 Loss: 0.66875 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.21s\n", + "774080 Examples seen. Accuracy: 0.7469 Error: 0.51962 Loss: 0.57829 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.23s\n", + "774720 Examples seen. Accuracy: 0.7493 Error: 0.73002 Loss: 0.74118 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "775360 Examples seen. Accuracy: 0.7509 Error: 0.87295 Loss: 1.02797 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "776000 Examples seen. Accuracy: 0.7509 Error: 0.60510 Loss: 0.75229 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "776640 Examples seen. Accuracy: 0.7510 Error: 0.77568 Loss: 0.82427 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.26s\n", + "777280 Examples seen. Accuracy: 0.7513 Error: 0.62681 Loss: 0.68385 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.32s\n", + "777920 Examples seen. Accuracy: 0.7479 Error: 0.56135 Loss: 0.66979 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.33s\n", + "778560 Examples seen. Accuracy: 0.7494 Error: 0.69744 Loss: 0.83112 Threads: 2 Forward time: 0.76s Backward time: 0.38s Step time: 2.34s\n", + "779200 Examples seen. Accuracy: 0.7482 Error: 0.54071 Loss: 0.50365 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.36s\n", + "779840 Examples seen. Accuracy: 0.7483 Error: 0.60984 Loss: 0.71318 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "780480 Examples seen. Accuracy: 0.7466 Error: 0.77419 Loss: 0.76812 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.28s\n", + "781120 Examples seen. Accuracy: 0.7462 Error: 0.69827 Loss: 0.70623 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "781760 Examples seen. Accuracy: 0.7458 Error: 0.78953 Loss: 0.81987 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.24s\n", + "782400 Examples seen. Accuracy: 0.7457 Error: 0.46266 Loss: 0.45021 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "783040 Examples seen. Accuracy: 0.7473 Error: 0.63881 Loss: 0.68950 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "783680 Examples seen. Accuracy: 0.7462 Error: 0.67190 Loss: 0.75382 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.32s\n", + "784320 Examples seen. Accuracy: 0.7465 Error: 0.70063 Loss: 0.83063 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.31s\n", + "784960 Examples seen. Accuracy: 0.7447 Error: 0.54616 Loss: 0.48841 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "785600 Examples seen. Accuracy: 0.7452 Error: 0.68409 Loss: 0.66861 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "786240 Examples seen. Accuracy: 0.7467 Error: 0.75765 Loss: 0.84731 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "786880 Examples seen. Accuracy: 0.7501 Error: 0.64454 Loss: 0.68241 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "787520 Examples seen. Accuracy: 0.7516 Error: 0.69561 Loss: 0.81390 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.24s\n", + "788160 Examples seen. Accuracy: 0.7521 Error: 0.74395 Loss: 0.79623 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "788800 Examples seen. Accuracy: 0.7530 Error: 0.66210 Loss: 0.68422 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "789440 Examples seen. Accuracy: 0.7544 Error: 0.65908 Loss: 0.68625 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "790080 Examples seen. Accuracy: 0.7547 Error: 0.75703 Loss: 0.96614 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.25s\n", + "790720 Examples seen. Accuracy: 0.7527 Error: 0.70642 Loss: 0.68642 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.26s\n", + "791360 Examples seen. Accuracy: 0.7519 Error: 0.65446 Loss: 0.74613 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.28s\n", + "792000 Examples seen. Accuracy: 0.7507 Error: 0.71545 Loss: 0.79001 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.29s\n", + "792640 Examples seen. Accuracy: 0.7496 Error: 0.53167 Loss: 0.44972 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "793280 Examples seen. Accuracy: 0.7492 Error: 0.65414 Loss: 0.75987 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.21s\n", + "793920 Examples seen. Accuracy: 0.7471 Error: 0.60184 Loss: 0.50171 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "794560 Examples seen. Accuracy: 0.7457 Error: 0.98126 Loss: 1.20397 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "795200 Examples seen. Accuracy: 0.7465 Error: 0.69250 Loss: 0.71571 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.22s\n", + "795840 Examples seen. Accuracy: 0.7447 Error: 0.82366 Loss: 0.81982 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "796480 Examples seen. Accuracy: 0.7432 Error: 0.72180 Loss: 0.82688 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "797120 Examples seen. Accuracy: 0.7446 Error: 0.65197 Loss: 0.56577 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "797760 Examples seen. Accuracy: 0.7462 Error: 0.56387 Loss: 0.57156 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.27s\n", + "798400 Examples seen. Accuracy: 0.7483 Error: 0.77927 Loss: 0.86586 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.26s\n", + "799040 Examples seen. Accuracy: 0.7510 Error: 0.47181 Loss: 0.48380 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "799680 Examples seen. Accuracy: 0.7462 Error: 0.76294 Loss: 0.76654 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.20s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 20 Examples seen:800000 Validation Accuracy: 0.8077 Validation Error: 0.5409 Validation Loss: 0.5646 Total time: 69.72min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.421 Min Weight: -0.495 Max Output: 4.172 Min Output: -5.018 TNNetConvolutionLinear 32,32,64 Times: 30.10s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.172 Min Output: -0.922 TNNetMaxPool 8,8,64 Times: 6.91s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.765 Min Weight: 0.713 Max Output: 4.780 Min Output: -2.367 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.247 Min Weight: -0.239 Max Output: 9.339 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.14s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.239 Min Weight: -0.206 Max Output: 6.290 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.99s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.246 Min Weight: -0.210 Max Output: 4.148 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.05s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.208 Min Weight: -0.199 Max Output: 2.330 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.06s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.330 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.330 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.40s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.299 Min Weight: -0.252 Max Output: 4.613 Min Output: -7.367 TNNetFullConnectLinear 10,1,1 Times: 0.09s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.516 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Starting Testing.\n", + "Epochs: 20 Examples seen:800000 Test Accuracy: 0.8013 Test Error: 0.5539 Test Loss: 0.5934 Total time: 70.75min\n", + "Epoch time: 2.2958 minutes. 50 epochs: 1.9132 hours.\n", + "Epochs: 20. Working time: 1.18 hours.\n", + "Learning rate set to: 0.00082\n", + "800640 Examples seen. Accuracy: 0.7448 Error: 0.56606 Loss: 0.50623 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "801280 Examples seen. Accuracy: 0.7453 Error: 0.72370 Loss: 0.81853 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "801920 Examples seen. Accuracy: 0.7459 Error: 0.57313 Loss: 0.66880 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "802560 Examples seen. Accuracy: 0.7459 Error: 0.63857 Loss: 0.60604 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "803200 Examples seen. Accuracy: 0.7475 Error: 0.61641 Loss: 0.61390 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.24s\n", + "803840 Examples seen. Accuracy: 0.7492 Error: 0.86898 Loss: 0.98058 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "804480 Examples seen. Accuracy: 0.7520 Error: 0.62232 Loss: 0.57860 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "805120 Examples seen. Accuracy: 0.7525 Error: 0.77007 Loss: 0.91639 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "805760 Examples seen. Accuracy: 0.7515 Error: 0.67737 Loss: 0.82705 Threads: 2 Forward time: 0.74s Backward time: 0.39s Step time: 2.23s\n", + "806400 Examples seen. Accuracy: 0.7509 Error: 0.81284 Loss: 0.75538 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.22s\n", + "807040 Examples seen. Accuracy: 0.7486 Error: 0.61276 Loss: 0.64802 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "807680 Examples seen. Accuracy: 0.7480 Error: 0.68058 Loss: 0.72430 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.24s\n", + "808320 Examples seen. Accuracy: 0.7502 Error: 0.65153 Loss: 0.64450 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "808960 Examples seen. Accuracy: 0.7508 Error: 0.65606 Loss: 0.71989 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.24s\n", + "809600 Examples seen. Accuracy: 0.7550 Error: 0.62511 Loss: 0.60859 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.22s\n", + "810240 Examples seen. Accuracy: 0.7537 Error: 0.64786 Loss: 0.67271 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "810880 Examples seen. Accuracy: 0.7511 Error: 0.67705 Loss: 0.60278 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "811520 Examples seen. Accuracy: 0.7523 Error: 0.79713 Loss: 0.78049 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "812160 Examples seen. Accuracy: 0.7558 Error: 0.59967 Loss: 0.54886 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "812800 Examples seen. Accuracy: 0.7569 Error: 0.58744 Loss: 0.64642 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.24s\n", + "813440 Examples seen. Accuracy: 0.7575 Error: 0.67909 Loss: 0.75188 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "814080 Examples seen. Accuracy: 0.7554 Error: 0.81473 Loss: 0.84896 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "814720 Examples seen. Accuracy: 0.7544 Error: 0.73934 Loss: 0.79863 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "815360 Examples seen. Accuracy: 0.7540 Error: 0.93307 Loss: 1.13414 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "816000 Examples seen. Accuracy: 0.7537 Error: 0.60772 Loss: 0.59638 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "816640 Examples seen. Accuracy: 0.7554 Error: 0.75697 Loss: 0.76513 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "817280 Examples seen. Accuracy: 0.7552 Error: 0.55212 Loss: 0.52262 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "817920 Examples seen. Accuracy: 0.7555 Error: 0.61158 Loss: 0.72845 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "818560 Examples seen. Accuracy: 0.7573 Error: 0.49725 Loss: 0.40735 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "819200 Examples seen. Accuracy: 0.7544 Error: 0.78351 Loss: 1.09500 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "819840 Examples seen. Accuracy: 0.7531 Error: 0.64963 Loss: 0.63236 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "820480 Examples seen. Accuracy: 0.7546 Error: 0.57888 Loss: 0.58468 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "821120 Examples seen. Accuracy: 0.7551 Error: 0.54723 Loss: 0.48716 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.23s\n", + "821760 Examples seen. Accuracy: 0.7554 Error: 0.53311 Loss: 0.54511 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "822400 Examples seen. Accuracy: 0.7543 Error: 0.60341 Loss: 0.56932 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.24s\n", + "823040 Examples seen. Accuracy: 0.7549 Error: 0.49616 Loss: 0.51366 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "823680 Examples seen. Accuracy: 0.7560 Error: 0.62031 Loss: 0.62986 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.26s\n", + "824320 Examples seen. Accuracy: 0.7533 Error: 0.69185 Loss: 0.68029 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "824960 Examples seen. Accuracy: 0.7543 Error: 0.70609 Loss: 0.66464 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "825600 Examples seen. Accuracy: 0.7540 Error: 0.65769 Loss: 0.82841 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "826240 Examples seen. Accuracy: 0.7518 Error: 0.63986 Loss: 0.64525 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.21s\n", + "826880 Examples seen. Accuracy: 0.7494 Error: 0.67326 Loss: 0.58677 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "827520 Examples seen. Accuracy: 0.7511 Error: 0.52688 Loss: 0.51957 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.33s\n", + "828160 Examples seen. Accuracy: 0.7533 Error: 0.58051 Loss: 0.56901 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.29s\n", + "828800 Examples seen. Accuracy: 0.7556 Error: 0.63636 Loss: 0.65161 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.29s\n", + "829440 Examples seen. Accuracy: 0.7538 Error: 0.66025 Loss: 0.85604 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "830080 Examples seen. Accuracy: 0.7551 Error: 0.79278 Loss: 1.02157 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "830720 Examples seen. Accuracy: 0.7563 Error: 0.68761 Loss: 0.75865 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "831360 Examples seen. Accuracy: 0.7571 Error: 0.65424 Loss: 0.65767 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.26s\n", + "832000 Examples seen. Accuracy: 0.7590 Error: 0.63025 Loss: 0.66050 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "832640 Examples seen. Accuracy: 0.7593 Error: 0.61213 Loss: 0.50304 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.30s\n", + "833280 Examples seen. Accuracy: 0.7588 Error: 0.64925 Loss: 0.70691 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "833920 Examples seen. Accuracy: 0.7607 Error: 0.50550 Loss: 0.50764 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.26s\n", + "834560 Examples seen. Accuracy: 0.7636 Error: 0.56939 Loss: 0.61559 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "835200 Examples seen. Accuracy: 0.7640 Error: 0.68163 Loss: 0.73794 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "835840 Examples seen. Accuracy: 0.7617 Error: 0.56446 Loss: 0.49256 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "836480 Examples seen. Accuracy: 0.7610 Error: 0.45381 Loss: 0.46240 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "837120 Examples seen. Accuracy: 0.7619 Error: 0.70312 Loss: 0.67412 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.26s\n", + "837760 Examples seen. Accuracy: 0.7603 Error: 0.77383 Loss: 0.94565 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "838400 Examples seen. Accuracy: 0.7591 Error: 0.66987 Loss: 0.74576 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.28s\n", + "839040 Examples seen. Accuracy: 0.7629 Error: 0.61075 Loss: 0.65921 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "839680 Examples seen. Accuracy: 0.7620 Error: 0.69317 Loss: 0.61748 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 21 Examples seen:840000 Validation Accuracy: 0.8097 Validation Error: 0.5327 Validation Loss: 0.5571 Total time: 74.13min\n", + "Epoch time: 2.3708 minutes. 50 epochs: 1.9757 hours.\n", + "Epochs: 21. Working time: 1.24 hours.\n", + "840640 Examples seen. Accuracy: 0.7609 Error: 0.72953 Loss: 0.84903 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "841280 Examples seen. Accuracy: 0.7612 Error: 0.61724 Loss: 0.65749 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "841920 Examples seen. Accuracy: 0.7595 Error: 0.52275 Loss: 0.54513 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "842560 Examples seen. Accuracy: 0.7601 Error: 0.56696 Loss: 0.56311 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.20s\n", + "843200 Examples seen. Accuracy: 0.7622 Error: 0.55077 Loss: 0.56713 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.23s\n", + "843840 Examples seen. Accuracy: 0.7624 Error: 0.64739 Loss: 0.69727 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.27s\n", + "844480 Examples seen. Accuracy: 0.7651 Error: 0.54495 Loss: 0.52471 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "845120 Examples seen. Accuracy: 0.7658 Error: 0.65810 Loss: 0.70731 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "845760 Examples seen. Accuracy: 0.7644 Error: 0.63726 Loss: 0.75203 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.19s\n", + "846400 Examples seen. Accuracy: 0.7652 Error: 0.63342 Loss: 0.59298 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "847040 Examples seen. Accuracy: 0.7641 Error: 0.70474 Loss: 0.75692 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "847680 Examples seen. Accuracy: 0.7647 Error: 0.63419 Loss: 0.79271 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "848320 Examples seen. Accuracy: 0.7627 Error: 0.55451 Loss: 0.55208 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.20s\n", + "848960 Examples seen. Accuracy: 0.7630 Error: 0.67070 Loss: 0.67164 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.20s\n", + "849600 Examples seen. Accuracy: 0.7637 Error: 0.59235 Loss: 0.64690 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.23s\n", + "850240 Examples seen. Accuracy: 0.7632 Error: 0.60878 Loss: 0.65336 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "850880 Examples seen. Accuracy: 0.7654 Error: 0.58023 Loss: 0.57833 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.21s\n", + "851520 Examples seen. Accuracy: 0.7643 Error: 0.65215 Loss: 0.66417 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "852160 Examples seen. Accuracy: 0.7641 Error: 0.68292 Loss: 0.74290 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "852800 Examples seen. Accuracy: 0.7626 Error: 0.66856 Loss: 0.66561 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "853440 Examples seen. Accuracy: 0.7642 Error: 0.51266 Loss: 0.45862 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.20s\n", + "854080 Examples seen. Accuracy: 0.7679 Error: 0.42405 Loss: 0.36937 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.22s\n", + "854720 Examples seen. Accuracy: 0.7684 Error: 0.70337 Loss: 0.78857 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "855360 Examples seen. Accuracy: 0.7680 Error: 0.55240 Loss: 0.60555 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.22s\n", + "856000 Examples seen. Accuracy: 0.7691 Error: 0.42695 Loss: 0.40510 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "856640 Examples seen. Accuracy: 0.7694 Error: 0.57832 Loss: 0.55287 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "857280 Examples seen. Accuracy: 0.7688 Error: 0.49576 Loss: 0.53500 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "857920 Examples seen. Accuracy: 0.7704 Error: 0.58619 Loss: 0.66270 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "858560 Examples seen. Accuracy: 0.7660 Error: 0.80197 Loss: 0.89805 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.27s\n", + "859200 Examples seen. Accuracy: 0.7656 Error: 0.53251 Loss: 0.54430 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "859840 Examples seen. Accuracy: 0.7659 Error: 0.64836 Loss: 0.68676 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.24s\n", + "860480 Examples seen. Accuracy: 0.7652 Error: 0.73756 Loss: 0.84799 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.24s\n", + "861120 Examples seen. Accuracy: 0.7666 Error: 0.51154 Loss: 0.49277 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "861760 Examples seen. Accuracy: 0.7685 Error: 0.68393 Loss: 0.84150 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "862400 Examples seen. Accuracy: 0.7666 Error: 0.69975 Loss: 0.71118 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "863040 Examples seen. Accuracy: 0.7633 Error: 0.70401 Loss: 0.70415 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.24s\n", + "863680 Examples seen. Accuracy: 0.7626 Error: 0.60714 Loss: 0.61289 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "864320 Examples seen. Accuracy: 0.7633 Error: 0.53959 Loss: 0.51367 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "864960 Examples seen. Accuracy: 0.7659 Error: 0.50350 Loss: 0.42101 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.24s\n", + "865600 Examples seen. Accuracy: 0.7650 Error: 0.53901 Loss: 0.59758 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "866240 Examples seen. Accuracy: 0.7625 Error: 0.58498 Loss: 0.60520 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "866880 Examples seen. Accuracy: 0.7600 Error: 0.62461 Loss: 0.67415 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "867520 Examples seen. Accuracy: 0.7598 Error: 0.65988 Loss: 0.70631 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "868160 Examples seen. Accuracy: 0.7582 Error: 0.66637 Loss: 0.70468 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.25s\n", + "868800 Examples seen. Accuracy: 0.7590 Error: 0.46321 Loss: 0.39767 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "869440 Examples seen. Accuracy: 0.7602 Error: 0.58933 Loss: 0.70036 Threads: 2 Forward time: 0.68s Backward time: 0.48s Step time: 2.28s\n", + "870080 Examples seen. Accuracy: 0.7578 Error: 0.78121 Loss: 0.77866 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.29s\n", + "870720 Examples seen. Accuracy: 0.7576 Error: 0.71789 Loss: 0.77415 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.23s\n", + "871360 Examples seen. Accuracy: 0.7593 Error: 0.62096 Loss: 0.62593 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "872000 Examples seen. Accuracy: 0.7599 Error: 0.60113 Loss: 0.58314 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "872640 Examples seen. Accuracy: 0.7619 Error: 0.43913 Loss: 0.46621 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.21s\n", + "873280 Examples seen. Accuracy: 0.7641 Error: 0.56613 Loss: 0.55002 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "873920 Examples seen. Accuracy: 0.7632 Error: 0.69879 Loss: 0.73606 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "874560 Examples seen. Accuracy: 0.7616 Error: 0.70013 Loss: 0.71432 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "875200 Examples seen. Accuracy: 0.7610 Error: 0.63077 Loss: 0.67407 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.26s\n", + "875840 Examples seen. Accuracy: 0.7606 Error: 0.64920 Loss: 0.66473 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.22s\n", + "876480 Examples seen. Accuracy: 0.7618 Error: 0.41814 Loss: 0.36967 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "877120 Examples seen. Accuracy: 0.7637 Error: 0.58875 Loss: 0.60159 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "877760 Examples seen. Accuracy: 0.7614 Error: 0.69495 Loss: 0.73337 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "878400 Examples seen. Accuracy: 0.7621 Error: 0.60607 Loss: 0.55744 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "879040 Examples seen. Accuracy: 0.7611 Error: 0.71082 Loss: 0.75437 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.26s\n", + "879680 Examples seen. Accuracy: 0.7615 Error: 0.72526 Loss: 0.85939 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 22 Examples seen:880000 Validation Accuracy: 0.8126 Validation Error: 0.5260 Validation Loss: 0.5505 Total time: 77.50min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.441 Min Weight: -0.510 Max Output: 4.299 Min Output: -5.128 TNNetConvolutionLinear 32,32,64 Times: 30.10s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.299 Min Output: -0.959 TNNetMaxPool 8,8,64 Times: 6.76s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.781 Min Weight: 0.729 Max Output: 4.828 Min Output: -2.386 TNNetMovingStdNormalization 8,8,64 Times: 0.16s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.255 Min Weight: -0.251 Max Output: 9.461 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.15s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.256 Min Weight: -0.214 Max Output: 7.115 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.04s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.248 Min Weight: -0.210 Max Output: 4.378 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.96s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.221 Min Weight: -0.208 Max Output: 2.159 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.28s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.159 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.159 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.42s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.313 Min Weight: -0.260 Max Output: 4.730 Min Output: -7.825 TNNetFullConnectLinear 10,1,1 Times: 0.10s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.516 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3354 minutes. 50 epochs: 1.9462 hours.\n", + "Epochs: 22. Working time: 1.29 hours.\n", + "880640 Examples seen. Accuracy: 0.7616 Error: 0.70495 Loss: 0.71932 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "881280 Examples seen. Accuracy: 0.7627 Error: 0.58435 Loss: 0.59232 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.21s\n", + "881920 Examples seen. Accuracy: 0.7646 Error: 0.63736 Loss: 0.61695 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.24s\n", + "882560 Examples seen. Accuracy: 0.7666 Error: 0.69517 Loss: 0.82518 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.30s\n", + "883200 Examples seen. Accuracy: 0.7698 Error: 0.52459 Loss: 0.50734 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "883840 Examples seen. Accuracy: 0.7706 Error: 0.58612 Loss: 0.73621 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.25s\n", + "884480 Examples seen. Accuracy: 0.7688 Error: 0.62014 Loss: 0.61913 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.25s\n", + "885120 Examples seen. Accuracy: 0.7668 Error: 0.83532 Loss: 0.90624 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "885760 Examples seen. Accuracy: 0.7693 Error: 0.47510 Loss: 0.47659 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "886400 Examples seen. Accuracy: 0.7681 Error: 0.64918 Loss: 0.67379 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "887040 Examples seen. Accuracy: 0.7677 Error: 0.70544 Loss: 0.72988 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "887680 Examples seen. Accuracy: 0.7676 Error: 0.63556 Loss: 0.62112 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.26s\n", + "888320 Examples seen. Accuracy: 0.7686 Error: 0.55302 Loss: 0.61195 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "888960 Examples seen. Accuracy: 0.7734 Error: 0.49023 Loss: 0.48141 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.21s\n", + "889600 Examples seen. Accuracy: 0.7726 Error: 0.59947 Loss: 0.57789 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "890240 Examples seen. Accuracy: 0.7712 Error: 0.57190 Loss: 0.65621 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.23s\n", + "890880 Examples seen. Accuracy: 0.7698 Error: 0.77545 Loss: 0.84368 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "891520 Examples seen. Accuracy: 0.7688 Error: 0.77536 Loss: 0.80531 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "892160 Examples seen. Accuracy: 0.7683 Error: 0.75775 Loss: 0.69213 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "892800 Examples seen. Accuracy: 0.7686 Error: 0.61012 Loss: 0.61801 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "893440 Examples seen. Accuracy: 0.7683 Error: 0.65555 Loss: 0.69638 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "894080 Examples seen. Accuracy: 0.7677 Error: 0.68020 Loss: 0.74392 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.23s\n", + "894720 Examples seen. Accuracy: 0.7677 Error: 0.56300 Loss: 0.54726 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.22s\n", + "895360 Examples seen. Accuracy: 0.7655 Error: 0.66284 Loss: 0.71666 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "896000 Examples seen. Accuracy: 0.7666 Error: 0.59861 Loss: 0.65441 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.27s\n", + "896640 Examples seen. Accuracy: 0.7691 Error: 0.60854 Loss: 0.65854 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "897280 Examples seen. Accuracy: 0.7717 Error: 0.55297 Loss: 0.65215 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "897920 Examples seen. Accuracy: 0.7705 Error: 0.61866 Loss: 0.55535 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.20s\n", + "898560 Examples seen. Accuracy: 0.7709 Error: 0.62805 Loss: 0.80791 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.23s\n", + "899200 Examples seen. Accuracy: 0.7720 Error: 0.52441 Loss: 0.54705 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.21s\n", + "899840 Examples seen. Accuracy: 0.7671 Error: 0.64295 Loss: 0.69646 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "900480 Examples seen. Accuracy: 0.7668 Error: 0.70933 Loss: 0.69101 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.21s\n", + "901120 Examples seen. Accuracy: 0.7660 Error: 0.54374 Loss: 0.55234 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "901760 Examples seen. Accuracy: 0.7655 Error: 0.67515 Loss: 0.88840 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.29s\n", + "902400 Examples seen. Accuracy: 0.7678 Error: 0.61994 Loss: 0.62292 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "903040 Examples seen. Accuracy: 0.7664 Error: 0.59015 Loss: 0.57289 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.21s\n", + "903680 Examples seen. Accuracy: 0.7645 Error: 0.47992 Loss: 0.53261 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "904320 Examples seen. Accuracy: 0.7636 Error: 0.68922 Loss: 0.68339 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "904960 Examples seen. Accuracy: 0.7646 Error: 0.63338 Loss: 0.75119 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "905600 Examples seen. Accuracy: 0.7651 Error: 0.66149 Loss: 0.73324 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.18s\n", + "906240 Examples seen. Accuracy: 0.7634 Error: 0.59867 Loss: 0.57170 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "906880 Examples seen. Accuracy: 0.7621 Error: 0.62026 Loss: 0.66378 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.19s\n", + "907520 Examples seen. Accuracy: 0.7601 Error: 0.70996 Loss: 0.74844 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.18s\n", + "908160 Examples seen. Accuracy: 0.7617 Error: 0.59622 Loss: 0.68635 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.20s\n", + "908800 Examples seen. Accuracy: 0.7638 Error: 0.56440 Loss: 0.56130 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "909440 Examples seen. Accuracy: 0.7652 Error: 0.70686 Loss: 0.86884 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.21s\n", + "910080 Examples seen. Accuracy: 0.7644 Error: 0.64908 Loss: 0.68787 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "910720 Examples seen. Accuracy: 0.7647 Error: 0.65176 Loss: 0.61152 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.27s\n", + "911360 Examples seen. Accuracy: 0.7646 Error: 0.69344 Loss: 0.64317 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "912000 Examples seen. Accuracy: 0.7650 Error: 0.37225 Loss: 0.37295 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.30s\n", + "912640 Examples seen. Accuracy: 0.7651 Error: 0.58135 Loss: 0.66954 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.31s\n", + "913280 Examples seen. Accuracy: 0.7654 Error: 0.70493 Loss: 0.76048 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "913920 Examples seen. Accuracy: 0.7657 Error: 0.67307 Loss: 0.69807 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "914560 Examples seen. Accuracy: 0.7661 Error: 0.66885 Loss: 0.66073 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.26s\n", + "915200 Examples seen. Accuracy: 0.7654 Error: 0.47722 Loss: 0.42466 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "915840 Examples seen. Accuracy: 0.7657 Error: 0.62885 Loss: 0.61189 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.26s\n", + "916480 Examples seen. Accuracy: 0.7660 Error: 0.54882 Loss: 0.65040 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.27s\n", + "917120 Examples seen. Accuracy: 0.7649 Error: 0.60900 Loss: 0.63533 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "917760 Examples seen. Accuracy: 0.7646 Error: 0.59868 Loss: 0.59406 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.28s\n", + "918400 Examples seen. Accuracy: 0.7659 Error: 0.67289 Loss: 0.87526 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "919040 Examples seen. Accuracy: 0.7654 Error: 0.61307 Loss: 0.59825 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "919680 Examples seen. Accuracy: 0.7633 Error: 0.65447 Loss: 0.66826 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 23 Examples seen:920000 Validation Accuracy: 0.8147 Validation Error: 0.5183 Validation Loss: 0.5426 Total time: 80.88min\n", + "Epoch time: 2.3604 minutes. 50 epochs: 1.9670 hours.\n", + "Epochs: 23. Working time: 1.35 hours.\n", + "920640 Examples seen. Accuracy: 0.7626 Error: 0.78481 Loss: 0.78438 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "921280 Examples seen. Accuracy: 0.7612 Error: 0.72489 Loss: 0.77208 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "921920 Examples seen. Accuracy: 0.7588 Error: 0.58095 Loss: 0.60434 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.23s\n", + "922560 Examples seen. Accuracy: 0.7584 Error: 0.63413 Loss: 0.59732 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.23s\n", + "923200 Examples seen. Accuracy: 0.7612 Error: 0.49784 Loss: 0.38789 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "923840 Examples seen. Accuracy: 0.7611 Error: 0.70160 Loss: 0.72378 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "924480 Examples seen. Accuracy: 0.7591 Error: 0.75117 Loss: 0.80583 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "925120 Examples seen. Accuracy: 0.7617 Error: 0.50915 Loss: 0.49582 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.22s\n", + "925760 Examples seen. Accuracy: 0.7642 Error: 0.48395 Loss: 0.47056 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "926400 Examples seen. Accuracy: 0.7638 Error: 0.67441 Loss: 0.66033 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.25s\n", + "927040 Examples seen. Accuracy: 0.7636 Error: 0.66216 Loss: 0.98904 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "927680 Examples seen. Accuracy: 0.7623 Error: 0.57194 Loss: 0.61443 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.20s\n", + "928320 Examples seen. Accuracy: 0.7651 Error: 0.73074 Loss: 0.82002 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.20s\n", + "928960 Examples seen. Accuracy: 0.7663 Error: 0.57718 Loss: 0.68986 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "929600 Examples seen. Accuracy: 0.7704 Error: 0.59988 Loss: 0.67087 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "930240 Examples seen. Accuracy: 0.7699 Error: 0.62665 Loss: 0.75354 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "930880 Examples seen. Accuracy: 0.7684 Error: 0.61280 Loss: 0.74570 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "931520 Examples seen. Accuracy: 0.7675 Error: 0.78237 Loss: 0.87719 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "932160 Examples seen. Accuracy: 0.7659 Error: 0.65755 Loss: 0.69774 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "932800 Examples seen. Accuracy: 0.7632 Error: 0.71988 Loss: 0.76520 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "933440 Examples seen. Accuracy: 0.7617 Error: 0.74322 Loss: 0.80149 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.20s\n", + "934080 Examples seen. Accuracy: 0.7601 Error: 0.71708 Loss: 0.80695 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.19s\n", + "934720 Examples seen. Accuracy: 0.7627 Error: 0.81305 Loss: 0.76823 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "935360 Examples seen. Accuracy: 0.7627 Error: 0.63169 Loss: 0.76535 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "936000 Examples seen. Accuracy: 0.7626 Error: 0.59959 Loss: 0.64671 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.19s\n", + "936640 Examples seen. Accuracy: 0.7649 Error: 0.70246 Loss: 0.92566 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "937280 Examples seen. Accuracy: 0.7644 Error: 0.64844 Loss: 0.76428 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "937920 Examples seen. Accuracy: 0.7641 Error: 0.74687 Loss: 0.80044 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "938560 Examples seen. Accuracy: 0.7627 Error: 0.49691 Loss: 0.50920 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "939200 Examples seen. Accuracy: 0.7643 Error: 0.57989 Loss: 0.55219 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "939840 Examples seen. Accuracy: 0.7631 Error: 0.57539 Loss: 0.58670 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "940480 Examples seen. Accuracy: 0.7638 Error: 0.66974 Loss: 0.65169 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "941120 Examples seen. Accuracy: 0.7654 Error: 0.55228 Loss: 0.52621 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.19s\n", + "941760 Examples seen. Accuracy: 0.7616 Error: 0.60407 Loss: 0.73886 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.19s\n", + "942400 Examples seen. Accuracy: 0.7607 Error: 0.53183 Loss: 0.52798 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.18s\n", + "943040 Examples seen. Accuracy: 0.7606 Error: 0.50802 Loss: 0.48818 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "943680 Examples seen. Accuracy: 0.7625 Error: 0.56380 Loss: 0.49372 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "944320 Examples seen. Accuracy: 0.7629 Error: 0.56329 Loss: 0.59625 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.23s\n", + "944960 Examples seen. Accuracy: 0.7634 Error: 0.59402 Loss: 0.53200 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "945600 Examples seen. Accuracy: 0.7626 Error: 0.66829 Loss: 0.93153 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "946240 Examples seen. Accuracy: 0.7628 Error: 0.67695 Loss: 0.79435 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.25s\n", + "946880 Examples seen. Accuracy: 0.7625 Error: 0.59058 Loss: 0.63089 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "947520 Examples seen. Accuracy: 0.7593 Error: 0.68078 Loss: 0.83672 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.25s\n", + "948160 Examples seen. Accuracy: 0.7591 Error: 0.71990 Loss: 0.88984 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "948800 Examples seen. Accuracy: 0.7603 Error: 0.62395 Loss: 0.65760 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "949440 Examples seen. Accuracy: 0.7612 Error: 0.60551 Loss: 0.59695 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "950080 Examples seen. Accuracy: 0.7627 Error: 0.57479 Loss: 0.48827 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "950720 Examples seen. Accuracy: 0.7664 Error: 0.62581 Loss: 0.58703 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "951360 Examples seen. Accuracy: 0.7671 Error: 0.68239 Loss: 0.85353 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "952000 Examples seen. Accuracy: 0.7650 Error: 0.63266 Loss: 0.69446 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "952640 Examples seen. Accuracy: 0.7645 Error: 0.58067 Loss: 0.57198 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "953280 Examples seen. Accuracy: 0.7659 Error: 0.61572 Loss: 0.65453 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.20s\n", + "953920 Examples seen. Accuracy: 0.7650 Error: 0.70056 Loss: 0.76925 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "954560 Examples seen. Accuracy: 0.7624 Error: 0.75395 Loss: 0.83920 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.23s\n", + "955200 Examples seen. Accuracy: 0.7618 Error: 0.67570 Loss: 0.60460 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "955840 Examples seen. Accuracy: 0.7629 Error: 0.60492 Loss: 0.68417 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "956480 Examples seen. Accuracy: 0.7619 Error: 0.62038 Loss: 0.68500 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "957120 Examples seen. Accuracy: 0.7623 Error: 0.53159 Loss: 0.57759 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "957760 Examples seen. Accuracy: 0.7647 Error: 0.59932 Loss: 0.68073 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "958400 Examples seen. Accuracy: 0.7653 Error: 0.61748 Loss: 0.67631 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "959040 Examples seen. Accuracy: 0.7668 Error: 0.61338 Loss: 0.63171 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "959680 Examples seen. Accuracy: 0.7666 Error: 0.71023 Loss: 0.64759 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.21s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 24 Examples seen:960000 Validation Accuracy: 0.8167 Validation Error: 0.5124 Validation Loss: 0.5361 Total time: 84.24min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.460 Min Weight: -0.523 Max Output: 4.429 Min Output: -5.275 TNNetConvolutionLinear 32,32,64 Times: 30.14s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.429 Min Output: -1.008 TNNetMaxPool 8,8,64 Times: 6.90s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.793 Min Weight: 0.744 Max Output: 4.890 Min Output: -2.421 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.260 Min Weight: -0.261 Max Output: 9.584 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.22s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.266 Min Weight: -0.227 Max Output: 7.572 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.97s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.251 Min Weight: -0.213 Max Output: 4.910 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.224 Min Weight: -0.214 Max Output: 2.148 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.08s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.148 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.148 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.39s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.327 Min Weight: -0.266 Max Output: 4.651 Min Output: -7.718 TNNetFullConnectLinear 10,1,1 Times: 0.11s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.598 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3042 minutes. 50 epochs: 1.9201 hours.\n", + "Epochs: 24. Working time: 1.40 hours.\n", + "960640 Examples seen. Accuracy: 0.7657 Error: 0.70273 Loss: 0.80831 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "961280 Examples seen. Accuracy: 0.7667 Error: 0.60021 Loss: 0.61620 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.24s\n", + "961920 Examples seen. Accuracy: 0.7683 Error: 0.64095 Loss: 0.56290 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "962560 Examples seen. Accuracy: 0.7727 Error: 0.56868 Loss: 0.57817 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.31s\n", + "963200 Examples seen. Accuracy: 0.7745 Error: 0.51835 Loss: 0.49585 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.32s\n", + "963840 Examples seen. Accuracy: 0.7743 Error: 0.59188 Loss: 0.58959 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "964480 Examples seen. Accuracy: 0.7725 Error: 0.58623 Loss: 0.59809 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "965120 Examples seen. Accuracy: 0.7712 Error: 0.68913 Loss: 0.72315 Threads: 2 Forward time: 0.74s Backward time: 0.38s Step time: 2.30s\n", + "965760 Examples seen. Accuracy: 0.7700 Error: 0.61661 Loss: 0.57838 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "966400 Examples seen. Accuracy: 0.7672 Error: 0.63911 Loss: 0.66763 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "967040 Examples seen. Accuracy: 0.7685 Error: 0.57004 Loss: 0.49748 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "967680 Examples seen. Accuracy: 0.7678 Error: 0.72484 Loss: 0.78594 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "968320 Examples seen. Accuracy: 0.7701 Error: 0.56807 Loss: 0.68791 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "968960 Examples seen. Accuracy: 0.7691 Error: 0.75824 Loss: 0.82020 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.32s\n", + "969600 Examples seen. Accuracy: 0.7684 Error: 0.69889 Loss: 0.73781 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "970240 Examples seen. Accuracy: 0.7676 Error: 0.69246 Loss: 0.94826 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.28s\n", + "970880 Examples seen. Accuracy: 0.7682 Error: 0.58095 Loss: 0.57332 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "971520 Examples seen. Accuracy: 0.7706 Error: 0.64592 Loss: 0.65757 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.26s\n", + "972160 Examples seen. Accuracy: 0.7671 Error: 0.66143 Loss: 0.75760 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.31s\n", + "972800 Examples seen. Accuracy: 0.7697 Error: 0.51329 Loss: 0.44416 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "973440 Examples seen. Accuracy: 0.7685 Error: 0.69100 Loss: 0.74069 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "974080 Examples seen. Accuracy: 0.7700 Error: 0.69336 Loss: 0.73041 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.26s\n", + "974720 Examples seen. Accuracy: 0.7714 Error: 0.47448 Loss: 0.49251 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "975360 Examples seen. Accuracy: 0.7723 Error: 0.57293 Loss: 0.64274 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "976000 Examples seen. Accuracy: 0.7713 Error: 0.71009 Loss: 0.77041 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "976640 Examples seen. Accuracy: 0.7694 Error: 0.71366 Loss: 0.67575 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "977280 Examples seen. Accuracy: 0.7708 Error: 0.53794 Loss: 0.54916 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.28s\n", + "977920 Examples seen. Accuracy: 0.7695 Error: 0.64693 Loss: 0.66017 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "978560 Examples seen. Accuracy: 0.7718 Error: 0.43777 Loss: 0.36920 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "979200 Examples seen. Accuracy: 0.7714 Error: 0.66631 Loss: 0.68272 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "979840 Examples seen. Accuracy: 0.7718 Error: 0.58005 Loss: 0.49689 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.32s\n", + "980480 Examples seen. Accuracy: 0.7713 Error: 0.65780 Loss: 0.79107 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.28s\n", + "981120 Examples seen. Accuracy: 0.7702 Error: 0.64567 Loss: 0.58171 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "981760 Examples seen. Accuracy: 0.7682 Error: 0.62929 Loss: 0.62051 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.29s\n", + "982400 Examples seen. Accuracy: 0.7653 Error: 0.70469 Loss: 0.69541 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "983040 Examples seen. Accuracy: 0.7682 Error: 0.52602 Loss: 0.54752 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "983680 Examples seen. Accuracy: 0.7684 Error: 0.62584 Loss: 0.60070 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "984320 Examples seen. Accuracy: 0.7680 Error: 0.56376 Loss: 0.58440 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "984960 Examples seen. Accuracy: 0.7683 Error: 0.56790 Loss: 0.62742 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "985600 Examples seen. Accuracy: 0.7720 Error: 0.54144 Loss: 0.51544 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "986240 Examples seen. Accuracy: 0.7700 Error: 0.62772 Loss: 0.58497 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "986880 Examples seen. Accuracy: 0.7704 Error: 0.65513 Loss: 0.65407 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "987520 Examples seen. Accuracy: 0.7701 Error: 0.74454 Loss: 0.73883 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "988160 Examples seen. Accuracy: 0.7677 Error: 0.57897 Loss: 0.58275 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.25s\n", + "988800 Examples seen. Accuracy: 0.7646 Error: 0.64738 Loss: 0.74001 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "989440 Examples seen. Accuracy: 0.7646 Error: 0.52954 Loss: 0.51862 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "990080 Examples seen. Accuracy: 0.7664 Error: 0.65639 Loss: 0.74434 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "990720 Examples seen. Accuracy: 0.7667 Error: 0.69605 Loss: 0.67447 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "991360 Examples seen. Accuracy: 0.7662 Error: 0.43483 Loss: 0.40303 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.30s\n", + "992000 Examples seen. Accuracy: 0.7678 Error: 0.54224 Loss: 0.65796 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "992640 Examples seen. Accuracy: 0.7669 Error: 0.54514 Loss: 0.45177 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "993280 Examples seen. Accuracy: 0.7679 Error: 0.48085 Loss: 0.41279 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "993920 Examples seen. Accuracy: 0.7693 Error: 0.60838 Loss: 0.58196 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.30s\n", + "994560 Examples seen. Accuracy: 0.7683 Error: 0.65785 Loss: 0.67545 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "995200 Examples seen. Accuracy: 0.7667 Error: 0.71601 Loss: 0.95200 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "995840 Examples seen. Accuracy: 0.7659 Error: 0.46075 Loss: 0.53384 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "996480 Examples seen. Accuracy: 0.7647 Error: 0.64373 Loss: 0.66603 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.27s\n", + "997120 Examples seen. Accuracy: 0.7670 Error: 0.47987 Loss: 0.41500 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "997760 Examples seen. Accuracy: 0.7661 Error: 0.65146 Loss: 0.86164 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "998400 Examples seen. Accuracy: 0.7668 Error: 0.71417 Loss: 0.77347 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.22s\n", + "999040 Examples seen. Accuracy: 0.7677 Error: 0.68442 Loss: 0.73742 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "999680 Examples seen. Accuracy: 0.7672 Error: 0.65885 Loss: 0.72615 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.21s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 25 Examples seen:1000000 Validation Accuracy: 0.8196 Validation Error: 0.5070 Validation Loss: 0.5317 Total time: 87.70min\n", + "Epoch time: 2.3000 minutes. 50 epochs: 1.9167 hours.\n", + "Epochs: 25. Working time: 1.46 hours.\n", + "1000640 Examples seen. Accuracy: 0.7688 Error: 0.50471 Loss: 0.54118 Threads: 2 Forward time: 0.75s Backward time: 0.44s Step time: 2.42s\n", + "1001280 Examples seen. Accuracy: 0.7693 Error: 0.56875 Loss: 0.67354 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.38s\n", + "1001920 Examples seen. Accuracy: 0.7695 Error: 0.64580 Loss: 0.75707 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.39s\n", + "1002560 Examples seen. Accuracy: 0.7703 Error: 0.58331 Loss: 0.63422 Threads: 2 Forward time: 0.81s Backward time: 0.52s Step time: 2.68s\n", + "1003200 Examples seen. Accuracy: 0.7725 Error: 0.58280 Loss: 0.57344 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.56s\n", + "1003840 Examples seen. Accuracy: 0.7717 Error: 0.61046 Loss: 0.55886 Threads: 2 Forward time: 0.75s Backward time: 0.48s Step time: 2.46s\n", + "1004480 Examples seen. Accuracy: 0.7694 Error: 0.67385 Loss: 0.69954 Threads: 2 Forward time: 0.77s Backward time: 0.46s Step time: 2.55s\n", + "1005120 Examples seen. Accuracy: 0.7710 Error: 0.68882 Loss: 0.77525 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.48s\n", + "1005760 Examples seen. Accuracy: 0.7730 Error: 0.75051 Loss: 0.71808 Threads: 2 Forward time: 0.75s Backward time: 0.48s Step time: 2.49s\n", + "1006400 Examples seen. Accuracy: 0.7751 Error: 0.63333 Loss: 0.57884 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.38s\n", + "1007040 Examples seen. Accuracy: 0.7750 Error: 0.62630 Loss: 0.63373 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.32s\n", + "1007680 Examples seen. Accuracy: 0.7755 Error: 0.56292 Loss: 0.53358 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1008320 Examples seen. Accuracy: 0.7763 Error: 0.56997 Loss: 0.66576 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.29s\n", + "1008960 Examples seen. Accuracy: 0.7761 Error: 0.65659 Loss: 0.65463 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.36s\n", + "1009600 Examples seen. Accuracy: 0.7736 Error: 0.86289 Loss: 1.00246 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1010240 Examples seen. Accuracy: 0.7730 Error: 0.79183 Loss: 0.89563 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1010880 Examples seen. Accuracy: 0.7741 Error: 0.62224 Loss: 0.60849 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1011520 Examples seen. Accuracy: 0.7764 Error: 0.43606 Loss: 0.39141 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.30s\n", + "1012160 Examples seen. Accuracy: 0.7775 Error: 0.52585 Loss: 0.62578 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "1012800 Examples seen. Accuracy: 0.7778 Error: 0.47595 Loss: 0.52312 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1013440 Examples seen. Accuracy: 0.7758 Error: 0.53799 Loss: 0.52272 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1014080 Examples seen. Accuracy: 0.7744 Error: 0.70497 Loss: 0.73876 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.31s\n", + "1014720 Examples seen. Accuracy: 0.7720 Error: 0.60608 Loss: 0.60127 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.30s\n", + "1015360 Examples seen. Accuracy: 0.7738 Error: 0.59289 Loss: 0.57069 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1016000 Examples seen. Accuracy: 0.7765 Error: 0.65931 Loss: 0.67396 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "1016640 Examples seen. Accuracy: 0.7748 Error: 0.52917 Loss: 0.52974 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1017280 Examples seen. Accuracy: 0.7726 Error: 0.57895 Loss: 0.66118 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.33s\n", + "1017920 Examples seen. Accuracy: 0.7746 Error: 0.59218 Loss: 0.53582 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.31s\n", + "1018560 Examples seen. Accuracy: 0.7740 Error: 0.65360 Loss: 0.79880 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1019200 Examples seen. Accuracy: 0.7732 Error: 0.74896 Loss: 0.77446 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1019840 Examples seen. Accuracy: 0.7746 Error: 0.63692 Loss: 0.66329 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.33s\n", + "1020480 Examples seen. Accuracy: 0.7733 Error: 0.75573 Loss: 0.84755 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.27s\n", + "1021120 Examples seen. Accuracy: 0.7743 Error: 0.62556 Loss: 0.74506 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1021760 Examples seen. Accuracy: 0.7755 Error: 0.61443 Loss: 0.62344 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1022400 Examples seen. Accuracy: 0.7758 Error: 0.64881 Loss: 0.61407 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.27s\n", + "1023040 Examples seen. Accuracy: 0.7751 Error: 0.65149 Loss: 0.60618 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.32s\n", + "1023680 Examples seen. Accuracy: 0.7753 Error: 0.51809 Loss: 0.50181 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.36s\n", + "1024320 Examples seen. Accuracy: 0.7748 Error: 0.56783 Loss: 0.65252 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1024960 Examples seen. Accuracy: 0.7733 Error: 0.60274 Loss: 0.65634 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.29s\n", + "1025600 Examples seen. Accuracy: 0.7739 Error: 0.39914 Loss: 0.39679 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.27s\n", + "1026240 Examples seen. Accuracy: 0.7739 Error: 0.58899 Loss: 0.56146 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1026880 Examples seen. Accuracy: 0.7740 Error: 0.55076 Loss: 0.48777 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.27s\n", + "1027520 Examples seen. Accuracy: 0.7747 Error: 0.47445 Loss: 0.40390 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.32s\n", + "1028160 Examples seen. Accuracy: 0.7746 Error: 0.59906 Loss: 0.68196 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.28s\n", + "1028800 Examples seen. Accuracy: 0.7756 Error: 0.69434 Loss: 0.70890 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.30s\n", + "1029440 Examples seen. Accuracy: 0.7759 Error: 0.56232 Loss: 0.52135 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.30s\n", + "1030080 Examples seen. Accuracy: 0.7753 Error: 0.53703 Loss: 0.63422 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.28s\n", + "1030720 Examples seen. Accuracy: 0.7712 Error: 0.71050 Loss: 0.68311 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1031360 Examples seen. Accuracy: 0.7702 Error: 0.50845 Loss: 0.49508 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1032000 Examples seen. Accuracy: 0.7719 Error: 0.57129 Loss: 0.54442 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.32s\n", + "1032640 Examples seen. Accuracy: 0.7731 Error: 0.51420 Loss: 0.58054 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.27s\n", + "1033280 Examples seen. Accuracy: 0.7716 Error: 0.65478 Loss: 0.70321 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1033920 Examples seen. Accuracy: 0.7732 Error: 0.64772 Loss: 0.71913 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1034560 Examples seen. Accuracy: 0.7710 Error: 0.64653 Loss: 0.81703 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1035200 Examples seen. Accuracy: 0.7697 Error: 0.57000 Loss: 0.57075 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1035840 Examples seen. Accuracy: 0.7712 Error: 0.51778 Loss: 0.54978 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.28s\n", + "1036480 Examples seen. Accuracy: 0.7691 Error: 0.60744 Loss: 0.58942 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1037120 Examples seen. Accuracy: 0.7685 Error: 0.61172 Loss: 0.70803 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1037760 Examples seen. Accuracy: 0.7716 Error: 0.71120 Loss: 0.75807 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1038400 Examples seen. Accuracy: 0.7696 Error: 0.66383 Loss: 0.64999 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.29s\n", + "1039040 Examples seen. Accuracy: 0.7690 Error: 0.57240 Loss: 0.71585 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.30s\n", + "1039680 Examples seen. Accuracy: 0.7689 Error: 0.52712 Loss: 0.50506 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 26 Examples seen:1040000 Validation Accuracy: 0.8223 Validation Error: 0.5000 Validation Loss: 0.5248 Total time: 91.17min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.479 Min Weight: -0.537 Max Output: 4.530 Min Output: -5.373 TNNetConvolutionLinear 32,32,64 Times: 30.29s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.530 Min Output: -1.085 TNNetMaxPool 8,8,64 Times: 6.95s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.807 Min Weight: 0.758 Max Output: 4.911 Min Output: -2.497 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.264 Min Weight: -0.270 Max Output: 9.563 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.29s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.276 Min Weight: -0.240 Max Output: 8.219 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.19s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.254 Min Weight: -0.218 Max Output: 5.593 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.29s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.229 Min Weight: -0.217 Max Output: 2.289 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.26s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.289 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.289 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.36s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.336 Min Weight: -0.270 Max Output: 4.672 Min Output: -7.835 TNNetFullConnectLinear 10,1,1 Times: 0.12s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.546 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3854 minutes. 50 epochs: 1.9878 hours.\n", + "Epochs: 26. Working time: 1.52 hours.\n", + "1040640 Examples seen. Accuracy: 0.7649 Error: 0.61200 Loss: 0.62400 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.25s\n", + "1041280 Examples seen. Accuracy: 0.7622 Error: 0.68391 Loss: 0.72871 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.24s\n", + "1041920 Examples seen. Accuracy: 0.7655 Error: 0.63478 Loss: 0.64761 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1042560 Examples seen. Accuracy: 0.7659 Error: 0.66454 Loss: 0.75863 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1043200 Examples seen. Accuracy: 0.7653 Error: 0.60650 Loss: 0.66562 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1043840 Examples seen. Accuracy: 0.7627 Error: 0.72505 Loss: 0.78411 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.36s\n", + "1044480 Examples seen. Accuracy: 0.7645 Error: 0.64140 Loss: 0.81219 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.32s\n", + "1045120 Examples seen. Accuracy: 0.7675 Error: 0.64084 Loss: 0.69836 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1045760 Examples seen. Accuracy: 0.7689 Error: 0.62481 Loss: 0.72662 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.31s\n", + "1046400 Examples seen. Accuracy: 0.7694 Error: 0.67196 Loss: 0.67580 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.28s\n", + "1047040 Examples seen. Accuracy: 0.7703 Error: 0.66269 Loss: 0.65764 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1047680 Examples seen. Accuracy: 0.7694 Error: 0.54606 Loss: 0.57851 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1048320 Examples seen. Accuracy: 0.7699 Error: 0.70745 Loss: 0.79667 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.31s\n", + "1048960 Examples seen. Accuracy: 0.7696 Error: 0.64145 Loss: 0.65407 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.31s\n", + "1049600 Examples seen. Accuracy: 0.7663 Error: 0.70753 Loss: 0.78658 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.28s\n", + "1050240 Examples seen. Accuracy: 0.7657 Error: 0.60931 Loss: 0.67479 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.34s\n", + "1050880 Examples seen. Accuracy: 0.7672 Error: 0.67088 Loss: 0.63827 Threads: 2 Forward time: 0.73s Backward time: 0.41s Step time: 2.29s\n", + "1051520 Examples seen. Accuracy: 0.7698 Error: 0.69628 Loss: 0.71167 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.30s\n", + "1052160 Examples seen. Accuracy: 0.7720 Error: 0.48660 Loss: 0.50095 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1052800 Examples seen. Accuracy: 0.7718 Error: 0.60956 Loss: 0.64610 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1053440 Examples seen. Accuracy: 0.7746 Error: 0.52746 Loss: 0.59267 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.26s\n", + "1054080 Examples seen. Accuracy: 0.7730 Error: 0.73125 Loss: 0.85383 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1054720 Examples seen. Accuracy: 0.7724 Error: 0.69876 Loss: 0.98279 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "1055360 Examples seen. Accuracy: 0.7750 Error: 0.59749 Loss: 0.68972 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1056000 Examples seen. Accuracy: 0.7741 Error: 0.76533 Loss: 0.89410 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1056640 Examples seen. Accuracy: 0.7721 Error: 0.52455 Loss: 0.53645 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.27s\n", + "1057280 Examples seen. Accuracy: 0.7711 Error: 0.48460 Loss: 0.47489 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1057920 Examples seen. Accuracy: 0.7699 Error: 0.56157 Loss: 0.61863 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.27s\n", + "1058560 Examples seen. Accuracy: 0.7694 Error: 0.59526 Loss: 0.51928 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "1059200 Examples seen. Accuracy: 0.7717 Error: 0.48730 Loss: 0.50844 Threads: 2 Forward time: 0.75s Backward time: 0.42s Step time: 2.30s\n", + "1059840 Examples seen. Accuracy: 0.7747 Error: 0.39828 Loss: 0.36854 Threads: 2 Forward time: 0.72s Backward time: 0.47s Step time: 2.44s\n", + "1060480 Examples seen. Accuracy: 0.7751 Error: 0.38394 Loss: 0.36463 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.42s\n", + "1061120 Examples seen. Accuracy: 0.7746 Error: 0.61423 Loss: 0.63737 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.35s\n", + "1061760 Examples seen. Accuracy: 0.7730 Error: 0.70864 Loss: 0.85128 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.36s\n", + "1062400 Examples seen. Accuracy: 0.7731 Error: 0.59273 Loss: 0.66422 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1063040 Examples seen. Accuracy: 0.7692 Error: 0.65597 Loss: 0.64625 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1063680 Examples seen. Accuracy: 0.7698 Error: 0.59310 Loss: 0.56844 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.28s\n", + "1064320 Examples seen. Accuracy: 0.7716 Error: 0.58413 Loss: 0.58618 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.34s\n", + "1064960 Examples seen. Accuracy: 0.7721 Error: 0.58101 Loss: 0.64491 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1065600 Examples seen. Accuracy: 0.7715 Error: 0.50464 Loss: 0.45315 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.28s\n", + "1066240 Examples seen. Accuracy: 0.7708 Error: 0.74233 Loss: 0.92730 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "1066880 Examples seen. Accuracy: 0.7721 Error: 0.65824 Loss: 0.60421 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.29s\n", + "1067520 Examples seen. Accuracy: 0.7753 Error: 0.48376 Loss: 0.55827 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.28s\n", + "1068160 Examples seen. Accuracy: 0.7757 Error: 0.62353 Loss: 0.57935 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.28s\n", + "1068800 Examples seen. Accuracy: 0.7764 Error: 0.65177 Loss: 0.72553 Threads: 2 Forward time: 0.72s Backward time: 0.45s Step time: 2.34s\n", + "1069440 Examples seen. Accuracy: 0.7733 Error: 0.73725 Loss: 0.83220 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.31s\n", + "1070080 Examples seen. Accuracy: 0.7750 Error: 0.53022 Loss: 0.46710 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1070720 Examples seen. Accuracy: 0.7743 Error: 0.70973 Loss: 0.73441 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1071360 Examples seen. Accuracy: 0.7744 Error: 0.67783 Loss: 0.65465 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1072000 Examples seen. Accuracy: 0.7743 Error: 0.61612 Loss: 0.59149 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1072640 Examples seen. Accuracy: 0.7721 Error: 0.67412 Loss: 0.74065 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1073280 Examples seen. Accuracy: 0.7717 Error: 0.49843 Loss: 0.46644 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1073920 Examples seen. Accuracy: 0.7706 Error: 0.65481 Loss: 0.66091 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "1074560 Examples seen. Accuracy: 0.7706 Error: 0.58088 Loss: 0.72890 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1075200 Examples seen. Accuracy: 0.7712 Error: 0.73258 Loss: 0.95148 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.34s\n", + "1075840 Examples seen. Accuracy: 0.7707 Error: 0.51011 Loss: 0.41506 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.30s\n", + "1076480 Examples seen. Accuracy: 0.7714 Error: 0.64267 Loss: 0.56943 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1077120 Examples seen. Accuracy: 0.7711 Error: 0.65202 Loss: 0.73068 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.27s\n", + "1077760 Examples seen. Accuracy: 0.7723 Error: 0.74949 Loss: 0.75692 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1078400 Examples seen. Accuracy: 0.7741 Error: 0.66644 Loss: 0.67929 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.28s\n", + "1079040 Examples seen. Accuracy: 0.7737 Error: 0.53330 Loss: 0.52250 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1079680 Examples seen. Accuracy: 0.7746 Error: 0.41760 Loss: 0.40439 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 27 Examples seen:1080000 Validation Accuracy: 0.8240 Validation Error: 0.4947 Validation Loss: 0.5198 Total time: 94.61min\n", + "Epoch time: 2.3344 minutes. 50 epochs: 1.9453 hours.\n", + "Epochs: 27. Working time: 1.58 hours.\n", + "1080640 Examples seen. Accuracy: 0.7713 Error: 0.67894 Loss: 0.71084 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1081280 Examples seen. Accuracy: 0.7728 Error: 0.53755 Loss: 0.49426 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1081920 Examples seen. Accuracy: 0.7691 Error: 0.76535 Loss: 0.76414 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "1082560 Examples seen. Accuracy: 0.7683 Error: 0.65598 Loss: 0.66660 Threads: 2 Forward time: 0.75s Backward time: 0.40s Step time: 2.31s\n", + "1083200 Examples seen. Accuracy: 0.7666 Error: 0.47416 Loss: 0.43963 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1083840 Examples seen. Accuracy: 0.7681 Error: 0.63682 Loss: 0.67082 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "1084480 Examples seen. Accuracy: 0.7713 Error: 0.66598 Loss: 0.74358 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1085120 Examples seen. Accuracy: 0.7728 Error: 0.70429 Loss: 0.83385 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.28s\n", + "1085760 Examples seen. Accuracy: 0.7753 Error: 0.63751 Loss: 0.68875 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1086400 Examples seen. Accuracy: 0.7742 Error: 0.51836 Loss: 0.56228 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.29s\n", + "1087040 Examples seen. Accuracy: 0.7775 Error: 0.66556 Loss: 0.64268 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1087680 Examples seen. Accuracy: 0.7738 Error: 0.63449 Loss: 0.68785 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "1088320 Examples seen. Accuracy: 0.7726 Error: 0.59835 Loss: 0.60566 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.27s\n", + "1088960 Examples seen. Accuracy: 0.7729 Error: 0.64772 Loss: 0.66562 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1089600 Examples seen. Accuracy: 0.7735 Error: 0.45638 Loss: 0.42367 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1090240 Examples seen. Accuracy: 0.7745 Error: 0.46694 Loss: 0.51519 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1090880 Examples seen. Accuracy: 0.7757 Error: 0.52814 Loss: 0.54169 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "1091520 Examples seen. Accuracy: 0.7767 Error: 0.48915 Loss: 0.50514 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.31s\n", + "1092160 Examples seen. Accuracy: 0.7759 Error: 0.69754 Loss: 0.81339 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1092800 Examples seen. Accuracy: 0.7739 Error: 0.81196 Loss: 0.88721 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.31s\n", + "1093440 Examples seen. Accuracy: 0.7744 Error: 0.57275 Loss: 0.52925 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1094080 Examples seen. Accuracy: 0.7740 Error: 0.57387 Loss: 0.59219 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.29s\n", + "1094720 Examples seen. Accuracy: 0.7720 Error: 0.61858 Loss: 0.62197 Threads: 2 Forward time: 0.72s Backward time: 0.46s Step time: 2.36s\n", + "1095360 Examples seen. Accuracy: 0.7733 Error: 0.58113 Loss: 0.66460 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.43s\n", + "1096000 Examples seen. Accuracy: 0.7715 Error: 0.55685 Loss: 0.53554 Threads: 2 Forward time: 0.75s Backward time: 0.45s Step time: 2.40s\n", + "1096640 Examples seen. Accuracy: 0.7762 Error: 0.55369 Loss: 0.60616 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.37s\n", + "1097280 Examples seen. Accuracy: 0.7755 Error: 0.55193 Loss: 0.61384 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1097920 Examples seen. Accuracy: 0.7774 Error: 0.59190 Loss: 0.70011 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.29s\n", + "1098560 Examples seen. Accuracy: 0.7754 Error: 0.71340 Loss: 0.68923 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.28s\n", + "1099200 Examples seen. Accuracy: 0.7770 Error: 0.51982 Loss: 0.51748 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1099840 Examples seen. Accuracy: 0.7757 Error: 0.55600 Loss: 0.51837 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1100480 Examples seen. Accuracy: 0.7738 Error: 0.78785 Loss: 0.91916 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.28s\n", + "1101120 Examples seen. Accuracy: 0.7715 Error: 0.67888 Loss: 0.66424 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1101760 Examples seen. Accuracy: 0.7711 Error: 0.63342 Loss: 0.68960 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1102400 Examples seen. Accuracy: 0.7709 Error: 0.61279 Loss: 0.67531 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1103040 Examples seen. Accuracy: 0.7736 Error: 0.63234 Loss: 0.62694 Threads: 2 Forward time: 0.77s Backward time: 0.42s Step time: 2.29s\n", + "1103680 Examples seen. Accuracy: 0.7722 Error: 0.62046 Loss: 0.58955 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.37s\n", + "1104320 Examples seen. Accuracy: 0.7725 Error: 0.53156 Loss: 0.65217 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.30s\n", + "1104960 Examples seen. Accuracy: 0.7724 Error: 0.53894 Loss: 0.57347 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1105600 Examples seen. Accuracy: 0.7745 Error: 0.61540 Loss: 0.61130 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.31s\n", + "1106240 Examples seen. Accuracy: 0.7732 Error: 0.61875 Loss: 0.57170 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1106880 Examples seen. Accuracy: 0.7724 Error: 0.77616 Loss: 0.93340 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1107520 Examples seen. Accuracy: 0.7720 Error: 0.69649 Loss: 0.71406 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1108160 Examples seen. Accuracy: 0.7706 Error: 0.64266 Loss: 0.65267 Threads: 2 Forward time: 0.74s Backward time: 0.41s Step time: 2.33s\n", + "1108800 Examples seen. Accuracy: 0.7697 Error: 0.63226 Loss: 0.60331 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "1109440 Examples seen. Accuracy: 0.7707 Error: 0.72177 Loss: 0.79441 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.31s\n", + "1110080 Examples seen. Accuracy: 0.7721 Error: 0.56079 Loss: 0.53028 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.36s\n", + "1110720 Examples seen. Accuracy: 0.7722 Error: 0.53931 Loss: 0.61064 Threads: 2 Forward time: 0.73s Backward time: 0.44s Step time: 2.34s\n", + "1111360 Examples seen. Accuracy: 0.7677 Error: 0.71927 Loss: 0.81796 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.32s\n", + "1112000 Examples seen. Accuracy: 0.7677 Error: 0.57221 Loss: 0.56836 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.35s\n", + "1112640 Examples seen. Accuracy: 0.7694 Error: 0.50521 Loss: 0.52993 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.35s\n", + "1113280 Examples seen. Accuracy: 0.7674 Error: 0.72137 Loss: 0.78678 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1113920 Examples seen. Accuracy: 0.7684 Error: 0.51623 Loss: 0.54745 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.30s\n", + "1114560 Examples seen. Accuracy: 0.7671 Error: 0.47534 Loss: 0.54274 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.28s\n", + "1115200 Examples seen. Accuracy: 0.7699 Error: 0.51134 Loss: 0.55922 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.30s\n", + "1115840 Examples seen. Accuracy: 0.7691 Error: 0.69697 Loss: 0.79744 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1116480 Examples seen. Accuracy: 0.7720 Error: 0.60532 Loss: 0.58824 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1117120 Examples seen. Accuracy: 0.7753 Error: 0.57749 Loss: 0.49632 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.29s\n", + "1117760 Examples seen. Accuracy: 0.7760 Error: 0.58438 Loss: 0.59893 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "1118400 Examples seen. Accuracy: 0.7733 Error: 0.53181 Loss: 0.54858 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.29s\n", + "1119040 Examples seen. Accuracy: 0.7732 Error: 0.59024 Loss: 0.53193 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.30s\n", + "1119680 Examples seen. Accuracy: 0.7740 Error: 0.68910 Loss: 0.71524 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.39s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 28 Examples seen:1120000 Validation Accuracy: 0.8261 Validation Error: 0.4891 Validation Loss: 0.5150 Total time: 98.09min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.494 Min Weight: -0.550 Max Output: 4.574 Min Output: -5.458 TNNetConvolutionLinear 32,32,64 Times: 30.77s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.574 Min Output: -1.136 TNNetMaxPool 8,8,64 Times: 7.03s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.821 Min Weight: 0.772 Max Output: 4.860 Min Output: -2.534 TNNetMovingStdNormalization 8,8,64 Times: 0.16s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.271 Min Weight: -0.277 Max Output: 9.686 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.52s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.286 Min Weight: -0.255 Max Output: 9.216 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.45s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.257 Min Weight: -0.225 Max Output: 6.026 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.60s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.235 Min Weight: -0.219 Max Output: 2.657 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.61s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.657 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.657 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.36s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.341 Min Weight: -0.271 Max Output: 4.850 Min Output: -8.163 TNNetFullConnectLinear 10,1,1 Times: 0.15s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.541 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.4896 minutes. 50 epochs: 2.0747 hours.\n", + "Epochs: 28. Working time: 1.63 hours.\n", + "1120640 Examples seen. Accuracy: 0.7794 Error: 0.52421 Loss: 0.63351 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.34s\n", + "1121280 Examples seen. Accuracy: 0.7815 Error: 0.52029 Loss: 0.55908 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.31s\n", + "1121920 Examples seen. Accuracy: 0.7798 Error: 0.64171 Loss: 0.63233 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.34s\n", + "1122560 Examples seen. Accuracy: 0.7798 Error: 0.64865 Loss: 0.75683 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1123200 Examples seen. Accuracy: 0.7778 Error: 0.61196 Loss: 0.56286 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.31s\n", + "1123840 Examples seen. Accuracy: 0.7766 Error: 0.46690 Loss: 0.43316 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1124480 Examples seen. Accuracy: 0.7785 Error: 0.60207 Loss: 0.61848 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1125120 Examples seen. Accuracy: 0.7767 Error: 0.59671 Loss: 0.69586 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1125760 Examples seen. Accuracy: 0.7766 Error: 0.56630 Loss: 0.57956 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.27s\n", + "1126400 Examples seen. Accuracy: 0.7776 Error: 0.47290 Loss: 0.49113 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1127040 Examples seen. Accuracy: 0.7764 Error: 0.64792 Loss: 0.63391 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1127680 Examples seen. Accuracy: 0.7781 Error: 0.49905 Loss: 0.43891 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1128320 Examples seen. Accuracy: 0.7755 Error: 0.38912 Loss: 0.35121 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "1128960 Examples seen. Accuracy: 0.7733 Error: 0.59010 Loss: 0.61952 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.31s\n", + "1129600 Examples seen. Accuracy: 0.7736 Error: 0.62095 Loss: 0.74850 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.30s\n", + "1130240 Examples seen. Accuracy: 0.7718 Error: 0.65263 Loss: 0.64472 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1130880 Examples seen. Accuracy: 0.7735 Error: 0.79717 Loss: 0.83316 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.26s\n", + "1131520 Examples seen. Accuracy: 0.7732 Error: 0.56024 Loss: 0.56859 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.27s\n", + "1132160 Examples seen. Accuracy: 0.7738 Error: 0.59734 Loss: 0.54427 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1132800 Examples seen. Accuracy: 0.7727 Error: 0.55674 Loss: 0.45714 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1133440 Examples seen. Accuracy: 0.7713 Error: 0.53348 Loss: 0.55996 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1134080 Examples seen. Accuracy: 0.7736 Error: 0.63320 Loss: 0.73677 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1134720 Examples seen. Accuracy: 0.7747 Error: 0.71991 Loss: 0.77038 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.30s\n", + "1135360 Examples seen. Accuracy: 0.7730 Error: 0.57787 Loss: 0.60152 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1136000 Examples seen. Accuracy: 0.7726 Error: 0.50915 Loss: 0.46865 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1136640 Examples seen. Accuracy: 0.7775 Error: 0.51334 Loss: 0.57772 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1137280 Examples seen. Accuracy: 0.7775 Error: 0.47320 Loss: 0.46707 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1137920 Examples seen. Accuracy: 0.7785 Error: 0.73078 Loss: 0.76182 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1138560 Examples seen. Accuracy: 0.7759 Error: 0.64600 Loss: 0.81387 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1139200 Examples seen. Accuracy: 0.7787 Error: 0.65314 Loss: 0.79598 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "1139840 Examples seen. Accuracy: 0.7786 Error: 0.53289 Loss: 0.53779 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.32s\n", + "1140480 Examples seen. Accuracy: 0.7758 Error: 0.67408 Loss: 0.67357 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.31s\n", + "1141120 Examples seen. Accuracy: 0.7747 Error: 0.76437 Loss: 0.72462 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1141760 Examples seen. Accuracy: 0.7751 Error: 0.63911 Loss: 0.64265 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.30s\n", + "1142400 Examples seen. Accuracy: 0.7752 Error: 0.60393 Loss: 0.65330 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.29s\n", + "1143040 Examples seen. Accuracy: 0.7754 Error: 0.64088 Loss: 0.66254 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.29s\n", + "1143680 Examples seen. Accuracy: 0.7738 Error: 0.68539 Loss: 0.73513 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1144320 Examples seen. Accuracy: 0.7727 Error: 0.47767 Loss: 0.45383 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "1144960 Examples seen. Accuracy: 0.7762 Error: 0.50762 Loss: 0.50520 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1145600 Examples seen. Accuracy: 0.7757 Error: 0.78931 Loss: 0.85896 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.27s\n", + "1146240 Examples seen. Accuracy: 0.7749 Error: 0.56260 Loss: 0.63088 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1146880 Examples seen. Accuracy: 0.7759 Error: 0.60969 Loss: 0.80845 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1147520 Examples seen. Accuracy: 0.7791 Error: 0.55723 Loss: 0.60484 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1148160 Examples seen. Accuracy: 0.7771 Error: 0.62622 Loss: 0.56205 Threads: 2 Forward time: 0.73s Backward time: 0.45s Step time: 2.31s\n", + "1148800 Examples seen. Accuracy: 0.7764 Error: 0.53529 Loss: 0.55049 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.38s\n", + "1149440 Examples seen. Accuracy: 0.7758 Error: 0.59341 Loss: 0.56023 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.31s\n", + "1150080 Examples seen. Accuracy: 0.7761 Error: 0.62092 Loss: 0.63427 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1150720 Examples seen. Accuracy: 0.7769 Error: 0.57329 Loss: 0.64913 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.27s\n", + "1151360 Examples seen. Accuracy: 0.7748 Error: 0.45510 Loss: 0.52737 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1152000 Examples seen. Accuracy: 0.7739 Error: 0.63758 Loss: 0.68069 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1152640 Examples seen. Accuracy: 0.7742 Error: 0.50571 Loss: 0.58059 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "1153280 Examples seen. Accuracy: 0.7744 Error: 0.56878 Loss: 0.53177 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.28s\n", + "1153920 Examples seen. Accuracy: 0.7768 Error: 0.54415 Loss: 0.56553 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "1154560 Examples seen. Accuracy: 0.7790 Error: 0.50388 Loss: 0.71423 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.27s\n", + "1155200 Examples seen. Accuracy: 0.7778 Error: 0.78313 Loss: 0.97846 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1155840 Examples seen. Accuracy: 0.7759 Error: 0.69764 Loss: 0.67843 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1156480 Examples seen. Accuracy: 0.7744 Error: 0.53026 Loss: 0.49082 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.27s\n", + "1157120 Examples seen. Accuracy: 0.7754 Error: 0.50892 Loss: 0.53582 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1157760 Examples seen. Accuracy: 0.7776 Error: 0.63629 Loss: 0.65726 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.24s\n", + "1158400 Examples seen. Accuracy: 0.7767 Error: 0.60666 Loss: 0.67876 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1159040 Examples seen. Accuracy: 0.7769 Error: 0.47899 Loss: 0.47012 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1159680 Examples seen. Accuracy: 0.7756 Error: 0.53084 Loss: 0.52093 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.31s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 29 Examples seen:1160000 Validation Accuracy: 0.8287 Validation Error: 0.4835 Validation Loss: 0.5090 Total time: 101.52min\n", + "Epoch time: 2.4073 minutes. 50 epochs: 2.0061 hours.\n", + "Epochs: 29. Working time: 1.69 hours.\n", + "1160640 Examples seen. Accuracy: 0.7776 Error: 0.56986 Loss: 0.47305 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1161280 Examples seen. Accuracy: 0.7762 Error: 0.66140 Loss: 0.61581 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1161920 Examples seen. Accuracy: 0.7805 Error: 0.60814 Loss: 0.70295 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1162560 Examples seen. Accuracy: 0.7788 Error: 0.67714 Loss: 0.70537 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "1163200 Examples seen. Accuracy: 0.7826 Error: 0.59043 Loss: 0.67026 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1163840 Examples seen. Accuracy: 0.7801 Error: 0.64057 Loss: 0.77652 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1164480 Examples seen. Accuracy: 0.7774 Error: 0.49402 Loss: 0.45296 Threads: 2 Forward time: 0.73s Backward time: 0.40s Step time: 2.29s\n", + "1165120 Examples seen. Accuracy: 0.7785 Error: 0.54668 Loss: 0.60388 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.27s\n", + "1165760 Examples seen. Accuracy: 0.7782 Error: 0.72739 Loss: 0.65615 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1166400 Examples seen. Accuracy: 0.7805 Error: 0.52673 Loss: 0.46872 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1167040 Examples seen. Accuracy: 0.7820 Error: 0.62018 Loss: 0.74346 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1167680 Examples seen. Accuracy: 0.7808 Error: 0.58190 Loss: 0.60172 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1168320 Examples seen. Accuracy: 0.7816 Error: 0.37622 Loss: 0.34950 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1168960 Examples seen. Accuracy: 0.7794 Error: 0.65894 Loss: 0.81498 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1169600 Examples seen. Accuracy: 0.7765 Error: 0.67649 Loss: 0.76236 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "1170240 Examples seen. Accuracy: 0.7765 Error: 0.50140 Loss: 0.48591 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1170880 Examples seen. Accuracy: 0.7776 Error: 0.66763 Loss: 0.78585 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1171520 Examples seen. Accuracy: 0.7759 Error: 0.67202 Loss: 0.80705 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1172160 Examples seen. Accuracy: 0.7777 Error: 0.53117 Loss: 0.56495 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.25s\n", + "1172800 Examples seen. Accuracy: 0.7797 Error: 0.51295 Loss: 0.44868 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1173440 Examples seen. Accuracy: 0.7794 Error: 0.50560 Loss: 0.55629 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1174080 Examples seen. Accuracy: 0.7805 Error: 0.62676 Loss: 0.63596 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.29s\n", + "1174720 Examples seen. Accuracy: 0.7805 Error: 0.68616 Loss: 0.72264 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.33s\n", + "1175360 Examples seen. Accuracy: 0.7777 Error: 0.55185 Loss: 0.54884 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.32s\n", + "1176000 Examples seen. Accuracy: 0.7770 Error: 0.64244 Loss: 0.71392 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1176640 Examples seen. Accuracy: 0.7804 Error: 0.39786 Loss: 0.43744 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.29s\n", + "1177280 Examples seen. Accuracy: 0.7786 Error: 0.65243 Loss: 0.73349 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1177920 Examples seen. Accuracy: 0.7790 Error: 0.53043 Loss: 0.50502 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1178560 Examples seen. Accuracy: 0.7812 Error: 0.51034 Loss: 0.52732 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1179200 Examples seen. Accuracy: 0.7822 Error: 0.60129 Loss: 0.63602 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1179840 Examples seen. Accuracy: 0.7812 Error: 0.64255 Loss: 0.70390 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.30s\n", + "1180480 Examples seen. Accuracy: 0.7818 Error: 0.60750 Loss: 0.59077 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.25s\n", + "1181120 Examples seen. Accuracy: 0.7806 Error: 0.52028 Loss: 0.49569 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1181760 Examples seen. Accuracy: 0.7805 Error: 0.69940 Loss: 0.79032 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.32s\n", + "1182400 Examples seen. Accuracy: 0.7805 Error: 0.70332 Loss: 0.66928 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1183040 Examples seen. Accuracy: 0.7791 Error: 0.57775 Loss: 0.59930 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "1183680 Examples seen. Accuracy: 0.7800 Error: 0.51869 Loss: 0.51265 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.26s\n", + "1184320 Examples seen. Accuracy: 0.7806 Error: 0.51277 Loss: 0.53224 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "1184960 Examples seen. Accuracy: 0.7805 Error: 0.62983 Loss: 0.70943 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "1185600 Examples seen. Accuracy: 0.7793 Error: 0.64632 Loss: 0.76454 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1186240 Examples seen. Accuracy: 0.7814 Error: 0.52997 Loss: 0.51816 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "1186880 Examples seen. Accuracy: 0.7824 Error: 0.52129 Loss: 0.67619 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1187520 Examples seen. Accuracy: 0.7838 Error: 0.74656 Loss: 0.91833 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1188160 Examples seen. Accuracy: 0.7832 Error: 0.64505 Loss: 0.65476 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.26s\n", + "1188800 Examples seen. Accuracy: 0.7792 Error: 0.57545 Loss: 0.69557 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.23s\n", + "1189440 Examples seen. Accuracy: 0.7791 Error: 0.71102 Loss: 0.67482 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1190080 Examples seen. Accuracy: 0.7784 Error: 0.64396 Loss: 0.55848 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.27s\n", + "1190720 Examples seen. Accuracy: 0.7802 Error: 0.61249 Loss: 0.60549 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1191360 Examples seen. Accuracy: 0.7780 Error: 0.52606 Loss: 0.52067 Threads: 2 Forward time: 0.64s Backward time: 0.42s Step time: 2.24s\n", + "1192000 Examples seen. Accuracy: 0.7748 Error: 0.66464 Loss: 0.68711 Threads: 2 Forward time: 0.73s Backward time: 0.44s Step time: 2.30s\n", + "1192640 Examples seen. Accuracy: 0.7729 Error: 0.57977 Loss: 0.54087 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.36s\n", + "1193280 Examples seen. Accuracy: 0.7737 Error: 0.73024 Loss: 0.91881 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1193920 Examples seen. Accuracy: 0.7750 Error: 0.71196 Loss: 0.76247 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.34s\n", + "1194560 Examples seen. Accuracy: 0.7741 Error: 0.70257 Loss: 0.64790 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1195200 Examples seen. Accuracy: 0.7746 Error: 0.51348 Loss: 0.52483 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1195840 Examples seen. Accuracy: 0.7751 Error: 0.72426 Loss: 0.69242 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1196480 Examples seen. Accuracy: 0.7744 Error: 0.70227 Loss: 0.76354 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "1197120 Examples seen. Accuracy: 0.7759 Error: 0.66231 Loss: 0.63596 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.28s\n", + "1197760 Examples seen. Accuracy: 0.7767 Error: 0.75073 Loss: 0.87106 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.30s\n", + "1198400 Examples seen. Accuracy: 0.7773 Error: 0.64883 Loss: 0.62832 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.27s\n", + "1199040 Examples seen. Accuracy: 0.7749 Error: 0.44764 Loss: 0.47303 Threads: 2 Forward time: 0.75s Backward time: 0.43s Step time: 2.26s\n", + "1199680 Examples seen. Accuracy: 0.7749 Error: 0.49609 Loss: 0.45942 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.38s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 30 Examples seen:1200000 Validation Accuracy: 0.8315 Validation Error: 0.4787 Validation Loss: 0.5051 Total time: 104.94min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.510 Min Weight: -0.562 Max Output: 4.717 Min Output: -5.502 TNNetConvolutionLinear 32,32,64 Times: 30.28s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.717 Min Output: -1.156 TNNetMaxPool 8,8,64 Times: 6.94s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.834 Min Weight: 0.786 Max Output: 4.939 Min Output: -2.532 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.279 Min Weight: -0.284 Max Output: 9.980 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.32s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.291 Min Weight: -0.270 Max Output: 9.685 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.264 Min Weight: -0.232 Max Output: 6.380 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.29s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.240 Min Weight: -0.219 Max Output: 2.677 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.24s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.677 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.04s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.677 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.38s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.345 Min Weight: -0.272 Max Output: 4.576 Min Output: -8.332 TNNetFullConnectLinear 10,1,1 Times: 0.11s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.559 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Starting Testing.\n", + "Epochs: 30 Examples seen:1200000 Test Accuracy: 0.8226 Test Error: 0.4935 Test Loss: 0.5318 Total time: 105.98min\n", + "Epoch time: 2.4771 minutes. 50 epochs: 2.0642 hours.\n", + "Epochs: 30. Working time: 1.77 hours.\n", + "Learning rate set to: 0.00074\n", + "1200640 Examples seen. Accuracy: 0.7751 Error: 0.64286 Loss: 0.65344 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1201280 Examples seen. Accuracy: 0.7754 Error: 0.71721 Loss: 0.69562 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1201920 Examples seen. Accuracy: 0.7767 Error: 0.67096 Loss: 0.80500 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1202560 Examples seen. Accuracy: 0.7779 Error: 0.61637 Loss: 0.55140 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1203200 Examples seen. Accuracy: 0.7772 Error: 0.55723 Loss: 0.63485 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1203840 Examples seen. Accuracy: 0.7775 Error: 0.77592 Loss: 0.83950 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "1204480 Examples seen. Accuracy: 0.7767 Error: 0.71214 Loss: 0.67258 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.24s\n", + "1205120 Examples seen. Accuracy: 0.7787 Error: 0.67056 Loss: 0.83594 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1205760 Examples seen. Accuracy: 0.7808 Error: 0.49759 Loss: 0.45220 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1206400 Examples seen. Accuracy: 0.7814 Error: 0.72138 Loss: 0.79935 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1207040 Examples seen. Accuracy: 0.7844 Error: 0.36128 Loss: 0.36295 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "1207680 Examples seen. Accuracy: 0.7874 Error: 0.51051 Loss: 0.48343 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1208320 Examples seen. Accuracy: 0.7863 Error: 0.70855 Loss: 0.74752 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1208960 Examples seen. Accuracy: 0.7874 Error: 0.47668 Loss: 0.44527 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1209600 Examples seen. Accuracy: 0.7854 Error: 0.59715 Loss: 0.67875 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.24s\n", + "1210240 Examples seen. Accuracy: 0.7836 Error: 0.55964 Loss: 0.59544 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1210880 Examples seen. Accuracy: 0.7857 Error: 0.55520 Loss: 0.52169 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1211520 Examples seen. Accuracy: 0.7848 Error: 0.75426 Loss: 0.79197 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1212160 Examples seen. Accuracy: 0.7832 Error: 0.66075 Loss: 0.79864 Threads: 2 Forward time: 0.72s Backward time: 0.38s Step time: 2.24s\n", + "1212800 Examples seen. Accuracy: 0.7792 Error: 0.70873 Loss: 0.85938 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.27s\n", + "1213440 Examples seen. Accuracy: 0.7786 Error: 0.62843 Loss: 0.63079 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.26s\n", + "1214080 Examples seen. Accuracy: 0.7800 Error: 0.57805 Loss: 0.68733 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1214720 Examples seen. Accuracy: 0.7790 Error: 0.57427 Loss: 0.57693 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1215360 Examples seen. Accuracy: 0.7801 Error: 0.62025 Loss: 0.74760 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1216000 Examples seen. Accuracy: 0.7800 Error: 0.49520 Loss: 0.42426 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.26s\n", + "1216640 Examples seen. Accuracy: 0.7819 Error: 0.51242 Loss: 0.51837 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1217280 Examples seen. Accuracy: 0.7820 Error: 0.54005 Loss: 0.62845 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1217920 Examples seen. Accuracy: 0.7844 Error: 0.53553 Loss: 0.60004 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "1218560 Examples seen. Accuracy: 0.7873 Error: 0.50862 Loss: 0.49073 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1219200 Examples seen. Accuracy: 0.7834 Error: 0.58298 Loss: 0.65297 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.25s\n", + "1219840 Examples seen. Accuracy: 0.7789 Error: 0.68969 Loss: 0.75226 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.29s\n", + "1220480 Examples seen. Accuracy: 0.7782 Error: 0.57104 Loss: 0.78865 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "1221120 Examples seen. Accuracy: 0.7781 Error: 0.65082 Loss: 0.71729 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1221760 Examples seen. Accuracy: 0.7771 Error: 0.62464 Loss: 0.73031 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1222400 Examples seen. Accuracy: 0.7774 Error: 0.68074 Loss: 0.72782 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.31s\n", + "1223040 Examples seen. Accuracy: 0.7765 Error: 0.65501 Loss: 0.67829 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.36s\n", + "1223680 Examples seen. Accuracy: 0.7782 Error: 0.53044 Loss: 0.64561 Threads: 2 Forward time: 0.76s Backward time: 0.45s Step time: 2.71s\n", + "1224320 Examples seen. Accuracy: 0.7780 Error: 0.63073 Loss: 0.68233 Threads: 2 Forward time: 0.81s Backward time: 0.50s Step time: 2.71s\n", + "1224960 Examples seen. Accuracy: 0.7785 Error: 0.59606 Loss: 0.65647 Threads: 2 Forward time: 0.78s Backward time: 0.49s Step time: 2.54s\n", + "1225600 Examples seen. Accuracy: 0.7825 Error: 0.48693 Loss: 0.56173 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.45s\n", + "1226240 Examples seen. Accuracy: 0.7824 Error: 0.46022 Loss: 0.62631 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.34s\n", + "1226880 Examples seen. Accuracy: 0.7830 Error: 0.50223 Loss: 0.51936 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.32s\n", + "1227520 Examples seen. Accuracy: 0.7833 Error: 0.64159 Loss: 0.66163 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.36s\n", + "1228160 Examples seen. Accuracy: 0.7836 Error: 0.48403 Loss: 0.41012 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.39s\n", + "1228800 Examples seen. Accuracy: 0.7842 Error: 0.55769 Loss: 0.64978 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1229440 Examples seen. Accuracy: 0.7853 Error: 0.49699 Loss: 0.54006 Threads: 2 Forward time: 0.74s Backward time: 0.46s Step time: 2.36s\n", + "1230080 Examples seen. Accuracy: 0.7854 Error: 0.53543 Loss: 0.56210 Threads: 2 Forward time: 0.75s Backward time: 0.48s Step time: 2.49s\n", + "1230720 Examples seen. Accuracy: 0.7862 Error: 0.50619 Loss: 0.55176 Threads: 2 Forward time: 0.72s Backward time: 0.38s Step time: 2.33s\n", + "1231360 Examples seen. Accuracy: 0.7866 Error: 0.40496 Loss: 0.36965 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.30s\n", + "1232000 Examples seen. Accuracy: 0.7859 Error: 0.54203 Loss: 0.54539 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "1232640 Examples seen. Accuracy: 0.7857 Error: 0.57522 Loss: 0.53422 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.29s\n", + "1233280 Examples seen. Accuracy: 0.7859 Error: 0.68595 Loss: 0.76582 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.27s\n", + "1233920 Examples seen. Accuracy: 0.7869 Error: 0.51987 Loss: 0.61110 Threads: 2 Forward time: 0.73s Backward time: 0.46s Step time: 2.35s\n", + "1234560 Examples seen. Accuracy: 0.7885 Error: 0.51042 Loss: 0.58027 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.40s\n", + "1235200 Examples seen. Accuracy: 0.7878 Error: 0.57845 Loss: 0.60363 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.31s\n", + "1235840 Examples seen. Accuracy: 0.7868 Error: 0.49994 Loss: 0.50530 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.31s\n", + "1236480 Examples seen. Accuracy: 0.7873 Error: 0.63299 Loss: 0.71473 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1237120 Examples seen. Accuracy: 0.7867 Error: 0.62847 Loss: 0.84041 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.28s\n", + "1237760 Examples seen. Accuracy: 0.7878 Error: 0.59563 Loss: 0.73300 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1238400 Examples seen. Accuracy: 0.7871 Error: 0.53870 Loss: 0.51377 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1239040 Examples seen. Accuracy: 0.7853 Error: 0.63139 Loss: 0.66731 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1239680 Examples seen. Accuracy: 0.7846 Error: 0.61708 Loss: 0.73526 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 31 Examples seen:1240000 Validation Accuracy: 0.8329 Validation Error: 0.4742 Validation Loss: 0.5028 Total time: 109.45min\n", + "Epoch time: 2.3698 minutes. 50 epochs: 1.9748 hours.\n", + "Epochs: 31. Working time: 1.82 hours.\n", + "1240640 Examples seen. Accuracy: 0.7843 Error: 0.47725 Loss: 0.51584 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1241280 Examples seen. Accuracy: 0.7840 Error: 0.49573 Loss: 0.46569 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1241920 Examples seen. Accuracy: 0.7828 Error: 0.56171 Loss: 0.66530 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1242560 Examples seen. Accuracy: 0.7833 Error: 0.53505 Loss: 0.46275 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.23s\n", + "1243200 Examples seen. Accuracy: 0.7807 Error: 0.52023 Loss: 0.59308 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1243840 Examples seen. Accuracy: 0.7832 Error: 0.60766 Loss: 0.67507 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1244480 Examples seen. Accuracy: 0.7875 Error: 0.55527 Loss: 0.54208 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1245120 Examples seen. Accuracy: 0.7880 Error: 0.56765 Loss: 0.63586 Threads: 2 Forward time: 0.72s Backward time: 0.38s Step time: 2.27s\n", + "1245760 Examples seen. Accuracy: 0.7896 Error: 0.54940 Loss: 0.67471 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1246400 Examples seen. Accuracy: 0.7890 Error: 0.58934 Loss: 0.64301 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1247040 Examples seen. Accuracy: 0.7878 Error: 0.56561 Loss: 0.61911 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1247680 Examples seen. Accuracy: 0.7883 Error: 0.54601 Loss: 0.59486 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1248320 Examples seen. Accuracy: 0.7885 Error: 0.63256 Loss: 0.79630 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.28s\n", + "1248960 Examples seen. Accuracy: 0.7865 Error: 0.59277 Loss: 0.75957 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1249600 Examples seen. Accuracy: 0.7874 Error: 0.54872 Loss: 0.60920 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1250240 Examples seen. Accuracy: 0.7872 Error: 0.55110 Loss: 0.56751 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1250880 Examples seen. Accuracy: 0.7883 Error: 0.45490 Loss: 0.40343 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "1251520 Examples seen. Accuracy: 0.7912 Error: 0.38080 Loss: 0.34165 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.25s\n", + "1252160 Examples seen. Accuracy: 0.7930 Error: 0.54881 Loss: 0.54164 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1252800 Examples seen. Accuracy: 0.7915 Error: 0.52708 Loss: 0.58480 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1253440 Examples seen. Accuracy: 0.7926 Error: 0.48129 Loss: 0.51919 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1254080 Examples seen. Accuracy: 0.7921 Error: 0.55212 Loss: 0.58826 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1254720 Examples seen. Accuracy: 0.7909 Error: 0.44050 Loss: 0.45105 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1255360 Examples seen. Accuracy: 0.7887 Error: 0.54091 Loss: 0.61723 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1256000 Examples seen. Accuracy: 0.7906 Error: 0.53010 Loss: 0.43359 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1256640 Examples seen. Accuracy: 0.7885 Error: 0.58651 Loss: 0.54602 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1257280 Examples seen. Accuracy: 0.7884 Error: 0.57085 Loss: 0.60078 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1257920 Examples seen. Accuracy: 0.7876 Error: 0.70097 Loss: 0.76701 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.24s\n", + "1258560 Examples seen. Accuracy: 0.7859 Error: 0.58308 Loss: 0.54945 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1259200 Examples seen. Accuracy: 0.7874 Error: 0.60047 Loss: 0.65089 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1259840 Examples seen. Accuracy: 0.7873 Error: 0.46302 Loss: 0.41428 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "1260480 Examples seen. Accuracy: 0.7860 Error: 0.64550 Loss: 0.73407 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.30s\n", + "1261120 Examples seen. Accuracy: 0.7836 Error: 0.38562 Loss: 0.41699 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1261760 Examples seen. Accuracy: 0.7817 Error: 0.75661 Loss: 0.86641 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1262400 Examples seen. Accuracy: 0.7800 Error: 0.55889 Loss: 0.56879 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.28s\n", + "1263040 Examples seen. Accuracy: 0.7805 Error: 0.56653 Loss: 0.58501 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1263680 Examples seen. Accuracy: 0.7813 Error: 0.61508 Loss: 0.63592 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.27s\n", + "1264320 Examples seen. Accuracy: 0.7830 Error: 0.53914 Loss: 0.46992 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1264960 Examples seen. Accuracy: 0.7820 Error: 0.58157 Loss: 0.52403 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1265600 Examples seen. Accuracy: 0.7830 Error: 0.56299 Loss: 0.53784 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.23s\n", + "1266240 Examples seen. Accuracy: 0.7851 Error: 0.54177 Loss: 0.59488 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "1266880 Examples seen. Accuracy: 0.7851 Error: 0.64596 Loss: 0.79294 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.24s\n", + "1267520 Examples seen. Accuracy: 0.7836 Error: 0.75294 Loss: 0.82062 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "1268160 Examples seen. Accuracy: 0.7832 Error: 0.67580 Loss: 0.77809 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1268800 Examples seen. Accuracy: 0.7831 Error: 0.70731 Loss: 0.80799 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1269440 Examples seen. Accuracy: 0.7825 Error: 0.56960 Loss: 0.57981 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1270080 Examples seen. Accuracy: 0.7831 Error: 0.57833 Loss: 0.51488 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.23s\n", + "1270720 Examples seen. Accuracy: 0.7850 Error: 0.58764 Loss: 0.54039 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1271360 Examples seen. Accuracy: 0.7841 Error: 0.63652 Loss: 0.80827 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.23s\n", + "1272000 Examples seen. Accuracy: 0.7826 Error: 0.64770 Loss: 0.86617 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.27s\n", + "1272640 Examples seen. Accuracy: 0.7822 Error: 0.52765 Loss: 0.48528 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1273280 Examples seen. Accuracy: 0.7797 Error: 0.46494 Loss: 0.42500 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1273920 Examples seen. Accuracy: 0.7822 Error: 0.55058 Loss: 0.52238 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1274560 Examples seen. Accuracy: 0.7810 Error: 0.59736 Loss: 0.60811 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "1275200 Examples seen. Accuracy: 0.7814 Error: 0.54648 Loss: 0.51191 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1275840 Examples seen. Accuracy: 0.7817 Error: 0.52865 Loss: 0.64533 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "1276480 Examples seen. Accuracy: 0.7823 Error: 0.58322 Loss: 0.52430 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.31s\n", + "1277120 Examples seen. Accuracy: 0.7810 Error: 0.53212 Loss: 0.54407 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1277760 Examples seen. Accuracy: 0.7835 Error: 0.49180 Loss: 0.43472 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1278400 Examples seen. Accuracy: 0.7844 Error: 0.43271 Loss: 0.44015 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "1279040 Examples seen. Accuracy: 0.7855 Error: 0.57346 Loss: 0.62711 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "1279680 Examples seen. Accuracy: 0.7850 Error: 0.59628 Loss: 0.69473 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "Starting Validation.\n", + "Epochs: 32 Examples seen:1280000 Validation Accuracy: 0.8329 Validation Error: 0.4698 Validation Loss: 0.4996 Total time: 112.87min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.520 Min Weight: -0.573 Max Output: 4.786 Min Output: -5.553 TNNetConvolutionLinear 32,32,64 Times: 30.83s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.786 Min Output: -1.217 TNNetMaxPool 8,8,64 Times: 7.00s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.847 Min Weight: 0.800 Max Output: 4.926 Min Output: -2.581 TNNetMovingStdNormalization 8,8,64 Times: 0.17s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.284 Min Weight: -0.293 Max Output: 10.200 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.56s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.293 Min Weight: -0.282 Max Output: 9.815 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.45s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.274 Min Weight: -0.238 Max Output: 6.736 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.53s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.242 Min Weight: -0.217 Max Output: 2.852 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.43s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.852 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.04s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.852 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.40s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.348 Min Weight: -0.271 Max Output: 4.509 Min Output: -8.595 TNNetFullConnectLinear 10,1,1 Times: 0.11s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.565 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3667 minutes. 50 epochs: 1.9722 hours.\n", + "Epochs: 32. Working time: 1.88 hours.\n", + "1280640 Examples seen. Accuracy: 0.7832 Error: 0.64585 Loss: 0.69587 Threads: 2 Forward time: 0.74s Backward time: 0.41s Step time: 2.28s\n", + "1281280 Examples seen. Accuracy: 0.7843 Error: 0.61671 Loss: 0.70524 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "1281920 Examples seen. Accuracy: 0.7839 Error: 0.60757 Loss: 0.64053 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.34s\n", + "1282560 Examples seen. Accuracy: 0.7855 Error: 0.47518 Loss: 0.43346 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1283200 Examples seen. Accuracy: 0.7877 Error: 0.59297 Loss: 0.85653 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.28s\n", + "1283840 Examples seen. Accuracy: 0.7895 Error: 0.52170 Loss: 0.44359 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1284480 Examples seen. Accuracy: 0.7881 Error: 0.53714 Loss: 0.54465 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1285120 Examples seen. Accuracy: 0.7874 Error: 0.58090 Loss: 0.53135 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1285760 Examples seen. Accuracy: 0.7874 Error: 0.47550 Loss: 0.45915 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1286400 Examples seen. Accuracy: 0.7866 Error: 0.64166 Loss: 0.78682 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.24s\n", + "1287040 Examples seen. Accuracy: 0.7865 Error: 0.50802 Loss: 0.52723 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1287680 Examples seen. Accuracy: 0.7898 Error: 0.60484 Loss: 0.63673 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1288320 Examples seen. Accuracy: 0.7897 Error: 0.53018 Loss: 0.56199 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.27s\n", + "1288960 Examples seen. Accuracy: 0.7865 Error: 0.61655 Loss: 0.61443 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1289600 Examples seen. Accuracy: 0.7832 Error: 0.61269 Loss: 0.55876 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "1290240 Examples seen. Accuracy: 0.7863 Error: 0.57752 Loss: 0.67834 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "1290880 Examples seen. Accuracy: 0.7872 Error: 0.70037 Loss: 0.73452 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.29s\n", + "1291520 Examples seen. Accuracy: 0.7911 Error: 0.50310 Loss: 0.50242 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1292160 Examples seen. Accuracy: 0.7871 Error: 0.70449 Loss: 0.75903 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.26s\n", + "1292800 Examples seen. Accuracy: 0.7881 Error: 0.65345 Loss: 0.72811 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1293440 Examples seen. Accuracy: 0.7864 Error: 0.65485 Loss: 0.65287 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "1294080 Examples seen. Accuracy: 0.7883 Error: 0.59678 Loss: 0.56790 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.31s\n", + "1294720 Examples seen. Accuracy: 0.7878 Error: 0.66222 Loss: 0.83246 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.31s\n", + "1295360 Examples seen. Accuracy: 0.7895 Error: 0.46031 Loss: 0.37152 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "1296000 Examples seen. Accuracy: 0.7925 Error: 0.51558 Loss: 0.47107 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.32s\n", + "1296640 Examples seen. Accuracy: 0.7907 Error: 0.62717 Loss: 0.71559 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.26s\n", + "1297280 Examples seen. Accuracy: 0.7911 Error: 0.58214 Loss: 0.58279 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.27s\n", + "1297920 Examples seen. Accuracy: 0.7923 Error: 0.57659 Loss: 0.71769 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1298560 Examples seen. Accuracy: 0.7951 Error: 0.57408 Loss: 0.49613 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1299200 Examples seen. Accuracy: 0.7940 Error: 0.44094 Loss: 0.40444 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "1299840 Examples seen. Accuracy: 0.7934 Error: 0.59908 Loss: 0.75478 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.32s\n", + "1300480 Examples seen. Accuracy: 0.7900 Error: 0.69863 Loss: 0.68214 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1301120 Examples seen. Accuracy: 0.7893 Error: 0.42779 Loss: 0.34304 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "1301760 Examples seen. Accuracy: 0.7860 Error: 0.60575 Loss: 0.59497 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1302400 Examples seen. Accuracy: 0.7869 Error: 0.59790 Loss: 0.64728 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.28s\n", + "1303040 Examples seen. Accuracy: 0.7853 Error: 0.73767 Loss: 0.79526 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.26s\n", + "1303680 Examples seen. Accuracy: 0.7838 Error: 0.67585 Loss: 0.65435 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1304320 Examples seen. Accuracy: 0.7853 Error: 0.52065 Loss: 0.42431 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "1304960 Examples seen. Accuracy: 0.7861 Error: 0.36962 Loss: 0.45761 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1305600 Examples seen. Accuracy: 0.7895 Error: 0.60682 Loss: 0.60567 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.29s\n", + "1306240 Examples seen. Accuracy: 0.7884 Error: 0.66043 Loss: 0.75180 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1306880 Examples seen. Accuracy: 0.7884 Error: 0.50895 Loss: 0.53755 Threads: 2 Forward time: 0.70s Backward time: 0.37s Step time: 2.25s\n", + "1307520 Examples seen. Accuracy: 0.7872 Error: 0.62135 Loss: 0.63892 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1308160 Examples seen. Accuracy: 0.7863 Error: 0.45117 Loss: 0.41081 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.26s\n", + "1308800 Examples seen. Accuracy: 0.7856 Error: 0.51989 Loss: 0.44871 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1309440 Examples seen. Accuracy: 0.7842 Error: 0.70024 Loss: 0.87309 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1310080 Examples seen. Accuracy: 0.7844 Error: 0.51669 Loss: 0.46924 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1310720 Examples seen. Accuracy: 0.7848 Error: 0.57813 Loss: 0.66389 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1311360 Examples seen. Accuracy: 0.7871 Error: 0.46848 Loss: 0.52171 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1312000 Examples seen. Accuracy: 0.7884 Error: 0.62824 Loss: 0.64377 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.30s\n", + "1312640 Examples seen. Accuracy: 0.7890 Error: 0.51217 Loss: 0.53284 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.29s\n", + "1313280 Examples seen. Accuracy: 0.7912 Error: 0.58014 Loss: 0.65342 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.29s\n", + "1313920 Examples seen. Accuracy: 0.7947 Error: 0.42172 Loss: 0.47614 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1314560 Examples seen. Accuracy: 0.7940 Error: 0.64409 Loss: 0.62473 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.29s\n", + "1315200 Examples seen. Accuracy: 0.7945 Error: 0.42007 Loss: 0.39447 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1315840 Examples seen. Accuracy: 0.7944 Error: 0.51635 Loss: 0.62484 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1316480 Examples seen. Accuracy: 0.7935 Error: 0.46763 Loss: 0.57362 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1317120 Examples seen. Accuracy: 0.7925 Error: 0.60232 Loss: 0.60671 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1317760 Examples seen. Accuracy: 0.7912 Error: 0.58365 Loss: 0.57285 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "1318400 Examples seen. Accuracy: 0.7914 Error: 0.60825 Loss: 0.61843 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1319040 Examples seen. Accuracy: 0.7936 Error: 0.36862 Loss: 0.30941 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.24s\n", + "1319680 Examples seen. Accuracy: 0.7911 Error: 0.53451 Loss: 0.47788 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 33 Examples seen:1320000 Validation Accuracy: 0.8353 Validation Error: 0.4672 Validation Loss: 0.4969 Total time: 116.31min\n", + "Epoch time: 2.3656 minutes. 50 epochs: 1.9714 hours.\n", + "Epochs: 33. Working time: 1.94 hours.\n", + "1320640 Examples seen. Accuracy: 0.7906 Error: 0.53081 Loss: 0.54587 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.26s\n", + "1321280 Examples seen. Accuracy: 0.7917 Error: 0.63764 Loss: 0.69533 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1321920 Examples seen. Accuracy: 0.7936 Error: 0.46233 Loss: 0.40093 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1322560 Examples seen. Accuracy: 0.7922 Error: 0.67207 Loss: 0.76874 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1323200 Examples seen. Accuracy: 0.7914 Error: 0.53289 Loss: 0.55294 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1323840 Examples seen. Accuracy: 0.7892 Error: 0.52619 Loss: 0.68985 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.26s\n", + "1324480 Examples seen. Accuracy: 0.7894 Error: 0.54905 Loss: 0.58755 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1325120 Examples seen. Accuracy: 0.7892 Error: 0.50748 Loss: 0.51020 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1325760 Examples seen. Accuracy: 0.7916 Error: 0.57824 Loss: 0.56624 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1326400 Examples seen. Accuracy: 0.7924 Error: 0.61998 Loss: 0.69956 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1327040 Examples seen. Accuracy: 0.7929 Error: 0.55754 Loss: 0.56295 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.25s\n", + "1327680 Examples seen. Accuracy: 0.7925 Error: 0.54066 Loss: 0.54614 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1328320 Examples seen. Accuracy: 0.7922 Error: 0.58956 Loss: 0.56415 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1328960 Examples seen. Accuracy: 0.7887 Error: 0.54197 Loss: 0.67557 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1329600 Examples seen. Accuracy: 0.7877 Error: 0.44009 Loss: 0.34554 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "1330240 Examples seen. Accuracy: 0.7890 Error: 0.43382 Loss: 0.40314 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.28s\n", + "1330880 Examples seen. Accuracy: 0.7880 Error: 0.62319 Loss: 0.63072 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1331520 Examples seen. Accuracy: 0.7888 Error: 0.70559 Loss: 0.63921 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1332160 Examples seen. Accuracy: 0.7883 Error: 0.57248 Loss: 0.74999 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "1332800 Examples seen. Accuracy: 0.7859 Error: 0.57180 Loss: 0.57545 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1333440 Examples seen. Accuracy: 0.7854 Error: 0.43697 Loss: 0.37849 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.28s\n", + "1334080 Examples seen. Accuracy: 0.7840 Error: 0.60208 Loss: 0.56056 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1334720 Examples seen. Accuracy: 0.7837 Error: 0.75670 Loss: 0.72626 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1335360 Examples seen. Accuracy: 0.7844 Error: 0.47922 Loss: 0.43309 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1336000 Examples seen. Accuracy: 0.7831 Error: 0.54498 Loss: 0.50272 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.26s\n", + "1336640 Examples seen. Accuracy: 0.7853 Error: 0.55214 Loss: 0.54320 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.26s\n", + "1337280 Examples seen. Accuracy: 0.7874 Error: 0.62943 Loss: 0.78451 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.32s\n", + "1337920 Examples seen. Accuracy: 0.7876 Error: 0.60653 Loss: 0.65194 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.36s\n", + "1338560 Examples seen. Accuracy: 0.7861 Error: 0.63837 Loss: 0.61434 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.32s\n", + "1339200 Examples seen. Accuracy: 0.7865 Error: 0.52642 Loss: 0.46827 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.30s\n", + "1339840 Examples seen. Accuracy: 0.7861 Error: 0.62272 Loss: 0.70624 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.27s\n", + "1340480 Examples seen. Accuracy: 0.7862 Error: 0.55882 Loss: 0.48922 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.26s\n", + "1341120 Examples seen. Accuracy: 0.7891 Error: 0.67534 Loss: 0.67404 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.27s\n", + "1341760 Examples seen. Accuracy: 0.7875 Error: 0.53217 Loss: 0.49085 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1342400 Examples seen. Accuracy: 0.7871 Error: 0.52482 Loss: 0.57882 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.29s\n", + "1343040 Examples seen. Accuracy: 0.7879 Error: 0.50817 Loss: 0.51205 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.30s\n", + "1343680 Examples seen. Accuracy: 0.7894 Error: 0.71266 Loss: 0.76258 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.28s\n", + "1344320 Examples seen. Accuracy: 0.7901 Error: 0.50584 Loss: 0.42748 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1344960 Examples seen. Accuracy: 0.7886 Error: 0.44178 Loss: 0.44868 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1345600 Examples seen. Accuracy: 0.7877 Error: 0.60253 Loss: 0.61629 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.26s\n", + "1346240 Examples seen. Accuracy: 0.7858 Error: 0.46678 Loss: 0.36829 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1346880 Examples seen. Accuracy: 0.7864 Error: 0.49625 Loss: 0.57179 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.32s\n", + "1347520 Examples seen. Accuracy: 0.7856 Error: 0.56962 Loss: 0.51950 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.29s\n", + "1348160 Examples seen. Accuracy: 0.7869 Error: 0.41979 Loss: 0.40398 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1348800 Examples seen. Accuracy: 0.7879 Error: 0.52735 Loss: 0.65224 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1349440 Examples seen. Accuracy: 0.7880 Error: 0.52790 Loss: 0.57884 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1350080 Examples seen. Accuracy: 0.7902 Error: 0.43375 Loss: 0.47981 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1350720 Examples seen. Accuracy: 0.7901 Error: 0.76934 Loss: 0.74440 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1351360 Examples seen. Accuracy: 0.7894 Error: 0.52292 Loss: 0.56203 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1352000 Examples seen. Accuracy: 0.7917 Error: 0.45565 Loss: 0.46184 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "1352640 Examples seen. Accuracy: 0.7918 Error: 0.61015 Loss: 0.87905 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1353280 Examples seen. Accuracy: 0.7898 Error: 0.57097 Loss: 0.65333 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.26s\n", + "1353920 Examples seen. Accuracy: 0.7936 Error: 0.48828 Loss: 0.49402 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "1354560 Examples seen. Accuracy: 0.7947 Error: 0.51336 Loss: 0.54540 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1355200 Examples seen. Accuracy: 0.7927 Error: 0.62883 Loss: 0.57372 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "1355840 Examples seen. Accuracy: 0.7930 Error: 0.43752 Loss: 0.45187 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.27s\n", + "1356480 Examples seen. Accuracy: 0.7933 Error: 0.39392 Loss: 0.41745 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.25s\n", + "1357120 Examples seen. Accuracy: 0.7932 Error: 0.47532 Loss: 0.45899 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1357760 Examples seen. Accuracy: 0.7921 Error: 0.53262 Loss: 0.53002 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "1358400 Examples seen. Accuracy: 0.7923 Error: 0.56730 Loss: 0.47916 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.30s\n", + "1359040 Examples seen. Accuracy: 0.7900 Error: 0.67767 Loss: 0.79810 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1359680 Examples seen. Accuracy: 0.7905 Error: 0.48715 Loss: 0.47946 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 34 Examples seen:1360000 Validation Accuracy: 0.8358 Validation Error: 0.4639 Validation Loss: 0.4947 Total time: 119.74min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.531 Min Weight: -0.584 Max Output: 4.877 Min Output: -5.516 TNNetConvolutionLinear 32,32,64 Times: 30.56s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.877 Min Output: -1.259 TNNetMaxPool 8,8,64 Times: 6.99s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.859 Min Weight: 0.813 Max Output: 4.941 Min Output: -2.604 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.287 Min Weight: -0.305 Max Output: 10.358 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.44s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.300 Min Weight: -0.293 Max Output: 10.262 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.27s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.281 Min Weight: -0.239 Max Output: 7.517 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.41s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.246 Min Weight: -0.215 Max Output: 3.048 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.42s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.048 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.04s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.048 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.42s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.347 Min Weight: -0.268 Max Output: 4.734 Min Output: -9.179 TNNetFullConnectLinear 10,1,1 Times: 0.10s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.596 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3219 minutes. 50 epochs: 1.9349 hours.\n", + "Epochs: 34. Working time: 2.00 hours.\n", + "1360640 Examples seen. Accuracy: 0.7904 Error: 0.66551 Loss: 0.77258 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.31s\n", + "1361280 Examples seen. Accuracy: 0.7893 Error: 0.60228 Loss: 0.67187 Threads: 2 Forward time: 0.75s Backward time: 0.40s Step time: 2.29s\n", + "1361920 Examples seen. Accuracy: 0.7885 Error: 0.47757 Loss: 0.51428 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.29s\n", + "1362560 Examples seen. Accuracy: 0.7899 Error: 0.64353 Loss: 0.73542 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1363200 Examples seen. Accuracy: 0.7938 Error: 0.42913 Loss: 0.53795 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "1363840 Examples seen. Accuracy: 0.7930 Error: 0.53567 Loss: 0.56472 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1364480 Examples seen. Accuracy: 0.7929 Error: 0.47312 Loss: 0.46882 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.27s\n", + "1365120 Examples seen. Accuracy: 0.7896 Error: 0.53248 Loss: 0.55358 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.33s\n", + "1365760 Examples seen. Accuracy: 0.7913 Error: 0.51667 Loss: 0.54214 Threads: 2 Forward time: 0.70s Backward time: 0.45s Step time: 2.30s\n", + "1366400 Examples seen. Accuracy: 0.7898 Error: 0.60868 Loss: 0.59832 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.33s\n", + "1367040 Examples seen. Accuracy: 0.7895 Error: 0.55792 Loss: 0.63774 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.35s\n", + "1367680 Examples seen. Accuracy: 0.7903 Error: 0.68655 Loss: 0.78163 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.33s\n", + "1368320 Examples seen. Accuracy: 0.7885 Error: 0.63714 Loss: 0.68270 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1368960 Examples seen. Accuracy: 0.7876 Error: 0.57575 Loss: 0.63247 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.32s\n", + "1369600 Examples seen. Accuracy: 0.7886 Error: 0.74258 Loss: 0.91724 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.30s\n", + "1370240 Examples seen. Accuracy: 0.7857 Error: 0.75369 Loss: 1.01436 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.35s\n", + "1370880 Examples seen. Accuracy: 0.7871 Error: 0.56847 Loss: 0.56136 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.37s\n", + "1371520 Examples seen. Accuracy: 0.7876 Error: 0.58679 Loss: 0.62115 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.31s\n", + "1372160 Examples seen. Accuracy: 0.7861 Error: 0.69325 Loss: 0.73734 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1372800 Examples seen. Accuracy: 0.7870 Error: 0.55757 Loss: 0.56305 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1373440 Examples seen. Accuracy: 0.7897 Error: 0.53923 Loss: 0.55133 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.32s\n", + "1374080 Examples seen. Accuracy: 0.7915 Error: 0.41593 Loss: 0.44189 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.27s\n", + "1374720 Examples seen. Accuracy: 0.7926 Error: 0.44439 Loss: 0.37935 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1375360 Examples seen. Accuracy: 0.7926 Error: 0.48982 Loss: 0.47245 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1376000 Examples seen. Accuracy: 0.7918 Error: 0.62969 Loss: 0.91535 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1376640 Examples seen. Accuracy: 0.7948 Error: 0.59784 Loss: 0.64116 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.28s\n", + "1377280 Examples seen. Accuracy: 0.7954 Error: 0.44505 Loss: 0.44538 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.39s\n", + "1377920 Examples seen. Accuracy: 0.7974 Error: 0.47687 Loss: 0.42464 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1378560 Examples seen. Accuracy: 0.7950 Error: 0.46202 Loss: 0.48478 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.29s\n", + "1379200 Examples seen. Accuracy: 0.7921 Error: 0.62656 Loss: 0.57290 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.28s\n", + "1379840 Examples seen. Accuracy: 0.7911 Error: 0.52512 Loss: 0.43350 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1380480 Examples seen. Accuracy: 0.7949 Error: 0.45741 Loss: 0.49912 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.27s\n", + "1381120 Examples seen. Accuracy: 0.7921 Error: 0.53146 Loss: 0.51007 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1381760 Examples seen. Accuracy: 0.7928 Error: 0.52270 Loss: 0.56671 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.37s\n", + "1382400 Examples seen. Accuracy: 0.7944 Error: 0.58356 Loss: 0.57412 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1383040 Examples seen. Accuracy: 0.7940 Error: 0.74110 Loss: 0.82604 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1383680 Examples seen. Accuracy: 0.7940 Error: 0.67915 Loss: 0.80165 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1384320 Examples seen. Accuracy: 0.7960 Error: 0.55723 Loss: 0.58448 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.29s\n", + "1384960 Examples seen. Accuracy: 0.7951 Error: 0.49551 Loss: 0.46810 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1385600 Examples seen. Accuracy: 0.7968 Error: 0.62934 Loss: 0.89585 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.29s\n", + "1386240 Examples seen. Accuracy: 0.7942 Error: 0.61803 Loss: 0.55267 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.44s\n", + "1386880 Examples seen. Accuracy: 0.7925 Error: 0.40230 Loss: 0.39612 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.33s\n", + "1387520 Examples seen. Accuracy: 0.7933 Error: 0.60803 Loss: 0.75251 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.32s\n", + "1388160 Examples seen. Accuracy: 0.7930 Error: 0.69201 Loss: 0.77757 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.26s\n", + "1388800 Examples seen. Accuracy: 0.7913 Error: 0.63678 Loss: 0.72920 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1389440 Examples seen. Accuracy: 0.7923 Error: 0.36882 Loss: 0.28884 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1390080 Examples seen. Accuracy: 0.7945 Error: 0.48729 Loss: 0.46907 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1390720 Examples seen. Accuracy: 0.7958 Error: 0.42891 Loss: 0.45197 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.27s\n", + "1391360 Examples seen. Accuracy: 0.7944 Error: 0.41582 Loss: 0.33006 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "1392000 Examples seen. Accuracy: 0.7927 Error: 0.53415 Loss: 0.51557 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.25s\n", + "1392640 Examples seen. Accuracy: 0.7920 Error: 0.58877 Loss: 0.60200 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1393280 Examples seen. Accuracy: 0.7918 Error: 0.50087 Loss: 0.51002 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1393920 Examples seen. Accuracy: 0.7913 Error: 0.59471 Loss: 0.60634 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1394560 Examples seen. Accuracy: 0.7919 Error: 0.62774 Loss: 0.73920 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "1395200 Examples seen. Accuracy: 0.7892 Error: 0.49100 Loss: 0.46820 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.29s\n", + "1395840 Examples seen. Accuracy: 0.7896 Error: 0.67802 Loss: 0.67544 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.28s\n", + "1396480 Examples seen. Accuracy: 0.7885 Error: 0.56594 Loss: 0.58914 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1397120 Examples seen. Accuracy: 0.7841 Error: 0.70194 Loss: 0.67783 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1397760 Examples seen. Accuracy: 0.7861 Error: 0.54178 Loss: 0.52979 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.27s\n", + "1398400 Examples seen. Accuracy: 0.7854 Error: 0.47421 Loss: 0.47343 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1399040 Examples seen. Accuracy: 0.7868 Error: 0.53248 Loss: 0.52474 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.29s\n", + "1399680 Examples seen. Accuracy: 0.7859 Error: 0.53881 Loss: 0.53190 Threads: 2 Forward time: 0.72s Backward time: 0.45s Step time: 2.33s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 35 Examples seen:1400000 Validation Accuracy: 0.8376 Validation Error: 0.4603 Validation Loss: 0.4909 Total time: 123.20min\n", + "Epoch time: 2.4302 minutes. 50 epochs: 2.0252 hours.\n", + "Epochs: 35. Working time: 2.05 hours.\n", + "1400640 Examples seen. Accuracy: 0.7871 Error: 0.37644 Loss: 0.33547 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1401280 Examples seen. Accuracy: 0.7890 Error: 0.49524 Loss: 0.45575 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.26s\n", + "1401920 Examples seen. Accuracy: 0.7863 Error: 0.53770 Loss: 0.55959 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1402560 Examples seen. Accuracy: 0.7884 Error: 0.38910 Loss: 0.38086 Threads: 2 Forward time: 0.73s Backward time: 0.41s Step time: 2.30s\n", + "1403200 Examples seen. Accuracy: 0.7862 Error: 0.55090 Loss: 0.52832 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1403840 Examples seen. Accuracy: 0.7871 Error: 0.46407 Loss: 0.54209 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.32s\n", + "1404480 Examples seen. Accuracy: 0.7879 Error: 0.60326 Loss: 0.55161 Threads: 2 Forward time: 0.71s Backward time: 0.46s Step time: 2.46s\n", + "1405120 Examples seen. Accuracy: 0.7883 Error: 0.61148 Loss: 0.64802 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.31s\n", + "1405760 Examples seen. Accuracy: 0.7879 Error: 0.37844 Loss: 0.40931 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "1406400 Examples seen. Accuracy: 0.7911 Error: 0.42469 Loss: 0.38576 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1407040 Examples seen. Accuracy: 0.7854 Error: 0.54161 Loss: 0.48758 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1407680 Examples seen. Accuracy: 0.7879 Error: 0.51393 Loss: 0.61240 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1408320 Examples seen. Accuracy: 0.7884 Error: 0.64943 Loss: 0.67040 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1408960 Examples seen. Accuracy: 0.7899 Error: 0.63990 Loss: 0.70231 Threads: 2 Forward time: 0.73s Backward time: 0.44s Step time: 2.39s\n", + "1409600 Examples seen. Accuracy: 0.7917 Error: 0.51016 Loss: 0.55920 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.34s\n", + "1410240 Examples seen. Accuracy: 0.7934 Error: 0.58073 Loss: 0.71511 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1410880 Examples seen. Accuracy: 0.7925 Error: 0.62490 Loss: 0.66567 Threads: 2 Forward time: 0.73s Backward time: 0.50s Step time: 2.41s\n", + "1411520 Examples seen. Accuracy: 0.7940 Error: 0.43440 Loss: 0.48871 Threads: 2 Forward time: 0.74s Backward time: 0.40s Step time: 2.36s\n", + "1412160 Examples seen. Accuracy: 0.7920 Error: 0.65292 Loss: 0.64483 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1412800 Examples seen. Accuracy: 0.7921 Error: 0.52433 Loss: 0.49698 Threads: 2 Forward time: 0.75s Backward time: 0.45s Step time: 2.43s\n", + "1413440 Examples seen. Accuracy: 0.7919 Error: 0.58720 Loss: 0.57653 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.31s\n", + "1414080 Examples seen. Accuracy: 0.7929 Error: 0.59628 Loss: 0.55744 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "1414720 Examples seen. Accuracy: 0.7929 Error: 0.58368 Loss: 0.55869 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.26s\n", + "1415360 Examples seen. Accuracy: 0.7948 Error: 0.50377 Loss: 0.42479 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "1416000 Examples seen. Accuracy: 0.7955 Error: 0.50471 Loss: 0.58178 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.27s\n", + "1416640 Examples seen. Accuracy: 0.7946 Error: 0.60126 Loss: 0.67530 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.32s\n", + "1417280 Examples seen. Accuracy: 0.7974 Error: 0.55261 Loss: 0.53645 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1417920 Examples seen. Accuracy: 0.7964 Error: 0.53559 Loss: 0.56596 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.35s\n", + "1418560 Examples seen. Accuracy: 0.7969 Error: 0.44782 Loss: 0.44811 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.34s\n", + "1419200 Examples seen. Accuracy: 0.7970 Error: 0.52728 Loss: 0.43709 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "1419840 Examples seen. Accuracy: 0.7973 Error: 0.55616 Loss: 0.65602 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.40s\n", + "1420480 Examples seen. Accuracy: 0.7956 Error: 0.58492 Loss: 0.71418 Threads: 2 Forward time: 0.75s Backward time: 0.41s Step time: 2.34s\n", + "1421120 Examples seen. Accuracy: 0.7954 Error: 0.63406 Loss: 0.69189 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.29s\n", + "1421760 Examples seen. Accuracy: 0.7964 Error: 0.54953 Loss: 0.57893 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1422400 Examples seen. Accuracy: 0.7968 Error: 0.53412 Loss: 0.66629 Threads: 2 Forward time: 0.70s Backward time: 0.37s Step time: 2.26s\n", + "1423040 Examples seen. Accuracy: 0.7970 Error: 0.65509 Loss: 0.63397 Threads: 2 Forward time: 0.73s Backward time: 0.38s Step time: 2.26s\n", + "1423680 Examples seen. Accuracy: 0.7960 Error: 0.70441 Loss: 0.73984 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1424320 Examples seen. Accuracy: 0.7966 Error: 0.62869 Loss: 0.59629 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.23s\n", + "1424960 Examples seen. Accuracy: 0.7958 Error: 0.55503 Loss: 0.57796 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.25s\n", + "1425600 Examples seen. Accuracy: 0.7982 Error: 0.46773 Loss: 0.44526 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1426240 Examples seen. Accuracy: 0.7983 Error: 0.53743 Loss: 0.59502 Threads: 2 Forward time: 0.74s Backward time: 0.41s Step time: 2.28s\n", + "1426880 Examples seen. Accuracy: 0.7995 Error: 0.52315 Loss: 0.64188 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.29s\n", + "1427520 Examples seen. Accuracy: 0.8011 Error: 0.59131 Loss: 0.59088 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.39s\n", + "1428160 Examples seen. Accuracy: 0.7991 Error: 0.41332 Loss: 0.39919 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.31s\n", + "1428800 Examples seen. Accuracy: 0.7987 Error: 0.51351 Loss: 0.57141 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1429440 Examples seen. Accuracy: 0.7975 Error: 0.57176 Loss: 0.76234 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.26s\n", + "1430080 Examples seen. Accuracy: 0.7966 Error: 0.54578 Loss: 0.53978 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1430720 Examples seen. Accuracy: 0.7971 Error: 0.59388 Loss: 0.70533 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1431360 Examples seen. Accuracy: 0.7976 Error: 0.48014 Loss: 0.44289 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1432000 Examples seen. Accuracy: 0.7974 Error: 0.42022 Loss: 0.37017 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.27s\n", + "1432640 Examples seen. Accuracy: 0.7971 Error: 0.44046 Loss: 0.39711 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1433280 Examples seen. Accuracy: 0.7944 Error: 0.70855 Loss: 0.81025 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.26s\n", + "1433920 Examples seen. Accuracy: 0.7954 Error: 0.55763 Loss: 0.58168 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1434560 Examples seen. Accuracy: 0.7952 Error: 0.49613 Loss: 0.47579 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1435200 Examples seen. Accuracy: 0.7937 Error: 0.58339 Loss: 0.58682 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "1435840 Examples seen. Accuracy: 0.7919 Error: 0.57869 Loss: 0.59606 Threads: 2 Forward time: 0.76s Backward time: 0.41s Step time: 2.31s\n", + "1436480 Examples seen. Accuracy: 0.7929 Error: 0.37381 Loss: 0.34753 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1437120 Examples seen. Accuracy: 0.7932 Error: 0.49441 Loss: 0.52788 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1437760 Examples seen. Accuracy: 0.7940 Error: 0.48157 Loss: 0.39509 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1438400 Examples seen. Accuracy: 0.7939 Error: 0.48748 Loss: 0.49990 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1439040 Examples seen. Accuracy: 0.7972 Error: 0.50280 Loss: 0.39764 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1439680 Examples seen. Accuracy: 0.7945 Error: 0.71343 Loss: 0.84558 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.27s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 36 Examples seen:1440000 Validation Accuracy: 0.8388 Validation Error: 0.4580 Validation Loss: 0.4900 Total time: 126.64min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.541 Min Weight: -0.592 Max Output: 4.994 Min Output: -5.543 TNNetConvolutionLinear 32,32,64 Times: 30.23s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.994 Min Output: -1.173 TNNetMaxPool 8,8,64 Times: 7.00s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.871 Min Weight: 0.826 Max Output: 4.990 Min Output: -2.474 TNNetMovingStdNormalization 8,8,64 Times: 0.16s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.287 Min Weight: -0.317 Max Output: 10.400 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.27s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.309 Min Weight: -0.301 Max Output: 10.716 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.21s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.284 Min Weight: -0.241 Max Output: 7.928 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.32s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.241 Min Weight: -0.215 Max Output: 3.236 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.33s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.236 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.236 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.37s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.346 Min Weight: -0.267 Max Output: 5.029 Min Output: -10.083 TNNetFullConnectLinear 10,1,1 Times: 0.12s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.582 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3635 minutes. 50 epochs: 1.9696 hours.\n", + "Epochs: 36. Working time: 2.11 hours.\n", + "1440640 Examples seen. Accuracy: 0.7952 Error: 0.48482 Loss: 0.42991 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.29s\n", + "1441280 Examples seen. Accuracy: 0.7974 Error: 0.67418 Loss: 0.67974 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "1441920 Examples seen. Accuracy: 0.7988 Error: 0.66769 Loss: 0.87548 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "1442560 Examples seen. Accuracy: 0.7974 Error: 0.50733 Loss: 0.49361 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1443200 Examples seen. Accuracy: 0.7965 Error: 0.57954 Loss: 0.55871 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1443840 Examples seen. Accuracy: 0.7961 Error: 0.59387 Loss: 0.67577 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1444480 Examples seen. Accuracy: 0.7965 Error: 0.54834 Loss: 0.51276 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1445120 Examples seen. Accuracy: 0.7955 Error: 0.57495 Loss: 0.54622 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "1445760 Examples seen. Accuracy: 0.7956 Error: 0.57268 Loss: 0.68491 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.29s\n", + "1446400 Examples seen. Accuracy: 0.7956 Error: 0.58457 Loss: 0.57786 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1447040 Examples seen. Accuracy: 0.7944 Error: 0.60213 Loss: 0.74947 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1447680 Examples seen. Accuracy: 0.7976 Error: 0.52798 Loss: 0.55201 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "1448320 Examples seen. Accuracy: 0.7956 Error: 0.58146 Loss: 0.60742 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.29s\n", + "1448960 Examples seen. Accuracy: 0.7945 Error: 0.62271 Loss: 0.64394 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1449600 Examples seen. Accuracy: 0.7932 Error: 0.48969 Loss: 0.64876 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1450240 Examples seen. Accuracy: 0.7898 Error: 0.46913 Loss: 0.50004 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1450880 Examples seen. Accuracy: 0.7896 Error: 0.61804 Loss: 0.71222 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1451520 Examples seen. Accuracy: 0.7906 Error: 0.65456 Loss: 0.70613 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.32s\n", + "1452160 Examples seen. Accuracy: 0.7901 Error: 0.65538 Loss: 0.65123 Threads: 2 Forward time: 0.89s Backward time: 0.59s Step time: 2.64s\n", + "1452800 Examples seen. Accuracy: 0.7934 Error: 0.54640 Loss: 0.68874 Threads: 2 Forward time: 0.74s Backward time: 0.45s Step time: 2.64s\n", + "1453440 Examples seen. Accuracy: 0.7934 Error: 0.68985 Loss: 0.84280 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.43s\n", + "1454080 Examples seen. Accuracy: 0.7917 Error: 0.46903 Loss: 0.42788 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.30s\n", + "1454720 Examples seen. Accuracy: 0.7950 Error: 0.50513 Loss: 0.49651 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1455360 Examples seen. Accuracy: 0.7969 Error: 0.44944 Loss: 0.49679 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1456000 Examples seen. Accuracy: 0.7944 Error: 0.64455 Loss: 0.58242 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1456640 Examples seen. Accuracy: 0.7930 Error: 0.54146 Loss: 0.50384 Threads: 2 Forward time: 0.85s Backward time: 0.54s Step time: 2.35s\n", + "1457280 Examples seen. Accuracy: 0.7899 Error: 0.79088 Loss: 0.99216 Threads: 2 Forward time: 0.74s Backward time: 0.44s Step time: 2.78s\n", + "1457920 Examples seen. Accuracy: 0.7920 Error: 0.60145 Loss: 0.66871 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1458560 Examples seen. Accuracy: 0.7927 Error: 0.53262 Loss: 0.50378 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "1459200 Examples seen. Accuracy: 0.7950 Error: 0.58732 Loss: 0.75836 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1459840 Examples seen. Accuracy: 0.7958 Error: 0.52407 Loss: 0.49234 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.27s\n", + "1460480 Examples seen. Accuracy: 0.7943 Error: 0.72053 Loss: 0.87277 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1461120 Examples seen. Accuracy: 0.7940 Error: 0.48818 Loss: 0.45383 Threads: 2 Forward time: 0.77s Backward time: 0.42s Step time: 2.33s\n", + "1461760 Examples seen. Accuracy: 0.7923 Error: 0.53458 Loss: 0.54493 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "1462400 Examples seen. Accuracy: 0.7919 Error: 0.61114 Loss: 0.70675 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "1463040 Examples seen. Accuracy: 0.7926 Error: 0.47122 Loss: 0.48614 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1463680 Examples seen. Accuracy: 0.7914 Error: 0.45540 Loss: 0.38718 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.26s\n", + "1464320 Examples seen. Accuracy: 0.7904 Error: 0.59693 Loss: 0.85783 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1464960 Examples seen. Accuracy: 0.7929 Error: 0.45974 Loss: 0.53702 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1465600 Examples seen. Accuracy: 0.7940 Error: 0.54415 Loss: 0.59026 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1466240 Examples seen. Accuracy: 0.7946 Error: 0.63333 Loss: 0.78580 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1466880 Examples seen. Accuracy: 0.7955 Error: 0.58113 Loss: 0.61179 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.28s\n", + "1467520 Examples seen. Accuracy: 0.7961 Error: 0.64805 Loss: 0.65126 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1468160 Examples seen. Accuracy: 0.7967 Error: 0.53687 Loss: 0.55177 Threads: 2 Forward time: 0.71s Backward time: 0.38s Step time: 2.27s\n", + "1468800 Examples seen. Accuracy: 0.7973 Error: 0.48581 Loss: 0.47481 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1469440 Examples seen. Accuracy: 0.7950 Error: 0.61200 Loss: 0.70640 Threads: 2 Forward time: 0.71s Backward time: 0.45s Step time: 2.28s\n", + "1470080 Examples seen. Accuracy: 0.7955 Error: 0.48118 Loss: 0.56702 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.43s\n", + "1470720 Examples seen. Accuracy: 0.7969 Error: 0.41658 Loss: 0.39986 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.26s\n", + "1471360 Examples seen. Accuracy: 0.7975 Error: 0.46686 Loss: 0.47597 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1472000 Examples seen. Accuracy: 0.7963 Error: 0.56651 Loss: 0.69081 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.25s\n", + "1472640 Examples seen. Accuracy: 0.7945 Error: 0.50877 Loss: 0.49074 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1473280 Examples seen. Accuracy: 0.7935 Error: 0.58653 Loss: 0.54966 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.23s\n", + "1473920 Examples seen. Accuracy: 0.7962 Error: 0.51447 Loss: 0.62124 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "1474560 Examples seen. Accuracy: 0.7948 Error: 0.56459 Loss: 0.66240 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.30s\n", + "1475200 Examples seen. Accuracy: 0.7936 Error: 0.63402 Loss: 0.61693 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.28s\n", + "1475840 Examples seen. Accuracy: 0.7927 Error: 0.62608 Loss: 0.66371 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1476480 Examples seen. Accuracy: 0.7924 Error: 0.56012 Loss: 0.49800 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1477120 Examples seen. Accuracy: 0.7909 Error: 0.51056 Loss: 0.47419 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.33s\n", + "1477760 Examples seen. Accuracy: 0.7913 Error: 0.51500 Loss: 0.50281 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1478400 Examples seen. Accuracy: 0.7897 Error: 0.46979 Loss: 0.46062 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.26s\n", + "1479040 Examples seen. Accuracy: 0.7902 Error: 0.69819 Loss: 0.76152 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "1479680 Examples seen. Accuracy: 0.7904 Error: 0.55448 Loss: 0.53793 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "Starting Validation.\n", + "Epochs: 37 Examples seen:1480000 Validation Accuracy: 0.8380 Validation Error: 0.4552 Validation Loss: 0.4877 Total time: 130.08min\n", + "Epoch time: 2.3458 minutes. 50 epochs: 1.9549 hours.\n", + "Epochs: 37. Working time: 2.17 hours.\n", + "1480640 Examples seen. Accuracy: 0.7866 Error: 0.75347 Loss: 0.85586 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1481280 Examples seen. Accuracy: 0.7886 Error: 0.60225 Loss: 0.76428 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1481920 Examples seen. Accuracy: 0.7882 Error: 0.48668 Loss: 0.58719 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1482560 Examples seen. Accuracy: 0.7874 Error: 0.52782 Loss: 0.48245 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.22s\n", + "1483200 Examples seen. Accuracy: 0.7890 Error: 0.58961 Loss: 0.64006 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1483840 Examples seen. Accuracy: 0.7863 Error: 0.53571 Loss: 0.54080 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1484480 Examples seen. Accuracy: 0.7897 Error: 0.38843 Loss: 0.41312 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1485120 Examples seen. Accuracy: 0.7890 Error: 0.66746 Loss: 0.81835 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1485760 Examples seen. Accuracy: 0.7903 Error: 0.50619 Loss: 0.51885 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.26s\n", + "1486400 Examples seen. Accuracy: 0.7919 Error: 0.52483 Loss: 0.48389 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1487040 Examples seen. Accuracy: 0.7918 Error: 0.51182 Loss: 0.46692 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1487680 Examples seen. Accuracy: 0.7911 Error: 0.52891 Loss: 0.60808 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.23s\n", + "1488320 Examples seen. Accuracy: 0.7905 Error: 0.47468 Loss: 0.44027 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1488960 Examples seen. Accuracy: 0.7916 Error: 0.52007 Loss: 0.48119 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.42s\n", + "1489600 Examples seen. Accuracy: 0.7913 Error: 0.59431 Loss: 0.66019 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1490240 Examples seen. Accuracy: 0.7928 Error: 0.28465 Loss: 0.20264 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1490880 Examples seen. Accuracy: 0.7939 Error: 0.55236 Loss: 0.61460 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1491520 Examples seen. Accuracy: 0.7974 Error: 0.56037 Loss: 0.60860 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.23s\n", + "1492160 Examples seen. Accuracy: 0.7966 Error: 0.60995 Loss: 0.60463 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1492800 Examples seen. Accuracy: 0.7942 Error: 0.46108 Loss: 0.39231 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "1493440 Examples seen. Accuracy: 0.7929 Error: 0.58913 Loss: 0.53430 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.29s\n", + "1494080 Examples seen. Accuracy: 0.7897 Error: 0.62714 Loss: 0.68551 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "1494720 Examples seen. Accuracy: 0.7907 Error: 0.47702 Loss: 0.45045 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.26s\n", + "1495360 Examples seen. Accuracy: 0.7905 Error: 0.51511 Loss: 0.47296 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1496000 Examples seen. Accuracy: 0.7906 Error: 0.55911 Loss: 0.58831 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1496640 Examples seen. Accuracy: 0.7925 Error: 0.45635 Loss: 0.44314 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.30s\n", + "1497280 Examples seen. Accuracy: 0.7932 Error: 0.55970 Loss: 0.62575 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.31s\n", + "1497920 Examples seen. Accuracy: 0.7934 Error: 0.58497 Loss: 0.60486 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "1498560 Examples seen. Accuracy: 0.7910 Error: 0.58976 Loss: 0.63906 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1499200 Examples seen. Accuracy: 0.7908 Error: 0.71239 Loss: 0.91936 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.25s\n", + "1499840 Examples seen. Accuracy: 0.7906 Error: 0.62715 Loss: 0.66625 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1500480 Examples seen. Accuracy: 0.7894 Error: 0.75906 Loss: 0.78093 Threads: 2 Forward time: 0.73s Backward time: 0.41s Step time: 2.25s\n", + "1501120 Examples seen. Accuracy: 0.7919 Error: 0.50715 Loss: 0.51536 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1501760 Examples seen. Accuracy: 0.7923 Error: 0.53881 Loss: 0.60699 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.27s\n", + "1502400 Examples seen. Accuracy: 0.7930 Error: 0.43168 Loss: 0.45120 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1503040 Examples seen. Accuracy: 0.7954 Error: 0.55112 Loss: 0.50520 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1503680 Examples seen. Accuracy: 0.7949 Error: 0.64072 Loss: 0.69666 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.27s\n", + "1504320 Examples seen. Accuracy: 0.7916 Error: 0.63412 Loss: 0.73455 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1504960 Examples seen. Accuracy: 0.7906 Error: 0.59459 Loss: 0.65094 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1505600 Examples seen. Accuracy: 0.7917 Error: 0.48038 Loss: 0.43522 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "1506240 Examples seen. Accuracy: 0.7914 Error: 0.50443 Loss: 0.49689 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1506880 Examples seen. Accuracy: 0.7934 Error: 0.51415 Loss: 0.49254 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.29s\n", + "1507520 Examples seen. Accuracy: 0.7931 Error: 0.42593 Loss: 0.48589 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.30s\n", + "1508160 Examples seen. Accuracy: 0.7932 Error: 0.47379 Loss: 0.39951 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.26s\n", + "1508800 Examples seen. Accuracy: 0.7930 Error: 0.51432 Loss: 0.52523 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.33s\n", + "1509440 Examples seen. Accuracy: 0.7939 Error: 0.55133 Loss: 0.44992 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1510080 Examples seen. Accuracy: 0.7927 Error: 0.64993 Loss: 0.75052 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.28s\n", + "1510720 Examples seen. Accuracy: 0.7923 Error: 0.52962 Loss: 0.45140 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1511360 Examples seen. Accuracy: 0.7939 Error: 0.49794 Loss: 0.64944 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1512000 Examples seen. Accuracy: 0.7955 Error: 0.48969 Loss: 0.48337 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.25s\n", + "1512640 Examples seen. Accuracy: 0.7944 Error: 0.50908 Loss: 0.45286 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.27s\n", + "1513280 Examples seen. Accuracy: 0.7983 Error: 0.35618 Loss: 0.37822 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.33s\n", + "1513920 Examples seen. Accuracy: 0.7970 Error: 0.63261 Loss: 0.77343 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1514560 Examples seen. Accuracy: 0.7955 Error: 0.66367 Loss: 0.81705 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1515200 Examples seen. Accuracy: 0.7943 Error: 0.55908 Loss: 0.60761 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1515840 Examples seen. Accuracy: 0.7921 Error: 0.69640 Loss: 0.78736 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1516480 Examples seen. Accuracy: 0.7918 Error: 0.60858 Loss: 0.70102 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1517120 Examples seen. Accuracy: 0.7934 Error: 0.77586 Loss: 0.81878 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "1517760 Examples seen. Accuracy: 0.7935 Error: 0.51998 Loss: 0.48167 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.27s\n", + "1518400 Examples seen. Accuracy: 0.7936 Error: 0.60375 Loss: 0.79310 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "1519040 Examples seen. Accuracy: 0.7926 Error: 0.62412 Loss: 0.63009 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1519680 Examples seen. Accuracy: 0.7929 Error: 0.53028 Loss: 0.54054 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.25s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 38 Examples seen:1520000 Validation Accuracy: 0.8393 Validation Error: 0.4531 Validation Loss: 0.4848 Total time: 133.49min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.553 Min Weight: -0.601 Max Output: 5.046 Min Output: -5.599 TNNetConvolutionLinear 32,32,64 Times: 30.14s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.046 Min Output: -1.176 TNNetMaxPool 8,8,64 Times: 6.96s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.881 Min Weight: 0.838 Max Output: 4.969 Min Output: -2.454 TNNetMovingStdNormalization 8,8,64 Times: 0.12s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.284 Min Weight: -0.327 Max Output: 10.310 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.23s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.322 Min Weight: -0.306 Max Output: 10.485 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.10s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.286 Min Weight: -0.243 Max Output: 7.926 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.25s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.230 Min Weight: -0.216 Max Output: 3.227 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.18s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.227 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.227 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.42s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.339 Min Weight: -0.268 Max Output: 5.057 Min Output: -10.213 TNNetFullConnectLinear 10,1,1 Times: 0.13s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.566 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3406 minutes. 50 epochs: 1.9505 hours.\n", + "Epochs: 38. Working time: 2.22 hours.\n", + "1520640 Examples seen. Accuracy: 0.7928 Error: 0.67371 Loss: 0.73775 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1521280 Examples seen. Accuracy: 0.7945 Error: 0.58567 Loss: 0.77671 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1521920 Examples seen. Accuracy: 0.7960 Error: 0.46430 Loss: 0.41841 Threads: 2 Forward time: 0.74s Backward time: 0.41s Step time: 2.26s\n", + "1522560 Examples seen. Accuracy: 0.7958 Error: 0.55571 Loss: 0.58948 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1523200 Examples seen. Accuracy: 0.7980 Error: 0.44864 Loss: 0.43539 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1523840 Examples seen. Accuracy: 0.7966 Error: 0.69253 Loss: 0.85449 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1524480 Examples seen. Accuracy: 0.7939 Error: 0.44124 Loss: 0.43668 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.29s\n", + "1525120 Examples seen. Accuracy: 0.7961 Error: 0.62615 Loss: 0.66965 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1525760 Examples seen. Accuracy: 0.7952 Error: 0.54026 Loss: 0.54328 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "1526400 Examples seen. Accuracy: 0.7951 Error: 0.49684 Loss: 0.67531 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1527040 Examples seen. Accuracy: 0.7930 Error: 0.68212 Loss: 0.72117 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1527680 Examples seen. Accuracy: 0.7940 Error: 0.58617 Loss: 0.61499 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.22s\n", + "1528320 Examples seen. Accuracy: 0.7944 Error: 0.56039 Loss: 0.52445 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1528960 Examples seen. Accuracy: 0.7960 Error: 0.49814 Loss: 0.49748 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1529600 Examples seen. Accuracy: 0.7962 Error: 0.56546 Loss: 0.57337 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1530240 Examples seen. Accuracy: 0.7960 Error: 0.55079 Loss: 0.55246 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "1530880 Examples seen. Accuracy: 0.7953 Error: 0.54197 Loss: 0.65231 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1531520 Examples seen. Accuracy: 0.7964 Error: 0.47446 Loss: 0.46548 Threads: 2 Forward time: 0.75s Backward time: 0.38s Step time: 2.22s\n", + "1532160 Examples seen. Accuracy: 0.7978 Error: 0.46482 Loss: 0.49894 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "1532800 Examples seen. Accuracy: 0.7991 Error: 0.53313 Loss: 0.51641 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1533440 Examples seen. Accuracy: 0.7986 Error: 0.39118 Loss: 0.34654 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.26s\n", + "1534080 Examples seen. Accuracy: 0.7995 Error: 0.46553 Loss: 0.41049 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1534720 Examples seen. Accuracy: 0.7979 Error: 0.49474 Loss: 0.53166 Threads: 2 Forward time: 0.74s Backward time: 0.39s Step time: 2.22s\n", + "1535360 Examples seen. Accuracy: 0.7967 Error: 0.61258 Loss: 0.70624 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "1536000 Examples seen. Accuracy: 0.7966 Error: 0.45353 Loss: 0.43459 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1536640 Examples seen. Accuracy: 0.7966 Error: 0.61230 Loss: 0.63005 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.18s\n", + "1537280 Examples seen. Accuracy: 0.7960 Error: 0.59669 Loss: 0.68752 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.20s\n", + "1537920 Examples seen. Accuracy: 0.7945 Error: 0.69669 Loss: 0.89655 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.27s\n", + "1538560 Examples seen. Accuracy: 0.7945 Error: 0.62914 Loss: 0.74424 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1539200 Examples seen. Accuracy: 0.7960 Error: 0.67901 Loss: 0.73963 Threads: 2 Forward time: 0.65s Backward time: 0.38s Step time: 2.20s\n", + "1539840 Examples seen. Accuracy: 0.7953 Error: 0.64537 Loss: 0.68970 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.17s\n", + "1540480 Examples seen. Accuracy: 0.7921 Error: 0.62359 Loss: 0.58386 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.18s\n", + "1541120 Examples seen. Accuracy: 0.7956 Error: 0.54447 Loss: 0.57641 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.19s\n", + "1541760 Examples seen. Accuracy: 0.7927 Error: 0.52883 Loss: 0.59555 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.17s\n", + "1542400 Examples seen. Accuracy: 0.7937 Error: 0.63052 Loss: 0.72026 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.17s\n", + "1543040 Examples seen. Accuracy: 0.7956 Error: 0.57521 Loss: 0.52067 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.17s\n", + "1543680 Examples seen. Accuracy: 0.7970 Error: 0.56016 Loss: 0.62935 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.20s\n", + "1544320 Examples seen. Accuracy: 0.7966 Error: 0.59682 Loss: 0.68506 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.18s\n", + "1544960 Examples seen. Accuracy: 0.7969 Error: 0.54919 Loss: 0.61232 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.19s\n", + "1545600 Examples seen. Accuracy: 0.7945 Error: 0.64745 Loss: 0.59091 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.17s\n", + "1546240 Examples seen. Accuracy: 0.7937 Error: 0.65913 Loss: 0.67844 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1546880 Examples seen. Accuracy: 0.7945 Error: 0.58297 Loss: 0.51839 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.20s\n", + "1547520 Examples seen. Accuracy: 0.7929 Error: 0.50542 Loss: 0.53786 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1548160 Examples seen. Accuracy: 0.7930 Error: 0.48890 Loss: 0.48153 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1548800 Examples seen. Accuracy: 0.7931 Error: 0.76413 Loss: 1.04752 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1549440 Examples seen. Accuracy: 0.7932 Error: 0.57961 Loss: 0.51512 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.18s\n", + "1550080 Examples seen. Accuracy: 0.7944 Error: 0.56650 Loss: 0.61709 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "1550720 Examples seen. Accuracy: 0.7924 Error: 0.43724 Loss: 0.45568 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.21s\n", + "1551360 Examples seen. Accuracy: 0.7929 Error: 0.66484 Loss: 0.78937 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.19s\n", + "1552000 Examples seen. Accuracy: 0.7945 Error: 0.39434 Loss: 0.36745 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1552640 Examples seen. Accuracy: 0.7984 Error: 0.43273 Loss: 0.42010 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "1553280 Examples seen. Accuracy: 0.7982 Error: 0.43916 Loss: 0.45716 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1553920 Examples seen. Accuracy: 0.7999 Error: 0.47695 Loss: 0.46539 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1554560 Examples seen. Accuracy: 0.7990 Error: 0.56959 Loss: 0.57689 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.21s\n", + "1555200 Examples seen. Accuracy: 0.7985 Error: 0.54629 Loss: 0.61258 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.22s\n", + "1555840 Examples seen. Accuracy: 0.7960 Error: 0.61928 Loss: 0.64982 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.25s\n", + "1556480 Examples seen. Accuracy: 0.7977 Error: 0.43986 Loss: 0.37436 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "1557120 Examples seen. Accuracy: 0.7967 Error: 0.51264 Loss: 0.48064 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1557760 Examples seen. Accuracy: 0.7958 Error: 0.67360 Loss: 0.67860 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1558400 Examples seen. Accuracy: 0.7958 Error: 0.33803 Loss: 0.38657 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1559040 Examples seen. Accuracy: 0.7974 Error: 0.64673 Loss: 0.65750 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.23s\n", + "1559680 Examples seen. Accuracy: 0.7957 Error: 0.57897 Loss: 0.54775 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 39 Examples seen:1560000 Validation Accuracy: 0.8402 Validation Error: 0.4503 Validation Loss: 0.4830 Total time: 136.86min\n", + "Epoch time: 2.3375 minutes. 50 epochs: 1.9479 hours.\n", + "Epochs: 39. Working time: 2.28 hours.\n", + "1560640 Examples seen. Accuracy: 0.7956 Error: 0.67319 Loss: 0.71352 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1561280 Examples seen. Accuracy: 0.7974 Error: 0.59394 Loss: 0.60337 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.21s\n", + "1561920 Examples seen. Accuracy: 0.7958 Error: 0.56277 Loss: 0.59270 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "1562560 Examples seen. Accuracy: 0.7972 Error: 0.52349 Loss: 0.46410 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1563200 Examples seen. Accuracy: 0.7975 Error: 0.62872 Loss: 0.69287 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "1563840 Examples seen. Accuracy: 0.7969 Error: 0.45314 Loss: 0.44901 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.19s\n", + "1564480 Examples seen. Accuracy: 0.7966 Error: 0.53668 Loss: 0.56319 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1565120 Examples seen. Accuracy: 0.7969 Error: 0.44478 Loss: 0.48647 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.21s\n", + "1565760 Examples seen. Accuracy: 0.7952 Error: 0.68136 Loss: 0.73749 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.20s\n", + "1566400 Examples seen. Accuracy: 0.7977 Error: 0.45363 Loss: 0.46525 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.20s\n", + "1567040 Examples seen. Accuracy: 0.7968 Error: 0.52275 Loss: 0.56796 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1567680 Examples seen. Accuracy: 0.7972 Error: 0.63848 Loss: 0.64375 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "1568320 Examples seen. Accuracy: 0.7973 Error: 0.51971 Loss: 0.52722 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.28s\n", + "1568960 Examples seen. Accuracy: 0.7962 Error: 0.55969 Loss: 0.58277 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.33s\n", + "1569600 Examples seen. Accuracy: 0.7960 Error: 0.39806 Loss: 0.34391 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1570240 Examples seen. Accuracy: 0.7971 Error: 0.44104 Loss: 0.46381 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1570880 Examples seen. Accuracy: 0.7964 Error: 0.53720 Loss: 0.53367 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1571520 Examples seen. Accuracy: 0.7968 Error: 0.46902 Loss: 0.49824 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1572160 Examples seen. Accuracy: 0.7974 Error: 0.61437 Loss: 0.61245 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.24s\n", + "1572800 Examples seen. Accuracy: 0.7973 Error: 0.50445 Loss: 0.66929 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.22s\n", + "1573440 Examples seen. Accuracy: 0.7979 Error: 0.54081 Loss: 0.58838 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.24s\n", + "1574080 Examples seen. Accuracy: 0.7998 Error: 0.52119 Loss: 0.54364 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1574720 Examples seen. Accuracy: 0.7993 Error: 0.68056 Loss: 0.72650 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1575360 Examples seen. Accuracy: 0.8020 Error: 0.67658 Loss: 0.84009 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.21s\n", + "1576000 Examples seen. Accuracy: 0.8001 Error: 0.53027 Loss: 0.65733 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1576640 Examples seen. Accuracy: 0.7987 Error: 0.48740 Loss: 0.48594 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1577280 Examples seen. Accuracy: 0.7986 Error: 0.63780 Loss: 0.77002 Threads: 2 Forward time: 0.69s Backward time: 0.36s Step time: 2.21s\n", + "1577920 Examples seen. Accuracy: 0.8005 Error: 0.49400 Loss: 0.55565 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.23s\n", + "1578560 Examples seen. Accuracy: 0.8013 Error: 0.27200 Loss: 0.24422 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.27s\n", + "1579200 Examples seen. Accuracy: 0.8006 Error: 0.42185 Loss: 0.36324 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.26s\n", + "1579840 Examples seen. Accuracy: 0.8019 Error: 0.60743 Loss: 0.67113 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "1580480 Examples seen. Accuracy: 0.8036 Error: 0.56529 Loss: 0.57365 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "1581120 Examples seen. Accuracy: 0.8012 Error: 0.53265 Loss: 0.50840 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1581760 Examples seen. Accuracy: 0.7972 Error: 0.55155 Loss: 0.48065 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1582400 Examples seen. Accuracy: 0.7953 Error: 0.55018 Loss: 0.59121 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.20s\n", + "1583040 Examples seen. Accuracy: 0.7922 Error: 0.62562 Loss: 0.69526 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.19s\n", + "1583680 Examples seen. Accuracy: 0.7930 Error: 0.53142 Loss: 0.60024 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.18s\n", + "1584320 Examples seen. Accuracy: 0.7934 Error: 0.60520 Loss: 0.64160 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1584960 Examples seen. Accuracy: 0.7939 Error: 0.50419 Loss: 0.44670 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1585600 Examples seen. Accuracy: 0.7924 Error: 0.54176 Loss: 0.58719 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.18s\n", + "1586240 Examples seen. Accuracy: 0.7924 Error: 0.67986 Loss: 0.67489 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.23s\n", + "1586880 Examples seen. Accuracy: 0.7932 Error: 0.50081 Loss: 0.43717 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.26s\n", + "1587520 Examples seen. Accuracy: 0.7935 Error: 0.51638 Loss: 0.50033 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.20s\n", + "1588160 Examples seen. Accuracy: 0.7921 Error: 0.61687 Loss: 0.77926 Threads: 2 Forward time: 0.65s Backward time: 0.38s Step time: 2.19s\n", + "1588800 Examples seen. Accuracy: 0.7926 Error: 0.59606 Loss: 0.63630 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.18s\n", + "1589440 Examples seen. Accuracy: 0.7950 Error: 0.45943 Loss: 0.47913 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.19s\n", + "1590080 Examples seen. Accuracy: 0.7978 Error: 0.40967 Loss: 0.40802 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.25s\n", + "1590720 Examples seen. Accuracy: 0.7993 Error: 0.54311 Loss: 0.59325 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.22s\n", + "1591360 Examples seen. Accuracy: 0.7994 Error: 0.53366 Loss: 0.64489 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.21s\n", + "1592000 Examples seen. Accuracy: 0.7997 Error: 0.50211 Loss: 0.46843 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.25s\n", + "1592640 Examples seen. Accuracy: 0.7990 Error: 0.47866 Loss: 0.45590 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "1593280 Examples seen. Accuracy: 0.8021 Error: 0.56508 Loss: 0.55671 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1593920 Examples seen. Accuracy: 0.8025 Error: 0.40057 Loss: 0.44647 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.20s\n", + "1594560 Examples seen. Accuracy: 0.8028 Error: 0.50300 Loss: 0.49433 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.19s\n", + "1595200 Examples seen. Accuracy: 0.8031 Error: 0.49374 Loss: 0.66467 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.20s\n", + "1595840 Examples seen. Accuracy: 0.8013 Error: 0.48335 Loss: 0.45182 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.18s\n", + "1596480 Examples seen. Accuracy: 0.8029 Error: 0.39189 Loss: 0.37119 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1597120 Examples seen. Accuracy: 0.8049 Error: 0.49278 Loss: 0.60319 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "1597760 Examples seen. Accuracy: 0.8031 Error: 0.65186 Loss: 0.76126 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1598400 Examples seen. Accuracy: 0.8031 Error: 0.46324 Loss: 0.48786 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.22s\n", + "1599040 Examples seen. Accuracy: 0.8021 Error: 0.53607 Loss: 0.71111 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1599680 Examples seen. Accuracy: 0.8019 Error: 0.61702 Loss: 0.64379 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "Starting Validation.\n", + "Epochs: 40 Examples seen:1600000 Validation Accuracy: 0.8396 Validation Error: 0.4481 Validation Loss: 0.4818 Total time: 140.22min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.567 Min Weight: -0.607 Max Output: 5.094 Min Output: -5.738 TNNetConvolutionLinear 32,32,64 Times: 30.15s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.094 Min Output: -1.141 TNNetMaxPool 8,8,64 Times: 7.07s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.890 Min Weight: 0.849 Max Output: 4.950 Min Output: -2.392 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.283 Min Weight: -0.333 Max Output: 10.168 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.07s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.326 Min Weight: -0.308 Max Output: 10.651 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.10s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.297 Min Weight: -0.245 Max Output: 8.100 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.23s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.218 Min Weight: -0.217 Max Output: 3.339 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.339 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.339 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.35s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.332 Min Weight: -0.268 Max Output: 5.123 Min Output: -10.639 TNNetFullConnectLinear 10,1,1 Times: 0.11s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.534 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Starting Testing.\n", + "Epochs: 40 Examples seen:1600000 Test Accuracy: 0.8323 Test Error: 0.4618 Test Loss: 0.5066 Total time: 141.26min\n", + "Epoch time: 2.3302 minutes. 50 epochs: 1.9418 hours.\n", + "Epochs: 40. Working time: 2.35 hours.\n", + "Learning rate set to: 0.00067\n", + "1600640 Examples seen. Accuracy: 0.8032 Error: 0.54834 Loss: 0.49500 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1601280 Examples seen. Accuracy: 0.8021 Error: 0.54158 Loss: 0.49562 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.24s\n", + "1601920 Examples seen. Accuracy: 0.8003 Error: 0.44752 Loss: 0.57778 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.31s\n", + "1602560 Examples seen. Accuracy: 0.7964 Error: 0.73845 Loss: 0.82155 Threads: 2 Forward time: 0.75s Backward time: 0.39s Step time: 2.29s\n", + "1603200 Examples seen. Accuracy: 0.7968 Error: 0.58723 Loss: 0.69386 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1603840 Examples seen. Accuracy: 0.7964 Error: 0.49952 Loss: 0.49230 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1604480 Examples seen. Accuracy: 0.7955 Error: 0.51424 Loss: 0.54972 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.28s\n", + "1605120 Examples seen. Accuracy: 0.7996 Error: 0.38084 Loss: 0.29860 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.25s\n", + "1605760 Examples seen. Accuracy: 0.7965 Error: 0.68793 Loss: 0.86853 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1606400 Examples seen. Accuracy: 0.7969 Error: 0.43971 Loss: 0.37113 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "1607040 Examples seen. Accuracy: 0.7968 Error: 0.45064 Loss: 0.45471 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.26s\n", + "1607680 Examples seen. Accuracy: 0.7952 Error: 0.47009 Loss: 0.53871 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1608320 Examples seen. Accuracy: 0.7946 Error: 0.49971 Loss: 0.46376 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.22s\n", + "1608960 Examples seen. Accuracy: 0.7914 Error: 0.42825 Loss: 0.39693 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1609600 Examples seen. Accuracy: 0.7919 Error: 0.54167 Loss: 0.49592 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1610240 Examples seen. Accuracy: 0.7950 Error: 0.49673 Loss: 0.48542 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1610880 Examples seen. Accuracy: 0.7963 Error: 0.60696 Loss: 0.66714 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1611520 Examples seen. Accuracy: 0.7986 Error: 0.58903 Loss: 0.56854 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1612160 Examples seen. Accuracy: 0.7966 Error: 0.55794 Loss: 0.54392 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.24s\n", + "1612800 Examples seen. Accuracy: 0.7966 Error: 0.57761 Loss: 0.69745 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1613440 Examples seen. Accuracy: 0.7978 Error: 0.62315 Loss: 0.78748 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1614080 Examples seen. Accuracy: 0.7989 Error: 0.59880 Loss: 0.64713 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1614720 Examples seen. Accuracy: 0.7970 Error: 0.51647 Loss: 0.45160 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "1615360 Examples seen. Accuracy: 0.7964 Error: 0.59025 Loss: 0.59156 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "1616000 Examples seen. Accuracy: 0.7975 Error: 0.49351 Loss: 0.53102 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.21s\n", + "1616640 Examples seen. Accuracy: 0.7965 Error: 0.55126 Loss: 0.54281 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1617280 Examples seen. Accuracy: 0.7990 Error: 0.49378 Loss: 0.46101 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1617920 Examples seen. Accuracy: 0.7966 Error: 0.46944 Loss: 0.44067 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1618560 Examples seen. Accuracy: 0.7940 Error: 0.54247 Loss: 0.65517 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.29s\n", + "1619200 Examples seen. Accuracy: 0.7927 Error: 0.57825 Loss: 0.64135 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.34s\n", + "1619840 Examples seen. Accuracy: 0.7911 Error: 0.69701 Loss: 0.75156 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1620480 Examples seen. Accuracy: 0.7921 Error: 0.54611 Loss: 0.64435 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1621120 Examples seen. Accuracy: 0.7921 Error: 0.52289 Loss: 0.50301 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1621760 Examples seen. Accuracy: 0.7910 Error: 0.59768 Loss: 0.53358 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.26s\n", + "1622400 Examples seen. Accuracy: 0.7935 Error: 0.45171 Loss: 0.52506 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "1623040 Examples seen. Accuracy: 0.7933 Error: 0.50049 Loss: 0.56558 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1623680 Examples seen. Accuracy: 0.7970 Error: 0.53434 Loss: 0.56107 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1624320 Examples seen. Accuracy: 0.7976 Error: 0.59257 Loss: 0.82279 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.24s\n", + "1624960 Examples seen. Accuracy: 0.7990 Error: 0.49330 Loss: 0.45670 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "1625600 Examples seen. Accuracy: 0.8033 Error: 0.43791 Loss: 0.39391 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1626240 Examples seen. Accuracy: 0.8039 Error: 0.53872 Loss: 0.77483 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1626880 Examples seen. Accuracy: 0.8034 Error: 0.49363 Loss: 0.51382 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1627520 Examples seen. Accuracy: 0.8021 Error: 0.58264 Loss: 0.56444 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.26s\n", + "1628160 Examples seen. Accuracy: 0.7996 Error: 0.53911 Loss: 0.62169 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "1628800 Examples seen. Accuracy: 0.8003 Error: 0.52876 Loss: 0.52727 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1629440 Examples seen. Accuracy: 0.7985 Error: 0.57780 Loss: 0.64174 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.21s\n", + "1630080 Examples seen. Accuracy: 0.8006 Error: 0.52410 Loss: 0.53068 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1630720 Examples seen. Accuracy: 0.8015 Error: 0.47819 Loss: 0.45263 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1631360 Examples seen. Accuracy: 0.8017 Error: 0.48907 Loss: 0.49822 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1632000 Examples seen. Accuracy: 0.8022 Error: 0.54620 Loss: 0.61435 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1632640 Examples seen. Accuracy: 0.8001 Error: 0.52847 Loss: 0.53528 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "1633280 Examples seen. Accuracy: 0.8035 Error: 0.42415 Loss: 0.48922 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1633920 Examples seen. Accuracy: 0.8019 Error: 0.69627 Loss: 0.83207 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1634560 Examples seen. Accuracy: 0.8040 Error: 0.42959 Loss: 0.43335 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "1635200 Examples seen. Accuracy: 0.8030 Error: 0.50978 Loss: 0.53222 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1635840 Examples seen. Accuracy: 0.8048 Error: 0.45571 Loss: 0.41322 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1636480 Examples seen. Accuracy: 0.8043 Error: 0.68396 Loss: 0.70279 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.28s\n", + "1637120 Examples seen. Accuracy: 0.8035 Error: 0.64402 Loss: 0.62521 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.36s\n", + "1637760 Examples seen. Accuracy: 0.8026 Error: 0.46955 Loss: 0.45105 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.32s\n", + "1638400 Examples seen. Accuracy: 0.8054 Error: 0.46528 Loss: 0.47117 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.25s\n", + "1639040 Examples seen. Accuracy: 0.8060 Error: 0.55940 Loss: 0.60628 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1639680 Examples seen. Accuracy: 0.8064 Error: 0.45515 Loss: 0.36650 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 41 Examples seen:1640000 Validation Accuracy: 0.8408 Validation Error: 0.4464 Validation Loss: 0.4813 Total time: 144.68min\n", + "Epoch time: 2.3635 minutes. 50 epochs: 1.9696 hours.\n", + "Epochs: 41. Working time: 2.41 hours.\n", + "1640640 Examples seen. Accuracy: 0.8036 Error: 0.46844 Loss: 0.47482 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1641280 Examples seen. Accuracy: 0.8056 Error: 0.45351 Loss: 0.50766 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1641920 Examples seen. Accuracy: 0.8055 Error: 0.63496 Loss: 0.66039 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1642560 Examples seen. Accuracy: 0.8050 Error: 0.52858 Loss: 0.50874 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.29s\n", + "1643200 Examples seen. Accuracy: 0.8056 Error: 0.51260 Loss: 0.52081 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1643840 Examples seen. Accuracy: 0.8061 Error: 0.53698 Loss: 0.52181 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "1644480 Examples seen. Accuracy: 0.8049 Error: 0.73764 Loss: 0.86155 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1645120 Examples seen. Accuracy: 0.8033 Error: 0.66385 Loss: 0.64354 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.27s\n", + "1645760 Examples seen. Accuracy: 0.8022 Error: 0.65954 Loss: 0.68206 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1646400 Examples seen. Accuracy: 0.8027 Error: 0.53160 Loss: 0.47919 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1647040 Examples seen. Accuracy: 0.8025 Error: 0.60844 Loss: 0.66404 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1647680 Examples seen. Accuracy: 0.8004 Error: 0.49658 Loss: 0.52059 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1648320 Examples seen. Accuracy: 0.8008 Error: 0.54046 Loss: 0.61702 Threads: 2 Forward time: 0.73s Backward time: 0.39s Step time: 2.22s\n", + "1648960 Examples seen. Accuracy: 0.7993 Error: 0.54266 Loss: 0.56505 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1649600 Examples seen. Accuracy: 0.7972 Error: 0.56532 Loss: 0.52850 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1650240 Examples seen. Accuracy: 0.7972 Error: 0.54621 Loss: 0.50362 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1650880 Examples seen. Accuracy: 0.7958 Error: 0.54663 Loss: 0.54676 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1651520 Examples seen. Accuracy: 0.7970 Error: 0.59492 Loss: 0.54005 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "1652160 Examples seen. Accuracy: 0.7991 Error: 0.50497 Loss: 0.56636 Threads: 2 Forward time: 0.73s Backward time: 0.40s Step time: 2.25s\n", + "1652800 Examples seen. Accuracy: 0.7993 Error: 0.38165 Loss: 0.46440 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "1653440 Examples seen. Accuracy: 0.8015 Error: 0.54787 Loss: 0.53506 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.28s\n", + "1654080 Examples seen. Accuracy: 0.8039 Error: 0.41015 Loss: 0.37745 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "1654720 Examples seen. Accuracy: 0.8056 Error: 0.65196 Loss: 0.74162 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.26s\n", + "1655360 Examples seen. Accuracy: 0.8070 Error: 0.49937 Loss: 0.47713 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.21s\n", + "1656000 Examples seen. Accuracy: 0.8096 Error: 0.55126 Loss: 0.58818 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1656640 Examples seen. Accuracy: 0.8097 Error: 0.42111 Loss: 0.34261 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "1657280 Examples seen. Accuracy: 0.8091 Error: 0.59249 Loss: 0.57066 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "1657920 Examples seen. Accuracy: 0.8096 Error: 0.48823 Loss: 0.52563 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1658560 Examples seen. Accuracy: 0.8081 Error: 0.47901 Loss: 0.48341 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.24s\n", + "1659200 Examples seen. Accuracy: 0.8060 Error: 0.58616 Loss: 0.62689 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.21s\n", + "1659840 Examples seen. Accuracy: 0.8063 Error: 0.54445 Loss: 0.47752 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "1660480 Examples seen. Accuracy: 0.8058 Error: 0.43380 Loss: 0.47763 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1661120 Examples seen. Accuracy: 0.8074 Error: 0.48094 Loss: 0.53642 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1661760 Examples seen. Accuracy: 0.8079 Error: 0.53709 Loss: 0.56328 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "1662400 Examples seen. Accuracy: 0.8040 Error: 0.66560 Loss: 0.62704 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.21s\n", + "1663040 Examples seen. Accuracy: 0.8011 Error: 0.60854 Loss: 0.60503 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1663680 Examples seen. Accuracy: 0.7995 Error: 0.57086 Loss: 0.73051 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "1664320 Examples seen. Accuracy: 0.7969 Error: 0.64232 Loss: 0.67945 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1664960 Examples seen. Accuracy: 0.7971 Error: 0.47593 Loss: 0.41808 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1665600 Examples seen. Accuracy: 0.7982 Error: 0.52872 Loss: 0.59126 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.21s\n", + "1666240 Examples seen. Accuracy: 0.7978 Error: 0.57924 Loss: 0.76161 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.19s\n", + "1666880 Examples seen. Accuracy: 0.7979 Error: 0.65772 Loss: 0.74640 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "1667520 Examples seen. Accuracy: 0.7947 Error: 0.52117 Loss: 0.49701 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1668160 Examples seen. Accuracy: 0.7959 Error: 0.44135 Loss: 0.41078 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1668800 Examples seen. Accuracy: 0.7943 Error: 0.68305 Loss: 0.80192 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1669440 Examples seen. Accuracy: 0.7942 Error: 0.66610 Loss: 0.72271 Threads: 2 Forward time: 0.74s Backward time: 0.40s Step time: 2.25s\n", + "1670080 Examples seen. Accuracy: 0.7948 Error: 0.53490 Loss: 0.71279 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1670720 Examples seen. Accuracy: 0.7960 Error: 0.52018 Loss: 0.68401 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.22s\n", + "1671360 Examples seen. Accuracy: 0.8003 Error: 0.41840 Loss: 0.36969 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1672000 Examples seen. Accuracy: 0.7997 Error: 0.54682 Loss: 0.58255 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1672640 Examples seen. Accuracy: 0.8000 Error: 0.38967 Loss: 0.36466 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1673280 Examples seen. Accuracy: 0.8007 Error: 0.57849 Loss: 0.58812 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.27s\n", + "1673920 Examples seen. Accuracy: 0.8012 Error: 0.57866 Loss: 0.71095 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1674560 Examples seen. Accuracy: 0.7975 Error: 0.52735 Loss: 0.53835 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1675200 Examples seen. Accuracy: 0.7987 Error: 0.58814 Loss: 0.70309 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1675840 Examples seen. Accuracy: 0.7979 Error: 0.59860 Loss: 0.59350 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.24s\n", + "1676480 Examples seen. Accuracy: 0.7984 Error: 0.52595 Loss: 0.59196 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1677120 Examples seen. Accuracy: 0.7990 Error: 0.48244 Loss: 0.52215 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1677760 Examples seen. Accuracy: 0.7980 Error: 0.74877 Loss: 0.91942 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "1678400 Examples seen. Accuracy: 0.7995 Error: 0.49146 Loss: 0.45821 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1679040 Examples seen. Accuracy: 0.7999 Error: 0.43567 Loss: 0.33887 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.21s\n", + "1679680 Examples seen. Accuracy: 0.7998 Error: 0.54667 Loss: 0.47788 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 42 Examples seen:1680000 Validation Accuracy: 0.8431 Validation Error: 0.4436 Validation Loss: 0.4792 Total time: 148.11min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.579 Min Weight: -0.612 Max Output: 5.170 Min Output: -5.810 TNNetConvolutionLinear 32,32,64 Times: 31.10s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.170 Min Output: -1.201 TNNetMaxPool 8,8,64 Times: 7.14s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.899 Min Weight: 0.859 Max Output: 4.970 Min Output: -2.444 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.281 Min Weight: -0.339 Max Output: 10.009 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.61s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.336 Min Weight: -0.312 Max Output: 11.004 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.49s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.308 Min Weight: -0.247 Max Output: 8.035 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.55s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.213 Min Weight: -0.218 Max Output: 3.255 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.61s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.255 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.04s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.255 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.41s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.329 Min Weight: -0.269 Max Output: 5.219 Min Output: -11.023 TNNetFullConnectLinear 10,1,1 Times: 0.13s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.453 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3135 minutes. 50 epochs: 1.9280 hours.\n", + "Epochs: 42. Working time: 2.47 hours.\n", + "1680640 Examples seen. Accuracy: 0.8000 Error: 0.67139 Loss: 0.76720 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1681280 Examples seen. Accuracy: 0.8009 Error: 0.46329 Loss: 0.44383 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.29s\n", + "1681920 Examples seen. Accuracy: 0.7987 Error: 0.45487 Loss: 0.42265 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1682560 Examples seen. Accuracy: 0.7991 Error: 0.53651 Loss: 0.58118 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1683200 Examples seen. Accuracy: 0.7983 Error: 0.62182 Loss: 0.72797 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1683840 Examples seen. Accuracy: 0.7974 Error: 0.51756 Loss: 0.49560 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.33s\n", + "1684480 Examples seen. Accuracy: 0.7976 Error: 0.42272 Loss: 0.50421 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.30s\n", + "1685120 Examples seen. Accuracy: 0.7954 Error: 0.59142 Loss: 0.70337 Threads: 2 Forward time: 0.71s Backward time: 0.37s Step time: 2.28s\n", + "1685760 Examples seen. Accuracy: 0.7987 Error: 0.62864 Loss: 0.75422 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1686400 Examples seen. Accuracy: 0.7967 Error: 0.58669 Loss: 0.61356 Threads: 2 Forward time: 0.73s Backward time: 0.39s Step time: 2.31s\n", + "1687040 Examples seen. Accuracy: 0.7964 Error: 0.37858 Loss: 0.36980 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.31s\n", + "1687680 Examples seen. Accuracy: 0.7974 Error: 0.66028 Loss: 0.80919 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1688320 Examples seen. Accuracy: 0.7989 Error: 0.44437 Loss: 0.47425 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1688960 Examples seen. Accuracy: 0.8005 Error: 0.43870 Loss: 0.43714 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.37s\n", + "1689600 Examples seen. Accuracy: 0.8001 Error: 0.43118 Loss: 0.44524 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1690240 Examples seen. Accuracy: 0.8022 Error: 0.45332 Loss: 0.43886 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1690880 Examples seen. Accuracy: 0.8031 Error: 0.65069 Loss: 0.68805 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.30s\n", + "1691520 Examples seen. Accuracy: 0.8031 Error: 0.49658 Loss: 0.51343 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "1692160 Examples seen. Accuracy: 0.8040 Error: 0.50640 Loss: 0.56564 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.25s\n", + "1692800 Examples seen. Accuracy: 0.8037 Error: 0.53802 Loss: 0.51715 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "1693440 Examples seen. Accuracy: 0.8067 Error: 0.44406 Loss: 0.38914 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.33s\n", + "1694080 Examples seen. Accuracy: 0.8060 Error: 0.49721 Loss: 0.53111 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1694720 Examples seen. Accuracy: 0.8076 Error: 0.45770 Loss: 0.45646 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.22s\n", + "1695360 Examples seen. Accuracy: 0.8062 Error: 0.52654 Loss: 0.57848 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1696000 Examples seen. Accuracy: 0.8063 Error: 0.63608 Loss: 0.70153 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1696640 Examples seen. Accuracy: 0.8037 Error: 0.37510 Loss: 0.31714 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.23s\n", + "1697280 Examples seen. Accuracy: 0.8039 Error: 0.51885 Loss: 0.45366 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "1697920 Examples seen. Accuracy: 0.8046 Error: 0.43285 Loss: 0.45659 Threads: 2 Forward time: 0.75s Backward time: 0.38s Step time: 2.29s\n", + "1698560 Examples seen. Accuracy: 0.8078 Error: 0.60024 Loss: 0.66575 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "1699200 Examples seen. Accuracy: 0.8095 Error: 0.57150 Loss: 0.70263 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1699840 Examples seen. Accuracy: 0.8092 Error: 0.49861 Loss: 0.42160 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.23s\n", + "1700480 Examples seen. Accuracy: 0.8108 Error: 0.46779 Loss: 0.39972 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1701120 Examples seen. Accuracy: 0.8119 Error: 0.41481 Loss: 0.51118 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "1701760 Examples seen. Accuracy: 0.8125 Error: 0.44243 Loss: 0.36300 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.27s\n", + "1702400 Examples seen. Accuracy: 0.8124 Error: 0.44899 Loss: 0.49796 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.29s\n", + "1703040 Examples seen. Accuracy: 0.8098 Error: 0.52932 Loss: 0.53997 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1703680 Examples seen. Accuracy: 0.8097 Error: 0.60533 Loss: 0.59089 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1704320 Examples seen. Accuracy: 0.8084 Error: 0.54161 Loss: 0.53130 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.29s\n", + "1704960 Examples seen. Accuracy: 0.8092 Error: 0.53471 Loss: 0.56710 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1705600 Examples seen. Accuracy: 0.8077 Error: 0.61441 Loss: 0.65031 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1706240 Examples seen. Accuracy: 0.8092 Error: 0.46696 Loss: 0.45175 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1706880 Examples seen. Accuracy: 0.8095 Error: 0.60226 Loss: 0.57590 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1707520 Examples seen. Accuracy: 0.8106 Error: 0.52049 Loss: 0.79232 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.23s\n", + "1708160 Examples seen. Accuracy: 0.8089 Error: 0.55049 Loss: 0.64751 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1708800 Examples seen. Accuracy: 0.8073 Error: 0.52926 Loss: 0.57544 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.21s\n", + "1709440 Examples seen. Accuracy: 0.8057 Error: 0.44427 Loss: 0.47284 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1710080 Examples seen. Accuracy: 0.8034 Error: 0.67256 Loss: 0.80340 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1710720 Examples seen. Accuracy: 0.8020 Error: 0.55730 Loss: 0.56850 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.27s\n", + "1711360 Examples seen. Accuracy: 0.8025 Error: 0.55680 Loss: 0.51552 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1712000 Examples seen. Accuracy: 0.8018 Error: 0.58785 Loss: 0.76400 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1712640 Examples seen. Accuracy: 0.8020 Error: 0.48576 Loss: 0.47088 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1713280 Examples seen. Accuracy: 0.7984 Error: 0.59862 Loss: 0.80245 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1713920 Examples seen. Accuracy: 0.7998 Error: 0.61474 Loss: 0.67588 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1714560 Examples seen. Accuracy: 0.8006 Error: 0.56500 Loss: 0.65336 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "1715200 Examples seen. Accuracy: 0.8011 Error: 0.64712 Loss: 0.90739 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.21s\n", + "1715840 Examples seen. Accuracy: 0.8027 Error: 0.58675 Loss: 0.65706 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.21s\n", + "1716480 Examples seen. Accuracy: 0.8025 Error: 0.45281 Loss: 0.39598 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1717120 Examples seen. Accuracy: 0.8005 Error: 0.70375 Loss: 0.77210 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1717760 Examples seen. Accuracy: 0.7993 Error: 0.63193 Loss: 0.68640 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.26s\n", + "1718400 Examples seen. Accuracy: 0.7990 Error: 0.58053 Loss: 0.62891 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.20s\n", + "1719040 Examples seen. Accuracy: 0.7971 Error: 0.65807 Loss: 0.76720 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1719680 Examples seen. Accuracy: 0.7985 Error: 0.55384 Loss: 0.43992 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 43 Examples seen:1720000 Validation Accuracy: 0.8435 Validation Error: 0.4421 Validation Loss: 0.4766 Total time: 151.50min\n", + "Epoch time: 2.2948 minutes. 50 epochs: 1.9123 hours.\n", + "Epochs: 43. Working time: 2.53 hours.\n", + "1720640 Examples seen. Accuracy: 0.7981 Error: 0.55341 Loss: 0.57737 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1721280 Examples seen. Accuracy: 0.7995 Error: 0.50887 Loss: 0.50630 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.23s\n", + "1721920 Examples seen. Accuracy: 0.7963 Error: 0.68551 Loss: 0.70875 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1722560 Examples seen. Accuracy: 0.7965 Error: 0.67230 Loss: 0.82301 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1723200 Examples seen. Accuracy: 0.7953 Error: 0.46954 Loss: 0.48940 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1723840 Examples seen. Accuracy: 0.7980 Error: 0.51257 Loss: 0.44211 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1724480 Examples seen. Accuracy: 0.7994 Error: 0.50717 Loss: 0.45955 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "1725120 Examples seen. Accuracy: 0.7985 Error: 0.65405 Loss: 0.76664 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1725760 Examples seen. Accuracy: 0.7988 Error: 0.62551 Loss: 0.62255 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1726400 Examples seen. Accuracy: 0.8007 Error: 0.49349 Loss: 0.49951 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "1727040 Examples seen. Accuracy: 0.7988 Error: 0.63706 Loss: 0.71263 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1727680 Examples seen. Accuracy: 0.8006 Error: 0.62528 Loss: 0.78108 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1728320 Examples seen. Accuracy: 0.8010 Error: 0.57656 Loss: 0.62641 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1728960 Examples seen. Accuracy: 0.8022 Error: 0.56029 Loss: 0.49488 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "1729600 Examples seen. Accuracy: 0.8029 Error: 0.34691 Loss: 0.37576 Threads: 2 Forward time: 0.73s Backward time: 0.41s Step time: 2.27s\n", + "1730240 Examples seen. Accuracy: 0.8026 Error: 0.49302 Loss: 0.60632 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1730880 Examples seen. Accuracy: 0.8039 Error: 0.47092 Loss: 0.50248 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.26s\n", + "1731520 Examples seen. Accuracy: 0.8048 Error: 0.62387 Loss: 0.60490 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.23s\n", + "1732160 Examples seen. Accuracy: 0.8028 Error: 0.49964 Loss: 0.48220 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "1732800 Examples seen. Accuracy: 0.8049 Error: 0.56605 Loss: 0.55722 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.23s\n", + "1733440 Examples seen. Accuracy: 0.8039 Error: 0.59731 Loss: 0.67491 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1734080 Examples seen. Accuracy: 0.8050 Error: 0.50678 Loss: 0.57558 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.31s\n", + "1734720 Examples seen. Accuracy: 0.8064 Error: 0.53332 Loss: 0.51525 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.36s\n", + "1735360 Examples seen. Accuracy: 0.8066 Error: 0.54413 Loss: 0.67696 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "1736000 Examples seen. Accuracy: 0.8046 Error: 0.53143 Loss: 0.56676 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.27s\n", + "1736640 Examples seen. Accuracy: 0.8022 Error: 0.56565 Loss: 0.59714 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1737280 Examples seen. Accuracy: 0.8029 Error: 0.56774 Loss: 0.55036 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1737920 Examples seen. Accuracy: 0.8029 Error: 0.34835 Loss: 0.31202 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.23s\n", + "1738560 Examples seen. Accuracy: 0.8033 Error: 0.51071 Loss: 0.64443 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.28s\n", + "1739200 Examples seen. Accuracy: 0.8059 Error: 0.36952 Loss: 0.33057 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1739840 Examples seen. Accuracy: 0.8097 Error: 0.50228 Loss: 0.56104 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1740480 Examples seen. Accuracy: 0.8066 Error: 0.48273 Loss: 0.45099 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1741120 Examples seen. Accuracy: 0.8078 Error: 0.45553 Loss: 0.37889 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "1741760 Examples seen. Accuracy: 0.8066 Error: 0.58246 Loss: 0.73300 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1742400 Examples seen. Accuracy: 0.8063 Error: 0.61806 Loss: 0.76036 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.31s\n", + "1743040 Examples seen. Accuracy: 0.8070 Error: 0.46658 Loss: 0.44036 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.26s\n", + "1743680 Examples seen. Accuracy: 0.8072 Error: 0.70367 Loss: 0.81154 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "1744320 Examples seen. Accuracy: 0.8074 Error: 0.46177 Loss: 0.46414 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.21s\n", + "1744960 Examples seen. Accuracy: 0.8063 Error: 0.47637 Loss: 0.48543 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1745600 Examples seen. Accuracy: 0.8041 Error: 0.44665 Loss: 0.38885 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.22s\n", + "1746240 Examples seen. Accuracy: 0.8007 Error: 0.54994 Loss: 0.59860 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1746880 Examples seen. Accuracy: 0.8025 Error: 0.46929 Loss: 0.40619 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.18s\n", + "1747520 Examples seen. Accuracy: 0.8033 Error: 0.50548 Loss: 0.53090 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1748160 Examples seen. Accuracy: 0.8021 Error: 0.56606 Loss: 0.61231 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1748800 Examples seen. Accuracy: 0.8033 Error: 0.56792 Loss: 0.64922 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1749440 Examples seen. Accuracy: 0.8041 Error: 0.58555 Loss: 0.69141 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.22s\n", + "1750080 Examples seen. Accuracy: 0.8037 Error: 0.54260 Loss: 0.64653 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "1750720 Examples seen. Accuracy: 0.8020 Error: 0.53329 Loss: 0.52588 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.19s\n", + "1751360 Examples seen. Accuracy: 0.8048 Error: 0.45951 Loss: 0.48354 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "1752000 Examples seen. Accuracy: 0.8058 Error: 0.53471 Loss: 0.66714 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.24s\n", + "1752640 Examples seen. Accuracy: 0.8040 Error: 0.51177 Loss: 0.54987 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1753280 Examples seen. Accuracy: 0.8056 Error: 0.56275 Loss: 0.57194 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1753920 Examples seen. Accuracy: 0.8041 Error: 0.52118 Loss: 0.53013 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1754560 Examples seen. Accuracy: 0.8017 Error: 0.47195 Loss: 0.54014 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1755200 Examples seen. Accuracy: 0.8020 Error: 0.52556 Loss: 0.59282 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.20s\n", + "1755840 Examples seen. Accuracy: 0.8043 Error: 0.42051 Loss: 0.44183 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "1756480 Examples seen. Accuracy: 0.8041 Error: 0.40768 Loss: 0.52747 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "1757120 Examples seen. Accuracy: 0.8046 Error: 0.41115 Loss: 0.49730 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.27s\n", + "1757760 Examples seen. Accuracy: 0.8040 Error: 0.45498 Loss: 0.54977 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "1758400 Examples seen. Accuracy: 0.8006 Error: 0.62762 Loss: 0.56970 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "1759040 Examples seen. Accuracy: 0.8013 Error: 0.53627 Loss: 0.55708 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1759680 Examples seen. Accuracy: 0.8023 Error: 0.49772 Loss: 0.53613 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 44 Examples seen:1760000 Validation Accuracy: 0.8437 Validation Error: 0.4400 Validation Loss: 0.4751 Total time: 154.87min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.591 Min Weight: -0.617 Max Output: 5.223 Min Output: -5.903 TNNetConvolutionLinear 32,32,64 Times: 30.09s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.223 Min Output: -1.230 TNNetMaxPool 8,8,64 Times: 6.98s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.908 Min Weight: 0.869 Max Output: 4.966 Min Output: -2.460 TNNetMovingStdNormalization 8,8,64 Times: 0.13s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.280 Min Weight: -0.345 Max Output: 10.068 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.11s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.347 Min Weight: -0.319 Max Output: 11.124 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.00s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.316 Min Weight: -0.251 Max Output: 7.513 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.06s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.218 Min Weight: -0.219 Max Output: 3.292 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.18s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.292 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.292 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.38s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.330 Min Weight: -0.269 Max Output: 5.223 Min Output: -11.036 TNNetFullConnectLinear 10,1,1 Times: 0.07s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.435 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3323 minutes. 50 epochs: 1.9436 hours.\n", + "Epochs: 44. Working time: 2.58 hours.\n", + "1760640 Examples seen. Accuracy: 0.8019 Error: 0.61683 Loss: 0.80504 Threads: 2 Forward time: 0.65s Backward time: 0.36s Step time: 2.17s\n", + "1761280 Examples seen. Accuracy: 0.7988 Error: 0.48159 Loss: 0.66259 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.19s\n", + "1761920 Examples seen. Accuracy: 0.7978 Error: 0.67617 Loss: 0.70790 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.17s\n", + "1762560 Examples seen. Accuracy: 0.7988 Error: 0.44849 Loss: 0.47353 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "1763200 Examples seen. Accuracy: 0.8010 Error: 0.47647 Loss: 0.41273 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1763840 Examples seen. Accuracy: 0.8002 Error: 0.38395 Loss: 0.35873 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.18s\n", + "1764480 Examples seen. Accuracy: 0.8012 Error: 0.50008 Loss: 0.50155 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.25s\n", + "1765120 Examples seen. Accuracy: 0.8027 Error: 0.65825 Loss: 0.90716 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.22s\n", + "1765760 Examples seen. Accuracy: 0.8015 Error: 0.47736 Loss: 0.40542 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1766400 Examples seen. Accuracy: 0.8046 Error: 0.47484 Loss: 0.56903 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.18s\n", + "1767040 Examples seen. Accuracy: 0.8026 Error: 0.64641 Loss: 0.68534 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.18s\n", + "1767680 Examples seen. Accuracy: 0.7990 Error: 0.50818 Loss: 0.51614 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1768320 Examples seen. Accuracy: 0.8013 Error: 0.54735 Loss: 0.57290 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1768960 Examples seen. Accuracy: 0.8028 Error: 0.49311 Loss: 0.47599 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1769600 Examples seen. Accuracy: 0.8011 Error: 0.59937 Loss: 0.71031 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.29s\n", + "1770240 Examples seen. Accuracy: 0.7988 Error: 0.53670 Loss: 0.49683 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1770880 Examples seen. Accuracy: 0.8017 Error: 0.47663 Loss: 0.44828 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.22s\n", + "1771520 Examples seen. Accuracy: 0.8028 Error: 0.53370 Loss: 0.48148 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.27s\n", + "1772160 Examples seen. Accuracy: 0.8010 Error: 0.49904 Loss: 0.42435 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1772800 Examples seen. Accuracy: 0.8017 Error: 0.56659 Loss: 0.63192 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1773440 Examples seen. Accuracy: 0.8024 Error: 0.55688 Loss: 0.58150 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1774080 Examples seen. Accuracy: 0.8039 Error: 0.61437 Loss: 0.68375 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1774720 Examples seen. Accuracy: 0.8041 Error: 0.47213 Loss: 0.47361 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.28s\n", + "1775360 Examples seen. Accuracy: 0.8044 Error: 0.47128 Loss: 0.51124 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "1776000 Examples seen. Accuracy: 0.8009 Error: 0.54083 Loss: 0.59915 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.28s\n", + "1776640 Examples seen. Accuracy: 0.8014 Error: 0.46656 Loss: 0.48497 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.24s\n", + "1777280 Examples seen. Accuracy: 0.8017 Error: 0.61647 Loss: 0.91066 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1777920 Examples seen. Accuracy: 0.8017 Error: 0.49758 Loss: 0.45129 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1778560 Examples seen. Accuracy: 0.8036 Error: 0.59772 Loss: 0.90901 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1779200 Examples seen. Accuracy: 0.8033 Error: 0.60793 Loss: 0.64957 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1779840 Examples seen. Accuracy: 0.8041 Error: 0.43762 Loss: 0.41248 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1780480 Examples seen. Accuracy: 0.8050 Error: 0.53764 Loss: 0.60561 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1781120 Examples seen. Accuracy: 0.8042 Error: 0.49296 Loss: 0.69129 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1781760 Examples seen. Accuracy: 0.8045 Error: 0.62751 Loss: 0.70030 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1782400 Examples seen. Accuracy: 0.8035 Error: 0.52960 Loss: 0.57779 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "1783040 Examples seen. Accuracy: 0.8046 Error: 0.49291 Loss: 0.46135 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1783680 Examples seen. Accuracy: 0.8032 Error: 0.54193 Loss: 0.57554 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.19s\n", + "1784320 Examples seen. Accuracy: 0.8047 Error: 0.43476 Loss: 0.38966 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1784960 Examples seen. Accuracy: 0.8047 Error: 0.65817 Loss: 0.69461 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.23s\n", + "1785600 Examples seen. Accuracy: 0.8065 Error: 0.40508 Loss: 0.42314 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.25s\n", + "1786240 Examples seen. Accuracy: 0.8082 Error: 0.39446 Loss: 0.36012 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1786880 Examples seen. Accuracy: 0.8100 Error: 0.64204 Loss: 0.78158 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.24s\n", + "1787520 Examples seen. Accuracy: 0.8108 Error: 0.45856 Loss: 0.47379 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.22s\n", + "1788160 Examples seen. Accuracy: 0.8075 Error: 0.52164 Loss: 0.56074 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1788800 Examples seen. Accuracy: 0.8078 Error: 0.55158 Loss: 0.52130 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "1789440 Examples seen. Accuracy: 0.8066 Error: 0.55669 Loss: 0.59806 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.20s\n", + "1790080 Examples seen. Accuracy: 0.8072 Error: 0.50236 Loss: 0.56735 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "1790720 Examples seen. Accuracy: 0.8062 Error: 0.54660 Loss: 0.49060 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1791360 Examples seen. Accuracy: 0.8034 Error: 0.53801 Loss: 0.56514 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "1792000 Examples seen. Accuracy: 0.8047 Error: 0.71923 Loss: 0.84937 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1792640 Examples seen. Accuracy: 0.8043 Error: 0.52414 Loss: 0.56046 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "1793280 Examples seen. Accuracy: 0.8037 Error: 0.45257 Loss: 0.46509 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "1793920 Examples seen. Accuracy: 0.8059 Error: 0.47616 Loss: 0.48805 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1794560 Examples seen. Accuracy: 0.8071 Error: 0.48401 Loss: 0.46580 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.21s\n", + "1795200 Examples seen. Accuracy: 0.8088 Error: 0.42652 Loss: 0.39704 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.20s\n", + "1795840 Examples seen. Accuracy: 0.8075 Error: 0.58858 Loss: 0.74968 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1796480 Examples seen. Accuracy: 0.8076 Error: 0.56355 Loss: 0.63541 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1797120 Examples seen. Accuracy: 0.8056 Error: 0.66625 Loss: 0.72501 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.22s\n", + "1797760 Examples seen. Accuracy: 0.8068 Error: 0.41951 Loss: 0.34286 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1798400 Examples seen. Accuracy: 0.8050 Error: 0.48299 Loss: 0.46655 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.19s\n", + "1799040 Examples seen. Accuracy: 0.8042 Error: 0.70356 Loss: 0.87311 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.19s\n", + "1799680 Examples seen. Accuracy: 0.8035 Error: 0.56777 Loss: 0.59480 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.18s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 45 Examples seen:1800000 Validation Accuracy: 0.8446 Validation Error: 0.4384 Validation Loss: 0.4724 Total time: 158.23min\n", + "Epoch time: 2.2729 minutes. 50 epochs: 1.8941 hours.\n", + "Epochs: 45. Working time: 2.64 hours.\n", + "1800640 Examples seen. Accuracy: 0.8050 Error: 0.52892 Loss: 0.57404 Threads: 2 Forward time: 0.67s Backward time: 0.36s Step time: 2.23s\n", + "1801280 Examples seen. Accuracy: 0.8031 Error: 0.67452 Loss: 0.67926 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1801920 Examples seen. Accuracy: 0.8040 Error: 0.48909 Loss: 0.47363 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1802560 Examples seen. Accuracy: 0.8037 Error: 0.57783 Loss: 0.59355 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "1803200 Examples seen. Accuracy: 0.8022 Error: 0.55752 Loss: 0.54343 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.20s\n", + "1803840 Examples seen. Accuracy: 0.8005 Error: 0.39555 Loss: 0.36763 Threads: 2 Forward time: 0.68s Backward time: 0.36s Step time: 2.20s\n", + "1804480 Examples seen. Accuracy: 0.7988 Error: 0.65284 Loss: 0.66711 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.18s\n", + "1805120 Examples seen. Accuracy: 0.8003 Error: 0.37873 Loss: 0.32789 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1805760 Examples seen. Accuracy: 0.7982 Error: 0.46833 Loss: 0.42251 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.23s\n", + "1806400 Examples seen. Accuracy: 0.7982 Error: 0.54267 Loss: 0.56125 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.20s\n", + "1807040 Examples seen. Accuracy: 0.7963 Error: 0.62307 Loss: 0.64502 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.21s\n", + "1807680 Examples seen. Accuracy: 0.7975 Error: 0.42875 Loss: 0.49366 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "1808320 Examples seen. Accuracy: 0.7986 Error: 0.54650 Loss: 0.53966 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1808960 Examples seen. Accuracy: 0.7973 Error: 0.61634 Loss: 0.60551 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.19s\n", + "1809600 Examples seen. Accuracy: 0.7984 Error: 0.53018 Loss: 0.53555 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.26s\n", + "1810240 Examples seen. Accuracy: 0.8032 Error: 0.44516 Loss: 0.45459 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.22s\n", + "1810880 Examples seen. Accuracy: 0.8017 Error: 0.60931 Loss: 0.72155 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.25s\n", + "1811520 Examples seen. Accuracy: 0.8038 Error: 0.49328 Loss: 0.48755 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.22s\n", + "1812160 Examples seen. Accuracy: 0.8020 Error: 0.55991 Loss: 0.49434 Threads: 2 Forward time: 0.68s Backward time: 0.36s Step time: 2.19s\n", + "1812800 Examples seen. Accuracy: 0.8016 Error: 0.54640 Loss: 0.48624 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.17s\n", + "1813440 Examples seen. Accuracy: 0.8023 Error: 0.44355 Loss: 0.47625 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.18s\n", + "1814080 Examples seen. Accuracy: 0.8051 Error: 0.42625 Loss: 0.48687 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.20s\n", + "1814720 Examples seen. Accuracy: 0.8052 Error: 0.45487 Loss: 0.46048 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.19s\n", + "1815360 Examples seen. Accuracy: 0.8074 Error: 0.39120 Loss: 0.37990 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.18s\n", + "1816000 Examples seen. Accuracy: 0.8047 Error: 0.48695 Loss: 0.57066 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "1816640 Examples seen. Accuracy: 0.8069 Error: 0.43109 Loss: 0.46597 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.21s\n", + "1817280 Examples seen. Accuracy: 0.8094 Error: 0.39044 Loss: 0.32945 Threads: 2 Forward time: 0.65s Backward time: 0.38s Step time: 2.17s\n", + "1817920 Examples seen. Accuracy: 0.8115 Error: 0.47312 Loss: 0.45862 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.18s\n", + "1818560 Examples seen. Accuracy: 0.8107 Error: 0.45257 Loss: 0.45493 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.21s\n", + "1819200 Examples seen. Accuracy: 0.8089 Error: 0.48358 Loss: 0.39886 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.24s\n", + "1819840 Examples seen. Accuracy: 0.8078 Error: 0.66989 Loss: 0.74429 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1820480 Examples seen. Accuracy: 0.8076 Error: 0.54592 Loss: 0.60786 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1821120 Examples seen. Accuracy: 0.8081 Error: 0.65073 Loss: 0.64975 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1821760 Examples seen. Accuracy: 0.8073 Error: 0.51966 Loss: 0.51214 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1822400 Examples seen. Accuracy: 0.8078 Error: 0.41417 Loss: 0.51032 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.23s\n", + "1823040 Examples seen. Accuracy: 0.8092 Error: 0.44996 Loss: 0.39109 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1823680 Examples seen. Accuracy: 0.8089 Error: 0.36494 Loss: 0.31402 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.23s\n", + "1824320 Examples seen. Accuracy: 0.8080 Error: 0.40704 Loss: 0.40096 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1824960 Examples seen. Accuracy: 0.8068 Error: 0.39971 Loss: 0.44130 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1825600 Examples seen. Accuracy: 0.8072 Error: 0.43501 Loss: 0.42799 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "1826240 Examples seen. Accuracy: 0.8093 Error: 0.49807 Loss: 0.48128 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1826880 Examples seen. Accuracy: 0.8089 Error: 0.51756 Loss: 0.49040 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.22s\n", + "1827520 Examples seen. Accuracy: 0.8085 Error: 0.61220 Loss: 0.69765 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1828160 Examples seen. Accuracy: 0.8074 Error: 0.57660 Loss: 0.54822 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.21s\n", + "1828800 Examples seen. Accuracy: 0.8056 Error: 0.64688 Loss: 0.74264 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.21s\n", + "1829440 Examples seen. Accuracy: 0.8065 Error: 0.48016 Loss: 0.44862 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.22s\n", + "1830080 Examples seen. Accuracy: 0.8066 Error: 0.55557 Loss: 0.69324 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.22s\n", + "1830720 Examples seen. Accuracy: 0.8078 Error: 0.52758 Loss: 0.65447 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.24s\n", + "1831360 Examples seen. Accuracy: 0.8101 Error: 0.40405 Loss: 0.36335 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1832000 Examples seen. Accuracy: 0.8082 Error: 0.76030 Loss: 0.83678 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1832640 Examples seen. Accuracy: 0.8085 Error: 0.49864 Loss: 0.50153 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.26s\n", + "1833280 Examples seen. Accuracy: 0.8099 Error: 0.52115 Loss: 0.52980 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.30s\n", + "1833920 Examples seen. Accuracy: 0.8100 Error: 0.56853 Loss: 0.58128 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.25s\n", + "1834560 Examples seen. Accuracy: 0.8107 Error: 0.43176 Loss: 0.40712 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1835200 Examples seen. Accuracy: 0.8092 Error: 0.41667 Loss: 0.50471 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1835840 Examples seen. Accuracy: 0.8095 Error: 0.55149 Loss: 0.55181 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.22s\n", + "1836480 Examples seen. Accuracy: 0.8084 Error: 0.65206 Loss: 0.68131 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1837120 Examples seen. Accuracy: 0.8089 Error: 0.54432 Loss: 0.49547 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1837760 Examples seen. Accuracy: 0.8083 Error: 0.53347 Loss: 0.57704 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1838400 Examples seen. Accuracy: 0.8097 Error: 0.44419 Loss: 0.43018 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "1839040 Examples seen. Accuracy: 0.8102 Error: 0.60324 Loss: 0.56386 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "1839680 Examples seen. Accuracy: 0.8101 Error: 0.58823 Loss: 0.66150 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 46 Examples seen:1840000 Validation Accuracy: 0.8453 Validation Error: 0.4362 Validation Loss: 0.4698 Total time: 161.58min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.603 Min Weight: -0.621 Max Output: 5.279 Min Output: -5.942 TNNetConvolutionLinear 32,32,64 Times: 30.19s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.279 Min Output: -1.276 TNNetMaxPool 8,8,64 Times: 6.97s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.918 Min Weight: 0.878 Max Output: 4.964 Min Output: -2.498 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.283 Min Weight: -0.351 Max Output: 10.346 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.04s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.357 Min Weight: -0.322 Max Output: 11.125 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.91s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.329 Min Weight: -0.256 Max Output: 7.380 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.222 Min Weight: -0.222 Max Output: 3.244 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.02s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.244 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.244 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.36s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.325 Min Weight: -0.268 Max Output: 5.071 Min Output: -10.765 TNNetFullConnectLinear 10,1,1 Times: 0.08s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.502 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3115 minutes. 50 epochs: 1.9262 hours.\n", + "Epochs: 46. Working time: 2.69 hours.\n", + "1840640 Examples seen. Accuracy: 0.8102 Error: 0.55662 Loss: 0.58351 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "1841280 Examples seen. Accuracy: 0.8109 Error: 0.41912 Loss: 0.41662 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.21s\n", + "1841920 Examples seen. Accuracy: 0.8099 Error: 0.45860 Loss: 0.40399 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.24s\n", + "1842560 Examples seen. Accuracy: 0.8089 Error: 0.46133 Loss: 0.45873 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.24s\n", + "1843200 Examples seen. Accuracy: 0.8083 Error: 0.58055 Loss: 0.62772 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.23s\n", + "1843840 Examples seen. Accuracy: 0.8087 Error: 0.58673 Loss: 0.63068 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.21s\n", + "1844480 Examples seen. Accuracy: 0.8083 Error: 0.52040 Loss: 0.48312 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1845120 Examples seen. Accuracy: 0.8067 Error: 0.43084 Loss: 0.39708 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1845760 Examples seen. Accuracy: 0.8076 Error: 0.51578 Loss: 0.42925 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1846400 Examples seen. Accuracy: 0.8048 Error: 0.48728 Loss: 0.52615 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.22s\n", + "1847040 Examples seen. Accuracy: 0.8057 Error: 0.58081 Loss: 0.60979 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1847680 Examples seen. Accuracy: 0.8068 Error: 0.50447 Loss: 0.52621 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "1848320 Examples seen. Accuracy: 0.8057 Error: 0.62777 Loss: 0.71009 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "1848960 Examples seen. Accuracy: 0.8046 Error: 0.45940 Loss: 0.41186 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.21s\n", + "1849600 Examples seen. Accuracy: 0.8074 Error: 0.42752 Loss: 0.38793 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1850240 Examples seen. Accuracy: 0.8056 Error: 0.40054 Loss: 0.42970 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1850880 Examples seen. Accuracy: 0.8046 Error: 0.50943 Loss: 0.52923 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.23s\n", + "1851520 Examples seen. Accuracy: 0.8040 Error: 0.44184 Loss: 0.55754 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1852160 Examples seen. Accuracy: 0.8045 Error: 0.64845 Loss: 0.69677 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1852800 Examples seen. Accuracy: 0.8033 Error: 0.62132 Loss: 0.77121 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1853440 Examples seen. Accuracy: 0.8050 Error: 0.51346 Loss: 0.55101 Threads: 2 Forward time: 0.74s Backward time: 0.40s Step time: 2.30s\n", + "1854080 Examples seen. Accuracy: 0.8043 Error: 0.47881 Loss: 0.49318 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1854720 Examples seen. Accuracy: 0.8035 Error: 0.57762 Loss: 0.56085 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "1855360 Examples seen. Accuracy: 0.8055 Error: 0.48882 Loss: 0.54016 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1856000 Examples seen. Accuracy: 0.8059 Error: 0.39939 Loss: 0.41297 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.23s\n", + "1856640 Examples seen. Accuracy: 0.8084 Error: 0.48090 Loss: 0.48291 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.25s\n", + "1857280 Examples seen. Accuracy: 0.8089 Error: 0.44803 Loss: 0.52942 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1857920 Examples seen. Accuracy: 0.8083 Error: 0.47875 Loss: 0.53443 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1858560 Examples seen. Accuracy: 0.8069 Error: 0.48345 Loss: 0.49016 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1859200 Examples seen. Accuracy: 0.8073 Error: 0.47541 Loss: 0.49879 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1859840 Examples seen. Accuracy: 0.8093 Error: 0.35205 Loss: 0.33276 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1860480 Examples seen. Accuracy: 0.8083 Error: 0.48212 Loss: 0.58720 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.22s\n", + "1861120 Examples seen. Accuracy: 0.8092 Error: 0.71481 Loss: 0.79775 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.18s\n", + "1861760 Examples seen. Accuracy: 0.8098 Error: 0.50361 Loss: 0.50614 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.18s\n", + "1862400 Examples seen. Accuracy: 0.8084 Error: 0.55415 Loss: 0.58423 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "1863040 Examples seen. Accuracy: 0.8089 Error: 0.62718 Loss: 0.66836 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.23s\n", + "1863680 Examples seen. Accuracy: 0.8090 Error: 0.37687 Loss: 0.32353 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "1864320 Examples seen. Accuracy: 0.8090 Error: 0.51290 Loss: 0.55429 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1864960 Examples seen. Accuracy: 0.8084 Error: 0.41410 Loss: 0.40580 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1865600 Examples seen. Accuracy: 0.8061 Error: 0.50324 Loss: 0.53725 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.19s\n", + "1866240 Examples seen. Accuracy: 0.8048 Error: 0.59008 Loss: 0.80487 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "1866880 Examples seen. Accuracy: 0.8053 Error: 0.51714 Loss: 0.64627 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1867520 Examples seen. Accuracy: 0.8049 Error: 0.61171 Loss: 0.63743 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.18s\n", + "1868160 Examples seen. Accuracy: 0.8050 Error: 0.58211 Loss: 0.60876 Threads: 2 Forward time: 0.67s Backward time: 0.36s Step time: 2.19s\n", + "1868800 Examples seen. Accuracy: 0.8063 Error: 0.39926 Loss: 0.38141 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.20s\n", + "1869440 Examples seen. Accuracy: 0.8059 Error: 0.44298 Loss: 0.57650 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.23s\n", + "1870080 Examples seen. Accuracy: 0.8031 Error: 0.39993 Loss: 0.36993 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.27s\n", + "1870720 Examples seen. Accuracy: 0.8033 Error: 0.51379 Loss: 0.64816 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1871360 Examples seen. Accuracy: 0.8020 Error: 0.35818 Loss: 0.35101 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.24s\n", + "1872000 Examples seen. Accuracy: 0.7990 Error: 0.52422 Loss: 0.48197 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.31s\n", + "1872640 Examples seen. Accuracy: 0.8000 Error: 0.43256 Loss: 0.50256 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1873280 Examples seen. Accuracy: 0.8009 Error: 0.55520 Loss: 0.60948 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1873920 Examples seen. Accuracy: 0.8036 Error: 0.44829 Loss: 0.39442 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1874560 Examples seen. Accuracy: 0.8031 Error: 0.54034 Loss: 0.50079 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "1875200 Examples seen. Accuracy: 0.8047 Error: 0.43847 Loss: 0.47462 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1875840 Examples seen. Accuracy: 0.8076 Error: 0.34572 Loss: 0.26925 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.25s\n", + "1876480 Examples seen. Accuracy: 0.8081 Error: 0.48546 Loss: 0.46712 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1877120 Examples seen. Accuracy: 0.8082 Error: 0.44968 Loss: 0.56125 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1877760 Examples seen. Accuracy: 0.8119 Error: 0.48711 Loss: 0.47384 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1878400 Examples seen. Accuracy: 0.8125 Error: 0.46647 Loss: 0.43919 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.26s\n", + "1879040 Examples seen. Accuracy: 0.8119 Error: 0.48567 Loss: 0.48658 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.26s\n", + "1879680 Examples seen. Accuracy: 0.8086 Error: 0.50921 Loss: 0.54014 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 47 Examples seen:1880000 Validation Accuracy: 0.8461 Validation Error: 0.4358 Validation Loss: 0.4672 Total time: 164.95min\n", + "Epoch time: 2.3156 minutes. 50 epochs: 1.9297 hours.\n", + "Epochs: 47. Working time: 2.75 hours.\n", + "1880640 Examples seen. Accuracy: 0.8078 Error: 0.54139 Loss: 0.56009 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1881280 Examples seen. Accuracy: 0.8081 Error: 0.56727 Loss: 0.68376 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "1881920 Examples seen. Accuracy: 0.8099 Error: 0.49809 Loss: 0.43852 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1882560 Examples seen. Accuracy: 0.8106 Error: 0.61307 Loss: 0.66965 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1883200 Examples seen. Accuracy: 0.8106 Error: 0.58100 Loss: 0.75292 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1883840 Examples seen. Accuracy: 0.8100 Error: 0.47796 Loss: 0.54201 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.18s\n", + "1884480 Examples seen. Accuracy: 0.8087 Error: 0.60912 Loss: 0.61059 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.20s\n", + "1885120 Examples seen. Accuracy: 0.8078 Error: 0.50626 Loss: 0.60628 Threads: 2 Forward time: 0.72s Backward time: 0.38s Step time: 2.26s\n", + "1885760 Examples seen. Accuracy: 0.8063 Error: 0.40853 Loss: 0.41381 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1886400 Examples seen. Accuracy: 0.8082 Error: 0.39194 Loss: 0.36214 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "1887040 Examples seen. Accuracy: 0.8087 Error: 0.56075 Loss: 0.75945 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1887680 Examples seen. Accuracy: 0.8104 Error: 0.56582 Loss: 0.70844 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1888320 Examples seen. Accuracy: 0.8086 Error: 0.55529 Loss: 0.61516 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1888960 Examples seen. Accuracy: 0.8080 Error: 0.54487 Loss: 0.69047 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.28s\n", + "1889600 Examples seen. Accuracy: 0.8081 Error: 0.47768 Loss: 0.49453 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1890240 Examples seen. Accuracy: 0.8070 Error: 0.50376 Loss: 0.44492 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "1890880 Examples seen. Accuracy: 0.8088 Error: 0.55881 Loss: 0.52958 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1891520 Examples seen. Accuracy: 0.8093 Error: 0.51281 Loss: 0.48524 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "1892160 Examples seen. Accuracy: 0.8078 Error: 0.49099 Loss: 0.53273 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.20s\n", + "1892800 Examples seen. Accuracy: 0.8055 Error: 0.48062 Loss: 0.52319 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "1893440 Examples seen. Accuracy: 0.8066 Error: 0.54917 Loss: 0.69473 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1894080 Examples seen. Accuracy: 0.8054 Error: 0.54562 Loss: 0.82806 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1894720 Examples seen. Accuracy: 0.8063 Error: 0.54859 Loss: 0.55954 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "1895360 Examples seen. Accuracy: 0.8057 Error: 0.53813 Loss: 0.62381 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1896000 Examples seen. Accuracy: 0.8054 Error: 0.58170 Loss: 0.62785 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1896640 Examples seen. Accuracy: 0.8037 Error: 0.59521 Loss: 0.63108 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1897280 Examples seen. Accuracy: 0.8029 Error: 0.43521 Loss: 0.44068 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1897920 Examples seen. Accuracy: 0.8008 Error: 0.56656 Loss: 0.59633 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "1898560 Examples seen. Accuracy: 0.8048 Error: 0.56983 Loss: 0.61642 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1899200 Examples seen. Accuracy: 0.8038 Error: 0.62338 Loss: 0.77100 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1899840 Examples seen. Accuracy: 0.8056 Error: 0.50801 Loss: 0.58874 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.19s\n", + "1900480 Examples seen. Accuracy: 0.8072 Error: 0.51230 Loss: 0.65778 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "1901120 Examples seen. Accuracy: 0.8053 Error: 0.44799 Loss: 0.44683 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1901760 Examples seen. Accuracy: 0.8059 Error: 0.53390 Loss: 0.66761 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1902400 Examples seen. Accuracy: 0.8093 Error: 0.48644 Loss: 0.55300 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1903040 Examples seen. Accuracy: 0.8082 Error: 0.49504 Loss: 0.52673 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.20s\n", + "1903680 Examples seen. Accuracy: 0.8057 Error: 0.50122 Loss: 0.60549 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.20s\n", + "1904320 Examples seen. Accuracy: 0.8043 Error: 0.63480 Loss: 0.67013 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1904960 Examples seen. Accuracy: 0.8055 Error: 0.47658 Loss: 0.59252 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1905600 Examples seen. Accuracy: 0.8044 Error: 0.53787 Loss: 0.60134 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "1906240 Examples seen. Accuracy: 0.8060 Error: 0.46180 Loss: 0.49688 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1906880 Examples seen. Accuracy: 0.8052 Error: 0.60323 Loss: 0.84103 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.21s\n", + "1907520 Examples seen. Accuracy: 0.8063 Error: 0.38955 Loss: 0.35543 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.23s\n", + "1908160 Examples seen. Accuracy: 0.8086 Error: 0.32895 Loss: 0.30417 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1908800 Examples seen. Accuracy: 0.8081 Error: 0.51247 Loss: 0.53960 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1909440 Examples seen. Accuracy: 0.8078 Error: 0.49790 Loss: 0.46333 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1910080 Examples seen. Accuracy: 0.8107 Error: 0.57926 Loss: 0.70562 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "1910720 Examples seen. Accuracy: 0.8104 Error: 0.37037 Loss: 0.34442 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.23s\n", + "1911360 Examples seen. Accuracy: 0.8117 Error: 0.47477 Loss: 0.43443 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1912000 Examples seen. Accuracy: 0.8113 Error: 0.57675 Loss: 0.71690 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1912640 Examples seen. Accuracy: 0.8114 Error: 0.60334 Loss: 0.70678 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1913280 Examples seen. Accuracy: 0.8095 Error: 0.54639 Loss: 0.49200 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1913920 Examples seen. Accuracy: 0.8086 Error: 0.65630 Loss: 0.67223 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.22s\n", + "1914560 Examples seen. Accuracy: 0.8084 Error: 0.37847 Loss: 0.35262 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "1915200 Examples seen. Accuracy: 0.8067 Error: 0.54743 Loss: 0.54633 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "1915840 Examples seen. Accuracy: 0.8074 Error: 0.67685 Loss: 0.81249 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.22s\n", + "1916480 Examples seen. Accuracy: 0.8070 Error: 0.48081 Loss: 0.54769 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "1917120 Examples seen. Accuracy: 0.8069 Error: 0.62720 Loss: 0.60286 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "1917760 Examples seen. Accuracy: 0.8077 Error: 0.59288 Loss: 0.66478 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "1918400 Examples seen. Accuracy: 0.8069 Error: 0.45460 Loss: 0.45116 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1919040 Examples seen. Accuracy: 0.8099 Error: 0.40712 Loss: 0.30144 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1919680 Examples seen. Accuracy: 0.8110 Error: 0.57006 Loss: 0.55709 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 48 Examples seen:1920000 Validation Accuracy: 0.8471 Validation Error: 0.4340 Validation Loss: 0.4655 Total time: 168.31min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.615 Min Weight: -0.624 Max Output: 5.370 Min Output: -5.961 TNNetConvolutionLinear 32,32,64 Times: 30.17s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.370 Min Output: -1.308 TNNetMaxPool 8,8,64 Times: 6.89s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.928 Min Weight: 0.888 Max Output: 5.003 Min Output: -2.518 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.287 Min Weight: -0.361 Max Output: 10.704 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.26s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.366 Min Weight: -0.329 Max Output: 11.567 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.11s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.341 Min Weight: -0.262 Max Output: 7.479 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.27s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.220 Min Weight: -0.222 Max Output: 3.229 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.17s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.229 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.04s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.229 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.40s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.322 Min Weight: -0.269 Max Output: 5.344 Min Output: -10.851 TNNetFullConnectLinear 10,1,1 Times: 0.12s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.541 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.2833 minutes. 50 epochs: 1.9028 hours.\n", + "Epochs: 48. Working time: 2.81 hours.\n", + "1920640 Examples seen. Accuracy: 0.8138 Error: 0.50093 Loss: 0.50409 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "1921280 Examples seen. Accuracy: 0.8136 Error: 0.42382 Loss: 0.38492 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1921920 Examples seen. Accuracy: 0.8121 Error: 0.64389 Loss: 0.69866 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "1922560 Examples seen. Accuracy: 0.8096 Error: 0.59103 Loss: 0.71368 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1923200 Examples seen. Accuracy: 0.8098 Error: 0.49093 Loss: 0.49587 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1923840 Examples seen. Accuracy: 0.8110 Error: 0.56455 Loss: 0.58051 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1924480 Examples seen. Accuracy: 0.8114 Error: 0.47479 Loss: 0.55061 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "1925120 Examples seen. Accuracy: 0.8111 Error: 0.46263 Loss: 0.50340 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "1925760 Examples seen. Accuracy: 0.8095 Error: 0.60998 Loss: 0.71820 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1926400 Examples seen. Accuracy: 0.8105 Error: 0.36097 Loss: 0.40560 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.20s\n", + "1927040 Examples seen. Accuracy: 0.8106 Error: 0.50679 Loss: 0.46585 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1927680 Examples seen. Accuracy: 0.8109 Error: 0.55296 Loss: 0.54762 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.22s\n", + "1928320 Examples seen. Accuracy: 0.8120 Error: 0.55677 Loss: 0.64495 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.20s\n", + "1928960 Examples seen. Accuracy: 0.8130 Error: 0.46066 Loss: 0.44279 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.18s\n", + "1929600 Examples seen. Accuracy: 0.8140 Error: 0.41416 Loss: 0.38152 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.24s\n", + "1930240 Examples seen. Accuracy: 0.8148 Error: 0.45348 Loss: 0.44263 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.25s\n", + "1930880 Examples seen. Accuracy: 0.8099 Error: 0.63283 Loss: 0.67863 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.21s\n", + "1931520 Examples seen. Accuracy: 0.8086 Error: 0.51092 Loss: 0.49371 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.27s\n", + "1932160 Examples seen. Accuracy: 0.8102 Error: 0.44514 Loss: 0.43048 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1932800 Examples seen. Accuracy: 0.8094 Error: 0.63867 Loss: 0.62604 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1933440 Examples seen. Accuracy: 0.8124 Error: 0.47405 Loss: 0.44067 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "1934080 Examples seen. Accuracy: 0.8132 Error: 0.36214 Loss: 0.34664 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "1934720 Examples seen. Accuracy: 0.8126 Error: 0.48852 Loss: 0.40766 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.25s\n", + "1935360 Examples seen. Accuracy: 0.8107 Error: 0.55911 Loss: 0.59137 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1936000 Examples seen. Accuracy: 0.8097 Error: 0.63318 Loss: 0.56502 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.24s\n", + "1936640 Examples seen. Accuracy: 0.8102 Error: 0.48249 Loss: 0.45195 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.21s\n", + "1937280 Examples seen. Accuracy: 0.8136 Error: 0.52887 Loss: 0.48031 Threads: 2 Forward time: 0.65s Backward time: 0.37s Step time: 2.20s\n", + "1937920 Examples seen. Accuracy: 0.8133 Error: 0.37443 Loss: 0.36349 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.19s\n", + "1938560 Examples seen. Accuracy: 0.8113 Error: 0.59044 Loss: 0.69063 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1939200 Examples seen. Accuracy: 0.8103 Error: 0.54198 Loss: 0.54411 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1939840 Examples seen. Accuracy: 0.8099 Error: 0.48984 Loss: 0.50818 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.27s\n", + "1940480 Examples seen. Accuracy: 0.8121 Error: 0.59723 Loss: 0.68765 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1941120 Examples seen. Accuracy: 0.8104 Error: 0.61404 Loss: 0.65054 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "1941760 Examples seen. Accuracy: 0.8110 Error: 0.58600 Loss: 0.83993 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.18s\n", + "1942400 Examples seen. Accuracy: 0.8119 Error: 0.42922 Loss: 0.44746 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.20s\n", + "1943040 Examples seen. Accuracy: 0.8103 Error: 0.47263 Loss: 0.55942 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1943680 Examples seen. Accuracy: 0.8069 Error: 0.48092 Loss: 0.45713 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.19s\n", + "1944320 Examples seen. Accuracy: 0.8077 Error: 0.46355 Loss: 0.42463 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.25s\n", + "1944960 Examples seen. Accuracy: 0.8068 Error: 0.48739 Loss: 0.46850 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1945600 Examples seen. Accuracy: 0.8078 Error: 0.58375 Loss: 0.79021 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1946240 Examples seen. Accuracy: 0.8083 Error: 0.44738 Loss: 0.39088 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "1946880 Examples seen. Accuracy: 0.8089 Error: 0.52736 Loss: 0.59547 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1947520 Examples seen. Accuracy: 0.8101 Error: 0.47553 Loss: 0.45973 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1948160 Examples seen. Accuracy: 0.8104 Error: 0.58103 Loss: 0.77457 Threads: 2 Forward time: 0.70s Backward time: 0.37s Step time: 2.23s\n", + "1948800 Examples seen. Accuracy: 0.8092 Error: 0.55348 Loss: 0.60071 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1949440 Examples seen. Accuracy: 0.8118 Error: 0.47113 Loss: 0.43825 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1950080 Examples seen. Accuracy: 0.8140 Error: 0.46416 Loss: 0.47955 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.23s\n", + "1950720 Examples seen. Accuracy: 0.8129 Error: 0.49415 Loss: 0.45426 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1951360 Examples seen. Accuracy: 0.8123 Error: 0.57079 Loss: 0.56431 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1952000 Examples seen. Accuracy: 0.8126 Error: 0.61713 Loss: 0.60112 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.21s\n", + "1952640 Examples seen. Accuracy: 0.8140 Error: 0.33224 Loss: 0.29115 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1953280 Examples seen. Accuracy: 0.8129 Error: 0.53382 Loss: 0.50491 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1953920 Examples seen. Accuracy: 0.8121 Error: 0.54572 Loss: 0.58553 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1954560 Examples seen. Accuracy: 0.8092 Error: 0.54420 Loss: 0.49624 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.21s\n", + "1955200 Examples seen. Accuracy: 0.8116 Error: 0.46305 Loss: 0.45468 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.20s\n", + "1955840 Examples seen. Accuracy: 0.8116 Error: 0.53085 Loss: 0.60465 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "1956480 Examples seen. Accuracy: 0.8125 Error: 0.60005 Loss: 0.62657 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1957120 Examples seen. Accuracy: 0.8133 Error: 0.62648 Loss: 0.67181 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.19s\n", + "1957760 Examples seen. Accuracy: 0.8141 Error: 0.59660 Loss: 0.64000 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "1958400 Examples seen. Accuracy: 0.8153 Error: 0.53871 Loss: 0.60181 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1959040 Examples seen. Accuracy: 0.8145 Error: 0.54917 Loss: 0.50352 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.19s\n", + "1959680 Examples seen. Accuracy: 0.8110 Error: 0.57082 Loss: 0.70858 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.21s\n", + "Starting Validation.\n", + "Epochs: 49 Examples seen:1960000 Validation Accuracy: 0.8467 Validation Error: 0.4330 Validation Loss: 0.4670 Total time: 171.67min\n", + "Epoch time: 2.3000 minutes. 50 epochs: 1.9167 hours.\n", + "Epochs: 49. Working time: 2.86 hours.\n", + "1960640 Examples seen. Accuracy: 0.8100 Error: 0.45957 Loss: 0.40462 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.34s\n", + "1961280 Examples seen. Accuracy: 0.8089 Error: 0.57411 Loss: 0.71178 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.32s\n", + "1961920 Examples seen. Accuracy: 0.8070 Error: 0.58835 Loss: 0.72774 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.32s\n", + "1962560 Examples seen. Accuracy: 0.8071 Error: 0.51441 Loss: 0.56713 Threads: 2 Forward time: 0.79s Backward time: 0.45s Step time: 2.38s\n", + "1963200 Examples seen. Accuracy: 0.8057 Error: 0.60466 Loss: 0.61726 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.40s\n", + "1963840 Examples seen. Accuracy: 0.8063 Error: 0.42496 Loss: 0.37403 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.29s\n", + "1964480 Examples seen. Accuracy: 0.8067 Error: 0.57526 Loss: 0.63215 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1965120 Examples seen. Accuracy: 0.8054 Error: 0.55087 Loss: 0.53794 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.24s\n", + "1965760 Examples seen. Accuracy: 0.8055 Error: 0.45622 Loss: 0.43673 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.24s\n", + "1966400 Examples seen. Accuracy: 0.8067 Error: 0.58231 Loss: 0.64266 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1967040 Examples seen. Accuracy: 0.8060 Error: 0.54395 Loss: 0.53295 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1967680 Examples seen. Accuracy: 0.8037 Error: 0.65669 Loss: 0.63776 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "1968320 Examples seen. Accuracy: 0.8030 Error: 0.59404 Loss: 0.74615 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.24s\n", + "1968960 Examples seen. Accuracy: 0.8041 Error: 0.67324 Loss: 0.71918 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "1969600 Examples seen. Accuracy: 0.8062 Error: 0.46650 Loss: 0.51092 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1970240 Examples seen. Accuracy: 0.8065 Error: 0.43729 Loss: 0.37835 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1970880 Examples seen. Accuracy: 0.8077 Error: 0.53524 Loss: 0.63282 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.28s\n", + "1971520 Examples seen. Accuracy: 0.8070 Error: 0.64358 Loss: 0.71935 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.29s\n", + "1972160 Examples seen. Accuracy: 0.8073 Error: 0.48978 Loss: 0.41765 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1972800 Examples seen. Accuracy: 0.8065 Error: 0.49182 Loss: 0.59439 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1973440 Examples seen. Accuracy: 0.8052 Error: 0.54001 Loss: 0.56961 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1974080 Examples seen. Accuracy: 0.8065 Error: 0.42105 Loss: 0.43186 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1974720 Examples seen. Accuracy: 0.8100 Error: 0.35631 Loss: 0.31772 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.24s\n", + "1975360 Examples seen. Accuracy: 0.8102 Error: 0.60557 Loss: 0.63095 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "1976000 Examples seen. Accuracy: 0.8126 Error: 0.60133 Loss: 0.68636 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.29s\n", + "1976640 Examples seen. Accuracy: 0.8126 Error: 0.46255 Loss: 0.44511 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.27s\n", + "1977280 Examples seen. Accuracy: 0.8142 Error: 0.42302 Loss: 0.47326 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1977920 Examples seen. Accuracy: 0.8155 Error: 0.52442 Loss: 0.52183 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.27s\n", + "1978560 Examples seen. Accuracy: 0.8158 Error: 0.51094 Loss: 0.46228 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1979200 Examples seen. Accuracy: 0.8150 Error: 0.59783 Loss: 0.59793 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.31s\n", + "1979840 Examples seen. Accuracy: 0.8158 Error: 0.47901 Loss: 0.51368 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1980480 Examples seen. Accuracy: 0.8152 Error: 0.39612 Loss: 0.40619 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.27s\n", + "1981120 Examples seen. Accuracy: 0.8149 Error: 0.50504 Loss: 0.49437 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1981760 Examples seen. Accuracy: 0.8124 Error: 0.49318 Loss: 0.53465 Threads: 2 Forward time: 0.71s Backward time: 0.37s Step time: 2.24s\n", + "1982400 Examples seen. Accuracy: 0.8100 Error: 0.62628 Loss: 0.69793 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1983040 Examples seen. Accuracy: 0.8098 Error: 0.49406 Loss: 0.49361 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "1983680 Examples seen. Accuracy: 0.8098 Error: 0.48432 Loss: 0.47630 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.32s\n", + "1984320 Examples seen. Accuracy: 0.8094 Error: 0.53666 Loss: 0.54689 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1984960 Examples seen. Accuracy: 0.8061 Error: 0.48903 Loss: 0.50320 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1985600 Examples seen. Accuracy: 0.8062 Error: 0.57331 Loss: 0.61513 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1986240 Examples seen. Accuracy: 0.8065 Error: 0.47005 Loss: 0.43056 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "1986880 Examples seen. Accuracy: 0.8076 Error: 0.44742 Loss: 0.49716 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1987520 Examples seen. Accuracy: 0.8073 Error: 0.57827 Loss: 0.53313 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "1988160 Examples seen. Accuracy: 0.8077 Error: 0.54712 Loss: 0.60738 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1988800 Examples seen. Accuracy: 0.8114 Error: 0.34752 Loss: 0.36562 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1989440 Examples seen. Accuracy: 0.8105 Error: 0.47211 Loss: 0.54768 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1990080 Examples seen. Accuracy: 0.8114 Error: 0.48211 Loss: 0.48761 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1990720 Examples seen. Accuracy: 0.8129 Error: 0.38580 Loss: 0.37487 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1991360 Examples seen. Accuracy: 0.8147 Error: 0.37795 Loss: 0.31157 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1992000 Examples seen. Accuracy: 0.8120 Error: 0.55512 Loss: 0.75219 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1992640 Examples seen. Accuracy: 0.8124 Error: 0.46599 Loss: 0.44235 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "1993280 Examples seen. Accuracy: 0.8118 Error: 0.38527 Loss: 0.33272 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.24s\n", + "1993920 Examples seen. Accuracy: 0.8093 Error: 0.70269 Loss: 0.79818 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1994560 Examples seen. Accuracy: 0.8082 Error: 0.52381 Loss: 0.50207 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.21s\n", + "1995200 Examples seen. Accuracy: 0.8065 Error: 0.45808 Loss: 0.43119 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "1995840 Examples seen. Accuracy: 0.8091 Error: 0.48418 Loss: 0.61899 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1996480 Examples seen. Accuracy: 0.8083 Error: 0.53391 Loss: 0.53823 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "1997120 Examples seen. Accuracy: 0.8079 Error: 0.47216 Loss: 0.51692 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "1997760 Examples seen. Accuracy: 0.8078 Error: 0.56156 Loss: 0.68294 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1998400 Examples seen. Accuracy: 0.8047 Error: 0.52817 Loss: 0.55287 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.29s\n", + "1999040 Examples seen. Accuracy: 0.8064 Error: 0.52653 Loss: 0.52088 Threads: 2 Forward time: 0.70s Backward time: 0.37s Step time: 2.27s\n", + "1999680 Examples seen. Accuracy: 0.8079 Error: 0.45205 Loss: 0.43995 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.22s\n", + "Starting Validation.\n", + "Epochs: 50 Examples seen:2000000 Validation Accuracy: 0.8461 Validation Error: 0.4314 Validation Loss: 0.4663 Total time: 175.07min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.626 Min Weight: -0.628 Max Output: 5.432 Min Output: -5.954 TNNetConvolutionLinear 32,32,64 Times: 30.24s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.432 Min Output: -1.371 TNNetMaxPool 8,8,64 Times: 7.01s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.937 Min Weight: 0.897 Max Output: 5.009 Min Output: -2.571 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.290 Min Weight: -0.370 Max Output: 10.887 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.22s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.376 Min Weight: -0.336 Max Output: 11.827 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.13s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.346 Min Weight: -0.269 Max Output: 7.334 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.21s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.215 Min Weight: -0.224 Max Output: 3.276 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.15s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.276 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.276 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.35s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.319 Min Weight: -0.273 Max Output: 5.777 Min Output: -10.742 TNNetFullConnectLinear 10,1,1 Times: 0.13s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.608 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Starting Testing.\n", + "Epochs: 50 Examples seen:2000000 Test Accuracy: 0.8393 Test Error: 0.4457 Test Loss: 0.4874 Total time: 176.12min\n", + "Epoch time: 2.3167 minutes. 50 epochs: 1.9306 hours.\n", + "Epochs: 50. Working time: 2.94 hours.\n", + "Finished.\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "gx8P5ODRCC3e" + }, + "source": [ + "from google.colab import files" + ], + "execution_count": 17, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "aZ4Tp6D6Pqq6", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 294 + }, + "outputId": "a76623a4-9f73-4a93-dfb3-f0e76356ac06" + }, + "source": [ + "files.download('SimpleImageClassifier.nn')" + ], + "execution_count": 18, + "outputs": [ + { + "output_type": "error", + "ename": "FileNotFoundError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfiles\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdownload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'SimpleImageClassifier.nn'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/usr/local/lib/python3.7/dist-packages/google/colab/files.py\u001b[0m in \u001b[0;36mdownload\u001b[0;34m(filename)\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mOSError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 142\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 143\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mFileNotFoundError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# pylint: disable=undefined-variable\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 144\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 145\u001b[0m \u001b[0mcomm_manager\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_IPython\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_ipython\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkernel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcomm_manager\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mFileNotFoundError\u001b[0m: Cannot find file: SimpleImageClassifier.nn" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "ZnSKco6Ene3u" + }, + "source": [ + "" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "zHtuMFPQLsYf", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 294 + }, + "outputId": "600bc4f6-aadc-4993-9079-773fe1282fab" + }, + "source": [ + "files.download('SimpleImageClassifier.csv')" + ], + "execution_count": 16, + "outputs": [ + { + "output_type": "error", + "ename": "FileNotFoundError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfiles\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdownload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'SimpleImageClassifier.csv'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/usr/local/lib/python3.7/dist-packages/google/colab/files.py\u001b[0m in \u001b[0;36mdownload\u001b[0;34m(filename)\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mOSError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 142\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 143\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mFileNotFoundError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# pylint: disable=undefined-variable\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 144\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 145\u001b[0m \u001b[0mcomm_manager\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_IPython\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_ipython\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkernel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcomm_manager\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mFileNotFoundError\u001b[0m: Cannot find file: SimpleImageClassifier.csv" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/EKON24_SimpleImageClassificationCPU_2021.ipynb b/EKON24_SimpleImageClassificationCPU_2021.ipynb new file mode 100644 index 00000000..b9630ce6 --- /dev/null +++ b/EKON24_SimpleImageClassificationCPU_2021.ipynb @@ -0,0 +1,5317 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "EKON24_SimpleImageClassificationCPU.ipynb", + "provenance": [], + "collapsed_sections": [], + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "qAy5FJaX1dsa", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "9af72430-d7c8-4d07-9c32-a38384e891af" + }, + "source": [ + "!apt-get update" + ], + "execution_count": 1, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\r0% [Working]\r \rIgn:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease\n", + "\r0% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com] [Wait\r \rGet:2 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ InRelease [3,626 B]\n", + "\r0% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com] [2 In\r0% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com] [Conn\r \rIgn:3 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 InRelease\n", + "\r0% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com] [Conn\r0% [2 InRelease gpgv 3,626 B] [Connecting to archive.ubuntu.com] [Connecting to\r \rHit:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 Release\n", + "Hit:5 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 Release\n", + "Get:6 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]\n", + "Get:7 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages [67.4 kB]\n", + "Get:8 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic InRelease [15.9 kB]\n", + "Hit:9 http://archive.ubuntu.com/ubuntu bionic InRelease\n", + "Get:11 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]\n", + "Hit:13 http://ppa.launchpad.net/cran/libgit2/ubuntu bionic InRelease\n", + "Get:14 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]\n", + "Hit:15 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease\n", + "Get:16 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [581 kB]\n", + "Hit:17 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease\n", + "Get:18 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1,428 kB]\n", + "Get:19 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic/main Sources [1,802 kB]\n", + "Get:20 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [2,335 kB]\n", + "Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2,202 kB]\n", + "Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [613 kB]\n", + "Get:23 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic/main amd64 Packages [922 kB]\n", + "Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2,770 kB]\n", + "Fetched 13.0 MB in 4s (3,425 kB/s)\n", + "Reading package lists... Done\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "UHZcHLryCbir", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "81239abd-9f9b-4471-ceb0-6209272b0644" + }, + "source": [ + "!apt-get install fpc fpc-source lazarus git subversion" + ], + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Reading package lists... Done\n", + "Building dependency tree \n", + "Reading state information... Done\n", + "git is already the newest version (1:2.17.1-1ubuntu0.9).\n", + "The following additional packages will be installed:\n", + " autoconf automake autopoint autotools-dev debhelper dh-autoreconf\n", + " dh-strip-nondeterminism file fp-compiler-3.0.4 fp-docs-3.0.4 fp-ide-3.0.4\n", + " fp-units-base-3.0.4 fp-units-db-3.0.4 fp-units-fcl-3.0.4 fp-units-fv-3.0.4\n", + " fp-units-gfx-3.0.4 fp-units-gtk2-3.0.4 fp-units-math-3.0.4\n", + " fp-units-misc-3.0.4 fp-units-multimedia-3.0.4 fp-units-net-3.0.4\n", + " fp-units-rtl-3.0.4 fp-utils-3.0.4 fpc-3.0.4 fpc-source-3.0.4 gdb gdbserver\n", + " gettext gettext-base gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0\n", + " gir1.2-gtk-2.0 gir1.2-pango-1.0 intltool-debian lazarus-1.8 lazarus-doc-1.8\n", + " lazarus-ide lazarus-ide-1.8 lazarus-ide-gtk2-1.8 lazarus-src-1.8 lcl-1.8\n", + " lcl-gtk2-1.8 lcl-nogui-1.8 lcl-units-1.8 lcl-utils-1.8 liba52-0.7.4\n", + " liba52-0.7.4-dev libapr1 libaprutil1 libarchive-cpio-perl\n", + " libarchive-zip-perl libatk1.0-dev libbabeltrace1 libc6-dbg libcaca-dev\n", + " libcairo-script-interpreter2 libcairo2-dev libdca-dev libdca0 libdts-dev\n", + " libdw1 libfile-stripnondeterminism-perl libfluidsynth1 libforms-dev\n", + " libforms2 libgail-common libgail18 libgd-dev libgdk-pixbuf2.0-dev libgmp-dev\n", + " libgmpxx4ldbl libgraphviz-dev libgtk2.0-0 libgtk2.0-bin libgtk2.0-common\n", + " libgtk2.0-dev libgvc6-plugins-gtk libmad0 libmad0-dev libmagic-mgc libmagic1\n", + " libmail-sendmail-perl libmikmod-config libmikmod-dev libmikmod3\n", + " libmodplug-dev libmodplug1 libpango1.0-dev libpangoxft-1.0-0 libpixman-1-dev\n", + " libproxy-tools libpulse-dev libpulse-mainloop-glib0 libsdl-mixer1.2\n", + " libsdl-mixer1.2-dev libsdl1.2-dev libsdl1.2debian libserf-1-1 libsigsegv2\n", + " libslang2-dev libsvn1 libsys-hostname-long-perl libtimedate-perl libtool\n", + " libvlc-bin libvlc-dev libvlc5 libvlccore9 libvpx-dev libxcb-shm0-dev\n", + " libxcomposite-dev libxcursor-dev libxdot4 libxinerama-dev libxml2-utils\n", + " libxpm-dev libxrandr-dev libxxf86dga-dev libxxf86dga1 m4 po-debconf\n", + " timgm6mb-soundfont x11proto-composite-dev x11proto-randr-dev\n", + " x11proto-xf86dga-dev x11proto-xinerama-dev\n", + "Suggested packages:\n", + " autoconf-archive gnu-standards autoconf-doc dh-make dwz firebird-dev\n", + " freetds-dev libgdbm-dev pxlib-dev gdb-doc gettext-doc libasprintf-dev\n", + " libgettextpo-dev libcairo2-doc libforms-bin libforms-doc gmp-doc\n", + " libgmp10-doc libmpfr-dev gvfs libgtk2.0-doc imagemagick libpango1.0-doc\n", + " libtool-doc gcj-jdk m4-doc libmail-box-perl db5.3-util libapache2-mod-svn\n", + " subversion-tools fluid-soundfont-gm fluidsynth timidity musescore\n", + "Recommended packages:\n", + " libggi2-dev\n", + "The following NEW packages will be installed:\n", + " autoconf automake autopoint autotools-dev debhelper dh-autoreconf\n", + " dh-strip-nondeterminism file fp-compiler-3.0.4 fp-docs-3.0.4 fp-ide-3.0.4\n", + " fp-units-base-3.0.4 fp-units-db-3.0.4 fp-units-fcl-3.0.4 fp-units-fv-3.0.4\n", + " fp-units-gfx-3.0.4 fp-units-gtk2-3.0.4 fp-units-math-3.0.4\n", + " fp-units-misc-3.0.4 fp-units-multimedia-3.0.4 fp-units-net-3.0.4\n", + " fp-units-rtl-3.0.4 fp-utils-3.0.4 fpc fpc-3.0.4 fpc-source fpc-source-3.0.4\n", + " gdb gdbserver gettext gettext-base gir1.2-atk-1.0 gir1.2-freedesktop\n", + " gir1.2-gdkpixbuf-2.0 gir1.2-gtk-2.0 gir1.2-pango-1.0 intltool-debian lazarus\n", + " lazarus-1.8 lazarus-doc-1.8 lazarus-ide lazarus-ide-1.8 lazarus-ide-gtk2-1.8\n", + " lazarus-src-1.8 lcl-1.8 lcl-gtk2-1.8 lcl-nogui-1.8 lcl-units-1.8\n", + " lcl-utils-1.8 liba52-0.7.4 liba52-0.7.4-dev libapr1 libaprutil1\n", + " libarchive-cpio-perl libarchive-zip-perl libatk1.0-dev libbabeltrace1\n", + " libc6-dbg libcaca-dev libcairo-script-interpreter2 libcairo2-dev libdca-dev\n", + " libdca0 libdts-dev libdw1 libfile-stripnondeterminism-perl libfluidsynth1\n", + " libforms-dev libforms2 libgail-common libgail18 libgd-dev\n", + " libgdk-pixbuf2.0-dev libgmp-dev libgmpxx4ldbl libgraphviz-dev libgtk2.0-0\n", + " libgtk2.0-bin libgtk2.0-common libgtk2.0-dev libgvc6-plugins-gtk libmad0\n", + " libmad0-dev libmagic-mgc libmagic1 libmail-sendmail-perl libmikmod-config\n", + " libmikmod-dev libmikmod3 libmodplug-dev libmodplug1 libpango1.0-dev\n", + " libpangoxft-1.0-0 libpixman-1-dev libproxy-tools libpulse-dev\n", + " libpulse-mainloop-glib0 libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl1.2-dev\n", + " libsdl1.2debian libserf-1-1 libsigsegv2 libslang2-dev libsvn1\n", + " libsys-hostname-long-perl libtimedate-perl libtool libvlc-bin libvlc-dev\n", + " libvlc5 libvlccore9 libvpx-dev libxcb-shm0-dev libxcomposite-dev\n", + " libxcursor-dev libxdot4 libxinerama-dev libxml2-utils libxpm-dev\n", + " libxrandr-dev libxxf86dga-dev libxxf86dga1 m4 po-debconf subversion\n", + " timgm6mb-soundfont x11proto-composite-dev x11proto-randr-dev\n", + " x11proto-xf86dga-dev x11proto-xinerama-dev\n", + "0 upgraded, 131 newly installed, 0 to remove and 61 not upgraded.\n", + "Need to get 166 MB of archives.\n", + "After this operation, 1,259 MB of additional disk space will be used.\n", + "Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxxf86dga1 amd64 2:1.1.4-1 [13.7 kB]\n", + "Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic-mgc amd64 1:5.32-2ubuntu0.4 [184 kB]\n", + "Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.4 [68.6 kB]\n", + "Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 file amd64 1:5.32-2ubuntu0.4 [22.1 kB]\n", + "Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gettext-base amd64 0.19.8.1-6ubuntu0.3 [113 kB]\n", + "Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsigsegv2 amd64 2.12-1 [14.7 kB]\n", + "Get:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 m4 amd64 1.4.18-1 [197 kB]\n", + "Get:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 autoconf all 2.69-11 [322 kB]\n", + "Get:9 http://archive.ubuntu.com/ubuntu bionic/main amd64 autotools-dev all 20180224.1 [39.6 kB]\n", + "Get:10 http://archive.ubuntu.com/ubuntu bionic/main amd64 automake all 1:1.15.1-3ubuntu2 [509 kB]\n", + "Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 autopoint all 0.19.8.1-6ubuntu0.3 [426 kB]\n", + "Get:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtool all 2.4.6-2 [194 kB]\n", + "Get:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 dh-autoreconf all 17 [15.8 kB]\n", + "Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libarchive-zip-perl all 1.60-1ubuntu0.1 [84.6 kB]\n", + "Get:15 http://archive.ubuntu.com/ubuntu bionic/main amd64 libfile-stripnondeterminism-perl all 0.040-1.1~build1 [13.8 kB]\n", + "Get:16 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB]\n", + "Get:17 http://archive.ubuntu.com/ubuntu bionic/main amd64 dh-strip-nondeterminism all 0.040-1.1~build1 [5,208 B]\n", + "Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gettext amd64 0.19.8.1-6ubuntu0.3 [1,293 kB]\n", + "Get:19 http://archive.ubuntu.com/ubuntu bionic/main amd64 intltool-debian all 0.35.0+20060710.4 [24.9 kB]\n", + "Get:20 http://archive.ubuntu.com/ubuntu bionic/main amd64 po-debconf all 1.0.20 [232 kB]\n", + "Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 debhelper all 11.1.6ubuntu2 [902 kB]\n", + "Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-rtl-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [2,039 kB]\n", + "Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-compiler-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,949 kB]\n", + "Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-docs-3.0.4 all 3.0.4+dfsg-18ubuntu2 [882 kB]\n", + "Get:25 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-ide-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,453 kB]\n", + "Get:26 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-base-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,050 kB]\n", + "Get:27 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-db-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [745 kB]\n", + "Get:28 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-fcl-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [4,798 kB]\n", + "Get:29 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-fv-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [297 kB]\n", + "Get:30 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-gfx-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,099 kB]\n", + "Get:31 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-common all 2.24.32-1ubuntu1 [125 kB]\n", + "Get:32 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-0 amd64 2.24.32-1ubuntu1 [1,769 kB]\n", + "Get:33 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-atk-1.0 amd64 2.28.1-1 [17.8 kB]\n", + "Get:34 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-freedesktop amd64 1.56.1-1 [9,080 B]\n", + "Get:35 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-gdkpixbuf-2.0 amd64 2.36.11-2 [7,748 B]\n", + "Get:36 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpangoxft-1.0-0 amd64 1.40.14-1ubuntu0.1 [15.0 kB]\n", + "Get:37 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gir1.2-pango-1.0 amd64 1.40.14-1ubuntu0.1 [21.6 kB]\n", + "Get:38 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-gtk-2.0 amd64 2.24.32-1ubuntu1 [172 kB]\n", + "Get:39 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgdk-pixbuf2.0-dev amd64 2.36.11-2 [46.8 kB]\n", + "Get:40 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcairo-script-interpreter2 amd64 1.15.10-2ubuntu0.1 [53.5 kB]\n", + "Get:41 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpixman-1-dev amd64 0.34.0-2 [244 kB]\n", + "Get:42 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxcb-shm0-dev amd64 1.13-2~ubuntu18.04 [6,684 B]\n", + "Get:43 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcairo2-dev amd64 1.15.10-2ubuntu0.1 [626 kB]\n", + "Get:44 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpango1.0-dev amd64 1.40.14-1ubuntu0.1 [288 kB]\n", + "Get:45 http://archive.ubuntu.com/ubuntu bionic/main amd64 libatk1.0-dev amd64 2.28.1-1 [79.9 kB]\n", + "Get:46 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-xinerama-dev all 2018.4-4 [2,628 B]\n", + "Get:47 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxinerama-dev amd64 2:1.1.3-1 [8,404 B]\n", + "Get:48 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-randr-dev all 2018.4-4 [2,620 B]\n", + "Get:49 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxrandr-dev amd64 2:1.5.1-1 [24.0 kB]\n", + "Get:50 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxcursor-dev amd64 1:1.1.15-1 [26.5 kB]\n", + "Get:51 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-composite-dev all 1:2018.4-4 [2,620 B]\n", + "Get:52 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxcomposite-dev amd64 1:0.4.4-2 [9,136 B]\n", + "Get:53 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxml2-utils amd64 2.9.4+dfsg1-6.1ubuntu1.4 [35.8 kB]\n", + "Get:54 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-dev amd64 2.24.32-1ubuntu1 [2,652 kB]\n", + "Get:55 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-gtk2-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,013 kB]\n", + "Get:56 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-math-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [344 kB]\n", + "Get:57 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-misc-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,087 kB]\n", + "Get:58 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-multimedia-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [208 kB]\n", + "Get:59 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-net-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [5,416 kB]\n", + "Get:60 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc-source-3.0.4 all 3.0.4+dfsg-18ubuntu2 [17.0 MB]\n", + "Get:61 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-utils-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [2,758 kB]\n", + "Get:62 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc-3.0.4 all 3.0.4+dfsg-18ubuntu2 [24.4 kB]\n", + "Get:63 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc all 3.0.4+dfsg-18ubuntu2 [23.9 kB]\n", + "Get:64 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc-source all 3.0.4+dfsg-18ubuntu2 [23.9 kB]\n", + "Get:65 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdw1 amd64 0.170-0.4ubuntu0.1 [203 kB]\n", + "Get:66 http://archive.ubuntu.com/ubuntu bionic/main amd64 libbabeltrace1 amd64 1.5.5-1 [154 kB]\n", + "Get:67 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gdb amd64 8.1.1-0ubuntu1 [2,937 kB]\n", + "Get:68 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gdbserver amd64 8.1.1-0ubuntu1 [282 kB]\n", + "Get:69 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-ide-1.8 amd64 1.8.2+dfsg-3 [8,386 kB]\n", + "Get:70 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-ide-gtk2-1.8 amd64 1.8.2+dfsg-3 [14.1 MB]\n", + "Get:71 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-ide all 1.8.2+dfsg-3 [28.9 kB]\n", + "Get:72 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-src-1.8 all 1.8.2+dfsg-3 [15.6 MB]\n", + "Get:73 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-nogui-1.8 amd64 1.8.2+dfsg-3 [6,637 kB]\n", + "Get:74 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-gtk2-1.8 amd64 1.8.2+dfsg-3 [8,523 kB]\n", + "Get:75 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-units-1.8 amd64 1.8.2+dfsg-3 [14.3 MB]\n", + "Get:76 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-utils-1.8 amd64 1.8.2+dfsg-3 [6,694 kB]\n", + "Get:77 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-1.8 amd64 1.8.2+dfsg-3 [28.9 kB]\n", + "Get:78 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-1.8 all 1.8.2+dfsg-3 [29.4 kB]\n", + "Get:79 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus all 1.8.2+dfsg-3 [28.8 kB]\n", + "Get:80 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-doc-1.8 all 1.8.2+dfsg-3 [15.1 MB]\n", + "Get:81 http://archive.ubuntu.com/ubuntu bionic/universe amd64 liba52-0.7.4 amd64 0.7.4-19 [35.2 kB]\n", + "Get:82 http://archive.ubuntu.com/ubuntu bionic/universe amd64 liba52-0.7.4-dev amd64 0.7.4-19 [47.5 kB]\n", + "Get:83 http://archive.ubuntu.com/ubuntu bionic/main amd64 libapr1 amd64 1.6.3-2 [90.9 kB]\n", + "Get:84 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1 amd64 1.6.1-2 [84.4 kB]\n", + "Get:85 http://archive.ubuntu.com/ubuntu bionic/main amd64 libarchive-cpio-perl all 0.10-1 [9,644 B]\n", + "Get:86 http://archive.ubuntu.com/ubuntu bionic/main amd64 libslang2-dev amd64 2.3.1a-3ubuntu1 [393 kB]\n", + "Get:87 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcaca-dev amd64 0.99.beta19-2ubuntu0.18.04.2 [747 kB]\n", + "Get:88 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libfluidsynth1 amd64 1.1.9-1 [137 kB]\n", + "Get:89 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libforms2 amd64 1.2.3-1.3 [327 kB]\n", + "Get:90 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxpm-dev amd64 1:3.5.12-1 [87.4 kB]\n", + "Get:91 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libforms-dev amd64 1.2.3-1.3 [692 kB]\n", + "Get:92 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgail18 amd64 2.24.32-1ubuntu1 [14.2 kB]\n", + "Get:93 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgail-common amd64 2.24.32-1ubuntu1 [112 kB]\n", + "Get:94 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libvpx-dev amd64 1.7.0-3ubuntu0.18.04.1 [932 kB]\n", + "Get:95 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgd-dev amd64 2.2.5-4ubuntu0.5 [246 kB]\n", + "Get:96 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgmpxx4ldbl amd64 2:6.1.2+dfsg-2 [8,964 B]\n", + "Get:97 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgmp-dev amd64 2:6.1.2+dfsg-2 [316 kB]\n", + "Get:98 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libxdot4 amd64 2.40.1-2 [15.7 kB]\n", + "Get:99 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libgvc6-plugins-gtk amd64 2.40.1-2 [18.2 kB]\n", + "Get:100 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libgraphviz-dev amd64 2.40.1-2 [57.3 kB]\n", + "Get:101 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-bin amd64 2.24.32-1ubuntu1 [7,536 B]\n", + "Get:102 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libmad0 amd64 0.15.1b-9ubuntu18.04.1 [64.6 kB]\n", + "Get:103 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libmad0-dev amd64 0.15.1b-9ubuntu18.04.1 [64.4 kB]\n", + "Get:104 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsys-hostname-long-perl all 1.5-1 [11.7 kB]\n", + "Get:105 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmail-sendmail-perl all 0.80-1 [22.6 kB]\n", + "Get:106 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmikmod-config amd64 3.3.11.1-3 [5,184 B]\n", + "Get:107 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmikmod3 amd64 3.3.11.1-3 [113 kB]\n", + "Get:108 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmikmod-dev amd64 3.3.11.1-3 [196 kB]\n", + "Get:109 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmodplug1 amd64 1:0.8.9.0-1 [150 kB]\n", + "Get:110 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmodplug-dev amd64 1:0.8.9.0-1 [14.6 kB]\n", + "Get:111 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libproxy-tools amd64 0.4.15-1ubuntu0.2 [5,320 B]\n", + "Get:112 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpulse-mainloop-glib0 amd64 1:11.1-1ubuntu7.11 [22.1 kB]\n", + "Get:113 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpulse-dev amd64 1:11.1-1ubuntu7.11 [81.5 kB]\n", + "Get:114 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsdl1.2debian amd64 1.2.15+dfsg2-0.1ubuntu0.1 [175 kB]\n", + "Get:115 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl-mixer1.2 amd64 1.2.12-14 [72.0 kB]\n", + "Get:116 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsdl1.2-dev amd64 1.2.15+dfsg2-0.1ubuntu0.1 [706 kB]\n", + "Get:117 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl-mixer1.2-dev amd64 1.2.12-14 [90.6 kB]\n", + "Get:118 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libserf-1-1 amd64 1.3.9-6 [44.4 kB]\n", + "Get:119 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsvn1 amd64 1.9.7-4ubuntu1 [1,183 kB]\n", + "Get:120 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlccore9 amd64 3.0.8-0ubuntu18.04.1 [434 kB]\n", + "Get:121 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlc5 amd64 3.0.8-0ubuntu18.04.1 [68.0 kB]\n", + "Get:122 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlc-bin amd64 3.0.8-0ubuntu18.04.1 [17.1 kB]\n", + "Get:123 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlc-dev amd64 3.0.8-0ubuntu18.04.1 [60.1 kB]\n", + "Get:124 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-xf86dga-dev all 2018.4-4 [2,624 B]\n", + "Get:125 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxxf86dga-dev amd64 2:1.1.4-1 [17.6 kB]\n", + "Get:126 http://archive.ubuntu.com/ubuntu bionic/universe amd64 subversion amd64 1.9.7-4ubuntu1 [834 kB]\n", + "Get:127 http://archive.ubuntu.com/ubuntu bionic/universe amd64 timgm6mb-soundfont all 1.3-2 [5,423 kB]\n", + "Get:128 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libc6-dbg amd64 2.27-3ubuntu1.4 [5,163 kB]\n", + "Get:129 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libdca0 amd64 0.0.5-10 [100.0 kB]\n", + "Get:130 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libdca-dev amd64 0.0.5-10 [90.2 kB]\n", + "Get:131 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libdts-dev amd64 0.0.5-10 [3,068 B]\n", + "Fetched 166 MB in 11s (15.1 MB/s)\n", + "Extracting templates from packages: 100%\n", + "Preconfiguring packages ...\n", + "Selecting previously unselected package libxxf86dga1:amd64.\n", + "(Reading database ... 155013 files and directories currently installed.)\n", + "Preparing to unpack .../000-libxxf86dga1_2%3a1.1.4-1_amd64.deb ...\n", + "Unpacking libxxf86dga1:amd64 (2:1.1.4-1) ...\n", + "Selecting previously unselected package libmagic-mgc.\n", + "Preparing to unpack .../001-libmagic-mgc_1%3a5.32-2ubuntu0.4_amd64.deb ...\n", + "Unpacking libmagic-mgc (1:5.32-2ubuntu0.4) ...\n", + "Selecting previously unselected package libmagic1:amd64.\n", + "Preparing to unpack .../002-libmagic1_1%3a5.32-2ubuntu0.4_amd64.deb ...\n", + "Unpacking libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\n", + "Selecting previously unselected package file.\n", + "Preparing to unpack .../003-file_1%3a5.32-2ubuntu0.4_amd64.deb ...\n", + "Unpacking file (1:5.32-2ubuntu0.4) ...\n", + "Selecting previously unselected package gettext-base.\n", + "Preparing to unpack .../004-gettext-base_0.19.8.1-6ubuntu0.3_amd64.deb ...\n", + "Unpacking gettext-base (0.19.8.1-6ubuntu0.3) ...\n", + "Selecting previously unselected package libsigsegv2:amd64.\n", + "Preparing to unpack .../005-libsigsegv2_2.12-1_amd64.deb ...\n", + "Unpacking libsigsegv2:amd64 (2.12-1) ...\n", + "Selecting previously unselected package m4.\n", + "Preparing to unpack .../006-m4_1.4.18-1_amd64.deb ...\n", + "Unpacking m4 (1.4.18-1) ...\n", + "Selecting previously unselected package autoconf.\n", + "Preparing to unpack .../007-autoconf_2.69-11_all.deb ...\n", + "Unpacking autoconf (2.69-11) ...\n", + "Selecting previously unselected package autotools-dev.\n", + "Preparing to unpack .../008-autotools-dev_20180224.1_all.deb ...\n", + "Unpacking autotools-dev (20180224.1) ...\n", + "Selecting previously unselected package automake.\n", + "Preparing to unpack .../009-automake_1%3a1.15.1-3ubuntu2_all.deb ...\n", + "Unpacking automake (1:1.15.1-3ubuntu2) ...\n", + "Selecting previously unselected package autopoint.\n", + "Preparing to unpack .../010-autopoint_0.19.8.1-6ubuntu0.3_all.deb ...\n", + "Unpacking autopoint (0.19.8.1-6ubuntu0.3) ...\n", + "Selecting previously unselected package libtool.\n", + "Preparing to unpack .../011-libtool_2.4.6-2_all.deb ...\n", + "Unpacking libtool (2.4.6-2) ...\n", + "Selecting previously unselected package dh-autoreconf.\n", + "Preparing to unpack .../012-dh-autoreconf_17_all.deb ...\n", + "Unpacking dh-autoreconf (17) ...\n", + "Selecting previously unselected package libarchive-zip-perl.\n", + "Preparing to unpack .../013-libarchive-zip-perl_1.60-1ubuntu0.1_all.deb ...\n", + "Unpacking libarchive-zip-perl (1.60-1ubuntu0.1) ...\n", + "Selecting previously unselected package libfile-stripnondeterminism-perl.\n", + "Preparing to unpack .../014-libfile-stripnondeterminism-perl_0.040-1.1~build1_all.deb ...\n", + "Unpacking libfile-stripnondeterminism-perl (0.040-1.1~build1) ...\n", + "Selecting previously unselected package libtimedate-perl.\n", + "Preparing to unpack .../015-libtimedate-perl_2.3000-2_all.deb ...\n", + "Unpacking libtimedate-perl (2.3000-2) ...\n", + "Selecting previously unselected package dh-strip-nondeterminism.\n", + "Preparing to unpack .../016-dh-strip-nondeterminism_0.040-1.1~build1_all.deb ...\n", + "Unpacking dh-strip-nondeterminism (0.040-1.1~build1) ...\n", + "Selecting previously unselected package gettext.\n", + "Preparing to unpack .../017-gettext_0.19.8.1-6ubuntu0.3_amd64.deb ...\n", + "Unpacking gettext (0.19.8.1-6ubuntu0.3) ...\n", + "Selecting previously unselected package intltool-debian.\n", + "Preparing to unpack .../018-intltool-debian_0.35.0+20060710.4_all.deb ...\n", + "Unpacking intltool-debian (0.35.0+20060710.4) ...\n", + "Selecting previously unselected package po-debconf.\n", + "Preparing to unpack .../019-po-debconf_1.0.20_all.deb ...\n", + "Unpacking po-debconf (1.0.20) ...\n", + "Selecting previously unselected package debhelper.\n", + "Preparing to unpack .../020-debhelper_11.1.6ubuntu2_all.deb ...\n", + "Unpacking debhelper (11.1.6ubuntu2) ...\n", + "Selecting previously unselected package fp-units-rtl-3.0.4:amd64.\n", + "Preparing to unpack .../021-fp-units-rtl-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-rtl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-compiler-3.0.4:amd64.\n", + "Preparing to unpack .../022-fp-compiler-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-compiler-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-docs-3.0.4.\n", + "Preparing to unpack .../023-fp-docs-3.0.4_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fp-docs-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-ide-3.0.4.\n", + "Preparing to unpack .../024-fp-ide-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-ide-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-base-3.0.4:amd64.\n", + "Preparing to unpack .../025-fp-units-base-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-base-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-db-3.0.4:amd64.\n", + "Preparing to unpack .../026-fp-units-db-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-db-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-fcl-3.0.4:amd64.\n", + "Preparing to unpack .../027-fp-units-fcl-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-fcl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-fv-3.0.4:amd64.\n", + "Preparing to unpack .../028-fp-units-fv-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-fv-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-gfx-3.0.4:amd64.\n", + "Preparing to unpack .../029-fp-units-gfx-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-gfx-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package libgtk2.0-common.\n", + "Preparing to unpack .../030-libgtk2.0-common_2.24.32-1ubuntu1_all.deb ...\n", + "Unpacking libgtk2.0-common (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libgtk2.0-0:amd64.\n", + "Preparing to unpack .../031-libgtk2.0-0_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgtk2.0-0:amd64 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package gir1.2-atk-1.0:amd64.\n", + "Preparing to unpack .../032-gir1.2-atk-1.0_2.28.1-1_amd64.deb ...\n", + "Unpacking gir1.2-atk-1.0:amd64 (2.28.1-1) ...\n", + "Selecting previously unselected package gir1.2-freedesktop:amd64.\n", + "Preparing to unpack .../033-gir1.2-freedesktop_1.56.1-1_amd64.deb ...\n", + "Unpacking gir1.2-freedesktop:amd64 (1.56.1-1) ...\n", + "Selecting previously unselected package gir1.2-gdkpixbuf-2.0:amd64.\n", + "Preparing to unpack .../034-gir1.2-gdkpixbuf-2.0_2.36.11-2_amd64.deb ...\n", + "Unpacking gir1.2-gdkpixbuf-2.0:amd64 (2.36.11-2) ...\n", + "Selecting previously unselected package libpangoxft-1.0-0:amd64.\n", + "Preparing to unpack .../035-libpangoxft-1.0-0_1.40.14-1ubuntu0.1_amd64.deb ...\n", + "Unpacking libpangoxft-1.0-0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Selecting previously unselected package gir1.2-pango-1.0:amd64.\n", + "Preparing to unpack .../036-gir1.2-pango-1.0_1.40.14-1ubuntu0.1_amd64.deb ...\n", + "Unpacking gir1.2-pango-1.0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Selecting previously unselected package gir1.2-gtk-2.0.\n", + "Preparing to unpack .../037-gir1.2-gtk-2.0_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking gir1.2-gtk-2.0 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libgdk-pixbuf2.0-dev.\n", + "Preparing to unpack .../038-libgdk-pixbuf2.0-dev_2.36.11-2_amd64.deb ...\n", + "Unpacking libgdk-pixbuf2.0-dev (2.36.11-2) ...\n", + "Selecting previously unselected package libcairo-script-interpreter2:amd64.\n", + "Preparing to unpack .../039-libcairo-script-interpreter2_1.15.10-2ubuntu0.1_amd64.deb ...\n", + "Unpacking libcairo-script-interpreter2:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Selecting previously unselected package libpixman-1-dev:amd64.\n", + "Preparing to unpack .../040-libpixman-1-dev_0.34.0-2_amd64.deb ...\n", + "Unpacking libpixman-1-dev:amd64 (0.34.0-2) ...\n", + "Selecting previously unselected package libxcb-shm0-dev:amd64.\n", + "Preparing to unpack .../041-libxcb-shm0-dev_1.13-2~ubuntu18.04_amd64.deb ...\n", + "Unpacking libxcb-shm0-dev:amd64 (1.13-2~ubuntu18.04) ...\n", + "Selecting previously unselected package libcairo2-dev:amd64.\n", + "Preparing to unpack .../042-libcairo2-dev_1.15.10-2ubuntu0.1_amd64.deb ...\n", + "Unpacking libcairo2-dev:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Selecting previously unselected package libpango1.0-dev.\n", + "Preparing to unpack .../043-libpango1.0-dev_1.40.14-1ubuntu0.1_amd64.deb ...\n", + "Unpacking libpango1.0-dev (1.40.14-1ubuntu0.1) ...\n", + "Selecting previously unselected package libatk1.0-dev:amd64.\n", + "Preparing to unpack .../044-libatk1.0-dev_2.28.1-1_amd64.deb ...\n", + "Unpacking libatk1.0-dev:amd64 (2.28.1-1) ...\n", + "Selecting previously unselected package x11proto-xinerama-dev.\n", + "Preparing to unpack .../045-x11proto-xinerama-dev_2018.4-4_all.deb ...\n", + "Unpacking x11proto-xinerama-dev (2018.4-4) ...\n", + "Selecting previously unselected package libxinerama-dev:amd64.\n", + "Preparing to unpack .../046-libxinerama-dev_2%3a1.1.3-1_amd64.deb ...\n", + "Unpacking libxinerama-dev:amd64 (2:1.1.3-1) ...\n", + "Selecting previously unselected package x11proto-randr-dev.\n", + "Preparing to unpack .../047-x11proto-randr-dev_2018.4-4_all.deb ...\n", + "Unpacking x11proto-randr-dev (2018.4-4) ...\n", + "Selecting previously unselected package libxrandr-dev:amd64.\n", + "Preparing to unpack .../048-libxrandr-dev_2%3a1.5.1-1_amd64.deb ...\n", + "Unpacking libxrandr-dev:amd64 (2:1.5.1-1) ...\n", + "Selecting previously unselected package libxcursor-dev:amd64.\n", + "Preparing to unpack .../049-libxcursor-dev_1%3a1.1.15-1_amd64.deb ...\n", + "Unpacking libxcursor-dev:amd64 (1:1.1.15-1) ...\n", + "Selecting previously unselected package x11proto-composite-dev.\n", + "Preparing to unpack .../050-x11proto-composite-dev_1%3a2018.4-4_all.deb ...\n", + "Unpacking x11proto-composite-dev (1:2018.4-4) ...\n", + "Selecting previously unselected package libxcomposite-dev:amd64.\n", + "Preparing to unpack .../051-libxcomposite-dev_1%3a0.4.4-2_amd64.deb ...\n", + "Unpacking libxcomposite-dev:amd64 (1:0.4.4-2) ...\n", + "Selecting previously unselected package libxml2-utils.\n", + "Preparing to unpack .../052-libxml2-utils_2.9.4+dfsg1-6.1ubuntu1.4_amd64.deb ...\n", + "Unpacking libxml2-utils (2.9.4+dfsg1-6.1ubuntu1.4) ...\n", + "Selecting previously unselected package libgtk2.0-dev.\n", + "Preparing to unpack .../053-libgtk2.0-dev_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgtk2.0-dev (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package fp-units-gtk2-3.0.4:amd64.\n", + "Preparing to unpack .../054-fp-units-gtk2-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-gtk2-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-math-3.0.4:amd64.\n", + "Preparing to unpack .../055-fp-units-math-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-math-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-misc-3.0.4:amd64.\n", + "Preparing to unpack .../056-fp-units-misc-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-misc-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-multimedia-3.0.4:amd64.\n", + "Preparing to unpack .../057-fp-units-multimedia-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-multimedia-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-net-3.0.4:amd64.\n", + "Preparing to unpack .../058-fp-units-net-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-net-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc-source-3.0.4.\n", + "Preparing to unpack .../059-fpc-source-3.0.4_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc-source-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-utils-3.0.4.\n", + "Preparing to unpack .../060-fp-utils-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-utils-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc-3.0.4.\n", + "Preparing to unpack .../061-fpc-3.0.4_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc.\n", + "Preparing to unpack .../062-fpc_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc-source.\n", + "Preparing to unpack .../063-fpc-source_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc-source (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package libdw1:amd64.\n", + "Preparing to unpack .../064-libdw1_0.170-0.4ubuntu0.1_amd64.deb ...\n", + "Unpacking libdw1:amd64 (0.170-0.4ubuntu0.1) ...\n", + "Selecting previously unselected package libbabeltrace1:amd64.\n", + "Preparing to unpack .../065-libbabeltrace1_1.5.5-1_amd64.deb ...\n", + "Unpacking libbabeltrace1:amd64 (1.5.5-1) ...\n", + "Selecting previously unselected package gdb.\n", + "Preparing to unpack .../066-gdb_8.1.1-0ubuntu1_amd64.deb ...\n", + "Unpacking gdb (8.1.1-0ubuntu1) ...\n", + "Selecting previously unselected package gdbserver.\n", + "Preparing to unpack .../067-gdbserver_8.1.1-0ubuntu1_amd64.deb ...\n", + "Unpacking gdbserver (8.1.1-0ubuntu1) ...\n", + "Selecting previously unselected package lazarus-ide-1.8.\n", + "Preparing to unpack .../068-lazarus-ide-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lazarus-ide-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-ide-gtk2-1.8.\n", + "Preparing to unpack .../069-lazarus-ide-gtk2-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lazarus-ide-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-ide.\n", + "Preparing to unpack .../070-lazarus-ide_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-ide (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-src-1.8.\n", + "Preparing to unpack .../071-lazarus-src-1.8_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-src-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-nogui-1.8.\n", + "Preparing to unpack .../072-lcl-nogui-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-nogui-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-gtk2-1.8.\n", + "Preparing to unpack .../073-lcl-gtk2-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-units-1.8.\n", + "Preparing to unpack .../074-lcl-units-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-units-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-utils-1.8.\n", + "Preparing to unpack .../075-lcl-utils-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-utils-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-1.8.\n", + "Preparing to unpack .../076-lcl-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-1.8.\n", + "Preparing to unpack .../077-lazarus-1.8_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus.\n", + "Preparing to unpack .../078-lazarus_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-doc-1.8.\n", + "Preparing to unpack .../079-lazarus-doc-1.8_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-doc-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package liba52-0.7.4:amd64.\n", + "Preparing to unpack .../080-liba52-0.7.4_0.7.4-19_amd64.deb ...\n", + "Unpacking liba52-0.7.4:amd64 (0.7.4-19) ...\n", + "Selecting previously unselected package liba52-0.7.4-dev.\n", + "Preparing to unpack .../081-liba52-0.7.4-dev_0.7.4-19_amd64.deb ...\n", + "Unpacking liba52-0.7.4-dev (0.7.4-19) ...\n", + "Selecting previously unselected package libapr1:amd64.\n", + "Preparing to unpack .../082-libapr1_1.6.3-2_amd64.deb ...\n", + "Unpacking libapr1:amd64 (1.6.3-2) ...\n", + "Selecting previously unselected package libaprutil1:amd64.\n", + "Preparing to unpack .../083-libaprutil1_1.6.1-2_amd64.deb ...\n", + "Unpacking libaprutil1:amd64 (1.6.1-2) ...\n", + "Selecting previously unselected package libarchive-cpio-perl.\n", + "Preparing to unpack .../084-libarchive-cpio-perl_0.10-1_all.deb ...\n", + "Unpacking libarchive-cpio-perl (0.10-1) ...\n", + "Selecting previously unselected package libslang2-dev:amd64.\n", + "Preparing to unpack .../085-libslang2-dev_2.3.1a-3ubuntu1_amd64.deb ...\n", + "Unpacking libslang2-dev:amd64 (2.3.1a-3ubuntu1) ...\n", + "Selecting previously unselected package libcaca-dev.\n", + "Preparing to unpack .../086-libcaca-dev_0.99.beta19-2ubuntu0.18.04.2_amd64.deb ...\n", + "Unpacking libcaca-dev (0.99.beta19-2ubuntu0.18.04.2) ...\n", + "Selecting previously unselected package libfluidsynth1:amd64.\n", + "Preparing to unpack .../087-libfluidsynth1_1.1.9-1_amd64.deb ...\n", + "Unpacking libfluidsynth1:amd64 (1.1.9-1) ...\n", + "Selecting previously unselected package libforms2.\n", + "Preparing to unpack .../088-libforms2_1.2.3-1.3_amd64.deb ...\n", + "Unpacking libforms2 (1.2.3-1.3) ...\n", + "Selecting previously unselected package libxpm-dev:amd64.\n", + "Preparing to unpack .../089-libxpm-dev_1%3a3.5.12-1_amd64.deb ...\n", + "Unpacking libxpm-dev:amd64 (1:3.5.12-1) ...\n", + "Selecting previously unselected package libforms-dev.\n", + "Preparing to unpack .../090-libforms-dev_1.2.3-1.3_amd64.deb ...\n", + "Unpacking libforms-dev (1.2.3-1.3) ...\n", + "Selecting previously unselected package libgail18:amd64.\n", + "Preparing to unpack .../091-libgail18_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgail18:amd64 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libgail-common:amd64.\n", + "Preparing to unpack .../092-libgail-common_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgail-common:amd64 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libvpx-dev:amd64.\n", + "Preparing to unpack .../093-libvpx-dev_1.7.0-3ubuntu0.18.04.1_amd64.deb ...\n", + "Unpacking libvpx-dev:amd64 (1.7.0-3ubuntu0.18.04.1) ...\n", + "Selecting previously unselected package libgd-dev:amd64.\n", + "Preparing to unpack .../094-libgd-dev_2.2.5-4ubuntu0.5_amd64.deb ...\n", + "Unpacking libgd-dev:amd64 (2.2.5-4ubuntu0.5) ...\n", + "Selecting previously unselected package libgmpxx4ldbl:amd64.\n", + "Preparing to unpack .../095-libgmpxx4ldbl_2%3a6.1.2+dfsg-2_amd64.deb ...\n", + "Unpacking libgmpxx4ldbl:amd64 (2:6.1.2+dfsg-2) ...\n", + "Selecting previously unselected package libgmp-dev:amd64.\n", + "Preparing to unpack .../096-libgmp-dev_2%3a6.1.2+dfsg-2_amd64.deb ...\n", + "Unpacking libgmp-dev:amd64 (2:6.1.2+dfsg-2) ...\n", + "Selecting previously unselected package libxdot4.\n", + "Preparing to unpack .../097-libxdot4_2.40.1-2_amd64.deb ...\n", + "Unpacking libxdot4 (2.40.1-2) ...\n", + "Selecting previously unselected package libgvc6-plugins-gtk.\n", + "Preparing to unpack .../098-libgvc6-plugins-gtk_2.40.1-2_amd64.deb ...\n", + "Unpacking libgvc6-plugins-gtk (2.40.1-2) ...\n", + "Selecting previously unselected package libgraphviz-dev.\n", + "Preparing to unpack .../099-libgraphviz-dev_2.40.1-2_amd64.deb ...\n", + "Unpacking libgraphviz-dev (2.40.1-2) ...\n", + "Selecting previously unselected package libgtk2.0-bin.\n", + "Preparing to unpack .../100-libgtk2.0-bin_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgtk2.0-bin (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libmad0:amd64.\n", + "Preparing to unpack .../101-libmad0_0.15.1b-9ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libmad0:amd64 (0.15.1b-9ubuntu18.04.1) ...\n", + "Selecting previously unselected package libmad0-dev.\n", + "Preparing to unpack .../102-libmad0-dev_0.15.1b-9ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libmad0-dev (0.15.1b-9ubuntu18.04.1) ...\n", + "Selecting previously unselected package libsys-hostname-long-perl.\n", + "Preparing to unpack .../103-libsys-hostname-long-perl_1.5-1_all.deb ...\n", + "Unpacking libsys-hostname-long-perl (1.5-1) ...\n", + "Selecting previously unselected package libmail-sendmail-perl.\n", + "Preparing to unpack .../104-libmail-sendmail-perl_0.80-1_all.deb ...\n", + "Unpacking libmail-sendmail-perl (0.80-1) ...\n", + "Selecting previously unselected package libmikmod-config.\n", + "Preparing to unpack .../105-libmikmod-config_3.3.11.1-3_amd64.deb ...\n", + "Unpacking libmikmod-config (3.3.11.1-3) ...\n", + "Selecting previously unselected package libmikmod3:amd64.\n", + "Preparing to unpack .../106-libmikmod3_3.3.11.1-3_amd64.deb ...\n", + "Unpacking libmikmod3:amd64 (3.3.11.1-3) ...\n", + "Selecting previously unselected package libmikmod-dev:amd64.\n", + "Preparing to unpack .../107-libmikmod-dev_3.3.11.1-3_amd64.deb ...\n", + "Unpacking libmikmod-dev:amd64 (3.3.11.1-3) ...\n", + "Selecting previously unselected package libmodplug1:amd64.\n", + "Preparing to unpack .../108-libmodplug1_1%3a0.8.9.0-1_amd64.deb ...\n", + "Unpacking libmodplug1:amd64 (1:0.8.9.0-1) ...\n", + "Selecting previously unselected package libmodplug-dev:amd64.\n", + "Preparing to unpack .../109-libmodplug-dev_1%3a0.8.9.0-1_amd64.deb ...\n", + "Unpacking libmodplug-dev:amd64 (1:0.8.9.0-1) ...\n", + "Selecting previously unselected package libproxy-tools.\n", + "Preparing to unpack .../110-libproxy-tools_0.4.15-1ubuntu0.2_amd64.deb ...\n", + "Unpacking libproxy-tools (0.4.15-1ubuntu0.2) ...\n", + "Selecting previously unselected package libpulse-mainloop-glib0:amd64.\n", + "Preparing to unpack .../111-libpulse-mainloop-glib0_1%3a11.1-1ubuntu7.11_amd64.deb ...\n", + "Unpacking libpulse-mainloop-glib0:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Selecting previously unselected package libpulse-dev:amd64.\n", + "Preparing to unpack .../112-libpulse-dev_1%3a11.1-1ubuntu7.11_amd64.deb ...\n", + "Unpacking libpulse-dev:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Selecting previously unselected package libsdl1.2debian:amd64.\n", + "Preparing to unpack .../113-libsdl1.2debian_1.2.15+dfsg2-0.1ubuntu0.1_amd64.deb ...\n", + "Unpacking libsdl1.2debian:amd64 (1.2.15+dfsg2-0.1ubuntu0.1) ...\n", + "Selecting previously unselected package libsdl-mixer1.2:amd64.\n", + "Preparing to unpack .../114-libsdl-mixer1.2_1.2.12-14_amd64.deb ...\n", + "Unpacking libsdl-mixer1.2:amd64 (1.2.12-14) ...\n", + "Selecting previously unselected package libsdl1.2-dev.\n", + "Preparing to unpack .../115-libsdl1.2-dev_1.2.15+dfsg2-0.1ubuntu0.1_amd64.deb ...\n", + "Unpacking libsdl1.2-dev (1.2.15+dfsg2-0.1ubuntu0.1) ...\n", + "Selecting previously unselected package libsdl-mixer1.2-dev:amd64.\n", + "Preparing to unpack .../116-libsdl-mixer1.2-dev_1.2.12-14_amd64.deb ...\n", + "Unpacking libsdl-mixer1.2-dev:amd64 (1.2.12-14) ...\n", + "Selecting previously unselected package libserf-1-1:amd64.\n", + "Preparing to unpack .../117-libserf-1-1_1.3.9-6_amd64.deb ...\n", + "Unpacking libserf-1-1:amd64 (1.3.9-6) ...\n", + "Selecting previously unselected package libsvn1:amd64.\n", + "Preparing to unpack .../118-libsvn1_1.9.7-4ubuntu1_amd64.deb ...\n", + "Unpacking libsvn1:amd64 (1.9.7-4ubuntu1) ...\n", + "Selecting previously unselected package libvlccore9:amd64.\n", + "Preparing to unpack .../119-libvlccore9_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlccore9:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package libvlc5:amd64.\n", + "Preparing to unpack .../120-libvlc5_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlc5:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package libvlc-bin:amd64.\n", + "Preparing to unpack .../121-libvlc-bin_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlc-bin:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package libvlc-dev:amd64.\n", + "Preparing to unpack .../122-libvlc-dev_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlc-dev:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package x11proto-xf86dga-dev.\n", + "Preparing to unpack .../123-x11proto-xf86dga-dev_2018.4-4_all.deb ...\n", + "Unpacking x11proto-xf86dga-dev (2018.4-4) ...\n", + "Selecting previously unselected package libxxf86dga-dev:amd64.\n", + "Preparing to unpack .../124-libxxf86dga-dev_2%3a1.1.4-1_amd64.deb ...\n", + "Unpacking libxxf86dga-dev:amd64 (2:1.1.4-1) ...\n", + "Selecting previously unselected package subversion.\n", + "Preparing to unpack .../125-subversion_1.9.7-4ubuntu1_amd64.deb ...\n", + "Unpacking subversion (1.9.7-4ubuntu1) ...\n", + "Selecting previously unselected package timgm6mb-soundfont.\n", + "Preparing to unpack .../126-timgm6mb-soundfont_1.3-2_all.deb ...\n", + "Unpacking timgm6mb-soundfont (1.3-2) ...\n", + "Selecting previously unselected package libc6-dbg:amd64.\n", + "Preparing to unpack .../127-libc6-dbg_2.27-3ubuntu1.4_amd64.deb ...\n", + "Unpacking libc6-dbg:amd64 (2.27-3ubuntu1.4) ...\n", + "Selecting previously unselected package libdca0:amd64.\n", + "Preparing to unpack .../128-libdca0_0.0.5-10_amd64.deb ...\n", + "Unpacking libdca0:amd64 (0.0.5-10) ...\n", + "Selecting previously unselected package libdca-dev:amd64.\n", + "Preparing to unpack .../129-libdca-dev_0.0.5-10_amd64.deb ...\n", + "Unpacking libdca-dev:amd64 (0.0.5-10) ...\n", + "Selecting previously unselected package libdts-dev:amd64.\n", + "Preparing to unpack .../130-libdts-dev_0.0.5-10_amd64.deb ...\n", + "Unpacking libdts-dev:amd64 (0.0.5-10) ...\n", + "Setting up libapr1:amd64 (1.6.3-2) ...\n", + "Setting up libxcursor-dev:amd64 (1:1.1.15-1) ...\n", + "Setting up libforms2 (1.2.3-1.3) ...\n", + "Setting up gir1.2-atk-1.0:amd64 (2.28.1-1) ...\n", + "Setting up libgtk2.0-common (2.24.32-1ubuntu1) ...\n", + "Setting up libxdot4 (2.40.1-2) ...\n", + "Setting up libc6-dbg:amd64 (2.27-3ubuntu1.4) ...\n", + "Setting up libpulse-mainloop-glib0:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Setting up libpulse-dev:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Setting up libarchive-zip-perl (1.60-1ubuntu0.1) ...\n", + "Setting up libmodplug1:amd64 (1:0.8.9.0-1) ...\n", + "Setting up libdw1:amd64 (0.170-0.4ubuntu0.1) ...\n", + "Setting up libtimedate-perl (2.3000-2) ...\n", + "Setting up libcairo-script-interpreter2:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Setting up libsigsegv2:amd64 (2.12-1) ...\n", + "Setting up gir1.2-freedesktop:amd64 (1.56.1-1) ...\n", + "Setting up libproxy-tools (0.4.15-1ubuntu0.2) ...\n", + "Setting up libxpm-dev:amd64 (1:3.5.12-1) ...\n", + "Setting up libxcb-shm0-dev:amd64 (1.13-2~ubuntu18.04) ...\n", + "Setting up libpangoxft-1.0-0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Setting up libxml2-utils (2.9.4+dfsg1-6.1ubuntu1.4) ...\n", + "Setting up libarchive-cpio-perl (0.10-1) ...\n", + "Setting up gir1.2-gdkpixbuf-2.0:amd64 (2.36.11-2) ...\n", + "Setting up libatk1.0-dev:amd64 (2.28.1-1) ...\n", + "Setting up libsdl1.2debian:amd64 (1.2.15+dfsg2-0.1ubuntu0.1) ...\n", + "Setting up gettext-base (0.19.8.1-6ubuntu0.3) ...\n", + "Setting up m4 (1.4.18-1) ...\n", + "Setting up fp-docs-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libmagic-mgc (1:5.32-2ubuntu0.4) ...\n", + "Setting up gir1.2-pango-1.0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Setting up libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\n", + "Setting up libsys-hostname-long-perl (1.5-1) ...\n", + "Setting up libmikmod3:amd64 (3.3.11.1-3) ...\n", + "Setting up liba52-0.7.4:amd64 (0.7.4-19) ...\n", + "Setting up libvpx-dev:amd64 (1.7.0-3ubuntu0.18.04.1) ...\n", + "Setting up libgdk-pixbuf2.0-dev (2.36.11-2) ...\n", + "Setting up libgd-dev:amd64 (2.2.5-4ubuntu0.5) ...\n", + "Setting up fp-units-rtl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libmail-sendmail-perl (0.80-1) ...\n", + "Setting up libxxf86dga1:amd64 (2:1.1.4-1) ...\n", + "Setting up lazarus-src-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up libvlccore9:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up x11proto-xinerama-dev (2018.4-4) ...\n", + "Setting up fpc-source-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up autotools-dev (20180224.1) ...\n", + "Setting up libpixman-1-dev:amd64 (0.34.0-2) ...\n", + "Setting up libaprutil1:amd64 (1.6.1-2) ...\n", + "Setting up x11proto-randr-dev (2018.4-4) ...\n", + "Setting up libxinerama-dev:amd64 (2:1.1.3-1) ...\n", + "Setting up liba52-0.7.4-dev (0.7.4-19) ...\n", + "Setting up x11proto-xf86dga-dev (2018.4-4) ...\n", + "Setting up libmikmod-config (3.3.11.1-3) ...\n", + "Setting up libxxf86dga-dev:amd64 (2:1.1.4-1) ...\n", + "Setting up gdbserver (8.1.1-0ubuntu1) ...\n", + "Setting up timgm6mb-soundfont (1.3-2) ...\n", + "Setting up libmad0:amd64 (0.15.1b-9ubuntu18.04.1) ...\n", + "Setting up libgmpxx4ldbl:amd64 (2:6.1.2+dfsg-2) ...\n", + "Setting up libdca0:amd64 (0.0.5-10) ...\n", + "Setting up libmodplug-dev:amd64 (1:0.8.9.0-1) ...\n", + "Setting up fp-utils-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "update-alternatives: using /usr/lib/x86_64-linux-gnu/fpc/3.0.4 to provide /usr/lib/x86_64-linux-gnu/fpc/default (fp-utils) in auto mode\n", + "Setting up libslang2-dev:amd64 (2.3.1a-3ubuntu1) ...\n", + "Setting up libfluidsynth1:amd64 (1.1.9-1) ...\n", + "Setting up x11proto-composite-dev (1:2018.4-4) ...\n", + "Setting up lazarus-doc-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up fp-ide-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "update-alternatives: using /usr/bin/fp-3.0.4 to provide /usr/bin/fp (fp) in auto mode\n", + "Setting up libbabeltrace1:amd64 (1.5.5-1) ...\n", + "Setting up autopoint (0.19.8.1-6ubuntu0.3) ...\n", + "Setting up fpc-source (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libfile-stripnondeterminism-perl (0.040-1.1~build1) ...\n", + "Setting up fp-units-base-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgmp-dev:amd64 (2:6.1.2+dfsg-2) ...\n", + "Setting up fp-units-multimedia-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up fp-units-math-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libmad0-dev (0.15.1b-9ubuntu18.04.1) ...\n", + "Setting up libforms-dev (1.2.3-1.3) ...\n", + "Setting up libdca-dev:amd64 (0.0.5-10) ...\n", + "Setting up libgtk2.0-0:amd64 (2.24.32-1ubuntu1) ...\n", + "Setting up libvlc5:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up libgail18:amd64 (2.24.32-1ubuntu1) ...\n", + "Setting up libxrandr-dev:amd64 (2:1.5.1-1) ...\n", + "Setting up libcairo2-dev:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Setting up gettext (0.19.8.1-6ubuntu0.3) ...\n", + "Setting up libxcomposite-dev:amd64 (1:0.4.4-2) ...\n", + "Setting up fp-units-fv-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up fp-compiler-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "update-alternatives: using /usr/bin/x86_64-linux-gnu-fpc-3.0.4 to provide /usr/bin/fpc (fpc) in auto mode\n", + "update-alternatives: using /etc/fpc-3.0.4.cfg to provide /etc/fpc.cfg (fpc.cfg) in auto mode\n", + "update-alternatives: using /usr/bin/fpc to provide /usr/bin/pc (pc) in auto mode\n", + "Setting up fp-units-gfx-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libsdl-mixer1.2:amd64 (1.2.12-14) ...\n", + "Setting up fp-units-fcl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgail-common:amd64 (2.24.32-1ubuntu1) ...\n", + "Setting up autoconf (2.69-11) ...\n", + "Setting up libmikmod-dev:amd64 (3.3.11.1-3) ...\n", + "Setting up fp-units-misc-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgvc6-plugins-gtk (2.40.1-2) ...\n", + "Setting up fp-units-net-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up file (1:5.32-2ubuntu0.4) ...\n", + "Setting up fp-units-db-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgraphviz-dev (2.40.1-2) ...\n", + "Setting up intltool-debian (0.35.0+20060710.4) ...\n", + "Setting up libcaca-dev (0.99.beta19-2ubuntu0.18.04.2) ...\n", + "Setting up libserf-1-1:amd64 (1.3.9-6) ...\n", + "Setting up libvlc-bin:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up lcl-utils-1.8 (1.8.2+dfsg-3) ...\n", + "update-alternatives: using /usr/lib/lazarus/1.8.2 to provide /usr/lib/lazarus/default (lazarus) in auto mode\n", + "Setting up libsdl1.2-dev (1.2.15+dfsg2-0.1ubuntu0.1) ...\n", + "Setting up automake (1:1.15.1-3ubuntu2) ...\n", + "update-alternatives: using /usr/bin/automake-1.15 to provide /usr/bin/automake (automake) in auto mode\n", + "Setting up libvlc-dev:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up libdts-dev:amd64 (0.0.5-10) ...\n", + "Setting up libsvn1:amd64 (1.9.7-4ubuntu1) ...\n", + "Setting up libpango1.0-dev (1.40.14-1ubuntu0.1) ...\n", + "Setting up gdb (8.1.1-0ubuntu1) ...\n", + "Setting up libsdl-mixer1.2-dev:amd64 (1.2.12-14) ...\n", + "Setting up gir1.2-gtk-2.0 (2.24.32-1ubuntu1) ...\n", + "Setting up libgtk2.0-bin (2.24.32-1ubuntu1) ...\n", + "Setting up libtool (2.4.6-2) ...\n", + "Setting up lazarus-ide-1.8 (1.8.2+dfsg-3) ...\n", + "update-alternatives: using /usr/lib/lazarus/1.8.2/startlazarus to provide /usr/bin/lazarus-ide (lazarus-ide) in auto mode\n", + "Setting up po-debconf (1.0.20) ...\n", + "Setting up lcl-nogui-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up libgtk2.0-dev (2.24.32-1ubuntu1) ...\n", + "Setting up lazarus-ide-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "update-alternatives: using /usr/lib/lazarus/1.8.2/lazarus-gtk2 to provide /usr/lib/lazarus/1.8.2/lazarus (lazarus-1.8.2) in auto mode\n", + "Setting up subversion (1.9.7-4ubuntu1) ...\n", + "Setting up fp-units-gtk2-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up lazarus-ide (1.8.2+dfsg-3) ...\n", + "Setting up fpc-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up lcl-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up lcl-units-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up fpc (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up lcl-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up lazarus-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up lazarus (1.8.2+dfsg-3) ...\n", + "Setting up dh-autoreconf (17) ...\n", + "Setting up debhelper (11.1.6ubuntu2) ...\n", + "Setting up dh-strip-nondeterminism (0.040-1.1~build1) ...\n", + "Processing triggers for libc-bin (2.27-3ubuntu1.3) ...\n", + "/sbin/ldconfig.real: /usr/local/lib/python3.7/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link\n", + "\n", + "Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n", + "Processing triggers for mime-support (3.60ubuntu1) ...\n", + "Processing triggers for libvlc-bin:amd64 (3.0.8-0ubuntu18.04.1) ...\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "qhr-tY5c1o3J", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "50345580-b2ab-4722-82c0-318378bb1928" + }, + "source": [ + "!git clone https://github.com/joaopauloschuler/neural-api.git" + ], + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Cloning into 'neural-api'...\n", + "remote: Enumerating objects: 2372, done.\u001b[K\n", + "remote: Counting objects: 100% (494/494), done.\u001b[K\n", + "remote: Compressing objects: 100% (370/370), done.\u001b[K\n", + "remote: Total 2372 (delta 340), reused 236 (delta 124), pack-reused 1878\u001b[K\n", + "Receiving objects: 100% (2372/2372), 4.58 MiB | 10.38 MiB/s, done.\n", + "Resolving deltas: 100% (1585/1585), done.\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "8htgbUo9744q", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "41481d70-ed29-4853-cbf3-c3babd67fb89" + }, + "source": [ + "!svn checkout https://svn.code.sf.net/p/lazarus-ccr/svn/components/multithreadprocs mtprocs" + ], + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "A mtprocs/examples\n", + "A mtprocs/examples/parallelloop1.lpr\n", + "A mtprocs/examples/parallelloop_nested1.lpi\n", + "A mtprocs/examples/parallelloop_nested1.lpr\n", + "A mtprocs/examples/recursivemtp1.lpr\n", + "A mtprocs/examples/simplemtp1.lpr\n", + "A mtprocs/examples/parallelloop1.lpi\n", + "A mtprocs/examples/recursivemtp1.lpi\n", + "A mtprocs/examples/simplemtp1.lpi\n", + "A mtprocs/examples/testmtp1.lpi\n", + "A mtprocs/examples/testmtp1.lpr\n", + "A mtprocs/Readme.txt\n", + "A mtprocs/mtprocs.pas\n", + "A mtprocs/mtpcpu.pas\n", + "A mtprocs/multithreadprocslaz.lpk\n", + "A mtprocs/mtputils.pas\n", + "A mtprocs/multithreadprocslaz.pas\n", + "Checked out revision 8093.\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "NYDMPdbn7W9w", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "49e5e05b-8c6e-4f5b-dd5a-55cfe5013f74" + }, + "source": [ + "!lazbuild mtprocs/multithreadprocslaz.lpk" + ], + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "CopySecondaryConfigFile /etc/lazarus/environmentoptions.xml -> /root/.lazarus/environmentoptions.xml\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"compilertest.pas\"\n", + "Hint: (lazarus) Missing state file of MultiThreadProcsLaz 1.2.1: /content/mtprocs/lib/x86_64-linux/MultiThreadProcsLaz.compiled\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\" \"-Px86_64\" \"-Tlinux\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"-Px86_64\" \"-Tlinux\" \"compilertest.pas\"\n", + "Info: (lazarus) Execute Title=\"Compile package MultiThreadProcsLaz 1.2.1\"\n", + "Info: (lazarus) Working Directory=\"/content/mtprocs/\"\n", + "Info: (lazarus) Executable=\"/usr/bin/fpc\"\n", + "Info: (lazarus) Param[0]=\"-B\"\n", + "Info: (lazarus) Param[1]=\"-MObjFPC\"\n", + "Info: (lazarus) Param[2]=\"-Scghi\"\n", + "Info: (lazarus) Param[3]=\"-Cg\"\n", + "Info: (lazarus) Param[4]=\"-O1\"\n", + "Info: (lazarus) Param[5]=\"-g\"\n", + "Info: (lazarus) Param[6]=\"-gl\"\n", + "Info: (lazarus) Param[7]=\"-l\"\n", + "Info: (lazarus) Param[8]=\"-vewnhibq\"\n", + "Info: (lazarus) Param[9]=\"-Fu/usr/lib/lazarus/1.8.2/packager/units/x86_64-linux\"\n", + "Info: (lazarus) Param[10]=\"-Fu/content/mtprocs/\"\n", + "Info: (lazarus) Param[11]=\"-FU/content/mtprocs/lib/x86_64-linux/\"\n", + "Info: (lazarus) Param[12]=\"multithreadprocslaz.pas\"\n", + "Hint: (11030) Start of reading config file /etc/fpc.cfg\n", + "Hint: (11031) End of reading config file /etc/fpc.cfg\n", + "Free Pascal Compiler version 3.0.4+dfsg-18ubuntu2 [2018/08/29] for x86_64\n", + "Copyright (c) 1993-2017 by Florian Klaempfl and others\n", + "(1002) Target OS: Linux for x86-64\n", + "(3104) Compiling multithreadprocslaz.pas\n", + "(3104) Compiling mtprocs.pas\n", + "(3104) Compiling mtpcpu.pas\n", + "(3104) Compiling mtputils.pas\n", + "/content/mtprocs/mtputils.pas(40,43) Hint: (5024) Parameter \"Data\" not used\n", + "/content/mtprocs/multithreadprocslaz.pas(10,10) Hint: (5023) Unit \"MTPUtils\" not used in MultiThreadProcsLaz\n", + "/content/mtprocs/multithreadprocslaz.pas(10,20) Hint: (5023) Unit \"MTPCPU\" not used in MultiThreadProcsLaz\n", + "(1008) 1215 lines compiled, 0.1 sec\n", + "(1022) 5 hint(s) issued\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "H_mKELt35Hym", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "42785862-c8f2-4c4f-f8f5-a60ad88d51b2" + }, + "source": [ + "!ls -l neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi" + ], + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "-rw-r--r-- 1 root root 5694 Sep 23 08:37 neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "_Xye-mYy2UHP", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "dedb9a91-c464-4cf8-ca6a-d5b9ac3379f6" + }, + "source": [ + "!lazbuild neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi" + ], + "execution_count": 7, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"compilertest.pas\"\n", + "TProject.DoLoadStateFile Statefile not found: /content/neural-api/bin/x86_64-linux/units/SimpleImageClassifier.compiled\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\" \"-Px86_64\" \"-Tlinux\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"-Px86_64\" \"-Tlinux\" \"compilertest.pas\"\n", + "Info: (lazarus) Execute Title=\"Compile Project, Mode: Default, Target: /content/neural-api/bin/x86_64-linux/bin/SimpleImageClassifier\"\n", + "Info: (lazarus) Working Directory=\"/content/neural-api/examples/SimpleImageClassifier/\"\n", + "Info: (lazarus) Executable=\"/usr/bin/fpc\"\n", + "Info: (lazarus) Param[0]=\"-B\"\n", + "Info: (lazarus) Param[1]=\"-MObjFPC\"\n", + "Info: (lazarus) Param[2]=\"-Scghi\"\n", + "Info: (lazarus) Param[3]=\"-Cg\"\n", + "Info: (lazarus) Param[4]=\"-O3\"\n", + "Info: (lazarus) Param[5]=\"-l\"\n", + "Info: (lazarus) Param[6]=\"-vewnhibq\"\n", + "Info: (lazarus) Param[7]=\"-Fi/content/neural-api/neural\"\n", + "Info: (lazarus) Param[8]=\"-Fi/content/neural-api/bin/x86_64-linux/units\"\n", + "Info: (lazarus) Param[9]=\"-Fu/content/neural-api/neural\"\n", + "Info: (lazarus) Param[10]=\"-Fu/usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux\"\n", + "Info: (lazarus) Param[11]=\"-Fu/usr/lib/lazarus/1.8.2/components/lazutils/lib/x86_64-linux\"\n", + "Info: (lazarus) Param[12]=\"-Fu/content/mtprocs/lib/x86_64-linux\"\n", + "Info: (lazarus) Param[13]=\"-Fu/usr/lib/lazarus/1.8.2/packager/units/x86_64-linux\"\n", + "Info: (lazarus) Param[14]=\"-Fu/content/neural-api/examples/SimpleImageClassifier/\"\n", + "Info: (lazarus) Param[15]=\"-FU/content/neural-api/bin/x86_64-linux/units/\"\n", + "Info: (lazarus) Param[16]=\"-FE/content/neural-api/bin/x86_64-linux/bin/\"\n", + "Info: (lazarus) Param[17]=\"-dUseCThreads\"\n", + "Info: (lazarus) Param[18]=\"-dAVX\"\n", + "Info: (lazarus) Param[19]=\"-dRelease\"\n", + "Info: (lazarus) Param[20]=\"SimpleImageClassifier.lpr\"\n", + "Hint: (11030) Start of reading config file /etc/fpc.cfg\n", + "Compiling Release Version\n", + "Hint: (11031) End of reading config file /etc/fpc.cfg\n", + "Free Pascal Compiler version 3.0.4+dfsg-18ubuntu2 [2018/08/29] for x86_64\n", + "Copyright (c) 1993-2017 by Florian Klaempfl and others\n", + "(1002) Target OS: Linux for x86-64\n", + "(3104) Compiling SimpleImageClassifier.lpr\n", + "(3104) Compiling /content/neural-api/neural/neuralnetwork.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralvolume.pas\n", + "/content/neural-api/neural/neuralnetwork.inc(34,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralnetwork.inc(38,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralvolume.pas(464,19) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt;LongInt;LongInt;Boolean=\"TRUE\");\"\n", + "(3104) Compiling /content/neural-api/neural/neuralbit.pas\n", + "/content/neural-api/neural/neuralbit.pas(722,19) Hint: (5058) Variable \"VARS\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(560,31) Hint: (5024) Parameter \"x\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(2076,37) Hint: (5058) Variable \"V\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(398,43) Hint: (5024) Parameter \"S\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(2329,19) Hint: (5058) Variable \"pInput\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(2335,21) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(2353,27) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(3411,16) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(4852,3) Note: (5027) Local variable \"version\" is assigned but never used\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "(3104) Compiling /content/neural-api/neural/neuralgeneric.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralbyteprediction.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralabfun.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralab.pas\n", + "/content/neural-api/neural/neuralabfun.pas(615,71) Hint: (5057) Local variable \"predictState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(702,32) Note: (5027) Local variable \"NonZeroErrorsCount\" is assigned but never used\n", + "/content/neural-api/neural/neuralabfun.pas(1027,9) Warning: (5036) Local variable \"PermissibleErrors\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(1021,83) Hint: (5057) Local variable \"efeito\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(669,3) Note: (5025) Local variable \"csUnitaryTests\" not used\n", + "/content/neural-api/neural/neuralabfun.pas(670,3) Note: (5025) Local variable \"csBinaryTests\" not used\n", + "(3104) Compiling /content/neural-api/neural/neuralcache.pas\n", + "/content/neural-api/neural/neuralcache.pas(206,1) Warning: (5059) Function result variable does not seem to initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(370,1) Warning: (5059) Function result variable does not seem to initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(373,49) Hint: (5058) Variable \"pState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(429,111) Hint: (5057) Local variable \"Effect\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(540,69) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(522,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(724,21) Warning: (5036) Local variable \"idxCache\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(760,43) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(780,69) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(863,3) Note: (5027) Local variable \"version\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(864,3) Note: (5027) Local variable \"evaluation\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(865,3) Note: (5027) Local variable \"pActionLen\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(866,3) Note: (5027) Local variable \"pStatelen\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(965,23) Hint: (5057) Local variable \"PredictedState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(978,36) Hint: (5058) Variable \"NG\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(980,29) Hint: (5057) Local variable \"Effect\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1081,42) Hint: (5024) Parameter \"PredictedBytePos\" not used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1126,35) Hint: (5058) Variable \"PNextStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1129,43) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1129,27) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1126,22) Hint: (5058) Variable \"pred\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1292,35) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1247,37) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1248,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1329,65) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1316,41) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1316,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(50,32) Hint: (5023) Unit \"neuralvolume\" not used in neuralbyteprediction\n", + "/content/neural-api/neural/neuralnetwork.pas(1005,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1072,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1078,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1084,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1615,17) Warning: (3057) An inherited method is hidden by \"constructor Create(TNNet;Word;Word;LongInt);\"\n", + "/content/neural-api/neural/neuralnetwork.pas(6250,3) Note: (5025) Local variable \"I\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7092,3) Note: (5025) Local variable \"OutX\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7092,9) Note: (5025) Local variable \"OutY\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7283,3) Note: (5027) Local variable \"Len\" is assigned but never used\n", + "/content/neural-api/neural/neuralnetwork.pas(9621,65) Warning: (5089) Local variable \"aL\" of a managed type does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(9622,77) Warning: (5089) Local variable \"aIdx\" of a managed type does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(12793,21) Warning: (5036) Local variable \"idxCache\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(12812,34) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "/content/neural-api/neural/neuralnetwork.pas(87,28) Hint: (5023) Unit \"syncobjs\" not used in neuralnetwork\n", + "(3104) Compiling /content/neural-api/neural/neuraldatasets.pas\n", + "/content/neural-api/neural/neuralnetwork.inc(34,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralnetwork.inc(38,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "(3104) Compiling /content/neural-api/neural/neuralthread.pas\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "/content/neural-api/neural/neuraldatasets.pas(151,46) Hint: (5024) Parameter \"FolderName\" not used\n", + "/content/neural-api/neural/neuraldatasets.pas(576,3) Note: (5025) Local variable \"SourceVolume\" not used\n", + "(3104) Compiling /content/neural-api/neural/neuralfit.pas\n", + "/content/neural-api/neural/neuralfit.pas(280,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(281,46) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(282,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(283,44) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(241,33) Hint: (5024) Parameter \"Idx\" not used\n", + "/content/neural-api/neural/neuralfit.pas(242,49) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(243,43) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(175,72) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(217,32) Hint: (5024) Parameter \"Idx\" not used\n", + "/content/neural-api/neural/neuralfit.pas(217,46) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(218,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(219,42) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(192,36) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(193,37) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(276,36) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(277,37) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpr(11,3) Hint: (5023) Unit \"math\" not used in SimpleImageClassifier\n", + "(9015) Linking /content/neural-api/bin/x86_64-linux/bin/SimpleImageClassifier\n", + "/usr/bin/ld.bfd: warning: /content/neural-api/bin/x86_64-linux/bin/link.res contains output sections; did you forget -T?\n", + "(1008) 35358 lines compiled, 1.8 sec\n", + "(1021) 17 warning(s) issued\n", + "(1022) 161 hint(s) issued\n", + "(1023) 13 note(s) issued\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "7xWWg1E1P2pm", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "55c25722-d62e-461c-b283-2c2ee37e776a" + }, + "source": [ + "ls -l neural-api/bin/x86_64-linux/bin/SimpleImageClassifier" + ], + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "-rwxr-xr-x 1 root root 1951024 Sep 23 08:43 \u001b[0m\u001b[01;32mneural-api/bin/x86_64-linux/bin/SimpleImageClassifier\u001b[0m*\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "WBxvm6S4-FtJ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e7b5f828-592e-4df3-87ad-53b017d4fd7c" + }, + "source": [ + "import os\n", + "import urllib.request\n", + "\n", + "if not os.path.isfile('cifar-10-batches-bin/data_batch_1.bin'):\n", + " print(\"Downloading CIFAR-10 Files\")\n", + " url = 'https://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz'\n", + " urllib.request.urlretrieve(url, './file.tar')" + ], + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Downloading CIFAR-10 Files\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "SpfaXVrrKgd0", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "1e92f226-019f-4857-af68-79cd62ddfd19" + }, + "source": [ + "ls -l" + ], + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "total 166080\n", + "-rw-r--r-- 1 root root 170052171 Sep 23 08:46 file.tar\n", + "drwxr-xr-x 5 root root 4096 Sep 23 08:39 \u001b[0m\u001b[01;34mmtprocs\u001b[0m/\n", + "drwxr-xr-x 7 root root 4096 Sep 23 08:42 \u001b[01;34mneural-api\u001b[0m/\n", + "drwxr-xr-x 1 root root 4096 Sep 16 13:40 \u001b[01;34msample_data\u001b[0m/\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "doqZbQkqKy9I", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "844e0f45-1184-49ab-8613-5353f5e8ad5b" + }, + "source": [ + "!tar -xvf ./file.tar" + ], + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "cifar-10-batches-bin/\n", + "cifar-10-batches-bin/data_batch_1.bin\n", + "cifar-10-batches-bin/batches.meta.txt\n", + "cifar-10-batches-bin/data_batch_3.bin\n", + "cifar-10-batches-bin/data_batch_4.bin\n", + "cifar-10-batches-bin/test_batch.bin\n", + "cifar-10-batches-bin/readme.html\n", + "cifar-10-batches-bin/data_batch_5.bin\n", + "cifar-10-batches-bin/data_batch_2.bin\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "VWB54wU5B1I9", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4008e5b2-ae01-4ba6-a548-1fba01228ea4" + }, + "source": [ + "if not os.path.isfile('./data_batch_1.bin'):\n", + " print(\"Copying files to current folder\")\n", + " !cp ./cifar-10-batches-bin/* ./" + ], + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Copying files to current folder\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "X5bpFXiaC_PY", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f7eb3f66-7944-4bed-ee64-1aa4558b3d89" + }, + "source": [ + "if os.path.isfile('./data_batch_1.bin'):\n", + " print(\"RUNNING!\")\n", + " !neural-api/bin/x86_64-linux/bin/SimpleImageClassifier" + ], + "execution_count": 13, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "RUNNING!\n", + "Creating Neural Network...\n", + " Layers: 12\n", + " Neurons:331\n", + " Weights:162498 Sum: -19.536575\n", + "Layer 0 Neurons: 0 Weights: 0 TNNetInput(32,32,3,0,0) Output:32,32,3 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Branches:1\n", + "Layer 1 Neurons: 64 Weights: 4800 TNNetConvolutionLinear(64,5,2,1,1) Output:32,32,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 9.3083 Parent:0 Branches:1\n", + "Layer 2 Neurons: 0 Weights: 0 TNNetMaxPool(4,4,0,0,0) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:1 Branches:1\n", + "Layer 3 Neurons: 1 Weights: 2 TNNetMovingStdNormalization(0,0,0,0,0) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 1.0000 Parent:2 Branches:1\n", + "Layer 4 Neurons: 64 Weights: 36864 TNNetConvolutionReLU(64,3,1,1,1) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum:-16.7340 Parent:3 Branches:1\n", + "Layer 5 Neurons: 64 Weights: 36864 TNNetConvolutionReLU(64,3,1,1,1) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: -2.0621 Parent:4 Branches:1\n", + "Layer 6 Neurons: 64 Weights: 36864 TNNetConvolutionReLU(64,3,1,1,1) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: -3.9453 Parent:5 Branches:1\n", + "Layer 7 Neurons: 64 Weights: 36864 TNNetConvolutionReLU(64,3,1,1,1) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 3.3115 Parent:6 Branches:1\n", + "Layer 8 Neurons: 0 Weights: 0 TNNetDropout(2,1,0,0,0) Output:8,8,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:7 Branches:1\n", + "Layer 9 Neurons: 0 Weights: 0 TNNetMaxPool(2,2,0,0,0) Output:4,4,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:8 Branches:1\n", + "Layer 10 Neurons: 10 Weights: 10240 TNNetFullConnectLinear(10,1,1,0,0) Output:10,1,1 Learning Rate:0.0100 Inertia:0.90 Weight Sum:-10.4149 Parent:9 Branches:1\n", + "Layer 11 Neurons: 0 Weights: 0 TNNetSoftMax(0,0,0,0,0) Output:10,1,1 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:10 Branches:0\n", + "Loading 10K images from file \"data_batch_1.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_2.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_3.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_4.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_5.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"test_batch.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "File name is: SimpleImageClassifier-64\n", + "Learning rate:0.001000 L2 decay:0.000010 Inertia:0.900000 Batch size:64 Step size:64 Staircase ephocs:10\n", + "Training images: 40000\n", + "Validation images: 10000\n", + "Test images: 10000\n", + "Computing...\n", + "640 Examples seen. Accuracy: 0.1481 Error: 1.79544 Loss: 2.29493 Threads: 2 Forward time: 0.69s Backward time: 0.52s Step time: 2.55s\n", + "1280 Examples seen. Accuracy: 0.1479 Error: 1.77985 Loss: 2.23596 Threads: 2 Forward time: 0.67s Backward time: 0.52s Step time: 2.50s\n", + "1920 Examples seen. Accuracy: 0.1498 Error: 1.75829 Loss: 2.17276 Threads: 2 Forward time: 0.71s Backward time: 0.53s Step time: 2.50s\n", + "2560 Examples seen. Accuracy: 0.1550 Error: 1.72284 Loss: 2.10358 Threads: 2 Forward time: 0.67s Backward time: 0.53s Step time: 2.50s\n", + "3200 Examples seen. Accuracy: 0.1607 Error: 1.71363 Loss: 2.12127 Threads: 2 Forward time: 0.67s Backward time: 0.53s Step time: 2.54s\n", + "3840 Examples seen. Accuracy: 0.1660 Error: 1.72590 Loss: 2.05349 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.51s\n", + "4480 Examples seen. Accuracy: 0.1770 Error: 1.63273 Loss: 1.86535 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.49s\n", + "5120 Examples seen. Accuracy: 0.1856 Error: 1.63568 Loss: 1.95574 Threads: 2 Forward time: 0.70s Backward time: 0.52s Step time: 2.50s\n", + "5760 Examples seen. Accuracy: 0.1979 Error: 1.62821 Loss: 1.88185 Threads: 2 Forward time: 0.66s Backward time: 0.53s Step time: 2.51s\n", + "6400 Examples seen. Accuracy: 0.2075 Error: 1.66402 Loss: 2.07736 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.50s\n", + "7040 Examples seen. Accuracy: 0.2177 Error: 1.64277 Loss: 2.04907 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.51s\n", + "7680 Examples seen. Accuracy: 0.2264 Error: 1.59409 Loss: 1.79512 Threads: 2 Forward time: 0.70s Backward time: 0.53s Step time: 2.50s\n", + "8320 Examples seen. Accuracy: 0.2360 Error: 1.54550 Loss: 1.85149 Threads: 2 Forward time: 0.69s Backward time: 0.53s Step time: 2.52s\n", + "8960 Examples seen. Accuracy: 0.2456 Error: 1.56664 Loss: 1.77805 Threads: 2 Forward time: 0.70s Backward time: 0.54s Step time: 2.55s\n", + "9600 Examples seen. Accuracy: 0.2541 Error: 1.59044 Loss: 1.93252 Threads: 2 Forward time: 0.69s Backward time: 0.54s Step time: 2.51s\n", + "10240 Examples seen. Accuracy: 0.2597 Error: 1.58854 Loss: 1.81173 Threads: 2 Forward time: 0.68s Backward time: 0.54s Step time: 2.50s\n", + "10880 Examples seen. Accuracy: 0.2660 Error: 1.49855 Loss: 1.64290 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.49s\n", + "11520 Examples seen. Accuracy: 0.2734 Error: 1.47110 Loss: 1.53985 Threads: 2 Forward time: 0.68s Backward time: 0.53s Step time: 2.49s\n", + "12160 Examples seen. Accuracy: 0.2793 Error: 1.43010 Loss: 1.51361 Threads: 2 Forward time: 0.66s Backward time: 0.51s Step time: 2.49s\n", + "12800 Examples seen. Accuracy: 0.2864 Error: 1.54338 Loss: 1.81172 Threads: 2 Forward time: 0.67s Backward time: 0.52s Step time: 2.48s\n", + "13440 Examples seen. Accuracy: 0.2888 Error: 1.56118 Loss: 1.84152 Threads: 2 Forward time: 0.66s Backward time: 0.52s Step time: 2.52s\n", + "14080 Examples seen. Accuracy: 0.2940 Error: 1.45340 Loss: 1.62768 Threads: 2 Forward time: 0.71s Backward time: 0.52s Step time: 2.50s\n", + "14720 Examples seen. Accuracy: 0.2992 Error: 1.53040 Loss: 1.71362 Threads: 2 Forward time: 0.70s Backward time: 0.53s Step time: 2.47s\n", + "15360 Examples seen. Accuracy: 0.3066 Error: 1.53963 Loss: 1.90071 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.45s\n", + "16000 Examples seen. Accuracy: 0.3135 Error: 1.46878 Loss: 1.61237 Threads: 2 Forward time: 0.71s Backward time: 0.56s Step time: 2.49s\n", + "16640 Examples seen. Accuracy: 0.3198 Error: 1.51176 Loss: 1.79796 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.46s\n", + "17280 Examples seen. Accuracy: 0.3235 Error: 1.44523 Loss: 1.63515 Threads: 2 Forward time: 0.67s Backward time: 0.49s Step time: 2.46s\n", + "17920 Examples seen. Accuracy: 0.3291 Error: 1.46046 Loss: 1.47104 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.43s\n", + "18560 Examples seen. Accuracy: 0.3359 Error: 1.48456 Loss: 1.75611 Threads: 2 Forward time: 0.72s Backward time: 0.56s Step time: 2.48s\n", + "19200 Examples seen. Accuracy: 0.3392 Error: 1.43991 Loss: 1.63127 Threads: 2 Forward time: 0.69s Backward time: 0.55s Step time: 2.47s\n", + "19840 Examples seen. Accuracy: 0.3407 Error: 1.46214 Loss: 1.58897 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.50s\n", + "20480 Examples seen. Accuracy: 0.3448 Error: 1.47581 Loss: 1.80389 Threads: 2 Forward time: 0.66s Backward time: 0.52s Step time: 2.46s\n", + "21120 Examples seen. Accuracy: 0.3535 Error: 1.51542 Loss: 1.71892 Threads: 2 Forward time: 0.66s Backward time: 0.53s Step time: 2.45s\n", + "21760 Examples seen. Accuracy: 0.3606 Error: 1.40996 Loss: 1.61076 Threads: 2 Forward time: 0.66s Backward time: 0.51s Step time: 2.46s\n", + "22400 Examples seen. Accuracy: 0.3626 Error: 1.57226 Loss: 2.04786 Threads: 2 Forward time: 0.70s Backward time: 0.52s Step time: 2.46s\n", + "23040 Examples seen. Accuracy: 0.3684 Error: 1.39514 Loss: 1.45001 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.44s\n", + "23680 Examples seen. Accuracy: 0.3742 Error: 1.36091 Loss: 1.61692 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.44s\n", + "24320 Examples seen. Accuracy: 0.3760 Error: 1.46164 Loss: 1.61883 Threads: 2 Forward time: 0.68s Backward time: 0.53s Step time: 2.47s\n", + "24960 Examples seen. Accuracy: 0.3802 Error: 1.38044 Loss: 1.39986 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.50s\n", + "25600 Examples seen. Accuracy: 0.3861 Error: 1.51735 Loss: 1.78022 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.48s\n", + "26240 Examples seen. Accuracy: 0.3902 Error: 1.41811 Loss: 1.61700 Threads: 2 Forward time: 0.69s Backward time: 0.49s Step time: 2.49s\n", + "26880 Examples seen. Accuracy: 0.3887 Error: 1.46899 Loss: 1.56543 Threads: 2 Forward time: 0.66s Backward time: 0.53s Step time: 2.48s\n", + "27520 Examples seen. Accuracy: 0.3936 Error: 1.31012 Loss: 1.30139 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.46s\n", + "28160 Examples seen. Accuracy: 0.3983 Error: 1.39935 Loss: 1.62048 Threads: 2 Forward time: 0.70s Backward time: 0.52s Step time: 2.46s\n", + "28800 Examples seen. Accuracy: 0.3986 Error: 1.41875 Loss: 1.52329 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.44s\n", + "29440 Examples seen. Accuracy: 0.4022 Error: 1.39563 Loss: 1.52202 Threads: 2 Forward time: 0.66s Backward time: 0.51s Step time: 2.47s\n", + "30080 Examples seen. Accuracy: 0.4017 Error: 1.45439 Loss: 1.65365 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.44s\n", + "30720 Examples seen. Accuracy: 0.4051 Error: 1.33340 Loss: 1.45610 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.42s\n", + "31360 Examples seen. Accuracy: 0.4062 Error: 1.43259 Loss: 1.59719 Threads: 2 Forward time: 0.69s Backward time: 0.51s Step time: 2.43s\n", + "32000 Examples seen. Accuracy: 0.4073 Error: 1.41820 Loss: 1.82291 Threads: 2 Forward time: 0.66s Backward time: 0.50s Step time: 2.47s\n", + "32640 Examples seen. Accuracy: 0.4096 Error: 1.47982 Loss: 1.65160 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.45s\n", + "33280 Examples seen. Accuracy: 0.4113 Error: 1.38456 Loss: 1.50167 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.44s\n", + "33920 Examples seen. Accuracy: 0.4124 Error: 1.37090 Loss: 1.55271 Threads: 2 Forward time: 0.66s Backward time: 0.50s Step time: 2.44s\n", + "34560 Examples seen. Accuracy: 0.4161 Error: 1.43860 Loss: 1.73516 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.44s\n", + "35200 Examples seen. Accuracy: 0.4171 Error: 1.39582 Loss: 1.64415 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.45s\n", + "35840 Examples seen. Accuracy: 0.4200 Error: 1.40152 Loss: 1.58708 Threads: 2 Forward time: 0.71s Backward time: 0.50s Step time: 2.45s\n", + "36480 Examples seen. Accuracy: 0.4234 Error: 1.33571 Loss: 1.57454 Threads: 2 Forward time: 0.69s Backward time: 0.54s Step time: 2.53s\n", + "37120 Examples seen. Accuracy: 0.4301 Error: 1.20996 Loss: 1.25736 Threads: 2 Forward time: 0.67s Backward time: 0.53s Step time: 2.52s\n", + "37760 Examples seen. Accuracy: 0.4323 Error: 1.44967 Loss: 1.83971 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.53s\n", + "38400 Examples seen. Accuracy: 0.4334 Error: 1.32567 Loss: 1.47977 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.46s\n", + "39040 Examples seen. Accuracy: 0.4319 Error: 1.34760 Loss: 1.38344 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.47s\n", + "39680 Examples seen. Accuracy: 0.4334 Error: 1.32686 Loss: 1.47318 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.47s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 1 Examples seen:40000 Validation Accuracy: 0.5163 Validation Error: 1.2367 Validation Loss: 1.3394 Total time: 3.66min\n", + "Epoch time: 2.5750 minutes. 50 epochs: 2.1458 hours.\n", + "Epochs: 1. Working time: 0.06 hours.\n", + "40640 Examples seen. Accuracy: 0.4402 Error: 1.39607 Loss: 1.68056 Threads: 2 Forward time: 0.66s Backward time: 0.51s Step time: 2.45s\n", + "41280 Examples seen. Accuracy: 0.4421 Error: 1.25289 Loss: 1.23783 Threads: 2 Forward time: 0.72s Backward time: 0.52s Step time: 2.52s\n", + "41920 Examples seen. Accuracy: 0.4458 Error: 1.22554 Loss: 1.16512 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.56s\n", + "42560 Examples seen. Accuracy: 0.4467 Error: 1.33534 Loss: 1.68178 Threads: 2 Forward time: 0.69s Backward time: 0.53s Step time: 2.49s\n", + "43200 Examples seen. Accuracy: 0.4503 Error: 1.36218 Loss: 1.59631 Threads: 2 Forward time: 0.66s Backward time: 0.51s Step time: 2.46s\n", + "43840 Examples seen. Accuracy: 0.4508 Error: 1.39591 Loss: 1.59698 Threads: 2 Forward time: 0.66s Backward time: 0.53s Step time: 2.47s\n", + "44480 Examples seen. Accuracy: 0.4512 Error: 1.35992 Loss: 1.53007 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.48s\n", + "45120 Examples seen. Accuracy: 0.4494 Error: 1.32980 Loss: 1.38933 Threads: 2 Forward time: 0.70s Backward time: 0.50s Step time: 2.45s\n", + "45760 Examples seen. Accuracy: 0.4512 Error: 1.24250 Loss: 1.40123 Threads: 2 Forward time: 0.67s Backward time: 0.49s Step time: 2.47s\n", + "46400 Examples seen. Accuracy: 0.4528 Error: 1.41063 Loss: 1.56648 Threads: 2 Forward time: 0.65s Backward time: 0.51s Step time: 2.43s\n", + "47040 Examples seen. Accuracy: 0.4542 Error: 1.34692 Loss: 1.58015 Threads: 2 Forward time: 0.74s Backward time: 0.52s Step time: 2.42s\n", + "47680 Examples seen. Accuracy: 0.4582 Error: 1.25918 Loss: 1.29102 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.42s\n", + "48320 Examples seen. Accuracy: 0.4607 Error: 1.31420 Loss: 1.48015 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.42s\n", + "48960 Examples seen. Accuracy: 0.4616 Error: 1.35348 Loss: 1.57047 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.43s\n", + "49600 Examples seen. Accuracy: 0.4612 Error: 1.22624 Loss: 1.37146 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.46s\n", + "50240 Examples seen. Accuracy: 0.4595 Error: 1.40065 Loss: 1.56835 Threads: 2 Forward time: 0.72s Backward time: 0.49s Step time: 2.49s\n", + "50880 Examples seen. Accuracy: 0.4617 Error: 1.36675 Loss: 1.55090 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.43s\n", + "51520 Examples seen. Accuracy: 0.4609 Error: 1.34522 Loss: 1.38099 Threads: 2 Forward time: 0.69s Backward time: 0.52s Step time: 2.44s\n", + "52160 Examples seen. Accuracy: 0.4633 Error: 1.28366 Loss: 1.41689 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.42s\n", + "52800 Examples seen. Accuracy: 0.4679 Error: 1.21513 Loss: 1.42658 Threads: 2 Forward time: 0.68s Backward time: 0.52s Step time: 2.45s\n", + "53440 Examples seen. Accuracy: 0.4708 Error: 1.30849 Loss: 1.53340 Threads: 2 Forward time: 0.69s Backward time: 0.49s Step time: 2.43s\n", + "54080 Examples seen. Accuracy: 0.4732 Error: 1.40573 Loss: 1.46094 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.42s\n", + "54720 Examples seen. Accuracy: 0.4775 Error: 1.23261 Loss: 1.33425 Threads: 2 Forward time: 0.67s Backward time: 0.49s Step time: 2.42s\n", + "55360 Examples seen. Accuracy: 0.4789 Error: 1.20426 Loss: 1.25272 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.44s\n", + "56000 Examples seen. Accuracy: 0.4824 Error: 1.17741 Loss: 1.18861 Threads: 2 Forward time: 0.67s Backward time: 0.49s Step time: 2.41s\n", + "56640 Examples seen. Accuracy: 0.4804 Error: 1.31370 Loss: 1.48129 Threads: 2 Forward time: 0.70s Backward time: 0.56s Step time: 2.47s\n", + "57280 Examples seen. Accuracy: 0.4816 Error: 1.34587 Loss: 1.58014 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.47s\n", + "57920 Examples seen. Accuracy: 0.4836 Error: 1.21501 Loss: 1.32031 Threads: 2 Forward time: 0.66s Backward time: 0.48s Step time: 2.46s\n", + "58560 Examples seen. Accuracy: 0.4855 Error: 1.25863 Loss: 1.42719 Threads: 2 Forward time: 0.69s Backward time: 0.51s Step time: 2.43s\n", + "59200 Examples seen. Accuracy: 0.4864 Error: 1.25754 Loss: 1.30167 Threads: 2 Forward time: 0.67s Backward time: 0.48s Step time: 2.41s\n", + "59840 Examples seen. Accuracy: 0.4902 Error: 1.18845 Loss: 1.25104 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.40s\n", + "60480 Examples seen. Accuracy: 0.4888 Error: 1.22724 Loss: 1.26680 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.40s\n", + "61120 Examples seen. Accuracy: 0.4858 Error: 1.32534 Loss: 1.66756 Threads: 2 Forward time: 0.67s Backward time: 0.48s Step time: 2.41s\n", + "61760 Examples seen. Accuracy: 0.4867 Error: 1.23665 Loss: 1.31761 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.40s\n", + "62400 Examples seen. Accuracy: 0.4891 Error: 1.37480 Loss: 1.56838 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.45s\n", + "63040 Examples seen. Accuracy: 0.4882 Error: 1.32497 Loss: 1.52067 Threads: 2 Forward time: 0.68s Backward time: 0.48s Step time: 2.43s\n", + "63680 Examples seen. Accuracy: 0.4885 Error: 1.23105 Loss: 1.33264 Threads: 2 Forward time: 0.69s Backward time: 0.51s Step time: 2.44s\n", + "64320 Examples seen. Accuracy: 0.4874 Error: 1.29117 Loss: 1.41264 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.44s\n", + "64960 Examples seen. Accuracy: 0.4905 Error: 1.04727 Loss: 1.08052 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.43s\n", + "65600 Examples seen. Accuracy: 0.4925 Error: 1.16781 Loss: 1.18518 Threads: 2 Forward time: 0.66s Backward time: 0.48s Step time: 2.42s\n", + "66240 Examples seen. Accuracy: 0.4946 Error: 1.32698 Loss: 1.36193 Threads: 2 Forward time: 0.66s Backward time: 0.48s Step time: 2.41s\n", + "66880 Examples seen. Accuracy: 0.4948 Error: 1.21861 Loss: 1.39665 Threads: 2 Forward time: 0.70s Backward time: 0.48s Step time: 2.39s\n", + "67520 Examples seen. Accuracy: 0.4989 Error: 1.13003 Loss: 1.22982 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.38s\n", + "68160 Examples seen. Accuracy: 0.4998 Error: 1.10655 Loss: 1.17619 Threads: 2 Forward time: 0.66s Backward time: 0.48s Step time: 2.38s\n", + "68800 Examples seen. Accuracy: 0.5027 Error: 1.11410 Loss: 1.23831 Threads: 2 Forward time: 0.68s Backward time: 0.51s Step time: 2.43s\n", + "69440 Examples seen. Accuracy: 0.5021 Error: 1.20098 Loss: 1.40219 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.42s\n", + "70080 Examples seen. Accuracy: 0.5025 Error: 1.28556 Loss: 1.60134 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.39s\n", + "70720 Examples seen. Accuracy: 0.5037 Error: 1.32673 Loss: 1.49878 Threads: 2 Forward time: 0.71s Backward time: 0.47s Step time: 2.37s\n", + "71360 Examples seen. Accuracy: 0.5057 Error: 1.17321 Loss: 1.19003 Threads: 2 Forward time: 0.65s Backward time: 0.49s Step time: 2.39s\n", + "72000 Examples seen. Accuracy: 0.5046 Error: 1.21618 Loss: 1.37591 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.39s\n", + "72640 Examples seen. Accuracy: 0.5064 Error: 1.17879 Loss: 1.23261 Threads: 2 Forward time: 0.70s Backward time: 0.49s Step time: 2.38s\n", + "73280 Examples seen. Accuracy: 0.5059 Error: 1.12521 Loss: 1.21161 Threads: 2 Forward time: 0.67s Backward time: 0.48s Step time: 2.38s\n", + "73920 Examples seen. Accuracy: 0.5061 Error: 1.21973 Loss: 1.37913 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.37s\n", + "74560 Examples seen. Accuracy: 0.5034 Error: 1.34306 Loss: 1.40960 Threads: 2 Forward time: 0.69s Backward time: 0.48s Step time: 2.40s\n", + "75200 Examples seen. Accuracy: 0.5054 Error: 1.28294 Loss: 1.44882 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.40s\n", + "75840 Examples seen. Accuracy: 0.5065 Error: 1.37193 Loss: 1.64460 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.40s\n", + "76480 Examples seen. Accuracy: 0.5065 Error: 1.34023 Loss: 1.53348 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.46s\n", + "77120 Examples seen. Accuracy: 0.5073 Error: 1.26684 Loss: 1.33574 Threads: 2 Forward time: 0.65s Backward time: 0.50s Step time: 2.43s\n", + "77760 Examples seen. Accuracy: 0.5115 Error: 1.19319 Loss: 1.29400 Threads: 2 Forward time: 0.70s Backward time: 0.49s Step time: 2.40s\n", + "78400 Examples seen. Accuracy: 0.5139 Error: 1.18306 Loss: 1.60150 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.43s\n", + "79040 Examples seen. Accuracy: 0.5180 Error: 1.28231 Loss: 1.38482 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.39s\n", + "79680 Examples seen. Accuracy: 0.5198 Error: 1.23234 Loss: 1.17779 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.42s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 2 Examples seen:80000 Validation Accuracy: 0.5280 Validation Error: 1.2106 Validation Loss: 1.2998 Total time: 7.23min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.241 Min Weight: -0.235 Max Output: 3.830 Min Output: -3.955 TNNetConvolutionLinear 32,32,64 Times: 30.20s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.830 Min Output: -1.498 TNNetMaxPool 8,8,64 Times: 7.00s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.902 Min Weight: 0.586 Max Output: 3.596 Min Output: -2.310 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.105 Min Weight: -0.104 Max Output: 4.570 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.05s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.112 Min Weight: -0.114 Max Output: 3.343 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.01s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.117 Min Weight: -0.102 Max Output: 2.087 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.96s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.124 Min Weight: -0.108 Max Output: 1.748 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.08s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.748 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.748 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.43s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.184 Min Weight: -0.146 Max Output: 2.421 Min Output: -2.251 TNNetFullConnectLinear 10,1,1 Times: 0.08s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.578 Min Output: 0.005 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.5208 minutes. 50 epochs: 2.1007 hours.\n", + "Epochs: 2. Working time: 0.12 hours.\n", + "80640 Examples seen. Accuracy: 0.5217 Error: 1.25977 Loss: 1.32582 Threads: 2 Forward time: 0.67s Backward time: 0.51s Step time: 2.42s\n", + "81280 Examples seen. Accuracy: 0.5215 Error: 1.23738 Loss: 1.46194 Threads: 2 Forward time: 0.74s Backward time: 0.53s Step time: 2.50s\n", + "81920 Examples seen. Accuracy: 0.5240 Error: 1.36221 Loss: 1.65249 Threads: 2 Forward time: 0.72s Backward time: 0.54s Step time: 2.64s\n", + "82560 Examples seen. Accuracy: 0.5249 Error: 1.08699 Loss: 1.05420 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.50s\n", + "83200 Examples seen. Accuracy: 0.5256 Error: 1.22711 Loss: 1.34938 Threads: 2 Forward time: 0.72s Backward time: 0.49s Step time: 2.44s\n", + "83840 Examples seen. Accuracy: 0.5265 Error: 1.22419 Loss: 1.33143 Threads: 2 Forward time: 0.69s Backward time: 0.48s Step time: 2.45s\n", + "84480 Examples seen. Accuracy: 0.5255 Error: 1.28435 Loss: 1.42781 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.44s\n", + "85120 Examples seen. Accuracy: 0.5273 Error: 1.11672 Loss: 1.16786 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.46s\n", + "85760 Examples seen. Accuracy: 0.5265 Error: 1.11195 Loss: 1.16223 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.49s\n", + "86400 Examples seen. Accuracy: 0.5271 Error: 1.18559 Loss: 1.20379 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.49s\n", + "87040 Examples seen. Accuracy: 0.5304 Error: 1.06645 Loss: 1.06041 Threads: 2 Forward time: 0.67s Backward time: 0.49s Step time: 2.44s\n", + "87680 Examples seen. Accuracy: 0.5291 Error: 1.06728 Loss: 1.12536 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.44s\n", + "88320 Examples seen. Accuracy: 0.5284 Error: 1.36197 Loss: 1.49824 Threads: 2 Forward time: 0.69s Backward time: 0.48s Step time: 2.46s\n", + "88960 Examples seen. Accuracy: 0.5286 Error: 1.33446 Loss: 1.53771 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.44s\n", + "89600 Examples seen. Accuracy: 0.5299 Error: 1.20436 Loss: 1.29304 Threads: 2 Forward time: 0.71s Backward time: 0.52s Step time: 2.49s\n", + "90240 Examples seen. Accuracy: 0.5322 Error: 1.13818 Loss: 1.20439 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.48s\n", + "90880 Examples seen. Accuracy: 0.5321 Error: 1.18145 Loss: 1.34056 Threads: 2 Forward time: 0.70s Backward time: 0.50s Step time: 2.46s\n", + "91520 Examples seen. Accuracy: 0.5338 Error: 1.18489 Loss: 1.25516 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.39s\n", + "92160 Examples seen. Accuracy: 0.5332 Error: 1.06375 Loss: 1.23520 Threads: 2 Forward time: 0.68s Backward time: 0.48s Step time: 2.38s\n", + "92800 Examples seen. Accuracy: 0.5353 Error: 1.20202 Loss: 1.41078 Threads: 2 Forward time: 0.74s Backward time: 0.51s Step time: 2.40s\n", + "93440 Examples seen. Accuracy: 0.5402 Error: 1.10855 Loss: 1.23545 Threads: 2 Forward time: 0.67s Backward time: 0.48s Step time: 2.40s\n", + "94080 Examples seen. Accuracy: 0.5418 Error: 1.23072 Loss: 1.32038 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.40s\n", + "94720 Examples seen. Accuracy: 0.5421 Error: 1.19074 Loss: 1.50945 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.45s\n", + "95360 Examples seen. Accuracy: 0.5426 Error: 1.26900 Loss: 1.37056 Threads: 2 Forward time: 0.68s Backward time: 0.50s Step time: 2.42s\n", + "96000 Examples seen. Accuracy: 0.5407 Error: 1.26377 Loss: 1.49441 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.42s\n", + "96640 Examples seen. Accuracy: 0.5392 Error: 1.28611 Loss: 1.47267 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.40s\n", + "97280 Examples seen. Accuracy: 0.5416 Error: 1.18893 Loss: 1.39908 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.43s\n", + "97920 Examples seen. Accuracy: 0.5405 Error: 1.18357 Loss: 1.29477 Threads: 2 Forward time: 0.69s Backward time: 0.49s Step time: 2.40s\n", + "98560 Examples seen. Accuracy: 0.5421 Error: 1.12833 Loss: 1.16271 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.39s\n", + "99200 Examples seen. Accuracy: 0.5448 Error: 1.18661 Loss: 1.23381 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.38s\n", + "99840 Examples seen. Accuracy: 0.5451 Error: 1.13116 Loss: 1.27461 Threads: 2 Forward time: 0.70s Backward time: 0.48s Step time: 2.40s\n", + "100480 Examples seen. Accuracy: 0.5438 Error: 1.19824 Loss: 1.33744 Threads: 2 Forward time: 0.67s Backward time: 0.50s Step time: 2.42s\n", + "101120 Examples seen. Accuracy: 0.5435 Error: 1.26597 Loss: 1.40315 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.43s\n", + "101760 Examples seen. Accuracy: 0.5447 Error: 1.14179 Loss: 1.22289 Threads: 2 Forward time: 0.71s Backward time: 0.50s Step time: 2.42s\n", + "102400 Examples seen. Accuracy: 0.5426 Error: 1.16172 Loss: 1.28683 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.45s\n", + "103040 Examples seen. Accuracy: 0.5464 Error: 1.12014 Loss: 1.14475 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.46s\n", + "103680 Examples seen. Accuracy: 0.5469 Error: 1.19354 Loss: 1.35633 Threads: 2 Forward time: 0.70s Backward time: 0.51s Step time: 2.40s\n", + "104320 Examples seen. Accuracy: 0.5503 Error: 1.09195 Loss: 1.17948 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.38s\n", + "104960 Examples seen. Accuracy: 0.5537 Error: 1.13195 Loss: 1.23216 Threads: 2 Forward time: 0.70s Backward time: 0.48s Step time: 2.39s\n", + "105600 Examples seen. Accuracy: 0.5542 Error: 1.17438 Loss: 1.25003 Threads: 2 Forward time: 0.65s Backward time: 0.47s Step time: 2.38s\n", + "106240 Examples seen. Accuracy: 0.5558 Error: 1.06134 Loss: 1.15410 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.38s\n", + "106880 Examples seen. Accuracy: 0.5553 Error: 1.14725 Loss: 1.23581 Threads: 2 Forward time: 0.72s Backward time: 0.47s Step time: 2.45s\n", + "107520 Examples seen. Accuracy: 0.5565 Error: 1.02141 Loss: 1.04104 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.35s\n", + "108160 Examples seen. Accuracy: 0.5562 Error: 1.09003 Loss: 1.10040 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.35s\n", + "108800 Examples seen. Accuracy: 0.5555 Error: 1.19926 Loss: 1.41436 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.38s\n", + "109440 Examples seen. Accuracy: 0.5555 Error: 1.13296 Loss: 1.32973 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.38s\n", + "110080 Examples seen. Accuracy: 0.5564 Error: 1.19110 Loss: 1.43251 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.35s\n", + "110720 Examples seen. Accuracy: 0.5594 Error: 1.14849 Loss: 1.27873 Threads: 2 Forward time: 0.69s Backward time: 0.52s Step time: 2.38s\n", + "111360 Examples seen. Accuracy: 0.5613 Error: 1.11265 Loss: 1.26440 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.42s\n", + "112000 Examples seen. Accuracy: 0.5588 Error: 1.05700 Loss: 1.13769 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.39s\n", + "112640 Examples seen. Accuracy: 0.5605 Error: 1.04210 Loss: 1.11334 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.36s\n", + "113280 Examples seen. Accuracy: 0.5577 Error: 1.08367 Loss: 1.09816 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.34s\n", + "113920 Examples seen. Accuracy: 0.5577 Error: 1.10999 Loss: 1.16392 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.35s\n", + "114560 Examples seen. Accuracy: 0.5576 Error: 1.12588 Loss: 1.15112 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.35s\n", + "115200 Examples seen. Accuracy: 0.5564 Error: 1.14632 Loss: 1.30112 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.38s\n", + "115840 Examples seen. Accuracy: 0.5592 Error: 1.13579 Loss: 1.28841 Threads: 2 Forward time: 0.66s Backward time: 0.48s Step time: 2.35s\n", + "116480 Examples seen. Accuracy: 0.5598 Error: 1.14585 Loss: 1.20761 Threads: 2 Forward time: 0.65s Backward time: 0.48s Step time: 2.35s\n", + "117120 Examples seen. Accuracy: 0.5603 Error: 1.03519 Loss: 1.08286 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.39s\n", + "117760 Examples seen. Accuracy: 0.5624 Error: 1.03469 Loss: 1.14592 Threads: 2 Forward time: 0.65s Backward time: 0.48s Step time: 2.37s\n", + "118400 Examples seen. Accuracy: 0.5621 Error: 1.12518 Loss: 1.22586 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.35s\n", + "119040 Examples seen. Accuracy: 0.5648 Error: 1.06442 Loss: 1.03027 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.36s\n", + "119680 Examples seen. Accuracy: 0.5632 Error: 1.14389 Loss: 1.19306 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.34s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 3 Examples seen:120000 Validation Accuracy: 0.5486 Validation Error: 1.1838 Validation Loss: 1.2516 Total time: 10.79min\n", + "Epoch time: 2.4354 minutes. 50 epochs: 2.0295 hours.\n", + "Epochs: 3. Working time: 0.18 hours.\n", + "120640 Examples seen. Accuracy: 0.5678 Error: 1.15427 Loss: 1.31939 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.36s\n", + "121280 Examples seen. Accuracy: 0.5715 Error: 1.17294 Loss: 1.40640 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.37s\n", + "121920 Examples seen. Accuracy: 0.5726 Error: 1.23617 Loss: 1.31894 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.37s\n", + "122560 Examples seen. Accuracy: 0.5752 Error: 1.14357 Loss: 1.25303 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.34s\n", + "123200 Examples seen. Accuracy: 0.5775 Error: 1.09119 Loss: 1.19887 Threads: 2 Forward time: 0.65s Backward time: 0.46s Step time: 2.35s\n", + "123840 Examples seen. Accuracy: 0.5796 Error: 0.94131 Loss: 1.00081 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.40s\n", + "124480 Examples seen. Accuracy: 0.5807 Error: 1.01060 Loss: 1.14257 Threads: 2 Forward time: 0.68s Backward time: 0.48s Step time: 2.39s\n", + "125120 Examples seen. Accuracy: 0.5856 Error: 1.07786 Loss: 1.16765 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.36s\n", + "125760 Examples seen. Accuracy: 0.5845 Error: 1.03366 Loss: 1.01894 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.41s\n", + "126400 Examples seen. Accuracy: 0.5819 Error: 1.14479 Loss: 1.12500 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.34s\n", + "127040 Examples seen. Accuracy: 0.5790 Error: 1.11493 Loss: 1.27241 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.32s\n", + "127680 Examples seen. Accuracy: 0.5763 Error: 1.20491 Loss: 1.40975 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.33s\n", + "128320 Examples seen. Accuracy: 0.5772 Error: 1.05885 Loss: 1.15720 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.34s\n", + "128960 Examples seen. Accuracy: 0.5772 Error: 1.25268 Loss: 1.32778 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.36s\n", + "129600 Examples seen. Accuracy: 0.5773 Error: 1.08535 Loss: 1.18995 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.35s\n", + "130240 Examples seen. Accuracy: 0.5787 Error: 1.03734 Loss: 1.07496 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.34s\n", + "130880 Examples seen. Accuracy: 0.5809 Error: 1.09932 Loss: 1.21523 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.35s\n", + "131520 Examples seen. Accuracy: 0.5821 Error: 0.99388 Loss: 0.99963 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.38s\n", + "132160 Examples seen. Accuracy: 0.5808 Error: 1.14672 Loss: 1.22018 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.36s\n", + "132800 Examples seen. Accuracy: 0.5827 Error: 1.11488 Loss: 1.23393 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.35s\n", + "133440 Examples seen. Accuracy: 0.5825 Error: 1.05946 Loss: 1.21389 Threads: 2 Forward time: 0.71s Backward time: 0.45s Step time: 2.37s\n", + "134080 Examples seen. Accuracy: 0.5834 Error: 1.05712 Loss: 1.07691 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.39s\n", + "134720 Examples seen. Accuracy: 0.5837 Error: 1.10804 Loss: 1.18131 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.36s\n", + "135360 Examples seen. Accuracy: 0.5829 Error: 1.10233 Loss: 1.17018 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.35s\n", + "136000 Examples seen. Accuracy: 0.5827 Error: 1.17012 Loss: 1.17661 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.36s\n", + "136640 Examples seen. Accuracy: 0.5824 Error: 1.11954 Loss: 1.15826 Threads: 2 Forward time: 0.68s Backward time: 0.49s Step time: 2.36s\n", + "137280 Examples seen. Accuracy: 0.5859 Error: 0.87084 Loss: 0.88198 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.37s\n", + "137920 Examples seen. Accuracy: 0.5853 Error: 1.03737 Loss: 1.08369 Threads: 2 Forward time: 0.70s Backward time: 0.48s Step time: 2.36s\n", + "138560 Examples seen. Accuracy: 0.5849 Error: 1.15893 Loss: 1.14778 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.35s\n", + "139200 Examples seen. Accuracy: 0.5793 Error: 1.18279 Loss: 1.34970 Threads: 2 Forward time: 0.67s Backward time: 0.47s Step time: 2.35s\n", + "139840 Examples seen. Accuracy: 0.5813 Error: 1.14796 Loss: 1.35672 Threads: 2 Forward time: 0.69s Backward time: 0.47s Step time: 2.38s\n", + "140480 Examples seen. Accuracy: 0.5845 Error: 1.14214 Loss: 1.26108 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.35s\n", + "141120 Examples seen. Accuracy: 0.5847 Error: 1.01864 Loss: 1.15375 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.36s\n", + "141760 Examples seen. Accuracy: 0.5884 Error: 0.91631 Loss: 0.91500 Threads: 2 Forward time: 0.70s Backward time: 0.45s Step time: 2.35s\n", + "142400 Examples seen. Accuracy: 0.5892 Error: 0.97186 Loss: 1.09613 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.40s\n", + "143040 Examples seen. Accuracy: 0.5880 Error: 1.14412 Loss: 1.22655 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.39s\n", + "143680 Examples seen. Accuracy: 0.5862 Error: 1.07820 Loss: 1.13345 Threads: 2 Forward time: 0.69s Backward time: 0.50s Step time: 2.40s\n", + "144320 Examples seen. Accuracy: 0.5867 Error: 1.04732 Loss: 1.10469 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.37s\n", + "144960 Examples seen. Accuracy: 0.5884 Error: 1.08661 Loss: 1.40247 Threads: 2 Forward time: 0.69s Backward time: 0.47s Step time: 2.35s\n", + "145600 Examples seen. Accuracy: 0.5886 Error: 1.07829 Loss: 1.27540 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.51s\n", + "146240 Examples seen. Accuracy: 0.5902 Error: 1.03226 Loss: 1.03883 Threads: 2 Forward time: 0.70s Backward time: 0.49s Step time: 2.46s\n", + "146880 Examples seen. Accuracy: 0.5899 Error: 1.12810 Loss: 1.28696 Threads: 2 Forward time: 0.73s Backward time: 0.47s Step time: 2.44s\n", + "147520 Examples seen. Accuracy: 0.5928 Error: 1.01543 Loss: 1.00434 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.39s\n", + "148160 Examples seen. Accuracy: 0.5915 Error: 1.11240 Loss: 1.34505 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.38s\n", + "148800 Examples seen. Accuracy: 0.5906 Error: 1.02513 Loss: 1.01837 Threads: 2 Forward time: 0.70s Backward time: 0.48s Step time: 2.37s\n", + "149440 Examples seen. Accuracy: 0.5902 Error: 0.98376 Loss: 0.96761 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.34s\n", + "150080 Examples seen. Accuracy: 0.5931 Error: 0.96226 Loss: 1.04849 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.35s\n", + "150720 Examples seen. Accuracy: 0.5935 Error: 1.10129 Loss: 1.17258 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.38s\n", + "151360 Examples seen. Accuracy: 0.5923 Error: 1.02696 Loss: 1.02534 Threads: 2 Forward time: 0.72s Backward time: 0.47s Step time: 2.40s\n", + "152000 Examples seen. Accuracy: 0.5943 Error: 1.00840 Loss: 1.04701 Threads: 2 Forward time: 0.67s Backward time: 0.48s Step time: 2.41s\n", + "152640 Examples seen. Accuracy: 0.5934 Error: 1.05954 Loss: 1.14086 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.35s\n", + "153280 Examples seen. Accuracy: 0.5957 Error: 1.05938 Loss: 1.15342 Threads: 2 Forward time: 0.73s Backward time: 0.44s Step time: 2.38s\n", + "153920 Examples seen. Accuracy: 0.5931 Error: 0.98127 Loss: 1.00095 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.37s\n", + "154560 Examples seen. Accuracy: 0.5938 Error: 0.97991 Loss: 1.05079 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.34s\n", + "155200 Examples seen. Accuracy: 0.5955 Error: 1.07636 Loss: 1.25756 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.39s\n", + "155840 Examples seen. Accuracy: 0.5973 Error: 0.92489 Loss: 0.95511 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.36s\n", + "156480 Examples seen. Accuracy: 0.5995 Error: 0.98247 Loss: 1.04234 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.40s\n", + "157120 Examples seen. Accuracy: 0.5993 Error: 1.02203 Loss: 1.08866 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.38s\n", + "157760 Examples seen. Accuracy: 0.6029 Error: 0.92700 Loss: 0.94507 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.34s\n", + "158400 Examples seen. Accuracy: 0.6019 Error: 1.04495 Loss: 1.01813 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.34s\n", + "159040 Examples seen. Accuracy: 0.6036 Error: 0.88928 Loss: 1.08346 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.37s\n", + "159680 Examples seen. Accuracy: 0.6046 Error: 1.04162 Loss: 1.01996 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.33s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 4 Examples seen:160000 Validation Accuracy: 0.5712 Validation Error: 1.1551 Validation Loss: 1.2014 Total time: 14.30min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.252 Min Weight: -0.242 Max Output: 3.777 Min Output: -3.985 TNNetConvolutionLinear 32,32,64 Times: 30.15s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.777 Min Output: -1.254 TNNetMaxPool 8,8,64 Times: 6.89s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.861 Min Weight: 0.596 Max Output: 3.696 Min Output: -2.149 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.107 Min Weight: -0.110 Max Output: 4.717 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.03s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.114 Min Weight: -0.116 Max Output: 3.411 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.10s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.124 Min Weight: -0.108 Max Output: 1.954 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.91s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.127 Min Weight: -0.113 Max Output: 1.609 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.11s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.609 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.609 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.48s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.186 Min Weight: -0.146 Max Output: 2.576 Min Output: -2.644 TNNetFullConnectLinear 10,1,1 Times: 0.10s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.554 Min Output: 0.003 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.4229 minutes. 50 epochs: 2.0191 hours.\n", + "Epochs: 4. Working time: 0.24 hours.\n", + "160640 Examples seen. Accuracy: 0.6022 Error: 1.02820 Loss: 1.13428 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.38s\n", + "161280 Examples seen. Accuracy: 0.6022 Error: 1.05159 Loss: 1.05270 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.33s\n", + "161920 Examples seen. Accuracy: 0.6058 Error: 1.00540 Loss: 1.10244 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.36s\n", + "162560 Examples seen. Accuracy: 0.6051 Error: 0.97309 Loss: 0.98486 Threads: 2 Forward time: 0.72s Backward time: 0.45s Step time: 2.32s\n", + "163200 Examples seen. Accuracy: 0.6049 Error: 1.02378 Loss: 1.09324 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.32s\n", + "163840 Examples seen. Accuracy: 0.6050 Error: 0.98171 Loss: 1.05447 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.38s\n", + "164480 Examples seen. Accuracy: 0.6063 Error: 1.08927 Loss: 1.17961 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.36s\n", + "165120 Examples seen. Accuracy: 0.6057 Error: 1.07732 Loss: 1.12248 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "165760 Examples seen. Accuracy: 0.6063 Error: 0.92235 Loss: 0.98999 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.32s\n", + "166400 Examples seen. Accuracy: 0.6082 Error: 1.01425 Loss: 1.06065 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.32s\n", + "167040 Examples seen. Accuracy: 0.6063 Error: 1.04411 Loss: 1.14851 Threads: 2 Forward time: 0.74s Backward time: 0.47s Step time: 2.36s\n", + "167680 Examples seen. Accuracy: 0.6105 Error: 0.84269 Loss: 0.85942 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.38s\n", + "168320 Examples seen. Accuracy: 0.6112 Error: 1.09453 Loss: 1.24523 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.32s\n", + "168960 Examples seen. Accuracy: 0.6112 Error: 0.96294 Loss: 1.00242 Threads: 2 Forward time: 0.71s Backward time: 0.45s Step time: 2.32s\n", + "169600 Examples seen. Accuracy: 0.6121 Error: 1.07545 Loss: 1.16168 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.37s\n", + "170240 Examples seen. Accuracy: 0.6138 Error: 1.01232 Loss: 1.10694 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.36s\n", + "170880 Examples seen. Accuracy: 0.6122 Error: 1.10105 Loss: 1.30855 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.37s\n", + "171520 Examples seen. Accuracy: 0.6142 Error: 1.06088 Loss: 1.04755 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.35s\n", + "172160 Examples seen. Accuracy: 0.6199 Error: 0.83291 Loss: 1.01911 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.31s\n", + "172800 Examples seen. Accuracy: 0.6223 Error: 0.85590 Loss: 0.78383 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.36s\n", + "173440 Examples seen. Accuracy: 0.6198 Error: 1.06112 Loss: 1.14728 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.34s\n", + "174080 Examples seen. Accuracy: 0.6217 Error: 0.97505 Loss: 0.93777 Threads: 2 Forward time: 0.68s Backward time: 0.47s Step time: 2.33s\n", + "174720 Examples seen. Accuracy: 0.6211 Error: 0.97522 Loss: 1.03195 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.36s\n", + "175360 Examples seen. Accuracy: 0.6228 Error: 0.87507 Loss: 0.88380 Threads: 2 Forward time: 0.72s Backward time: 0.46s Step time: 2.37s\n", + "176000 Examples seen. Accuracy: 0.6212 Error: 1.16597 Loss: 1.20718 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.35s\n", + "176640 Examples seen. Accuracy: 0.6230 Error: 1.01122 Loss: 1.18690 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.34s\n", + "177280 Examples seen. Accuracy: 0.6185 Error: 1.02248 Loss: 0.98817 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.35s\n", + "177920 Examples seen. Accuracy: 0.6188 Error: 1.06655 Loss: 1.06127 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.33s\n", + "178560 Examples seen. Accuracy: 0.6180 Error: 0.97312 Loss: 1.14437 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.38s\n", + "179200 Examples seen. Accuracy: 0.6215 Error: 1.03910 Loss: 1.08587 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.34s\n", + "179840 Examples seen. Accuracy: 0.6208 Error: 0.98562 Loss: 1.01533 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.34s\n", + "180480 Examples seen. Accuracy: 0.6212 Error: 1.02901 Loss: 1.27258 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.34s\n", + "181120 Examples seen. Accuracy: 0.6230 Error: 0.83415 Loss: 0.82829 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.37s\n", + "181760 Examples seen. Accuracy: 0.6233 Error: 0.97535 Loss: 0.99595 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.34s\n", + "182400 Examples seen. Accuracy: 0.6225 Error: 0.87811 Loss: 0.85344 Threads: 2 Forward time: 0.66s Backward time: 0.47s Step time: 2.35s\n", + "183040 Examples seen. Accuracy: 0.6225 Error: 0.85728 Loss: 0.80623 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.32s\n", + "183680 Examples seen. Accuracy: 0.6218 Error: 0.92311 Loss: 0.95655 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.37s\n", + "184320 Examples seen. Accuracy: 0.6234 Error: 0.94198 Loss: 0.93368 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.38s\n", + "184960 Examples seen. Accuracy: 0.6222 Error: 0.94934 Loss: 0.99408 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.40s\n", + "185600 Examples seen. Accuracy: 0.6199 Error: 0.90684 Loss: 1.01579 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.37s\n", + "186240 Examples seen. Accuracy: 0.6204 Error: 0.95989 Loss: 1.00655 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.33s\n", + "186880 Examples seen. Accuracy: 0.6219 Error: 0.96921 Loss: 1.03707 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.33s\n", + "187520 Examples seen. Accuracy: 0.6229 Error: 1.06548 Loss: 1.11824 Threads: 2 Forward time: 0.69s Backward time: 0.48s Step time: 2.37s\n", + "188160 Examples seen. Accuracy: 0.6253 Error: 1.05412 Loss: 1.07881 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.33s\n", + "188800 Examples seen. Accuracy: 0.6247 Error: 1.00579 Loss: 1.13074 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.33s\n", + "189440 Examples seen. Accuracy: 0.6280 Error: 0.94236 Loss: 0.97535 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.36s\n", + "190080 Examples seen. Accuracy: 0.6275 Error: 1.01475 Loss: 1.00532 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.33s\n", + "190720 Examples seen. Accuracy: 0.6283 Error: 0.91269 Loss: 0.97482 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.33s\n", + "191360 Examples seen. Accuracy: 0.6280 Error: 0.92642 Loss: 1.02756 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.34s\n", + "192000 Examples seen. Accuracy: 0.6243 Error: 0.82342 Loss: 0.87881 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.33s\n", + "192640 Examples seen. Accuracy: 0.6259 Error: 0.93359 Loss: 1.03371 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.36s\n", + "193280 Examples seen. Accuracy: 0.6257 Error: 1.01015 Loss: 1.11906 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.37s\n", + "193920 Examples seen. Accuracy: 0.6241 Error: 0.92462 Loss: 0.98118 Threads: 2 Forward time: 0.70s Backward time: 0.45s Step time: 2.34s\n", + "194560 Examples seen. Accuracy: 0.6237 Error: 1.00565 Loss: 1.07568 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.32s\n", + "195200 Examples seen. Accuracy: 0.6277 Error: 0.80101 Loss: 0.83433 Threads: 2 Forward time: 0.66s Backward time: 0.46s Step time: 2.32s\n", + "195840 Examples seen. Accuracy: 0.6305 Error: 0.94517 Loss: 1.12437 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.32s\n", + "196480 Examples seen. Accuracy: 0.6321 Error: 1.04707 Loss: 1.12696 Threads: 2 Forward time: 0.71s Backward time: 0.46s Step time: 2.33s\n", + "197120 Examples seen. Accuracy: 0.6312 Error: 0.92833 Loss: 0.96707 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.32s\n", + "197760 Examples seen. Accuracy: 0.6345 Error: 0.87504 Loss: 0.87752 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.33s\n", + "198400 Examples seen. Accuracy: 0.6382 Error: 0.97443 Loss: 0.97866 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.32s\n", + "199040 Examples seen. Accuracy: 0.6379 Error: 1.00369 Loss: 1.13482 Threads: 2 Forward time: 0.69s Backward time: 0.47s Step time: 2.36s\n", + "199680 Examples seen. Accuracy: 0.6357 Error: 0.79795 Loss: 0.78376 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.36s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 5 Examples seen:200000 Validation Accuracy: 0.5977 Validation Error: 1.1206 Validation Loss: 1.1437 Total time: 17.79min\n", + "Epoch time: 2.4615 minutes. 50 epochs: 2.0512 hours.\n", + "Epochs: 5. Working time: 0.30 hours.\n", + "200640 Examples seen. Accuracy: 0.6340 Error: 0.92656 Loss: 1.00299 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.33s\n", + "201280 Examples seen. Accuracy: 0.6319 Error: 0.95938 Loss: 1.14827 Threads: 2 Forward time: 0.69s Backward time: 0.49s Step time: 2.35s\n", + "201920 Examples seen. Accuracy: 0.6293 Error: 1.06460 Loss: 1.11463 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.32s\n", + "202560 Examples seen. Accuracy: 0.6257 Error: 0.99327 Loss: 1.10830 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.33s\n", + "203200 Examples seen. Accuracy: 0.6257 Error: 0.89696 Loss: 0.90306 Threads: 2 Forward time: 0.71s Backward time: 0.47s Step time: 2.36s\n", + "203840 Examples seen. Accuracy: 0.6308 Error: 0.81209 Loss: 0.86287 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.36s\n", + "204480 Examples seen. Accuracy: 0.6313 Error: 0.88187 Loss: 0.90381 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.34s\n", + "205120 Examples seen. Accuracy: 0.6372 Error: 0.82707 Loss: 0.79100 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.36s\n", + "205760 Examples seen. Accuracy: 0.6351 Error: 0.96984 Loss: 1.02852 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.31s\n", + "206400 Examples seen. Accuracy: 0.6350 Error: 0.95105 Loss: 0.96745 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.29s\n", + "207040 Examples seen. Accuracy: 0.6359 Error: 0.97298 Loss: 0.95440 Threads: 2 Forward time: 0.65s Backward time: 0.46s Step time: 2.29s\n", + "207680 Examples seen. Accuracy: 0.6369 Error: 0.95721 Loss: 1.03644 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.34s\n", + "208320 Examples seen. Accuracy: 0.6389 Error: 0.77683 Loss: 0.88934 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.33s\n", + "208960 Examples seen. Accuracy: 0.6370 Error: 0.84208 Loss: 0.83019 Threads: 2 Forward time: 0.69s Backward time: 0.47s Step time: 2.33s\n", + "209600 Examples seen. Accuracy: 0.6378 Error: 0.92404 Loss: 0.92688 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.32s\n", + "210240 Examples seen. Accuracy: 0.6371 Error: 0.91755 Loss: 0.93381 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.31s\n", + "210880 Examples seen. Accuracy: 0.6349 Error: 1.07281 Loss: 1.23049 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.37s\n", + "211520 Examples seen. Accuracy: 0.6344 Error: 0.88252 Loss: 0.87913 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.32s\n", + "212160 Examples seen. Accuracy: 0.6370 Error: 0.78111 Loss: 0.80427 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.29s\n", + "212800 Examples seen. Accuracy: 0.6374 Error: 0.80105 Loss: 0.83192 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.31s\n", + "213440 Examples seen. Accuracy: 0.6397 Error: 0.87028 Loss: 0.82421 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.29s\n", + "214080 Examples seen. Accuracy: 0.6382 Error: 1.02596 Loss: 1.48838 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.30s\n", + "214720 Examples seen. Accuracy: 0.6414 Error: 0.99155 Loss: 1.09154 Threads: 2 Forward time: 0.69s Backward time: 0.47s Step time: 2.32s\n", + "215360 Examples seen. Accuracy: 0.6396 Error: 0.92797 Loss: 0.98854 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.31s\n", + "216000 Examples seen. Accuracy: 0.6380 Error: 1.10293 Loss: 1.22358 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.38s\n", + "216640 Examples seen. Accuracy: 0.6399 Error: 1.02033 Loss: 1.33986 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.32s\n", + "217280 Examples seen. Accuracy: 0.6402 Error: 0.97859 Loss: 1.13347 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.34s\n", + "217920 Examples seen. Accuracy: 0.6403 Error: 1.07421 Loss: 1.19600 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "218560 Examples seen. Accuracy: 0.6415 Error: 1.01226 Loss: 1.23750 Threads: 2 Forward time: 0.71s Backward time: 0.46s Step time: 2.31s\n", + "219200 Examples seen. Accuracy: 0.6431 Error: 0.93929 Loss: 1.00604 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.30s\n", + "219840 Examples seen. Accuracy: 0.6442 Error: 1.01110 Loss: 1.01819 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.34s\n", + "220480 Examples seen. Accuracy: 0.6451 Error: 1.04194 Loss: 1.14600 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.33s\n", + "221120 Examples seen. Accuracy: 0.6445 Error: 0.86636 Loss: 0.92328 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.30s\n", + "221760 Examples seen. Accuracy: 0.6457 Error: 0.94119 Loss: 1.10345 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.31s\n", + "222400 Examples seen. Accuracy: 0.6417 Error: 1.01641 Loss: 1.17796 Threads: 2 Forward time: 0.65s Backward time: 0.44s Step time: 2.30s\n", + "223040 Examples seen. Accuracy: 0.6434 Error: 0.92372 Loss: 1.09811 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.29s\n", + "223680 Examples seen. Accuracy: 0.6424 Error: 0.87976 Loss: 0.83098 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.31s\n", + "224320 Examples seen. Accuracy: 0.6400 Error: 0.97100 Loss: 0.93698 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "224960 Examples seen. Accuracy: 0.6404 Error: 0.94412 Loss: 1.03400 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.36s\n", + "225600 Examples seen. Accuracy: 0.6386 Error: 0.96877 Loss: 1.09604 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.37s\n", + "226240 Examples seen. Accuracy: 0.6413 Error: 0.68084 Loss: 0.68411 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.35s\n", + "226880 Examples seen. Accuracy: 0.6399 Error: 1.01626 Loss: 1.09217 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.31s\n", + "227520 Examples seen. Accuracy: 0.6425 Error: 0.94883 Loss: 1.13541 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.30s\n", + "228160 Examples seen. Accuracy: 0.6426 Error: 0.90699 Loss: 1.01289 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.29s\n", + "228800 Examples seen. Accuracy: 0.6450 Error: 0.96422 Loss: 1.22883 Threads: 2 Forward time: 0.72s Backward time: 0.46s Step time: 2.34s\n", + "229440 Examples seen. Accuracy: 0.6438 Error: 0.88007 Loss: 0.82281 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.30s\n", + "230080 Examples seen. Accuracy: 0.6428 Error: 0.91463 Loss: 1.09818 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.32s\n", + "230720 Examples seen. Accuracy: 0.6405 Error: 1.00789 Loss: 1.14272 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.31s\n", + "231360 Examples seen. Accuracy: 0.6418 Error: 0.96387 Loss: 0.99789 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.33s\n", + "232000 Examples seen. Accuracy: 0.6426 Error: 0.99947 Loss: 1.00277 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.33s\n", + "232640 Examples seen. Accuracy: 0.6425 Error: 0.99527 Loss: 1.03264 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.31s\n", + "233280 Examples seen. Accuracy: 0.6431 Error: 1.01942 Loss: 1.32953 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.31s\n", + "233920 Examples seen. Accuracy: 0.6430 Error: 0.91747 Loss: 0.95371 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "234560 Examples seen. Accuracy: 0.6425 Error: 0.94861 Loss: 0.99667 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.33s\n", + "235200 Examples seen. Accuracy: 0.6414 Error: 0.96205 Loss: 1.11025 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.30s\n", + "235840 Examples seen. Accuracy: 0.6411 Error: 0.96424 Loss: 1.07136 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.32s\n", + "236480 Examples seen. Accuracy: 0.6402 Error: 0.83694 Loss: 0.84988 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.29s\n", + "237120 Examples seen. Accuracy: 0.6417 Error: 0.83658 Loss: 0.84442 Threads: 2 Forward time: 0.71s Backward time: 0.48s Step time: 2.33s\n", + "237760 Examples seen. Accuracy: 0.6438 Error: 0.83238 Loss: 0.87519 Threads: 2 Forward time: 0.71s Backward time: 0.48s Step time: 2.43s\n", + "238400 Examples seen. Accuracy: 0.6467 Error: 0.81255 Loss: 0.89347 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.38s\n", + "239040 Examples seen. Accuracy: 0.6485 Error: 1.01966 Loss: 1.11521 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.32s\n", + "239680 Examples seen. Accuracy: 0.6502 Error: 0.85513 Loss: 0.85761 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 6 Examples seen:240000 Validation Accuracy: 0.6216 Validation Error: 1.0832 Validation Loss: 1.0860 Total time: 21.25min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.267 Min Weight: -0.266 Max Output: 3.712 Min Output: -4.069 TNNetConvolutionLinear 32,32,64 Times: 30.14s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.712 Min Output: -1.107 TNNetMaxPool 8,8,64 Times: 7.06s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.809 Min Weight: 0.611 Max Output: 3.833 Min Output: -2.124 TNNetMovingStdNormalization 8,8,64 Times: 0.13s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.113 Min Weight: -0.118 Max Output: 5.113 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.98s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.128 Min Weight: -0.121 Max Output: 3.537 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.97s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.132 Min Weight: -0.118 Max Output: 2.158 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.09s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.129 Min Weight: -0.119 Max Output: 1.431 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.13s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.431 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.431 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.45s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.188 Min Weight: -0.155 Max Output: 2.511 Min Output: -3.327 TNNetFullConnectLinear 10,1,1 Times: 0.08s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.482 Min Output: 0.001 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.4021 minutes. 50 epochs: 2.0017 hours.\n", + "Epochs: 6. Working time: 0.35 hours.\n", + "240640 Examples seen. Accuracy: 0.6514 Error: 1.05593 Loss: 1.24585 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "241280 Examples seen. Accuracy: 0.6528 Error: 1.00934 Loss: 1.21984 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.29s\n", + "241920 Examples seen. Accuracy: 0.6512 Error: 0.98645 Loss: 0.99501 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.28s\n", + "242560 Examples seen. Accuracy: 0.6503 Error: 0.97602 Loss: 1.06098 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.29s\n", + "243200 Examples seen. Accuracy: 0.6483 Error: 0.93434 Loss: 0.93540 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "243840 Examples seen. Accuracy: 0.6486 Error: 0.87679 Loss: 0.86060 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.27s\n", + "244480 Examples seen. Accuracy: 0.6480 Error: 0.90356 Loss: 0.97229 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.30s\n", + "245120 Examples seen. Accuracy: 0.6462 Error: 1.09681 Loss: 1.24257 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "245760 Examples seen. Accuracy: 0.6484 Error: 0.80445 Loss: 0.87402 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "246400 Examples seen. Accuracy: 0.6497 Error: 0.89923 Loss: 0.95752 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.34s\n", + "247040 Examples seen. Accuracy: 0.6525 Error: 0.93155 Loss: 0.95608 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.31s\n", + "247680 Examples seen. Accuracy: 0.6504 Error: 0.92839 Loss: 0.87156 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "248320 Examples seen. Accuracy: 0.6497 Error: 0.97887 Loss: 1.11965 Threads: 2 Forward time: 0.65s Backward time: 0.45s Step time: 2.27s\n", + "248960 Examples seen. Accuracy: 0.6520 Error: 0.86699 Loss: 0.92019 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "249600 Examples seen. Accuracy: 0.6523 Error: 0.90719 Loss: 1.00199 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.27s\n", + "250240 Examples seen. Accuracy: 0.6530 Error: 0.90950 Loss: 1.07124 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "250880 Examples seen. Accuracy: 0.6544 Error: 0.80067 Loss: 0.80112 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "251520 Examples seen. Accuracy: 0.6582 Error: 0.74866 Loss: 0.74906 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.28s\n", + "252160 Examples seen. Accuracy: 0.6592 Error: 0.89516 Loss: 0.91860 Threads: 2 Forward time: 0.73s Backward time: 0.44s Step time: 2.32s\n", + "252800 Examples seen. Accuracy: 0.6594 Error: 0.81464 Loss: 0.81126 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.32s\n", + "253440 Examples seen. Accuracy: 0.6575 Error: 0.94119 Loss: 1.14373 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.31s\n", + "254080 Examples seen. Accuracy: 0.6591 Error: 0.72000 Loss: 0.73080 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.28s\n", + "254720 Examples seen. Accuracy: 0.6598 Error: 0.89996 Loss: 0.99644 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.29s\n", + "255360 Examples seen. Accuracy: 0.6626 Error: 0.71628 Loss: 0.80722 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "256000 Examples seen. Accuracy: 0.6633 Error: 0.87480 Loss: 0.90962 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "256640 Examples seen. Accuracy: 0.6648 Error: 0.71119 Loss: 0.71887 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "257280 Examples seen. Accuracy: 0.6637 Error: 0.81723 Loss: 0.85206 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "257920 Examples seen. Accuracy: 0.6626 Error: 1.09709 Loss: 1.18089 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.32s\n", + "258560 Examples seen. Accuracy: 0.6639 Error: 1.02364 Loss: 1.12581 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.37s\n", + "259200 Examples seen. Accuracy: 0.6655 Error: 0.71246 Loss: 0.77271 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.36s\n", + "259840 Examples seen. Accuracy: 0.6642 Error: 0.94031 Loss: 1.10884 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.34s\n", + "260480 Examples seen. Accuracy: 0.6633 Error: 0.95615 Loss: 1.12876 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "261120 Examples seen. Accuracy: 0.6620 Error: 0.88772 Loss: 1.07373 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "261760 Examples seen. Accuracy: 0.6620 Error: 0.98767 Loss: 1.01650 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.33s\n", + "262400 Examples seen. Accuracy: 0.6634 Error: 0.83257 Loss: 0.82805 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.32s\n", + "263040 Examples seen. Accuracy: 0.6635 Error: 0.90364 Loss: 0.98802 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.32s\n", + "263680 Examples seen. Accuracy: 0.6633 Error: 0.79628 Loss: 1.09021 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.32s\n", + "264320 Examples seen. Accuracy: 0.6649 Error: 0.85204 Loss: 0.94030 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.30s\n", + "264960 Examples seen. Accuracy: 0.6628 Error: 0.86950 Loss: 0.95321 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.26s\n", + "265600 Examples seen. Accuracy: 0.6644 Error: 0.85000 Loss: 0.96080 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "266240 Examples seen. Accuracy: 0.6613 Error: 0.93168 Loss: 1.06479 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "266880 Examples seen. Accuracy: 0.6585 Error: 0.93783 Loss: 0.95848 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "267520 Examples seen. Accuracy: 0.6588 Error: 1.06285 Loss: 1.23863 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.32s\n", + "268160 Examples seen. Accuracy: 0.6592 Error: 0.91578 Loss: 0.92424 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.32s\n", + "268800 Examples seen. Accuracy: 0.6577 Error: 0.80375 Loss: 0.81949 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.31s\n", + "269440 Examples seen. Accuracy: 0.6588 Error: 0.90486 Loss: 1.01750 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.30s\n", + "270080 Examples seen. Accuracy: 0.6619 Error: 0.94658 Loss: 1.00524 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.25s\n", + "270720 Examples seen. Accuracy: 0.6604 Error: 0.87354 Loss: 0.95574 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "271360 Examples seen. Accuracy: 0.6600 Error: 0.88130 Loss: 1.03322 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.28s\n", + "272000 Examples seen. Accuracy: 0.6568 Error: 0.99213 Loss: 0.98421 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "272640 Examples seen. Accuracy: 0.6519 Error: 0.96752 Loss: 0.98813 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.31s\n", + "273280 Examples seen. Accuracy: 0.6512 Error: 1.09135 Loss: 1.28151 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.30s\n", + "273920 Examples seen. Accuracy: 0.6534 Error: 0.81518 Loss: 0.76397 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "274560 Examples seen. Accuracy: 0.6545 Error: 0.81300 Loss: 0.84880 Threads: 2 Forward time: 0.70s Backward time: 0.45s Step time: 2.29s\n", + "275200 Examples seen. Accuracy: 0.6529 Error: 0.85933 Loss: 0.85624 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.37s\n", + "275840 Examples seen. Accuracy: 0.6539 Error: 1.01306 Loss: 1.04145 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.30s\n", + "276480 Examples seen. Accuracy: 0.6572 Error: 0.95905 Loss: 1.08669 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "277120 Examples seen. Accuracy: 0.6537 Error: 0.86275 Loss: 0.91495 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.36s\n", + "277760 Examples seen. Accuracy: 0.6540 Error: 0.92852 Loss: 0.86510 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.33s\n", + "278400 Examples seen. Accuracy: 0.6537 Error: 0.94450 Loss: 1.03397 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.31s\n", + "279040 Examples seen. Accuracy: 0.6558 Error: 0.83445 Loss: 1.00823 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.30s\n", + "279680 Examples seen. Accuracy: 0.6608 Error: 0.93242 Loss: 1.11469 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.34s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 7 Examples seen:280000 Validation Accuracy: 0.6468 Validation Error: 1.0372 Validation Loss: 1.0213 Total time: 24.69min\n", + "Epoch time: 2.4375 minutes. 50 epochs: 2.0313 hours.\n", + "Epochs: 7. Working time: 0.41 hours.\n", + "280640 Examples seen. Accuracy: 0.6595 Error: 0.82600 Loss: 0.94376 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "281280 Examples seen. Accuracy: 0.6623 Error: 0.90251 Loss: 0.96588 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.26s\n", + "281920 Examples seen. Accuracy: 0.6631 Error: 0.89004 Loss: 0.82104 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "282560 Examples seen. Accuracy: 0.6635 Error: 0.88271 Loss: 1.00724 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.30s\n", + "283200 Examples seen. Accuracy: 0.6644 Error: 0.62600 Loss: 0.60408 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.29s\n", + "283840 Examples seen. Accuracy: 0.6698 Error: 0.71501 Loss: 0.73127 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.32s\n", + "284480 Examples seen. Accuracy: 0.6680 Error: 0.92484 Loss: 1.00859 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.29s\n", + "285120 Examples seen. Accuracy: 0.6687 Error: 0.93158 Loss: 1.05683 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "285760 Examples seen. Accuracy: 0.6653 Error: 1.02391 Loss: 1.05976 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "286400 Examples seen. Accuracy: 0.6670 Error: 0.69469 Loss: 0.70708 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "287040 Examples seen. Accuracy: 0.6678 Error: 0.72668 Loss: 0.71559 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.29s\n", + "287680 Examples seen. Accuracy: 0.6666 Error: 0.91634 Loss: 0.93299 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "288320 Examples seen. Accuracy: 0.6669 Error: 0.88425 Loss: 0.84828 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "288960 Examples seen. Accuracy: 0.6679 Error: 0.83965 Loss: 0.85687 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "289600 Examples seen. Accuracy: 0.6701 Error: 0.79211 Loss: 0.77677 Threads: 2 Forward time: 0.70s Backward time: 0.45s Step time: 2.29s\n", + "290240 Examples seen. Accuracy: 0.6729 Error: 0.70112 Loss: 0.80414 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "290880 Examples seen. Accuracy: 0.6745 Error: 0.99169 Loss: 1.07779 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.27s\n", + "291520 Examples seen. Accuracy: 0.6764 Error: 0.85950 Loss: 0.89610 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "292160 Examples seen. Accuracy: 0.6765 Error: 0.76061 Loss: 0.80193 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.24s\n", + "292800 Examples seen. Accuracy: 0.6762 Error: 0.86220 Loss: 0.92161 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.28s\n", + "293440 Examples seen. Accuracy: 0.6778 Error: 0.80205 Loss: 0.74136 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "294080 Examples seen. Accuracy: 0.6748 Error: 0.91620 Loss: 0.92760 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.25s\n", + "294720 Examples seen. Accuracy: 0.6746 Error: 0.82923 Loss: 0.84221 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "295360 Examples seen. Accuracy: 0.6760 Error: 1.05348 Loss: 1.27101 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "296000 Examples seen. Accuracy: 0.6771 Error: 0.85328 Loss: 0.85372 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "296640 Examples seen. Accuracy: 0.6754 Error: 0.99165 Loss: 1.20119 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "297280 Examples seen. Accuracy: 0.6734 Error: 0.94531 Loss: 1.10762 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "297920 Examples seen. Accuracy: 0.6716 Error: 1.00206 Loss: 1.22243 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "298560 Examples seen. Accuracy: 0.6709 Error: 0.95735 Loss: 0.95216 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.27s\n", + "299200 Examples seen. Accuracy: 0.6697 Error: 0.94498 Loss: 1.03192 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.30s\n", + "299840 Examples seen. Accuracy: 0.6730 Error: 0.84626 Loss: 0.89177 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "300480 Examples seen. Accuracy: 0.6747 Error: 0.81766 Loss: 0.88894 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.29s\n", + "301120 Examples seen. Accuracy: 0.6755 Error: 0.80451 Loss: 0.83018 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.25s\n", + "301760 Examples seen. Accuracy: 0.6763 Error: 0.92576 Loss: 0.93402 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.25s\n", + "302400 Examples seen. Accuracy: 0.6737 Error: 0.96477 Loss: 1.09257 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.24s\n", + "303040 Examples seen. Accuracy: 0.6722 Error: 0.81764 Loss: 0.80887 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.26s\n", + "303680 Examples seen. Accuracy: 0.6756 Error: 0.84041 Loss: 0.91604 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "304320 Examples seen. Accuracy: 0.6732 Error: 0.93256 Loss: 1.09922 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.32s\n", + "304960 Examples seen. Accuracy: 0.6754 Error: 0.81657 Loss: 0.87520 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "305600 Examples seen. Accuracy: 0.6736 Error: 0.98567 Loss: 1.02651 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.26s\n", + "306240 Examples seen. Accuracy: 0.6728 Error: 0.72973 Loss: 0.62668 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.26s\n", + "306880 Examples seen. Accuracy: 0.6743 Error: 0.73370 Loss: 0.72145 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.26s\n", + "307520 Examples seen. Accuracy: 0.6746 Error: 0.67468 Loss: 0.72256 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "308160 Examples seen. Accuracy: 0.6740 Error: 1.03030 Loss: 1.14193 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "308800 Examples seen. Accuracy: 0.6775 Error: 0.92522 Loss: 1.11043 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "309440 Examples seen. Accuracy: 0.6768 Error: 0.93354 Loss: 0.96485 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "310080 Examples seen. Accuracy: 0.6762 Error: 0.88760 Loss: 1.01510 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.27s\n", + "310720 Examples seen. Accuracy: 0.6761 Error: 0.94432 Loss: 0.95214 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "311360 Examples seen. Accuracy: 0.6773 Error: 0.88861 Loss: 1.00425 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "312000 Examples seen. Accuracy: 0.6761 Error: 0.79803 Loss: 0.98969 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "312640 Examples seen. Accuracy: 0.6750 Error: 0.77377 Loss: 0.81355 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "313280 Examples seen. Accuracy: 0.6705 Error: 0.82089 Loss: 0.87615 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.23s\n", + "313920 Examples seen. Accuracy: 0.6723 Error: 0.91588 Loss: 1.01952 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "314560 Examples seen. Accuracy: 0.6731 Error: 0.75757 Loss: 0.79069 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "315200 Examples seen. Accuracy: 0.6756 Error: 0.70881 Loss: 0.64134 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "315840 Examples seen. Accuracy: 0.6778 Error: 0.93236 Loss: 1.04414 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.25s\n", + "316480 Examples seen. Accuracy: 0.6742 Error: 0.86207 Loss: 0.91547 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "317120 Examples seen. Accuracy: 0.6736 Error: 0.93038 Loss: 0.92133 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "317760 Examples seen. Accuracy: 0.6761 Error: 0.77638 Loss: 0.82470 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.27s\n", + "318400 Examples seen. Accuracy: 0.6778 Error: 0.67504 Loss: 0.59215 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.27s\n", + "319040 Examples seen. Accuracy: 0.6788 Error: 0.79351 Loss: 0.85345 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "319680 Examples seen. Accuracy: 0.6771 Error: 0.80269 Loss: 0.78314 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 8 Examples seen:320000 Validation Accuracy: 0.6726 Validation Error: 0.9813 Validation Loss: 0.9495 Total time: 28.09min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.286 Min Weight: -0.305 Max Output: 3.617 Min Output: -4.113 TNNetConvolutionLinear 32,32,64 Times: 30.22s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.617 Min Output: -0.971 TNNetMaxPool 8,8,64 Times: 6.94s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.757 Min Weight: 0.632 Max Output: 3.945 Min Output: -2.119 TNNetMovingStdNormalization 8,8,64 Times: 0.13s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.128 Min Weight: -0.137 Max Output: 5.824 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.22s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.143 Min Weight: -0.129 Max Output: 3.624 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.06s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.143 Min Weight: -0.127 Max Output: 2.186 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.15s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.150 Min Weight: -0.126 Max Output: 1.446 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.16s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.446 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.446 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.43s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.207 Min Weight: -0.173 Max Output: 2.373 Min Output: -3.884 TNNetFullConnectLinear 10,1,1 Times: 0.11s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.399 Min Output: 0.001 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3333 minutes. 50 epochs: 1.9444 hours.\n", + "Epochs: 8. Working time: 0.47 hours.\n", + "320640 Examples seen. Accuracy: 0.6746 Error: 0.80608 Loss: 0.88726 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "321280 Examples seen. Accuracy: 0.6750 Error: 0.92418 Loss: 1.04939 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.33s\n", + "321920 Examples seen. Accuracy: 0.6750 Error: 0.80783 Loss: 0.73848 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.32s\n", + "322560 Examples seen. Accuracy: 0.6746 Error: 0.83216 Loss: 0.78996 Threads: 2 Forward time: 0.73s Backward time: 0.41s Step time: 2.29s\n", + "323200 Examples seen. Accuracy: 0.6768 Error: 0.78246 Loss: 0.79558 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.27s\n", + "323840 Examples seen. Accuracy: 0.6779 Error: 0.85623 Loss: 0.93316 Threads: 2 Forward time: 0.64s Backward time: 0.44s Step time: 2.26s\n", + "324480 Examples seen. Accuracy: 0.6772 Error: 0.86815 Loss: 0.94828 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "325120 Examples seen. Accuracy: 0.6745 Error: 0.86923 Loss: 1.04023 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.33s\n", + "325760 Examples seen. Accuracy: 0.6766 Error: 0.90301 Loss: 1.10009 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.27s\n", + "326400 Examples seen. Accuracy: 0.6792 Error: 0.72691 Loss: 0.73168 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "327040 Examples seen. Accuracy: 0.6798 Error: 0.83889 Loss: 0.93271 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "327680 Examples seen. Accuracy: 0.6773 Error: 0.91944 Loss: 0.92991 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.33s\n", + "328320 Examples seen. Accuracy: 0.6739 Error: 0.98521 Loss: 1.20311 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "328960 Examples seen. Accuracy: 0.6734 Error: 0.82776 Loss: 0.93424 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.25s\n", + "329600 Examples seen. Accuracy: 0.6719 Error: 0.90022 Loss: 0.94998 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "330240 Examples seen. Accuracy: 0.6735 Error: 0.75942 Loss: 0.70869 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.24s\n", + "330880 Examples seen. Accuracy: 0.6734 Error: 0.93974 Loss: 1.01319 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "331520 Examples seen. Accuracy: 0.6745 Error: 0.88273 Loss: 0.91846 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "332160 Examples seen. Accuracy: 0.6739 Error: 0.80025 Loss: 0.86264 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "332800 Examples seen. Accuracy: 0.6765 Error: 0.89051 Loss: 1.07191 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "333440 Examples seen. Accuracy: 0.6777 Error: 0.85595 Loss: 0.97014 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.25s\n", + "334080 Examples seen. Accuracy: 0.6810 Error: 0.80774 Loss: 0.86967 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "334720 Examples seen. Accuracy: 0.6841 Error: 0.76323 Loss: 0.77481 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.24s\n", + "335360 Examples seen. Accuracy: 0.6841 Error: 0.86440 Loss: 1.06786 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "336000 Examples seen. Accuracy: 0.6855 Error: 0.79173 Loss: 0.99724 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "336640 Examples seen. Accuracy: 0.6845 Error: 0.84526 Loss: 0.94543 Threads: 2 Forward time: 0.66s Backward time: 0.49s Step time: 2.29s\n", + "337280 Examples seen. Accuracy: 0.6844 Error: 0.79016 Loss: 0.87642 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.32s\n", + "337920 Examples seen. Accuracy: 0.6837 Error: 0.71374 Loss: 0.72188 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.32s\n", + "338560 Examples seen. Accuracy: 0.6824 Error: 0.79755 Loss: 0.92635 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "339200 Examples seen. Accuracy: 0.6830 Error: 1.01271 Loss: 1.12879 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.26s\n", + "339840 Examples seen. Accuracy: 0.6837 Error: 0.84140 Loss: 1.00001 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.25s\n", + "340480 Examples seen. Accuracy: 0.6818 Error: 0.94872 Loss: 1.09921 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "341120 Examples seen. Accuracy: 0.6773 Error: 0.84342 Loss: 0.84416 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.24s\n", + "341760 Examples seen. Accuracy: 0.6745 Error: 0.89283 Loss: 0.92712 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.32s\n", + "342400 Examples seen. Accuracy: 0.6721 Error: 0.90393 Loss: 0.84787 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "343040 Examples seen. Accuracy: 0.6718 Error: 0.81913 Loss: 0.84188 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "343680 Examples seen. Accuracy: 0.6717 Error: 0.78402 Loss: 0.90977 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "344320 Examples seen. Accuracy: 0.6725 Error: 0.90614 Loss: 0.91631 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.24s\n", + "344960 Examples seen. Accuracy: 0.6743 Error: 0.69912 Loss: 0.66666 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.24s\n", + "345600 Examples seen. Accuracy: 0.6750 Error: 0.74682 Loss: 0.75126 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "346240 Examples seen. Accuracy: 0.6769 Error: 0.85479 Loss: 0.94110 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "346880 Examples seen. Accuracy: 0.6768 Error: 0.74779 Loss: 0.74923 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "347520 Examples seen. Accuracy: 0.6806 Error: 0.72227 Loss: 0.74978 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "348160 Examples seen. Accuracy: 0.6817 Error: 0.72984 Loss: 0.80529 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.24s\n", + "348800 Examples seen. Accuracy: 0.6797 Error: 0.99660 Loss: 1.03470 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "349440 Examples seen. Accuracy: 0.6812 Error: 0.70780 Loss: 0.69271 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "350080 Examples seen. Accuracy: 0.6846 Error: 0.85745 Loss: 1.07135 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "350720 Examples seen. Accuracy: 0.6839 Error: 0.79216 Loss: 0.85529 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "351360 Examples seen. Accuracy: 0.6832 Error: 0.90750 Loss: 0.93023 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "352000 Examples seen. Accuracy: 0.6845 Error: 0.87822 Loss: 0.98398 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "352640 Examples seen. Accuracy: 0.6866 Error: 0.75723 Loss: 0.90549 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "353280 Examples seen. Accuracy: 0.6860 Error: 0.91905 Loss: 0.96732 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "353920 Examples seen. Accuracy: 0.6878 Error: 0.75457 Loss: 0.75893 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "354560 Examples seen. Accuracy: 0.6896 Error: 0.89470 Loss: 0.99602 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "355200 Examples seen. Accuracy: 0.6871 Error: 0.83453 Loss: 0.77940 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.23s\n", + "355840 Examples seen. Accuracy: 0.6843 Error: 0.75824 Loss: 0.65149 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "356480 Examples seen. Accuracy: 0.6833 Error: 0.79836 Loss: 0.81279 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "357120 Examples seen. Accuracy: 0.6859 Error: 0.79211 Loss: 0.92599 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.26s\n", + "357760 Examples seen. Accuracy: 0.6888 Error: 0.93717 Loss: 1.04447 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.26s\n", + "358400 Examples seen. Accuracy: 0.6894 Error: 0.73993 Loss: 0.80377 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.31s\n", + "359040 Examples seen. Accuracy: 0.6881 Error: 0.91732 Loss: 1.03610 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "359680 Examples seen. Accuracy: 0.6873 Error: 0.82041 Loss: 0.84118 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.26s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 9 Examples seen:360000 Validation Accuracy: 0.7005 Validation Error: 0.9130 Validation Loss: 0.8731 Total time: 31.49min\n", + "Epoch time: 2.3542 minutes. 50 epochs: 1.9618 hours.\n", + "Epochs: 9. Working time: 0.52 hours.\n", + "360640 Examples seen. Accuracy: 0.6870 Error: 0.99102 Loss: 1.13030 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.32s\n", + "361280 Examples seen. Accuracy: 0.6879 Error: 0.98226 Loss: 1.10132 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "361920 Examples seen. Accuracy: 0.6861 Error: 0.81048 Loss: 0.78015 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.31s\n", + "362560 Examples seen. Accuracy: 0.6853 Error: 0.82575 Loss: 0.85574 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "363200 Examples seen. Accuracy: 0.6874 Error: 0.82046 Loss: 0.92182 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.29s\n", + "363840 Examples seen. Accuracy: 0.6900 Error: 0.72060 Loss: 0.67072 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.29s\n", + "364480 Examples seen. Accuracy: 0.6878 Error: 0.90538 Loss: 0.99555 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.31s\n", + "365120 Examples seen. Accuracy: 0.6880 Error: 0.75652 Loss: 0.82947 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "365760 Examples seen. Accuracy: 0.6917 Error: 0.87550 Loss: 1.02521 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.29s\n", + "366400 Examples seen. Accuracy: 0.6939 Error: 0.98520 Loss: 0.97981 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.29s\n", + "367040 Examples seen. Accuracy: 0.6948 Error: 0.83249 Loss: 0.84764 Threads: 2 Forward time: 0.71s Backward time: 0.46s Step time: 2.31s\n", + "367680 Examples seen. Accuracy: 0.6947 Error: 0.87921 Loss: 0.98406 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "368320 Examples seen. Accuracy: 0.6986 Error: 0.81887 Loss: 0.91101 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.31s\n", + "368960 Examples seen. Accuracy: 0.6977 Error: 0.73057 Loss: 0.74258 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.28s\n", + "369600 Examples seen. Accuracy: 0.6968 Error: 0.77150 Loss: 0.79038 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.30s\n", + "370240 Examples seen. Accuracy: 0.6972 Error: 0.91387 Loss: 0.93440 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.31s\n", + "370880 Examples seen. Accuracy: 0.6979 Error: 0.69506 Loss: 0.75387 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.35s\n", + "371520 Examples seen. Accuracy: 0.6938 Error: 0.82977 Loss: 0.82222 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "372160 Examples seen. Accuracy: 0.6922 Error: 0.74130 Loss: 0.63260 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "372800 Examples seen. Accuracy: 0.6919 Error: 0.61393 Loss: 0.54026 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "373440 Examples seen. Accuracy: 0.6929 Error: 0.82919 Loss: 0.84779 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.26s\n", + "374080 Examples seen. Accuracy: 0.6925 Error: 0.77389 Loss: 0.90815 Threads: 2 Forward time: 0.71s Backward time: 0.47s Step time: 2.36s\n", + "374720 Examples seen. Accuracy: 0.6948 Error: 0.76773 Loss: 0.75683 Threads: 2 Forward time: 0.72s Backward time: 0.46s Step time: 2.40s\n", + "375360 Examples seen. Accuracy: 0.6925 Error: 0.92700 Loss: 0.93701 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.34s\n", + "376000 Examples seen. Accuracy: 0.6938 Error: 0.64868 Loss: 0.58159 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.33s\n", + "376640 Examples seen. Accuracy: 0.6944 Error: 0.76134 Loss: 0.77990 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.30s\n", + "377280 Examples seen. Accuracy: 0.6940 Error: 0.90245 Loss: 1.03077 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.31s\n", + "377920 Examples seen. Accuracy: 0.6931 Error: 0.92095 Loss: 1.01853 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.31s\n", + "378560 Examples seen. Accuracy: 0.6948 Error: 0.76422 Loss: 0.81965 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "379200 Examples seen. Accuracy: 0.6941 Error: 0.84171 Loss: 0.84435 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.31s\n", + "379840 Examples seen. Accuracy: 0.6933 Error: 0.83652 Loss: 0.84591 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.31s\n", + "380480 Examples seen. Accuracy: 0.6922 Error: 0.86241 Loss: 0.93829 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.28s\n", + "381120 Examples seen. Accuracy: 0.6919 Error: 0.84401 Loss: 0.83420 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.30s\n", + "381760 Examples seen. Accuracy: 0.6923 Error: 0.87555 Loss: 0.96276 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.29s\n", + "382400 Examples seen. Accuracy: 0.6915 Error: 0.82004 Loss: 0.84103 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.27s\n", + "383040 Examples seen. Accuracy: 0.6932 Error: 0.76874 Loss: 0.81044 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "383680 Examples seen. Accuracy: 0.6942 Error: 0.80235 Loss: 0.84572 Threads: 2 Forward time: 0.66s Backward time: 0.45s Step time: 2.32s\n", + "384320 Examples seen. Accuracy: 0.6967 Error: 0.75182 Loss: 0.83043 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.30s\n", + "384960 Examples seen. Accuracy: 0.6957 Error: 0.87272 Loss: 1.08511 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.31s\n", + "385600 Examples seen. Accuracy: 0.6940 Error: 0.88422 Loss: 0.95285 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "386240 Examples seen. Accuracy: 0.6937 Error: 0.78533 Loss: 0.90082 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "386880 Examples seen. Accuracy: 0.6957 Error: 0.83891 Loss: 0.91819 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "387520 Examples seen. Accuracy: 0.6966 Error: 0.80963 Loss: 0.82660 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.29s\n", + "388160 Examples seen. Accuracy: 0.6980 Error: 0.70199 Loss: 0.66609 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "388800 Examples seen. Accuracy: 0.6981 Error: 0.71472 Loss: 0.78854 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.31s\n", + "389440 Examples seen. Accuracy: 0.6977 Error: 0.76907 Loss: 0.79745 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.34s\n", + "390080 Examples seen. Accuracy: 0.6988 Error: 0.97835 Loss: 0.93827 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.29s\n", + "390720 Examples seen. Accuracy: 0.6979 Error: 0.81469 Loss: 0.84105 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.27s\n", + "391360 Examples seen. Accuracy: 0.6984 Error: 0.80755 Loss: 0.79055 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.32s\n", + "392000 Examples seen. Accuracy: 0.6970 Error: 0.72795 Loss: 0.81478 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.26s\n", + "392640 Examples seen. Accuracy: 0.6965 Error: 0.86454 Loss: 0.92939 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "393280 Examples seen. Accuracy: 0.6944 Error: 0.87080 Loss: 1.07583 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "393920 Examples seen. Accuracy: 0.6955 Error: 0.66071 Loss: 0.66657 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "394560 Examples seen. Accuracy: 0.6972 Error: 0.74985 Loss: 0.83199 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "395200 Examples seen. Accuracy: 0.6959 Error: 0.81379 Loss: 0.86817 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.31s\n", + "395840 Examples seen. Accuracy: 0.6987 Error: 0.66327 Loss: 0.64872 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "396480 Examples seen. Accuracy: 0.6970 Error: 0.79263 Loss: 0.83147 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.30s\n", + "397120 Examples seen. Accuracy: 0.6972 Error: 0.85795 Loss: 0.87358 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "397760 Examples seen. Accuracy: 0.6999 Error: 0.77065 Loss: 0.75524 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.26s\n", + "398400 Examples seen. Accuracy: 0.6987 Error: 0.69937 Loss: 0.74557 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.24s\n", + "399040 Examples seen. Accuracy: 0.6975 Error: 0.85826 Loss: 0.92526 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "399680 Examples seen. Accuracy: 0.6950 Error: 0.85978 Loss: 0.99050 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 10 Examples seen:400000 Validation Accuracy: 0.7264 Validation Error: 0.8392 Validation Loss: 0.8016 Total time: 34.92min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.307 Min Weight: -0.349 Max Output: 3.490 Min Output: -4.198 TNNetConvolutionLinear 32,32,64 Times: 30.11s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.490 Min Output: -0.836 TNNetMaxPool 8,8,64 Times: 6.86s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.706 Min Weight: 0.659 Max Output: 4.007 Min Output: -2.116 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.150 Min Weight: -0.160 Max Output: 6.938 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.14s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.162 Min Weight: -0.144 Max Output: 4.198 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.00s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.159 Min Weight: -0.147 Max Output: 2.281 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.99s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.169 Min Weight: -0.134 Max Output: 1.555 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.555 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.555 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.44s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.232 Min Weight: -0.196 Max Output: 2.282 Min Output: -4.570 TNNetFullConnectLinear 10,1,1 Times: 0.08s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.297 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Starting Testing.\n", + "Epochs: 10 Examples seen:400000 Test Accuracy: 0.7196 Test Error: 0.8487 Test Loss: 0.8175 Total time: 35.96min\n", + "Epoch time: 2.3594 minutes. 50 epochs: 1.9661 hours.\n", + "Epochs: 10. Working time: 0.60 hours.\n", + "Learning rate set to: 0.00090\n", + "400640 Examples seen. Accuracy: 0.6944 Error: 0.79827 Loss: 0.88313 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "401280 Examples seen. Accuracy: 0.6946 Error: 0.96281 Loss: 1.07937 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.26s\n", + "401920 Examples seen. Accuracy: 0.6956 Error: 0.71811 Loss: 0.77069 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "402560 Examples seen. Accuracy: 0.6964 Error: 0.83718 Loss: 0.84177 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.27s\n", + "403200 Examples seen. Accuracy: 0.6996 Error: 0.56462 Loss: 0.53864 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "403840 Examples seen. Accuracy: 0.6994 Error: 0.83586 Loss: 0.90140 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "404480 Examples seen. Accuracy: 0.6980 Error: 0.78890 Loss: 0.89494 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "405120 Examples seen. Accuracy: 0.6971 Error: 0.75002 Loss: 0.78461 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.27s\n", + "405760 Examples seen. Accuracy: 0.6962 Error: 0.79677 Loss: 0.79444 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "406400 Examples seen. Accuracy: 0.6990 Error: 0.83953 Loss: 0.86807 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.26s\n", + "407040 Examples seen. Accuracy: 0.6980 Error: 0.78360 Loss: 0.76686 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "407680 Examples seen. Accuracy: 0.7035 Error: 0.57692 Loss: 0.54299 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.25s\n", + "408320 Examples seen. Accuracy: 0.7040 Error: 0.87694 Loss: 1.10601 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.25s\n", + "408960 Examples seen. Accuracy: 0.7013 Error: 0.78070 Loss: 0.89345 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "409600 Examples seen. Accuracy: 0.7008 Error: 0.84706 Loss: 0.95418 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "410240 Examples seen. Accuracy: 0.7025 Error: 0.88677 Loss: 0.96750 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "410880 Examples seen. Accuracy: 0.7013 Error: 0.82835 Loss: 1.09910 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "411520 Examples seen. Accuracy: 0.7004 Error: 0.79865 Loss: 0.83026 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "412160 Examples seen. Accuracy: 0.7011 Error: 0.82756 Loss: 0.83940 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "412800 Examples seen. Accuracy: 0.7013 Error: 0.66509 Loss: 0.71769 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.24s\n", + "413440 Examples seen. Accuracy: 0.7007 Error: 0.84655 Loss: 0.93009 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.31s\n", + "414080 Examples seen. Accuracy: 0.7012 Error: 0.88743 Loss: 0.96724 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "414720 Examples seen. Accuracy: 0.7030 Error: 0.88924 Loss: 1.10586 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.27s\n", + "415360 Examples seen. Accuracy: 0.7045 Error: 0.76330 Loss: 0.69952 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.24s\n", + "416000 Examples seen. Accuracy: 0.7021 Error: 0.84887 Loss: 0.91870 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "416640 Examples seen. Accuracy: 0.7033 Error: 0.78722 Loss: 0.81782 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "417280 Examples seen. Accuracy: 0.7044 Error: 0.74771 Loss: 0.87205 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "417920 Examples seen. Accuracy: 0.7026 Error: 0.90083 Loss: 0.91435 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "418560 Examples seen. Accuracy: 0.7016 Error: 0.85048 Loss: 0.92828 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "419200 Examples seen. Accuracy: 0.7026 Error: 0.76385 Loss: 0.77123 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "419840 Examples seen. Accuracy: 0.7051 Error: 0.72022 Loss: 0.73595 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "420480 Examples seen. Accuracy: 0.7050 Error: 0.70890 Loss: 0.72313 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.30s\n", + "421120 Examples seen. Accuracy: 0.7060 Error: 0.77504 Loss: 0.85528 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "421760 Examples seen. Accuracy: 0.7046 Error: 0.67149 Loss: 0.80695 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "422400 Examples seen. Accuracy: 0.7044 Error: 0.81298 Loss: 0.79828 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "423040 Examples seen. Accuracy: 0.7105 Error: 0.61800 Loss: 0.61740 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.26s\n", + "423680 Examples seen. Accuracy: 0.7128 Error: 0.66715 Loss: 0.75963 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.34s\n", + "424320 Examples seen. Accuracy: 0.7139 Error: 0.82122 Loss: 0.95315 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.34s\n", + "424960 Examples seen. Accuracy: 0.7130 Error: 0.78074 Loss: 0.86985 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.30s\n", + "425600 Examples seen. Accuracy: 0.7158 Error: 0.78785 Loss: 0.77041 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.27s\n", + "426240 Examples seen. Accuracy: 0.7149 Error: 0.88856 Loss: 0.92326 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "426880 Examples seen. Accuracy: 0.7123 Error: 0.74013 Loss: 0.73850 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "427520 Examples seen. Accuracy: 0.7164 Error: 0.67271 Loss: 0.65382 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "428160 Examples seen. Accuracy: 0.7174 Error: 0.84550 Loss: 0.80292 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "428800 Examples seen. Accuracy: 0.7183 Error: 0.89275 Loss: 0.98121 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "429440 Examples seen. Accuracy: 0.7163 Error: 0.90404 Loss: 0.97022 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.29s\n", + "430080 Examples seen. Accuracy: 0.7144 Error: 0.79728 Loss: 0.86836 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.30s\n", + "430720 Examples seen. Accuracy: 0.7118 Error: 0.75183 Loss: 0.75944 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "431360 Examples seen. Accuracy: 0.7122 Error: 0.78443 Loss: 0.72462 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "432000 Examples seen. Accuracy: 0.7138 Error: 0.79717 Loss: 0.77412 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "432640 Examples seen. Accuracy: 0.7118 Error: 0.74848 Loss: 0.84423 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "433280 Examples seen. Accuracy: 0.7093 Error: 0.78267 Loss: 0.75609 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "433920 Examples seen. Accuracy: 0.7094 Error: 0.67661 Loss: 0.68525 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.26s\n", + "434560 Examples seen. Accuracy: 0.7062 Error: 0.81234 Loss: 0.83494 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.31s\n", + "435200 Examples seen. Accuracy: 0.7068 Error: 0.75373 Loss: 0.80960 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.27s\n", + "435840 Examples seen. Accuracy: 0.7102 Error: 0.81008 Loss: 0.83170 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "436480 Examples seen. Accuracy: 0.7063 Error: 1.02774 Loss: 1.30178 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "437120 Examples seen. Accuracy: 0.7077 Error: 0.84527 Loss: 0.91554 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "437760 Examples seen. Accuracy: 0.7067 Error: 0.79582 Loss: 1.01987 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "438400 Examples seen. Accuracy: 0.7058 Error: 0.86893 Loss: 1.03800 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.22s\n", + "439040 Examples seen. Accuracy: 0.7061 Error: 0.80982 Loss: 0.95561 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "439680 Examples seen. Accuracy: 0.7109 Error: 0.70675 Loss: 0.84404 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 11 Examples seen:440000 Validation Accuracy: 0.7459 Validation Error: 0.7620 Validation Loss: 0.7395 Total time: 39.36min\n", + "Epoch time: 2.3490 minutes. 50 epochs: 1.9575 hours.\n", + "Epochs: 11. Working time: 0.66 hours.\n", + "440640 Examples seen. Accuracy: 0.7112 Error: 0.75090 Loss: 0.73681 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.31s\n", + "441280 Examples seen. Accuracy: 0.7147 Error: 0.79958 Loss: 0.90243 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "441920 Examples seen. Accuracy: 0.7154 Error: 0.72568 Loss: 0.81930 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "442560 Examples seen. Accuracy: 0.7181 Error: 0.62918 Loss: 0.64142 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "443200 Examples seen. Accuracy: 0.7159 Error: 0.85248 Loss: 0.90539 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "443840 Examples seen. Accuracy: 0.7166 Error: 0.81171 Loss: 0.88727 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.25s\n", + "444480 Examples seen. Accuracy: 0.7146 Error: 0.77190 Loss: 0.88780 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "445120 Examples seen. Accuracy: 0.7140 Error: 0.70516 Loss: 0.82153 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.26s\n", + "445760 Examples seen. Accuracy: 0.7121 Error: 0.78639 Loss: 0.78645 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.26s\n", + "446400 Examples seen. Accuracy: 0.7114 Error: 0.78763 Loss: 0.80618 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "447040 Examples seen. Accuracy: 0.7098 Error: 0.81796 Loss: 0.82348 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.32s\n", + "447680 Examples seen. Accuracy: 0.7123 Error: 0.69137 Loss: 0.77521 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "448320 Examples seen. Accuracy: 0.7124 Error: 0.69026 Loss: 0.63380 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.27s\n", + "448960 Examples seen. Accuracy: 0.7136 Error: 0.68528 Loss: 0.75157 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "449600 Examples seen. Accuracy: 0.7131 Error: 0.73661 Loss: 0.72990 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.24s\n", + "450240 Examples seen. Accuracy: 0.7125 Error: 0.70364 Loss: 0.70550 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "450880 Examples seen. Accuracy: 0.7147 Error: 0.79971 Loss: 0.83212 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.24s\n", + "451520 Examples seen. Accuracy: 0.7123 Error: 0.89665 Loss: 1.07015 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.27s\n", + "452160 Examples seen. Accuracy: 0.7096 Error: 0.75705 Loss: 0.77934 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "452800 Examples seen. Accuracy: 0.7127 Error: 0.71722 Loss: 0.75133 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "453440 Examples seen. Accuracy: 0.7139 Error: 0.70605 Loss: 0.74962 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.30s\n", + "454080 Examples seen. Accuracy: 0.7143 Error: 0.82519 Loss: 0.87374 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.28s\n", + "454720 Examples seen. Accuracy: 0.7135 Error: 0.64336 Loss: 0.62676 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "455360 Examples seen. Accuracy: 0.7164 Error: 0.68913 Loss: 0.68072 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "456000 Examples seen. Accuracy: 0.7137 Error: 0.94645 Loss: 1.38585 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "456640 Examples seen. Accuracy: 0.7120 Error: 0.77201 Loss: 0.72073 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.24s\n", + "457280 Examples seen. Accuracy: 0.7141 Error: 0.87116 Loss: 0.94200 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.27s\n", + "457920 Examples seen. Accuracy: 0.7166 Error: 0.65593 Loss: 0.77803 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "458560 Examples seen. Accuracy: 0.7169 Error: 0.67448 Loss: 0.71479 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.27s\n", + "459200 Examples seen. Accuracy: 0.7149 Error: 0.67725 Loss: 0.77081 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.26s\n", + "459840 Examples seen. Accuracy: 0.7161 Error: 0.79945 Loss: 0.74566 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "460480 Examples seen. Accuracy: 0.7143 Error: 0.95533 Loss: 1.12959 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.24s\n", + "461120 Examples seen. Accuracy: 0.7101 Error: 0.88571 Loss: 0.90288 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "461760 Examples seen. Accuracy: 0.7135 Error: 0.62519 Loss: 0.82394 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.24s\n", + "462400 Examples seen. Accuracy: 0.7144 Error: 0.59951 Loss: 0.51216 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "463040 Examples seen. Accuracy: 0.7135 Error: 0.69531 Loss: 0.82922 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.27s\n", + "463680 Examples seen. Accuracy: 0.7121 Error: 0.66156 Loss: 0.67263 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "464320 Examples seen. Accuracy: 0.7101 Error: 0.69165 Loss: 0.66978 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.30s\n", + "464960 Examples seen. Accuracy: 0.7061 Error: 0.85761 Loss: 0.84206 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "465600 Examples seen. Accuracy: 0.7108 Error: 0.72666 Loss: 0.75573 Threads: 2 Forward time: 0.65s Backward time: 0.43s Step time: 2.27s\n", + "466240 Examples seen. Accuracy: 0.7118 Error: 0.66336 Loss: 0.70712 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.25s\n", + "466880 Examples seen. Accuracy: 0.7065 Error: 0.85893 Loss: 0.97865 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "467520 Examples seen. Accuracy: 0.7082 Error: 0.80851 Loss: 0.92579 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "468160 Examples seen. Accuracy: 0.7101 Error: 0.91147 Loss: 1.07881 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "468800 Examples seen. Accuracy: 0.7112 Error: 0.79746 Loss: 0.81371 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "469440 Examples seen. Accuracy: 0.7112 Error: 0.83633 Loss: 0.92174 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "470080 Examples seen. Accuracy: 0.7107 Error: 0.72029 Loss: 0.64677 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "470720 Examples seen. Accuracy: 0.7111 Error: 0.74078 Loss: 0.78597 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "471360 Examples seen. Accuracy: 0.7116 Error: 0.69620 Loss: 0.68358 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "472000 Examples seen. Accuracy: 0.7140 Error: 0.69758 Loss: 0.66707 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "472640 Examples seen. Accuracy: 0.7161 Error: 0.75355 Loss: 0.79558 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "473280 Examples seen. Accuracy: 0.7152 Error: 0.85246 Loss: 0.90928 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "473920 Examples seen. Accuracy: 0.7119 Error: 0.79664 Loss: 0.81882 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "474560 Examples seen. Accuracy: 0.7130 Error: 0.76626 Loss: 0.82618 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.31s\n", + "475200 Examples seen. Accuracy: 0.7139 Error: 0.85440 Loss: 1.05641 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "475840 Examples seen. Accuracy: 0.7159 Error: 0.71368 Loss: 0.75263 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.22s\n", + "476480 Examples seen. Accuracy: 0.7149 Error: 0.80042 Loss: 0.87887 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "477120 Examples seen. Accuracy: 0.7160 Error: 0.74688 Loss: 0.81990 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.22s\n", + "477760 Examples seen. Accuracy: 0.7135 Error: 0.84378 Loss: 0.92690 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "478400 Examples seen. Accuracy: 0.7118 Error: 0.74229 Loss: 0.82712 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "479040 Examples seen. Accuracy: 0.7128 Error: 0.75876 Loss: 0.75832 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.22s\n", + "479680 Examples seen. Accuracy: 0.7115 Error: 0.82783 Loss: 0.87476 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 12 Examples seen:480000 Validation Accuracy: 0.7610 Validation Error: 0.7096 Validation Loss: 0.6954 Total time: 42.74min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.326 Min Weight: -0.396 Max Output: 3.709 Min Output: -4.359 TNNetConvolutionLinear 32,32,64 Times: 30.11s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.709 Min Output: -0.780 TNNetMaxPool 8,8,64 Times: 6.93s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.686 Min Weight: 0.670 Max Output: 4.509 Min Output: -2.187 TNNetMovingStdNormalization 8,8,64 Times: 0.16s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.171 Min Weight: -0.184 Max Output: 8.144 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.04s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.186 Min Weight: -0.165 Max Output: 5.154 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.94s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.189 Min Weight: -0.170 Max Output: 2.682 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.08s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.184 Min Weight: -0.151 Max Output: 1.856 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.00s 0.01s Parent:6\n", + "Layer 8 Max Output: 1.856 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 1.856 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.42s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.252 Min Weight: -0.215 Max Output: 2.958 Min Output: -5.466 TNNetFullConnectLinear 10,1,1 Times: 0.09s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.384 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3146 minutes. 50 epochs: 1.9288 hours.\n", + "Epochs: 12. Working time: 0.71 hours.\n", + "480640 Examples seen. Accuracy: 0.7132 Error: 0.74584 Loss: 0.84714 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "481280 Examples seen. Accuracy: 0.7152 Error: 0.69531 Loss: 0.72907 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "481920 Examples seen. Accuracy: 0.7155 Error: 0.77983 Loss: 0.81069 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.23s\n", + "482560 Examples seen. Accuracy: 0.7128 Error: 0.60650 Loss: 0.66012 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.29s\n", + "483200 Examples seen. Accuracy: 0.7132 Error: 0.64428 Loss: 0.60381 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.26s\n", + "483840 Examples seen. Accuracy: 0.7111 Error: 0.73992 Loss: 0.77452 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "484480 Examples seen. Accuracy: 0.7121 Error: 0.77070 Loss: 0.69173 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "485120 Examples seen. Accuracy: 0.7148 Error: 0.75463 Loss: 0.69089 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.23s\n", + "485760 Examples seen. Accuracy: 0.7156 Error: 0.85348 Loss: 0.97100 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "486400 Examples seen. Accuracy: 0.7125 Error: 0.71897 Loss: 0.69074 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "487040 Examples seen. Accuracy: 0.7134 Error: 0.76211 Loss: 0.74753 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "487680 Examples seen. Accuracy: 0.7167 Error: 0.53856 Loss: 0.67373 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.23s\n", + "488320 Examples seen. Accuracy: 0.7150 Error: 0.68174 Loss: 0.77533 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "488960 Examples seen. Accuracy: 0.7163 Error: 0.80288 Loss: 0.83149 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "489600 Examples seen. Accuracy: 0.7163 Error: 0.82511 Loss: 0.96139 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "490240 Examples seen. Accuracy: 0.7171 Error: 0.76451 Loss: 0.78677 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "490880 Examples seen. Accuracy: 0.7198 Error: 0.59256 Loss: 0.56093 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "491520 Examples seen. Accuracy: 0.7202 Error: 0.57008 Loss: 0.58644 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.34s\n", + "492160 Examples seen. Accuracy: 0.7180 Error: 0.84067 Loss: 0.86652 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.33s\n", + "492800 Examples seen. Accuracy: 0.7159 Error: 0.77086 Loss: 0.72474 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "493440 Examples seen. Accuracy: 0.7180 Error: 0.60613 Loss: 0.72534 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.32s\n", + "494080 Examples seen. Accuracy: 0.7195 Error: 0.75677 Loss: 0.72396 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.26s\n", + "494720 Examples seen. Accuracy: 0.7211 Error: 0.65503 Loss: 0.71134 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "495360 Examples seen. Accuracy: 0.7202 Error: 0.65776 Loss: 0.67718 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "496000 Examples seen. Accuracy: 0.7174 Error: 0.94382 Loss: 1.02258 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "496640 Examples seen. Accuracy: 0.7176 Error: 0.63724 Loss: 0.63861 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.32s\n", + "497280 Examples seen. Accuracy: 0.7185 Error: 0.65614 Loss: 0.63748 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "497920 Examples seen. Accuracy: 0.7169 Error: 0.77385 Loss: 0.78622 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "498560 Examples seen. Accuracy: 0.7177 Error: 0.94953 Loss: 1.06829 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "499200 Examples seen. Accuracy: 0.7165 Error: 0.71451 Loss: 0.76900 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "499840 Examples seen. Accuracy: 0.7129 Error: 0.94714 Loss: 1.04725 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "500480 Examples seen. Accuracy: 0.7138 Error: 0.78324 Loss: 0.95934 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "501120 Examples seen. Accuracy: 0.7170 Error: 0.72326 Loss: 0.69125 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "501760 Examples seen. Accuracy: 0.7181 Error: 0.79261 Loss: 0.90189 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "502400 Examples seen. Accuracy: 0.7169 Error: 0.84751 Loss: 0.84283 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "503040 Examples seen. Accuracy: 0.7142 Error: 0.70957 Loss: 0.70398 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.24s\n", + "503680 Examples seen. Accuracy: 0.7165 Error: 0.75362 Loss: 0.79541 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "504320 Examples seen. Accuracy: 0.7217 Error: 0.65437 Loss: 0.55792 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "504960 Examples seen. Accuracy: 0.7259 Error: 0.62734 Loss: 0.63808 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "505600 Examples seen. Accuracy: 0.7281 Error: 0.77873 Loss: 0.90384 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.29s\n", + "506240 Examples seen. Accuracy: 0.7282 Error: 0.66170 Loss: 0.63120 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.30s\n", + "506880 Examples seen. Accuracy: 0.7292 Error: 0.58860 Loss: 0.59531 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "507520 Examples seen. Accuracy: 0.7260 Error: 0.87351 Loss: 1.00996 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.24s\n", + "508160 Examples seen. Accuracy: 0.7263 Error: 0.71529 Loss: 0.70644 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "508800 Examples seen. Accuracy: 0.7249 Error: 0.71136 Loss: 0.80688 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "509440 Examples seen. Accuracy: 0.7257 Error: 0.75468 Loss: 0.82708 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "510080 Examples seen. Accuracy: 0.7266 Error: 0.73600 Loss: 0.82209 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "510720 Examples seen. Accuracy: 0.7267 Error: 0.64450 Loss: 0.60830 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "511360 Examples seen. Accuracy: 0.7283 Error: 0.65405 Loss: 0.61811 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "512000 Examples seen. Accuracy: 0.7270 Error: 0.45728 Loss: 0.43486 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "512640 Examples seen. Accuracy: 0.7258 Error: 0.78040 Loss: 0.84160 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "513280 Examples seen. Accuracy: 0.7254 Error: 0.72081 Loss: 0.65352 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "513920 Examples seen. Accuracy: 0.7248 Error: 0.63449 Loss: 0.59896 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "514560 Examples seen. Accuracy: 0.7228 Error: 0.61914 Loss: 0.57322 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "515200 Examples seen. Accuracy: 0.7226 Error: 0.63302 Loss: 0.65841 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "515840 Examples seen. Accuracy: 0.7226 Error: 0.60485 Loss: 0.66033 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.31s\n", + "516480 Examples seen. Accuracy: 0.7242 Error: 0.78215 Loss: 0.91657 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "517120 Examples seen. Accuracy: 0.7205 Error: 0.73882 Loss: 0.84812 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "517760 Examples seen. Accuracy: 0.7216 Error: 0.85210 Loss: 0.94369 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.23s\n", + "518400 Examples seen. Accuracy: 0.7223 Error: 0.69614 Loss: 0.67126 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "519040 Examples seen. Accuracy: 0.7207 Error: 0.81899 Loss: 0.83598 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "519680 Examples seen. Accuracy: 0.7223 Error: 0.66769 Loss: 0.63915 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 13 Examples seen:520000 Validation Accuracy: 0.7688 Validation Error: 0.6684 Validation Loss: 0.6639 Total time: 46.13min\n", + "Epoch time: 2.3344 minutes. 50 epochs: 1.9453 hours.\n", + "Epochs: 13. Working time: 0.77 hours.\n", + "520640 Examples seen. Accuracy: 0.7212 Error: 0.76382 Loss: 0.80789 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.24s\n", + "521280 Examples seen. Accuracy: 0.7223 Error: 0.72920 Loss: 0.82963 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.21s\n", + "521920 Examples seen. Accuracy: 0.7199 Error: 0.80229 Loss: 0.81868 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "522560 Examples seen. Accuracy: 0.7204 Error: 0.86225 Loss: 0.89131 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "523200 Examples seen. Accuracy: 0.7233 Error: 0.59301 Loss: 0.60349 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "523840 Examples seen. Accuracy: 0.7214 Error: 0.66773 Loss: 0.80849 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "524480 Examples seen. Accuracy: 0.7198 Error: 0.96479 Loss: 1.00542 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.22s\n", + "525120 Examples seen. Accuracy: 0.7226 Error: 0.67815 Loss: 0.83707 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.20s\n", + "525760 Examples seen. Accuracy: 0.7245 Error: 0.69012 Loss: 0.68533 Threads: 2 Forward time: 0.65s Backward time: 0.44s Step time: 2.28s\n", + "526400 Examples seen. Accuracy: 0.7256 Error: 0.68813 Loss: 0.77270 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "527040 Examples seen. Accuracy: 0.7259 Error: 0.50937 Loss: 0.43279 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "527680 Examples seen. Accuracy: 0.7229 Error: 0.63795 Loss: 0.60759 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.24s\n", + "528320 Examples seen. Accuracy: 0.7234 Error: 0.52090 Loss: 0.50386 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "528960 Examples seen. Accuracy: 0.7238 Error: 0.81742 Loss: 0.77372 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "529600 Examples seen. Accuracy: 0.7213 Error: 0.87822 Loss: 0.85913 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "530240 Examples seen. Accuracy: 0.7218 Error: 0.76327 Loss: 0.75705 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "530880 Examples seen. Accuracy: 0.7215 Error: 0.82403 Loss: 0.81884 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "531520 Examples seen. Accuracy: 0.7233 Error: 0.83089 Loss: 0.92845 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.23s\n", + "532160 Examples seen. Accuracy: 0.7231 Error: 0.83531 Loss: 0.83064 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "532800 Examples seen. Accuracy: 0.7237 Error: 0.76910 Loss: 0.82441 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "533440 Examples seen. Accuracy: 0.7273 Error: 0.61633 Loss: 0.60771 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "534080 Examples seen. Accuracy: 0.7250 Error: 0.78924 Loss: 0.94726 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "534720 Examples seen. Accuracy: 0.7228 Error: 0.77237 Loss: 0.83175 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.24s\n", + "535360 Examples seen. Accuracy: 0.7199 Error: 0.79900 Loss: 0.92404 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.21s\n", + "536000 Examples seen. Accuracy: 0.7219 Error: 0.82467 Loss: 0.88878 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.22s\n", + "536640 Examples seen. Accuracy: 0.7211 Error: 0.75859 Loss: 0.95874 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.21s\n", + "537280 Examples seen. Accuracy: 0.7239 Error: 0.64664 Loss: 0.75680 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "537920 Examples seen. Accuracy: 0.7244 Error: 0.75934 Loss: 0.81481 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.22s\n", + "538560 Examples seen. Accuracy: 0.7244 Error: 0.86391 Loss: 0.86154 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.22s\n", + "539200 Examples seen. Accuracy: 0.7252 Error: 0.67938 Loss: 0.70893 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "539840 Examples seen. Accuracy: 0.7273 Error: 0.62804 Loss: 0.62618 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.21s\n", + "540480 Examples seen. Accuracy: 0.7246 Error: 0.89304 Loss: 0.96264 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.31s\n", + "541120 Examples seen. Accuracy: 0.7248 Error: 0.95614 Loss: 1.10903 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.35s\n", + "541760 Examples seen. Accuracy: 0.7293 Error: 0.54207 Loss: 0.48875 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.27s\n", + "542400 Examples seen. Accuracy: 0.7292 Error: 0.73790 Loss: 0.70872 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.23s\n", + "543040 Examples seen. Accuracy: 0.7286 Error: 0.83263 Loss: 0.94727 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "543680 Examples seen. Accuracy: 0.7283 Error: 0.66514 Loss: 0.61452 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "544320 Examples seen. Accuracy: 0.7273 Error: 0.65210 Loss: 0.63786 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.23s\n", + "544960 Examples seen. Accuracy: 0.7270 Error: 0.95984 Loss: 1.06722 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.27s\n", + "545600 Examples seen. Accuracy: 0.7275 Error: 0.65816 Loss: 0.61876 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.33s\n", + "546240 Examples seen. Accuracy: 0.7269 Error: 0.72152 Loss: 0.73718 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.28s\n", + "546880 Examples seen. Accuracy: 0.7247 Error: 0.64205 Loss: 0.63491 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.30s\n", + "547520 Examples seen. Accuracy: 0.7224 Error: 0.85589 Loss: 1.13951 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "548160 Examples seen. Accuracy: 0.7230 Error: 0.69306 Loss: 0.71370 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "548800 Examples seen. Accuracy: 0.7254 Error: 0.78880 Loss: 0.93733 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "549440 Examples seen. Accuracy: 0.7248 Error: 0.79678 Loss: 0.97227 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "550080 Examples seen. Accuracy: 0.7241 Error: 0.64468 Loss: 0.63939 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.29s\n", + "550720 Examples seen. Accuracy: 0.7250 Error: 0.66852 Loss: 0.69237 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "551360 Examples seen. Accuracy: 0.7238 Error: 0.57138 Loss: 0.68234 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "552000 Examples seen. Accuracy: 0.7244 Error: 0.70917 Loss: 0.89323 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "552640 Examples seen. Accuracy: 0.7247 Error: 0.67273 Loss: 0.59706 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "553280 Examples seen. Accuracy: 0.7234 Error: 0.79465 Loss: 0.82839 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.27s\n", + "553920 Examples seen. Accuracy: 0.7273 Error: 0.71642 Loss: 0.73077 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "554560 Examples seen. Accuracy: 0.7284 Error: 0.71214 Loss: 0.77101 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "555200 Examples seen. Accuracy: 0.7297 Error: 0.60608 Loss: 0.56877 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "555840 Examples seen. Accuracy: 0.7279 Error: 0.79744 Loss: 0.95453 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "556480 Examples seen. Accuracy: 0.7289 Error: 0.95153 Loss: 1.01603 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "557120 Examples seen. Accuracy: 0.7272 Error: 0.86453 Loss: 0.96938 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "557760 Examples seen. Accuracy: 0.7276 Error: 0.82442 Loss: 0.89380 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "558400 Examples seen. Accuracy: 0.7266 Error: 0.61843 Loss: 0.57421 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.24s\n", + "559040 Examples seen. Accuracy: 0.7282 Error: 0.72495 Loss: 0.84566 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "559680 Examples seen. Accuracy: 0.7292 Error: 0.75060 Loss: 0.83603 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 14 Examples seen:560000 Validation Accuracy: 0.7765 Validation Error: 0.6387 Validation Loss: 0.6414 Total time: 49.50min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.351 Min Weight: -0.432 Max Output: 3.874 Min Output: -4.535 TNNetConvolutionLinear 32,32,64 Times: 30.17s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.874 Min Output: -0.801 TNNetMaxPool 8,8,64 Times: 6.85s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.710 Min Weight: 0.669 Max Output: 4.732 Min Output: -2.261 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.196 Min Weight: -0.202 Max Output: 8.743 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.07s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.205 Min Weight: -0.177 Max Output: 5.602 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.03s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.209 Min Weight: -0.186 Max Output: 3.182 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.00s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.191 Min Weight: -0.164 Max Output: 2.272 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.08s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.272 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.272 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.42s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.267 Min Weight: -0.230 Max Output: 3.686 Min Output: -6.240 TNNetFullConnectLinear 10,1,1 Times: 0.09s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.471 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3271 minutes. 50 epochs: 1.9392 hours.\n", + "Epochs: 14. Working time: 0.83 hours.\n", + "560640 Examples seen. Accuracy: 0.7306 Error: 0.80351 Loss: 0.87696 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "561280 Examples seen. Accuracy: 0.7304 Error: 0.64158 Loss: 0.59135 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.23s\n", + "561920 Examples seen. Accuracy: 0.7278 Error: 0.88604 Loss: 0.91336 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "562560 Examples seen. Accuracy: 0.7257 Error: 0.59453 Loss: 0.59496 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "563200 Examples seen. Accuracy: 0.7234 Error: 0.78538 Loss: 1.03088 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.26s\n", + "563840 Examples seen. Accuracy: 0.7228 Error: 0.80699 Loss: 1.04114 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "564480 Examples seen. Accuracy: 0.7247 Error: 0.80023 Loss: 0.80287 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.27s\n", + "565120 Examples seen. Accuracy: 0.7246 Error: 0.69403 Loss: 0.69507 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "565760 Examples seen. Accuracy: 0.7251 Error: 0.59034 Loss: 0.64138 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "566400 Examples seen. Accuracy: 0.7241 Error: 0.69445 Loss: 0.68190 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "567040 Examples seen. Accuracy: 0.7246 Error: 0.52389 Loss: 0.52861 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "567680 Examples seen. Accuracy: 0.7247 Error: 0.66098 Loss: 0.72401 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.24s\n", + "568320 Examples seen. Accuracy: 0.7244 Error: 0.69488 Loss: 0.61237 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "568960 Examples seen. Accuracy: 0.7249 Error: 0.77336 Loss: 0.85342 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.26s\n", + "569600 Examples seen. Accuracy: 0.7238 Error: 0.88228 Loss: 1.22315 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.27s\n", + "570240 Examples seen. Accuracy: 0.7264 Error: 0.68647 Loss: 0.66992 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "570880 Examples seen. Accuracy: 0.7285 Error: 0.61368 Loss: 0.58891 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "571520 Examples seen. Accuracy: 0.7297 Error: 0.73747 Loss: 0.74279 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "572160 Examples seen. Accuracy: 0.7280 Error: 0.77270 Loss: 0.86834 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "572800 Examples seen. Accuracy: 0.7264 Error: 0.86754 Loss: 0.98843 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "573440 Examples seen. Accuracy: 0.7277 Error: 0.86382 Loss: 0.91161 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "574080 Examples seen. Accuracy: 0.7273 Error: 0.82721 Loss: 0.98299 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "574720 Examples seen. Accuracy: 0.7259 Error: 0.63012 Loss: 0.67063 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.23s\n", + "575360 Examples seen. Accuracy: 0.7240 Error: 0.85158 Loss: 0.90515 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "576000 Examples seen. Accuracy: 0.7233 Error: 0.83303 Loss: 0.85841 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "576640 Examples seen. Accuracy: 0.7258 Error: 0.87603 Loss: 1.08411 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.22s\n", + "577280 Examples seen. Accuracy: 0.7252 Error: 0.64026 Loss: 0.64775 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "577920 Examples seen. Accuracy: 0.7278 Error: 0.64054 Loss: 0.61645 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.21s\n", + "578560 Examples seen. Accuracy: 0.7333 Error: 0.68802 Loss: 0.70049 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "579200 Examples seen. Accuracy: 0.7323 Error: 0.73008 Loss: 0.69514 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "579840 Examples seen. Accuracy: 0.7328 Error: 0.70623 Loss: 0.80600 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "580480 Examples seen. Accuracy: 0.7313 Error: 0.76681 Loss: 0.98736 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "581120 Examples seen. Accuracy: 0.7316 Error: 0.66294 Loss: 0.64105 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.22s\n", + "581760 Examples seen. Accuracy: 0.7331 Error: 0.59241 Loss: 0.63014 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.21s\n", + "582400 Examples seen. Accuracy: 0.7327 Error: 0.69372 Loss: 0.67690 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.21s\n", + "583040 Examples seen. Accuracy: 0.7316 Error: 0.87871 Loss: 0.94061 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "583680 Examples seen. Accuracy: 0.7322 Error: 0.67386 Loss: 0.69274 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "584320 Examples seen. Accuracy: 0.7317 Error: 0.68296 Loss: 0.66084 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "584960 Examples seen. Accuracy: 0.7303 Error: 0.77688 Loss: 0.84082 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.23s\n", + "585600 Examples seen. Accuracy: 0.7300 Error: 0.80486 Loss: 0.80401 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "586240 Examples seen. Accuracy: 0.7299 Error: 0.58914 Loss: 0.58735 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "586880 Examples seen. Accuracy: 0.7306 Error: 0.74473 Loss: 0.68488 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "587520 Examples seen. Accuracy: 0.7289 Error: 0.71507 Loss: 0.91941 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "588160 Examples seen. Accuracy: 0.7287 Error: 0.82115 Loss: 0.86644 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "588800 Examples seen. Accuracy: 0.7308 Error: 0.63042 Loss: 0.61971 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "589440 Examples seen. Accuracy: 0.7299 Error: 0.82658 Loss: 0.99962 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "590080 Examples seen. Accuracy: 0.7264 Error: 0.70545 Loss: 0.74360 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.21s\n", + "590720 Examples seen. Accuracy: 0.7289 Error: 0.67823 Loss: 0.59907 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.21s\n", + "591360 Examples seen. Accuracy: 0.7278 Error: 0.86924 Loss: 0.91082 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "592000 Examples seen. Accuracy: 0.7291 Error: 0.70767 Loss: 0.79358 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.25s\n", + "592640 Examples seen. Accuracy: 0.7309 Error: 0.55643 Loss: 0.54535 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.26s\n", + "593280 Examples seen. Accuracy: 0.7294 Error: 0.84435 Loss: 0.91779 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "593920 Examples seen. Accuracy: 0.7291 Error: 0.80799 Loss: 0.81080 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "594560 Examples seen. Accuracy: 0.7303 Error: 0.83026 Loss: 0.82174 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.25s\n", + "595200 Examples seen. Accuracy: 0.7307 Error: 0.88218 Loss: 1.01781 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "595840 Examples seen. Accuracy: 0.7326 Error: 0.63130 Loss: 0.79850 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.26s\n", + "596480 Examples seen. Accuracy: 0.7312 Error: 0.85629 Loss: 0.84790 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.24s\n", + "597120 Examples seen. Accuracy: 0.7323 Error: 0.60323 Loss: 0.59276 Threads: 2 Forward time: 0.74s Backward time: 0.40s Step time: 2.25s\n", + "597760 Examples seen. Accuracy: 0.7303 Error: 0.71906 Loss: 0.91518 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.25s\n", + "598400 Examples seen. Accuracy: 0.7298 Error: 0.63105 Loss: 0.56186 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.25s\n", + "599040 Examples seen. Accuracy: 0.7280 Error: 0.81189 Loss: 1.02724 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "599680 Examples seen. Accuracy: 0.7262 Error: 0.76338 Loss: 0.71589 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 15 Examples seen:600000 Validation Accuracy: 0.7838 Validation Error: 0.6131 Validation Loss: 0.6218 Total time: 52.87min\n", + "Epoch time: 2.3292 minutes. 50 epochs: 1.9410 hours.\n", + "Epochs: 15. Working time: 0.88 hours.\n", + "600640 Examples seen. Accuracy: 0.7284 Error: 0.81994 Loss: 0.85169 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "601280 Examples seen. Accuracy: 0.7295 Error: 0.63513 Loss: 0.69268 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "601920 Examples seen. Accuracy: 0.7287 Error: 0.75240 Loss: 0.78298 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "602560 Examples seen. Accuracy: 0.7309 Error: 0.64375 Loss: 0.63940 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "603200 Examples seen. Accuracy: 0.7339 Error: 0.68932 Loss: 0.71015 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "603840 Examples seen. Accuracy: 0.7345 Error: 0.60915 Loss: 0.62535 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "604480 Examples seen. Accuracy: 0.7343 Error: 0.74622 Loss: 0.79655 Threads: 2 Forward time: 0.71s Backward time: 0.38s Step time: 2.25s\n", + "605120 Examples seen. Accuracy: 0.7365 Error: 0.65867 Loss: 0.75340 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "605760 Examples seen. Accuracy: 0.7325 Error: 0.83955 Loss: 1.09509 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "606400 Examples seen. Accuracy: 0.7329 Error: 0.68075 Loss: 0.74307 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "607040 Examples seen. Accuracy: 0.7348 Error: 0.72267 Loss: 0.98237 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "607680 Examples seen. Accuracy: 0.7368 Error: 0.64895 Loss: 0.57925 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.24s\n", + "608320 Examples seen. Accuracy: 0.7386 Error: 0.59484 Loss: 0.67471 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "608960 Examples seen. Accuracy: 0.7376 Error: 0.92837 Loss: 1.08551 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "609600 Examples seen. Accuracy: 0.7332 Error: 0.74487 Loss: 0.72064 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.24s\n", + "610240 Examples seen. Accuracy: 0.7330 Error: 0.61891 Loss: 0.60612 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "610880 Examples seen. Accuracy: 0.7345 Error: 0.68090 Loss: 0.70807 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "611520 Examples seen. Accuracy: 0.7347 Error: 0.71821 Loss: 0.72071 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "612160 Examples seen. Accuracy: 0.7347 Error: 0.67727 Loss: 0.79103 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "612800 Examples seen. Accuracy: 0.7346 Error: 0.64321 Loss: 0.71347 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "613440 Examples seen. Accuracy: 0.7354 Error: 0.86482 Loss: 1.03235 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "614080 Examples seen. Accuracy: 0.7345 Error: 0.79361 Loss: 0.89498 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.29s\n", + "614720 Examples seen. Accuracy: 0.7313 Error: 0.75310 Loss: 0.85220 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "615360 Examples seen. Accuracy: 0.7311 Error: 0.80142 Loss: 0.85136 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "616000 Examples seen. Accuracy: 0.7319 Error: 0.85156 Loss: 0.92874 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "616640 Examples seen. Accuracy: 0.7325 Error: 0.71977 Loss: 0.92685 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "617280 Examples seen. Accuracy: 0.7308 Error: 0.63902 Loss: 0.66988 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.23s\n", + "617920 Examples seen. Accuracy: 0.7308 Error: 0.74319 Loss: 0.80647 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "618560 Examples seen. Accuracy: 0.7323 Error: 0.68184 Loss: 0.73890 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "619200 Examples seen. Accuracy: 0.7325 Error: 0.81646 Loss: 0.97258 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.23s\n", + "619840 Examples seen. Accuracy: 0.7334 Error: 0.67333 Loss: 0.61803 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.26s\n", + "620480 Examples seen. Accuracy: 0.7344 Error: 0.74474 Loss: 0.86607 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "621120 Examples seen. Accuracy: 0.7341 Error: 0.61966 Loss: 0.65237 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.22s\n", + "621760 Examples seen. Accuracy: 0.7330 Error: 0.74581 Loss: 0.71640 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "622400 Examples seen. Accuracy: 0.7339 Error: 0.66135 Loss: 0.79537 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "623040 Examples seen. Accuracy: 0.7365 Error: 0.58393 Loss: 0.52766 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "623680 Examples seen. Accuracy: 0.7352 Error: 0.77711 Loss: 0.85853 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.22s\n", + "624320 Examples seen. Accuracy: 0.7343 Error: 0.73479 Loss: 0.76162 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.26s\n", + "624960 Examples seen. Accuracy: 0.7345 Error: 0.65527 Loss: 0.64969 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "625600 Examples seen. Accuracy: 0.7370 Error: 0.74948 Loss: 0.82470 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "626240 Examples seen. Accuracy: 0.7369 Error: 0.90981 Loss: 1.05147 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "626880 Examples seen. Accuracy: 0.7373 Error: 0.66287 Loss: 0.80990 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "627520 Examples seen. Accuracy: 0.7359 Error: 0.73969 Loss: 0.81561 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.22s\n", + "628160 Examples seen. Accuracy: 0.7375 Error: 0.79360 Loss: 0.84161 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "628800 Examples seen. Accuracy: 0.7365 Error: 0.72637 Loss: 0.88804 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "629440 Examples seen. Accuracy: 0.7359 Error: 0.72532 Loss: 0.76928 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.26s\n", + "630080 Examples seen. Accuracy: 0.7339 Error: 0.57431 Loss: 0.51671 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "630720 Examples seen. Accuracy: 0.7336 Error: 0.62127 Loss: 0.61188 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.23s\n", + "631360 Examples seen. Accuracy: 0.7341 Error: 0.70153 Loss: 0.74808 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "632000 Examples seen. Accuracy: 0.7343 Error: 0.71181 Loss: 0.77254 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "632640 Examples seen. Accuracy: 0.7333 Error: 0.66034 Loss: 0.62480 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "633280 Examples seen. Accuracy: 0.7344 Error: 0.71350 Loss: 0.66858 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "633920 Examples seen. Accuracy: 0.7314 Error: 0.76506 Loss: 0.98048 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.20s\n", + "634560 Examples seen. Accuracy: 0.7327 Error: 0.74348 Loss: 0.81963 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.19s\n", + "635200 Examples seen. Accuracy: 0.7361 Error: 0.73710 Loss: 0.84706 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.22s\n", + "635840 Examples seen. Accuracy: 0.7375 Error: 0.52457 Loss: 0.48535 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "636480 Examples seen. Accuracy: 0.7363 Error: 0.79605 Loss: 0.85576 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.18s\n", + "637120 Examples seen. Accuracy: 0.7340 Error: 0.72260 Loss: 0.85414 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "637760 Examples seen. Accuracy: 0.7327 Error: 0.94315 Loss: 1.11068 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "638400 Examples seen. Accuracy: 0.7327 Error: 0.80111 Loss: 0.81753 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "639040 Examples seen. Accuracy: 0.7333 Error: 0.63148 Loss: 0.62587 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "639680 Examples seen. Accuracy: 0.7328 Error: 0.70743 Loss: 0.76274 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 16 Examples seen:640000 Validation Accuracy: 0.7886 Validation Error: 0.5938 Validation Loss: 0.6055 Total time: 56.24min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.376 Min Weight: -0.457 Max Output: 3.971 Min Output: -4.654 TNNetConvolutionLinear 32,32,64 Times: 30.17s 0.07s Parent:0\n", + "Layer 2 Max Output: 3.971 Min Output: -0.845 TNNetMaxPool 8,8,64 Times: 6.98s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.731 Min Weight: 0.680 Max Output: 4.762 Min Output: -2.316 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.217 Min Weight: -0.216 Max Output: 9.054 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.02s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.218 Min Weight: -0.187 Max Output: 5.782 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.226 Min Weight: -0.198 Max Output: 3.523 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.00s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.193 Min Weight: -0.176 Max Output: 2.450 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.13s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.450 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.450 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.40s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.274 Min Weight: -0.236 Max Output: 4.063 Min Output: -6.511 TNNetFullConnectLinear 10,1,1 Times: 0.10s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.533 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3135 minutes. 50 epochs: 1.9280 hours.\n", + "Epochs: 16. Working time: 0.94 hours.\n", + "640640 Examples seen. Accuracy: 0.7309 Error: 0.82638 Loss: 0.92494 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "641280 Examples seen. Accuracy: 0.7325 Error: 0.91600 Loss: 0.94810 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "641920 Examples seen. Accuracy: 0.7340 Error: 0.57504 Loss: 0.58877 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "642560 Examples seen. Accuracy: 0.7361 Error: 0.70371 Loss: 0.66729 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.24s\n", + "643200 Examples seen. Accuracy: 0.7349 Error: 0.59611 Loss: 0.55064 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "643840 Examples seen. Accuracy: 0.7356 Error: 0.68335 Loss: 0.72285 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "644480 Examples seen. Accuracy: 0.7354 Error: 0.79125 Loss: 0.81970 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.21s\n", + "645120 Examples seen. Accuracy: 0.7341 Error: 0.62963 Loss: 0.66480 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.22s\n", + "645760 Examples seen. Accuracy: 0.7348 Error: 0.63267 Loss: 0.68203 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "646400 Examples seen. Accuracy: 0.7334 Error: 0.77634 Loss: 0.77292 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "647040 Examples seen. Accuracy: 0.7340 Error: 0.68604 Loss: 0.74443 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "647680 Examples seen. Accuracy: 0.7323 Error: 0.84024 Loss: 0.88229 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "648320 Examples seen. Accuracy: 0.7335 Error: 0.64345 Loss: 0.62506 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "648960 Examples seen. Accuracy: 0.7369 Error: 0.67470 Loss: 0.64669 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.22s\n", + "649600 Examples seen. Accuracy: 0.7390 Error: 0.73256 Loss: 0.85692 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "650240 Examples seen. Accuracy: 0.7400 Error: 0.73254 Loss: 0.79751 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "650880 Examples seen. Accuracy: 0.7407 Error: 0.62521 Loss: 0.64345 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "651520 Examples seen. Accuracy: 0.7369 Error: 0.68342 Loss: 0.63963 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.19s\n", + "652160 Examples seen. Accuracy: 0.7377 Error: 0.68928 Loss: 0.77645 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "652800 Examples seen. Accuracy: 0.7373 Error: 0.64143 Loss: 0.56451 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "653440 Examples seen. Accuracy: 0.7380 Error: 0.72414 Loss: 0.73863 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "654080 Examples seen. Accuracy: 0.7420 Error: 0.54171 Loss: 0.52409 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "654720 Examples seen. Accuracy: 0.7420 Error: 0.74278 Loss: 0.77258 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "655360 Examples seen. Accuracy: 0.7423 Error: 0.66121 Loss: 0.72188 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "656000 Examples seen. Accuracy: 0.7432 Error: 0.82239 Loss: 0.94187 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "656640 Examples seen. Accuracy: 0.7427 Error: 0.64885 Loss: 0.68349 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "657280 Examples seen. Accuracy: 0.7437 Error: 0.71814 Loss: 0.74520 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "657920 Examples seen. Accuracy: 0.7453 Error: 0.64737 Loss: 0.62897 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "658560 Examples seen. Accuracy: 0.7464 Error: 0.70529 Loss: 0.81118 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.21s\n", + "659200 Examples seen. Accuracy: 0.7449 Error: 0.76477 Loss: 1.09963 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "659840 Examples seen. Accuracy: 0.7471 Error: 0.64581 Loss: 0.68587 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.30s\n", + "660480 Examples seen. Accuracy: 0.7464 Error: 0.65515 Loss: 0.56691 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "661120 Examples seen. Accuracy: 0.7461 Error: 0.70373 Loss: 0.77010 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.29s\n", + "661760 Examples seen. Accuracy: 0.7470 Error: 0.52837 Loss: 0.51442 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "662400 Examples seen. Accuracy: 0.7482 Error: 0.67102 Loss: 0.58382 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "663040 Examples seen. Accuracy: 0.7493 Error: 0.72828 Loss: 0.79608 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "663680 Examples seen. Accuracy: 0.7502 Error: 0.66922 Loss: 0.78517 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "664320 Examples seen. Accuracy: 0.7477 Error: 0.65005 Loss: 0.62998 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "664960 Examples seen. Accuracy: 0.7478 Error: 0.72008 Loss: 0.77701 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "665600 Examples seen. Accuracy: 0.7495 Error: 0.62754 Loss: 0.72530 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "666240 Examples seen. Accuracy: 0.7461 Error: 0.71913 Loss: 0.76676 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "666880 Examples seen. Accuracy: 0.7466 Error: 0.61662 Loss: 0.64074 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "667520 Examples seen. Accuracy: 0.7455 Error: 0.61484 Loss: 0.64118 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "668160 Examples seen. Accuracy: 0.7463 Error: 0.80282 Loss: 0.86444 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "668800 Examples seen. Accuracy: 0.7447 Error: 0.71970 Loss: 0.75942 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "669440 Examples seen. Accuracy: 0.7445 Error: 0.65272 Loss: 0.62319 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.22s\n", + "670080 Examples seen. Accuracy: 0.7454 Error: 0.70711 Loss: 0.83477 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "670720 Examples seen. Accuracy: 0.7454 Error: 0.66471 Loss: 0.64513 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.23s\n", + "671360 Examples seen. Accuracy: 0.7447 Error: 0.57398 Loss: 0.54833 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "672000 Examples seen. Accuracy: 0.7429 Error: 0.62394 Loss: 0.56139 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.23s\n", + "672640 Examples seen. Accuracy: 0.7434 Error: 0.75827 Loss: 0.80341 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.26s\n", + "673280 Examples seen. Accuracy: 0.7425 Error: 0.62356 Loss: 0.59256 Threads: 2 Forward time: 0.69s Backward time: 0.46s Step time: 2.27s\n", + "673920 Examples seen. Accuracy: 0.7451 Error: 0.64164 Loss: 0.54813 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.24s\n", + "674560 Examples seen. Accuracy: 0.7429 Error: 0.78330 Loss: 0.82028 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.22s\n", + "675200 Examples seen. Accuracy: 0.7451 Error: 0.54920 Loss: 0.46735 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.26s\n", + "675840 Examples seen. Accuracy: 0.7441 Error: 0.76564 Loss: 0.83251 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "676480 Examples seen. Accuracy: 0.7445 Error: 0.58589 Loss: 0.55629 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.22s\n", + "677120 Examples seen. Accuracy: 0.7452 Error: 0.72955 Loss: 0.75121 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.22s\n", + "677760 Examples seen. Accuracy: 0.7426 Error: 0.75823 Loss: 0.81646 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "678400 Examples seen. Accuracy: 0.7427 Error: 0.77147 Loss: 0.91921 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.26s\n", + "679040 Examples seen. Accuracy: 0.7439 Error: 0.80838 Loss: 0.76238 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "679680 Examples seen. Accuracy: 0.7443 Error: 0.63170 Loss: 0.62603 Threads: 2 Forward time: 0.67s Backward time: 0.46s Step time: 2.28s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 17 Examples seen:680000 Validation Accuracy: 0.7973 Validation Error: 0.5764 Validation Loss: 0.5915 Total time: 59.61min\n", + "Epoch time: 2.3740 minutes. 50 epochs: 1.9783 hours.\n", + "Epochs: 17. Working time: 0.99 hours.\n", + "680640 Examples seen. Accuracy: 0.7444 Error: 0.76471 Loss: 0.85697 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "681280 Examples seen. Accuracy: 0.7440 Error: 0.63860 Loss: 0.62789 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "681920 Examples seen. Accuracy: 0.7461 Error: 0.70501 Loss: 0.67998 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "682560 Examples seen. Accuracy: 0.7463 Error: 0.67425 Loss: 0.66258 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.23s\n", + "683200 Examples seen. Accuracy: 0.7457 Error: 0.82548 Loss: 0.93123 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "683840 Examples seen. Accuracy: 0.7447 Error: 0.76277 Loss: 0.79113 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "684480 Examples seen. Accuracy: 0.7462 Error: 0.60808 Loss: 0.65183 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "685120 Examples seen. Accuracy: 0.7474 Error: 0.68330 Loss: 0.79063 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "685760 Examples seen. Accuracy: 0.7478 Error: 0.62325 Loss: 0.73712 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.23s\n", + "686400 Examples seen. Accuracy: 0.7448 Error: 0.75919 Loss: 0.78990 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "687040 Examples seen. Accuracy: 0.7424 Error: 0.69270 Loss: 0.80321 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "687680 Examples seen. Accuracy: 0.7432 Error: 0.59096 Loss: 0.65548 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "688320 Examples seen. Accuracy: 0.7419 Error: 0.62345 Loss: 0.58529 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.19s\n", + "688960 Examples seen. Accuracy: 0.7423 Error: 0.69672 Loss: 0.71657 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "689600 Examples seen. Accuracy: 0.7398 Error: 0.81346 Loss: 0.97869 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.23s\n", + "690240 Examples seen. Accuracy: 0.7425 Error: 0.64256 Loss: 0.70856 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.26s\n", + "690880 Examples seen. Accuracy: 0.7439 Error: 0.57510 Loss: 0.54927 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "691520 Examples seen. Accuracy: 0.7435 Error: 0.65889 Loss: 0.68224 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "692160 Examples seen. Accuracy: 0.7444 Error: 0.70932 Loss: 0.69278 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "692800 Examples seen. Accuracy: 0.7469 Error: 0.76683 Loss: 0.81982 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "693440 Examples seen. Accuracy: 0.7489 Error: 0.57121 Loss: 0.58941 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "694080 Examples seen. Accuracy: 0.7503 Error: 0.65543 Loss: 0.64369 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "694720 Examples seen. Accuracy: 0.7507 Error: 0.59517 Loss: 0.71840 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "695360 Examples seen. Accuracy: 0.7505 Error: 0.64793 Loss: 0.70247 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "696000 Examples seen. Accuracy: 0.7514 Error: 0.54395 Loss: 0.54845 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "696640 Examples seen. Accuracy: 0.7524 Error: 0.45395 Loss: 0.43116 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.24s\n", + "697280 Examples seen. Accuracy: 0.7508 Error: 0.58586 Loss: 0.66098 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "697920 Examples seen. Accuracy: 0.7504 Error: 0.68551 Loss: 0.68534 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "698560 Examples seen. Accuracy: 0.7500 Error: 0.67417 Loss: 0.63803 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "699200 Examples seen. Accuracy: 0.7515 Error: 0.72931 Loss: 0.82549 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "699840 Examples seen. Accuracy: 0.7498 Error: 0.72527 Loss: 0.73511 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "700480 Examples seen. Accuracy: 0.7501 Error: 0.71699 Loss: 0.83645 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.21s\n", + "701120 Examples seen. Accuracy: 0.7497 Error: 0.69301 Loss: 0.84705 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "701760 Examples seen. Accuracy: 0.7515 Error: 0.61931 Loss: 0.71229 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "702400 Examples seen. Accuracy: 0.7481 Error: 0.67687 Loss: 0.66375 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "703040 Examples seen. Accuracy: 0.7480 Error: 0.66191 Loss: 0.66811 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "703680 Examples seen. Accuracy: 0.7476 Error: 0.54325 Loss: 0.52029 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.21s\n", + "704320 Examples seen. Accuracy: 0.7478 Error: 0.66869 Loss: 0.73869 Threads: 2 Forward time: 0.71s Backward time: 0.38s Step time: 2.19s\n", + "704960 Examples seen. Accuracy: 0.7475 Error: 0.66700 Loss: 0.70041 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "705600 Examples seen. Accuracy: 0.7458 Error: 0.58845 Loss: 0.60085 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "706240 Examples seen. Accuracy: 0.7441 Error: 0.67111 Loss: 0.69219 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "706880 Examples seen. Accuracy: 0.7458 Error: 0.84117 Loss: 0.96418 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "707520 Examples seen. Accuracy: 0.7439 Error: 0.69631 Loss: 0.85907 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "708160 Examples seen. Accuracy: 0.7423 Error: 0.73660 Loss: 0.76291 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "708800 Examples seen. Accuracy: 0.7433 Error: 0.61974 Loss: 0.54191 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "709440 Examples seen. Accuracy: 0.7443 Error: 0.68206 Loss: 0.72189 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "710080 Examples seen. Accuracy: 0.7427 Error: 0.63347 Loss: 0.74007 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.21s\n", + "710720 Examples seen. Accuracy: 0.7406 Error: 0.81315 Loss: 0.86407 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "711360 Examples seen. Accuracy: 0.7426 Error: 0.67010 Loss: 0.69347 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "712000 Examples seen. Accuracy: 0.7440 Error: 0.61678 Loss: 0.59234 Threads: 2 Forward time: 0.71s Backward time: 0.38s Step time: 2.21s\n", + "712640 Examples seen. Accuracy: 0.7461 Error: 0.78602 Loss: 0.85127 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "713280 Examples seen. Accuracy: 0.7470 Error: 0.62901 Loss: 0.65326 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "713920 Examples seen. Accuracy: 0.7466 Error: 0.72594 Loss: 0.72941 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "714560 Examples seen. Accuracy: 0.7476 Error: 0.60528 Loss: 0.52597 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.19s\n", + "715200 Examples seen. Accuracy: 0.7481 Error: 0.56867 Loss: 0.62178 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.22s\n", + "715840 Examples seen. Accuracy: 0.7491 Error: 0.69793 Loss: 0.85806 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.21s\n", + "716480 Examples seen. Accuracy: 0.7496 Error: 0.61443 Loss: 0.68154 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "717120 Examples seen. Accuracy: 0.7459 Error: 0.70307 Loss: 0.72271 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.20s\n", + "717760 Examples seen. Accuracy: 0.7427 Error: 0.75862 Loss: 0.80682 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "718400 Examples seen. Accuracy: 0.7406 Error: 0.77899 Loss: 0.76672 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "719040 Examples seen. Accuracy: 0.7371 Error: 0.77070 Loss: 0.89312 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "719680 Examples seen. Accuracy: 0.7384 Error: 0.68532 Loss: 0.77363 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.20s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 18 Examples seen:720000 Validation Accuracy: 0.8013 Validation Error: 0.5615 Validation Loss: 0.5810 Total time: 62.96min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.401 Min Weight: -0.477 Max Output: 4.046 Min Output: -4.851 TNNetConvolutionLinear 32,32,64 Times: 30.15s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.046 Min Output: -0.858 TNNetMaxPool 8,8,64 Times: 6.94s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.749 Min Weight: 0.696 Max Output: 4.736 Min Output: -2.308 TNNetMovingStdNormalization 8,8,64 Times: 0.12s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.233 Min Weight: -0.228 Max Output: 9.352 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.03s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.230 Min Weight: -0.197 Max Output: 6.127 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.05s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.239 Min Weight: -0.207 Max Output: 3.796 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.96s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.196 Min Weight: -0.185 Max Output: 2.495 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.10s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.495 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.495 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.40s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.277 Min Weight: -0.243 Max Output: 4.363 Min Output: -6.905 TNNetFullConnectLinear 10,1,1 Times: 0.08s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.525 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.2948 minutes. 50 epochs: 1.9123 hours.\n", + "Epochs: 18. Working time: 1.05 hours.\n", + "720640 Examples seen. Accuracy: 0.7384 Error: 0.81479 Loss: 0.86477 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.23s\n", + "721280 Examples seen. Accuracy: 0.7369 Error: 0.67019 Loss: 0.67882 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.21s\n", + "721920 Examples seen. Accuracy: 0.7353 Error: 0.71617 Loss: 0.81941 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "722560 Examples seen. Accuracy: 0.7355 Error: 0.78681 Loss: 0.94953 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.20s\n", + "723200 Examples seen. Accuracy: 0.7355 Error: 0.59769 Loss: 0.64527 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "723840 Examples seen. Accuracy: 0.7370 Error: 0.67503 Loss: 0.75800 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "724480 Examples seen. Accuracy: 0.7363 Error: 0.67807 Loss: 0.70894 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "725120 Examples seen. Accuracy: 0.7359 Error: 0.68503 Loss: 0.70721 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "725760 Examples seen. Accuracy: 0.7349 Error: 0.81691 Loss: 0.85376 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "726400 Examples seen. Accuracy: 0.7354 Error: 0.69860 Loss: 0.84943 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "727040 Examples seen. Accuracy: 0.7392 Error: 0.60966 Loss: 0.59020 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "727680 Examples seen. Accuracy: 0.7426 Error: 0.60382 Loss: 0.73869 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "728320 Examples seen. Accuracy: 0.7448 Error: 0.67780 Loss: 0.67395 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "728960 Examples seen. Accuracy: 0.7438 Error: 0.79227 Loss: 0.86053 Threads: 2 Forward time: 0.71s Backward time: 0.38s Step time: 2.24s\n", + "729600 Examples seen. Accuracy: 0.7463 Error: 0.54816 Loss: 0.49878 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.23s\n", + "730240 Examples seen. Accuracy: 0.7495 Error: 0.59373 Loss: 0.73298 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "730880 Examples seen. Accuracy: 0.7479 Error: 0.66296 Loss: 0.65091 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "731520 Examples seen. Accuracy: 0.7503 Error: 0.63504 Loss: 0.61188 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "732160 Examples seen. Accuracy: 0.7494 Error: 0.69592 Loss: 0.78318 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "732800 Examples seen. Accuracy: 0.7530 Error: 0.68255 Loss: 0.68436 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.30s\n", + "733440 Examples seen. Accuracy: 0.7548 Error: 0.63731 Loss: 0.62985 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.30s\n", + "734080 Examples seen. Accuracy: 0.7564 Error: 0.58715 Loss: 0.62825 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.24s\n", + "734720 Examples seen. Accuracy: 0.7562 Error: 0.68128 Loss: 0.78043 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "735360 Examples seen. Accuracy: 0.7534 Error: 0.80153 Loss: 0.81774 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "736000 Examples seen. Accuracy: 0.7551 Error: 0.64163 Loss: 0.60553 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "736640 Examples seen. Accuracy: 0.7525 Error: 0.66038 Loss: 0.72153 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "737280 Examples seen. Accuracy: 0.7538 Error: 0.80220 Loss: 1.03444 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "737920 Examples seen. Accuracy: 0.7535 Error: 0.65068 Loss: 0.72064 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.28s\n", + "738560 Examples seen. Accuracy: 0.7521 Error: 0.72063 Loss: 0.80066 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "739200 Examples seen. Accuracy: 0.7522 Error: 0.75485 Loss: 0.69329 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.23s\n", + "739840 Examples seen. Accuracy: 0.7534 Error: 0.47387 Loss: 0.40322 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "740480 Examples seen. Accuracy: 0.7523 Error: 0.57351 Loss: 0.60010 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "741120 Examples seen. Accuracy: 0.7529 Error: 0.57557 Loss: 0.60500 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "741760 Examples seen. Accuracy: 0.7528 Error: 0.73074 Loss: 0.84120 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "742400 Examples seen. Accuracy: 0.7515 Error: 0.79246 Loss: 0.84883 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "743040 Examples seen. Accuracy: 0.7504 Error: 0.56091 Loss: 0.58200 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.30s\n", + "743680 Examples seen. Accuracy: 0.7513 Error: 0.72926 Loss: 0.91264 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.27s\n", + "744320 Examples seen. Accuracy: 0.7518 Error: 0.60331 Loss: 0.53953 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "744960 Examples seen. Accuracy: 0.7500 Error: 0.62054 Loss: 0.62459 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.23s\n", + "745600 Examples seen. Accuracy: 0.7474 Error: 0.90180 Loss: 0.91301 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "746240 Examples seen. Accuracy: 0.7437 Error: 0.71330 Loss: 0.63391 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "746880 Examples seen. Accuracy: 0.7424 Error: 0.64487 Loss: 0.63013 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "747520 Examples seen. Accuracy: 0.7414 Error: 0.71003 Loss: 0.79684 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.21s\n", + "748160 Examples seen. Accuracy: 0.7399 Error: 0.79718 Loss: 1.08230 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.31s\n", + "748800 Examples seen. Accuracy: 0.7414 Error: 0.57249 Loss: 0.49681 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.26s\n", + "749440 Examples seen. Accuracy: 0.7428 Error: 0.65894 Loss: 0.59739 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "750080 Examples seen. Accuracy: 0.7411 Error: 0.77658 Loss: 0.92213 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "750720 Examples seen. Accuracy: 0.7390 Error: 0.64206 Loss: 0.67396 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "751360 Examples seen. Accuracy: 0.7382 Error: 0.61305 Loss: 0.64371 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "752000 Examples seen. Accuracy: 0.7392 Error: 0.56364 Loss: 0.58881 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "752640 Examples seen. Accuracy: 0.7416 Error: 0.68479 Loss: 0.67162 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "753280 Examples seen. Accuracy: 0.7419 Error: 0.68147 Loss: 0.71788 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "753920 Examples seen. Accuracy: 0.7415 Error: 0.81534 Loss: 0.92658 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "754560 Examples seen. Accuracy: 0.7403 Error: 0.84757 Loss: 0.84771 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.21s\n", + "755200 Examples seen. Accuracy: 0.7426 Error: 0.61342 Loss: 0.61207 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "755840 Examples seen. Accuracy: 0.7454 Error: 0.59487 Loss: 0.54379 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "756480 Examples seen. Accuracy: 0.7465 Error: 0.68374 Loss: 0.61202 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "757120 Examples seen. Accuracy: 0.7472 Error: 0.68763 Loss: 0.79570 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "757760 Examples seen. Accuracy: 0.7487 Error: 0.62339 Loss: 0.53550 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "758400 Examples seen. Accuracy: 0.7468 Error: 0.73641 Loss: 0.82330 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "759040 Examples seen. Accuracy: 0.7467 Error: 0.73017 Loss: 0.76498 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "759680 Examples seen. Accuracy: 0.7465 Error: 0.78027 Loss: 0.87566 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 19 Examples seen:760000 Validation Accuracy: 0.8041 Validation Error: 0.5506 Validation Loss: 0.5727 Total time: 66.33min\n", + "Epoch time: 2.3094 minutes. 50 epochs: 1.9245 hours.\n", + "Epochs: 19. Working time: 1.11 hours.\n", + "760640 Examples seen. Accuracy: 0.7455 Error: 0.76612 Loss: 0.65207 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "761280 Examples seen. Accuracy: 0.7450 Error: 0.65331 Loss: 0.60922 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "761920 Examples seen. Accuracy: 0.7421 Error: 0.69570 Loss: 0.79371 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "762560 Examples seen. Accuracy: 0.7440 Error: 0.62391 Loss: 0.65246 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.30s\n", + "763200 Examples seen. Accuracy: 0.7443 Error: 0.65916 Loss: 0.72765 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.23s\n", + "763840 Examples seen. Accuracy: 0.7428 Error: 0.73183 Loss: 0.81312 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "764480 Examples seen. Accuracy: 0.7430 Error: 0.59290 Loss: 0.64103 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "765120 Examples seen. Accuracy: 0.7456 Error: 0.63603 Loss: 0.78334 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "765760 Examples seen. Accuracy: 0.7441 Error: 0.77148 Loss: 0.74225 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "766400 Examples seen. Accuracy: 0.7441 Error: 0.57005 Loss: 0.55999 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.26s\n", + "767040 Examples seen. Accuracy: 0.7447 Error: 0.59310 Loss: 0.60814 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "767680 Examples seen. Accuracy: 0.7456 Error: 0.58268 Loss: 0.55473 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "768320 Examples seen. Accuracy: 0.7465 Error: 0.65579 Loss: 0.66358 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.22s\n", + "768960 Examples seen. Accuracy: 0.7464 Error: 0.66301 Loss: 0.75138 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "769600 Examples seen. Accuracy: 0.7473 Error: 0.68843 Loss: 0.66562 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "770240 Examples seen. Accuracy: 0.7483 Error: 0.64479 Loss: 0.59848 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.21s\n", + "770880 Examples seen. Accuracy: 0.7474 Error: 0.68483 Loss: 0.76079 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.23s\n", + "771520 Examples seen. Accuracy: 0.7471 Error: 0.66196 Loss: 0.55847 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "772160 Examples seen. Accuracy: 0.7460 Error: 0.59508 Loss: 0.75376 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "772800 Examples seen. Accuracy: 0.7444 Error: 0.68392 Loss: 0.67414 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "773440 Examples seen. Accuracy: 0.7450 Error: 0.62442 Loss: 0.66875 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.21s\n", + "774080 Examples seen. Accuracy: 0.7469 Error: 0.51962 Loss: 0.57829 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.23s\n", + "774720 Examples seen. Accuracy: 0.7493 Error: 0.73002 Loss: 0.74118 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "775360 Examples seen. Accuracy: 0.7509 Error: 0.87295 Loss: 1.02797 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "776000 Examples seen. Accuracy: 0.7509 Error: 0.60510 Loss: 0.75229 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "776640 Examples seen. Accuracy: 0.7510 Error: 0.77568 Loss: 0.82427 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.26s\n", + "777280 Examples seen. Accuracy: 0.7513 Error: 0.62681 Loss: 0.68385 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.32s\n", + "777920 Examples seen. Accuracy: 0.7479 Error: 0.56135 Loss: 0.66979 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.33s\n", + "778560 Examples seen. Accuracy: 0.7494 Error: 0.69744 Loss: 0.83112 Threads: 2 Forward time: 0.76s Backward time: 0.38s Step time: 2.34s\n", + "779200 Examples seen. Accuracy: 0.7482 Error: 0.54071 Loss: 0.50365 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.36s\n", + "779840 Examples seen. Accuracy: 0.7483 Error: 0.60984 Loss: 0.71318 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "780480 Examples seen. Accuracy: 0.7466 Error: 0.77419 Loss: 0.76812 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.28s\n", + "781120 Examples seen. Accuracy: 0.7462 Error: 0.69827 Loss: 0.70623 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "781760 Examples seen. Accuracy: 0.7458 Error: 0.78953 Loss: 0.81987 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.24s\n", + "782400 Examples seen. Accuracy: 0.7457 Error: 0.46266 Loss: 0.45021 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "783040 Examples seen. Accuracy: 0.7473 Error: 0.63881 Loss: 0.68950 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "783680 Examples seen. Accuracy: 0.7462 Error: 0.67190 Loss: 0.75382 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.32s\n", + "784320 Examples seen. Accuracy: 0.7465 Error: 0.70063 Loss: 0.83063 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.31s\n", + "784960 Examples seen. Accuracy: 0.7447 Error: 0.54616 Loss: 0.48841 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "785600 Examples seen. Accuracy: 0.7452 Error: 0.68409 Loss: 0.66861 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "786240 Examples seen. Accuracy: 0.7467 Error: 0.75765 Loss: 0.84731 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "786880 Examples seen. Accuracy: 0.7501 Error: 0.64454 Loss: 0.68241 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "787520 Examples seen. Accuracy: 0.7516 Error: 0.69561 Loss: 0.81390 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.24s\n", + "788160 Examples seen. Accuracy: 0.7521 Error: 0.74395 Loss: 0.79623 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "788800 Examples seen. Accuracy: 0.7530 Error: 0.66210 Loss: 0.68422 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "789440 Examples seen. Accuracy: 0.7544 Error: 0.65908 Loss: 0.68625 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "790080 Examples seen. Accuracy: 0.7547 Error: 0.75703 Loss: 0.96614 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.25s\n", + "790720 Examples seen. Accuracy: 0.7527 Error: 0.70642 Loss: 0.68642 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.26s\n", + "791360 Examples seen. Accuracy: 0.7519 Error: 0.65446 Loss: 0.74613 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.28s\n", + "792000 Examples seen. Accuracy: 0.7507 Error: 0.71545 Loss: 0.79001 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.29s\n", + "792640 Examples seen. Accuracy: 0.7496 Error: 0.53167 Loss: 0.44972 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "793280 Examples seen. Accuracy: 0.7492 Error: 0.65414 Loss: 0.75987 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.21s\n", + "793920 Examples seen. Accuracy: 0.7471 Error: 0.60184 Loss: 0.50171 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "794560 Examples seen. Accuracy: 0.7457 Error: 0.98126 Loss: 1.20397 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "795200 Examples seen. Accuracy: 0.7465 Error: 0.69250 Loss: 0.71571 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.22s\n", + "795840 Examples seen. Accuracy: 0.7447 Error: 0.82366 Loss: 0.81982 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "796480 Examples seen. Accuracy: 0.7432 Error: 0.72180 Loss: 0.82688 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "797120 Examples seen. Accuracy: 0.7446 Error: 0.65197 Loss: 0.56577 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "797760 Examples seen. Accuracy: 0.7462 Error: 0.56387 Loss: 0.57156 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.27s\n", + "798400 Examples seen. Accuracy: 0.7483 Error: 0.77927 Loss: 0.86586 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.26s\n", + "799040 Examples seen. Accuracy: 0.7510 Error: 0.47181 Loss: 0.48380 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "799680 Examples seen. Accuracy: 0.7462 Error: 0.76294 Loss: 0.76654 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.20s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 20 Examples seen:800000 Validation Accuracy: 0.8077 Validation Error: 0.5409 Validation Loss: 0.5646 Total time: 69.72min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.421 Min Weight: -0.495 Max Output: 4.172 Min Output: -5.018 TNNetConvolutionLinear 32,32,64 Times: 30.10s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.172 Min Output: -0.922 TNNetMaxPool 8,8,64 Times: 6.91s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.765 Min Weight: 0.713 Max Output: 4.780 Min Output: -2.367 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.247 Min Weight: -0.239 Max Output: 9.339 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.14s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.239 Min Weight: -0.206 Max Output: 6.290 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.99s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.246 Min Weight: -0.210 Max Output: 4.148 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.05s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.208 Min Weight: -0.199 Max Output: 2.330 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.06s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.330 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.330 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.40s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.299 Min Weight: -0.252 Max Output: 4.613 Min Output: -7.367 TNNetFullConnectLinear 10,1,1 Times: 0.09s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.516 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Starting Testing.\n", + "Epochs: 20 Examples seen:800000 Test Accuracy: 0.8013 Test Error: 0.5539 Test Loss: 0.5934 Total time: 70.75min\n", + "Epoch time: 2.2958 minutes. 50 epochs: 1.9132 hours.\n", + "Epochs: 20. Working time: 1.18 hours.\n", + "Learning rate set to: 0.00082\n", + "800640 Examples seen. Accuracy: 0.7448 Error: 0.56606 Loss: 0.50623 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "801280 Examples seen. Accuracy: 0.7453 Error: 0.72370 Loss: 0.81853 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "801920 Examples seen. Accuracy: 0.7459 Error: 0.57313 Loss: 0.66880 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "802560 Examples seen. Accuracy: 0.7459 Error: 0.63857 Loss: 0.60604 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "803200 Examples seen. Accuracy: 0.7475 Error: 0.61641 Loss: 0.61390 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.24s\n", + "803840 Examples seen. Accuracy: 0.7492 Error: 0.86898 Loss: 0.98058 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "804480 Examples seen. Accuracy: 0.7520 Error: 0.62232 Loss: 0.57860 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "805120 Examples seen. Accuracy: 0.7525 Error: 0.77007 Loss: 0.91639 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "805760 Examples seen. Accuracy: 0.7515 Error: 0.67737 Loss: 0.82705 Threads: 2 Forward time: 0.74s Backward time: 0.39s Step time: 2.23s\n", + "806400 Examples seen. Accuracy: 0.7509 Error: 0.81284 Loss: 0.75538 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.22s\n", + "807040 Examples seen. Accuracy: 0.7486 Error: 0.61276 Loss: 0.64802 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "807680 Examples seen. Accuracy: 0.7480 Error: 0.68058 Loss: 0.72430 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.24s\n", + "808320 Examples seen. Accuracy: 0.7502 Error: 0.65153 Loss: 0.64450 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "808960 Examples seen. Accuracy: 0.7508 Error: 0.65606 Loss: 0.71989 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.24s\n", + "809600 Examples seen. Accuracy: 0.7550 Error: 0.62511 Loss: 0.60859 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.22s\n", + "810240 Examples seen. Accuracy: 0.7537 Error: 0.64786 Loss: 0.67271 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "810880 Examples seen. Accuracy: 0.7511 Error: 0.67705 Loss: 0.60278 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "811520 Examples seen. Accuracy: 0.7523 Error: 0.79713 Loss: 0.78049 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "812160 Examples seen. Accuracy: 0.7558 Error: 0.59967 Loss: 0.54886 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "812800 Examples seen. Accuracy: 0.7569 Error: 0.58744 Loss: 0.64642 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.24s\n", + "813440 Examples seen. Accuracy: 0.7575 Error: 0.67909 Loss: 0.75188 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "814080 Examples seen. Accuracy: 0.7554 Error: 0.81473 Loss: 0.84896 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "814720 Examples seen. Accuracy: 0.7544 Error: 0.73934 Loss: 0.79863 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "815360 Examples seen. Accuracy: 0.7540 Error: 0.93307 Loss: 1.13414 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "816000 Examples seen. Accuracy: 0.7537 Error: 0.60772 Loss: 0.59638 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "816640 Examples seen. Accuracy: 0.7554 Error: 0.75697 Loss: 0.76513 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "817280 Examples seen. Accuracy: 0.7552 Error: 0.55212 Loss: 0.52262 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "817920 Examples seen. Accuracy: 0.7555 Error: 0.61158 Loss: 0.72845 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "818560 Examples seen. Accuracy: 0.7573 Error: 0.49725 Loss: 0.40735 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "819200 Examples seen. Accuracy: 0.7544 Error: 0.78351 Loss: 1.09500 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "819840 Examples seen. Accuracy: 0.7531 Error: 0.64963 Loss: 0.63236 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "820480 Examples seen. Accuracy: 0.7546 Error: 0.57888 Loss: 0.58468 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "821120 Examples seen. Accuracy: 0.7551 Error: 0.54723 Loss: 0.48716 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.23s\n", + "821760 Examples seen. Accuracy: 0.7554 Error: 0.53311 Loss: 0.54511 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "822400 Examples seen. Accuracy: 0.7543 Error: 0.60341 Loss: 0.56932 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.24s\n", + "823040 Examples seen. Accuracy: 0.7549 Error: 0.49616 Loss: 0.51366 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "823680 Examples seen. Accuracy: 0.7560 Error: 0.62031 Loss: 0.62986 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.26s\n", + "824320 Examples seen. Accuracy: 0.7533 Error: 0.69185 Loss: 0.68029 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "824960 Examples seen. Accuracy: 0.7543 Error: 0.70609 Loss: 0.66464 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "825600 Examples seen. Accuracy: 0.7540 Error: 0.65769 Loss: 0.82841 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "826240 Examples seen. Accuracy: 0.7518 Error: 0.63986 Loss: 0.64525 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.21s\n", + "826880 Examples seen. Accuracy: 0.7494 Error: 0.67326 Loss: 0.58677 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "827520 Examples seen. Accuracy: 0.7511 Error: 0.52688 Loss: 0.51957 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.33s\n", + "828160 Examples seen. Accuracy: 0.7533 Error: 0.58051 Loss: 0.56901 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.29s\n", + "828800 Examples seen. Accuracy: 0.7556 Error: 0.63636 Loss: 0.65161 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.29s\n", + "829440 Examples seen. Accuracy: 0.7538 Error: 0.66025 Loss: 0.85604 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "830080 Examples seen. Accuracy: 0.7551 Error: 0.79278 Loss: 1.02157 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "830720 Examples seen. Accuracy: 0.7563 Error: 0.68761 Loss: 0.75865 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "831360 Examples seen. Accuracy: 0.7571 Error: 0.65424 Loss: 0.65767 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.26s\n", + "832000 Examples seen. Accuracy: 0.7590 Error: 0.63025 Loss: 0.66050 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "832640 Examples seen. Accuracy: 0.7593 Error: 0.61213 Loss: 0.50304 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.30s\n", + "833280 Examples seen. Accuracy: 0.7588 Error: 0.64925 Loss: 0.70691 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "833920 Examples seen. Accuracy: 0.7607 Error: 0.50550 Loss: 0.50764 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.26s\n", + "834560 Examples seen. Accuracy: 0.7636 Error: 0.56939 Loss: 0.61559 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "835200 Examples seen. Accuracy: 0.7640 Error: 0.68163 Loss: 0.73794 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "835840 Examples seen. Accuracy: 0.7617 Error: 0.56446 Loss: 0.49256 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "836480 Examples seen. Accuracy: 0.7610 Error: 0.45381 Loss: 0.46240 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "837120 Examples seen. Accuracy: 0.7619 Error: 0.70312 Loss: 0.67412 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.26s\n", + "837760 Examples seen. Accuracy: 0.7603 Error: 0.77383 Loss: 0.94565 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "838400 Examples seen. Accuracy: 0.7591 Error: 0.66987 Loss: 0.74576 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.28s\n", + "839040 Examples seen. Accuracy: 0.7629 Error: 0.61075 Loss: 0.65921 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "839680 Examples seen. Accuracy: 0.7620 Error: 0.69317 Loss: 0.61748 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 21 Examples seen:840000 Validation Accuracy: 0.8097 Validation Error: 0.5327 Validation Loss: 0.5571 Total time: 74.13min\n", + "Epoch time: 2.3708 minutes. 50 epochs: 1.9757 hours.\n", + "Epochs: 21. Working time: 1.24 hours.\n", + "840640 Examples seen. Accuracy: 0.7609 Error: 0.72953 Loss: 0.84903 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "841280 Examples seen. Accuracy: 0.7612 Error: 0.61724 Loss: 0.65749 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "841920 Examples seen. Accuracy: 0.7595 Error: 0.52275 Loss: 0.54513 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "842560 Examples seen. Accuracy: 0.7601 Error: 0.56696 Loss: 0.56311 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.20s\n", + "843200 Examples seen. Accuracy: 0.7622 Error: 0.55077 Loss: 0.56713 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.23s\n", + "843840 Examples seen. Accuracy: 0.7624 Error: 0.64739 Loss: 0.69727 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.27s\n", + "844480 Examples seen. Accuracy: 0.7651 Error: 0.54495 Loss: 0.52471 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "845120 Examples seen. Accuracy: 0.7658 Error: 0.65810 Loss: 0.70731 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "845760 Examples seen. Accuracy: 0.7644 Error: 0.63726 Loss: 0.75203 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.19s\n", + "846400 Examples seen. Accuracy: 0.7652 Error: 0.63342 Loss: 0.59298 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "847040 Examples seen. Accuracy: 0.7641 Error: 0.70474 Loss: 0.75692 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "847680 Examples seen. Accuracy: 0.7647 Error: 0.63419 Loss: 0.79271 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "848320 Examples seen. Accuracy: 0.7627 Error: 0.55451 Loss: 0.55208 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.20s\n", + "848960 Examples seen. Accuracy: 0.7630 Error: 0.67070 Loss: 0.67164 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.20s\n", + "849600 Examples seen. Accuracy: 0.7637 Error: 0.59235 Loss: 0.64690 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.23s\n", + "850240 Examples seen. Accuracy: 0.7632 Error: 0.60878 Loss: 0.65336 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "850880 Examples seen. Accuracy: 0.7654 Error: 0.58023 Loss: 0.57833 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.21s\n", + "851520 Examples seen. Accuracy: 0.7643 Error: 0.65215 Loss: 0.66417 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "852160 Examples seen. Accuracy: 0.7641 Error: 0.68292 Loss: 0.74290 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "852800 Examples seen. Accuracy: 0.7626 Error: 0.66856 Loss: 0.66561 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "853440 Examples seen. Accuracy: 0.7642 Error: 0.51266 Loss: 0.45862 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.20s\n", + "854080 Examples seen. Accuracy: 0.7679 Error: 0.42405 Loss: 0.36937 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.22s\n", + "854720 Examples seen. Accuracy: 0.7684 Error: 0.70337 Loss: 0.78857 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "855360 Examples seen. Accuracy: 0.7680 Error: 0.55240 Loss: 0.60555 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.22s\n", + "856000 Examples seen. Accuracy: 0.7691 Error: 0.42695 Loss: 0.40510 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "856640 Examples seen. Accuracy: 0.7694 Error: 0.57832 Loss: 0.55287 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "857280 Examples seen. Accuracy: 0.7688 Error: 0.49576 Loss: 0.53500 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "857920 Examples seen. Accuracy: 0.7704 Error: 0.58619 Loss: 0.66270 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "858560 Examples seen. Accuracy: 0.7660 Error: 0.80197 Loss: 0.89805 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.27s\n", + "859200 Examples seen. Accuracy: 0.7656 Error: 0.53251 Loss: 0.54430 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "859840 Examples seen. Accuracy: 0.7659 Error: 0.64836 Loss: 0.68676 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.24s\n", + "860480 Examples seen. Accuracy: 0.7652 Error: 0.73756 Loss: 0.84799 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.24s\n", + "861120 Examples seen. Accuracy: 0.7666 Error: 0.51154 Loss: 0.49277 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "861760 Examples seen. Accuracy: 0.7685 Error: 0.68393 Loss: 0.84150 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "862400 Examples seen. Accuracy: 0.7666 Error: 0.69975 Loss: 0.71118 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "863040 Examples seen. Accuracy: 0.7633 Error: 0.70401 Loss: 0.70415 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.24s\n", + "863680 Examples seen. Accuracy: 0.7626 Error: 0.60714 Loss: 0.61289 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "864320 Examples seen. Accuracy: 0.7633 Error: 0.53959 Loss: 0.51367 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "864960 Examples seen. Accuracy: 0.7659 Error: 0.50350 Loss: 0.42101 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.24s\n", + "865600 Examples seen. Accuracy: 0.7650 Error: 0.53901 Loss: 0.59758 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "866240 Examples seen. Accuracy: 0.7625 Error: 0.58498 Loss: 0.60520 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "866880 Examples seen. Accuracy: 0.7600 Error: 0.62461 Loss: 0.67415 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "867520 Examples seen. Accuracy: 0.7598 Error: 0.65988 Loss: 0.70631 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "868160 Examples seen. Accuracy: 0.7582 Error: 0.66637 Loss: 0.70468 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.25s\n", + "868800 Examples seen. Accuracy: 0.7590 Error: 0.46321 Loss: 0.39767 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "869440 Examples seen. Accuracy: 0.7602 Error: 0.58933 Loss: 0.70036 Threads: 2 Forward time: 0.68s Backward time: 0.48s Step time: 2.28s\n", + "870080 Examples seen. Accuracy: 0.7578 Error: 0.78121 Loss: 0.77866 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.29s\n", + "870720 Examples seen. Accuracy: 0.7576 Error: 0.71789 Loss: 0.77415 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.23s\n", + "871360 Examples seen. Accuracy: 0.7593 Error: 0.62096 Loss: 0.62593 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "872000 Examples seen. Accuracy: 0.7599 Error: 0.60113 Loss: 0.58314 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "872640 Examples seen. Accuracy: 0.7619 Error: 0.43913 Loss: 0.46621 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.21s\n", + "873280 Examples seen. Accuracy: 0.7641 Error: 0.56613 Loss: 0.55002 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "873920 Examples seen. Accuracy: 0.7632 Error: 0.69879 Loss: 0.73606 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "874560 Examples seen. Accuracy: 0.7616 Error: 0.70013 Loss: 0.71432 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "875200 Examples seen. Accuracy: 0.7610 Error: 0.63077 Loss: 0.67407 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.26s\n", + "875840 Examples seen. Accuracy: 0.7606 Error: 0.64920 Loss: 0.66473 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.22s\n", + "876480 Examples seen. Accuracy: 0.7618 Error: 0.41814 Loss: 0.36967 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "877120 Examples seen. Accuracy: 0.7637 Error: 0.58875 Loss: 0.60159 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "877760 Examples seen. Accuracy: 0.7614 Error: 0.69495 Loss: 0.73337 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "878400 Examples seen. Accuracy: 0.7621 Error: 0.60607 Loss: 0.55744 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "879040 Examples seen. Accuracy: 0.7611 Error: 0.71082 Loss: 0.75437 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.26s\n", + "879680 Examples seen. Accuracy: 0.7615 Error: 0.72526 Loss: 0.85939 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 22 Examples seen:880000 Validation Accuracy: 0.8126 Validation Error: 0.5260 Validation Loss: 0.5505 Total time: 77.50min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.441 Min Weight: -0.510 Max Output: 4.299 Min Output: -5.128 TNNetConvolutionLinear 32,32,64 Times: 30.10s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.299 Min Output: -0.959 TNNetMaxPool 8,8,64 Times: 6.76s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.781 Min Weight: 0.729 Max Output: 4.828 Min Output: -2.386 TNNetMovingStdNormalization 8,8,64 Times: 0.16s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.255 Min Weight: -0.251 Max Output: 9.461 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.15s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.256 Min Weight: -0.214 Max Output: 7.115 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.04s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.248 Min Weight: -0.210 Max Output: 4.378 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.96s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.221 Min Weight: -0.208 Max Output: 2.159 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.28s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.159 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.159 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.42s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.313 Min Weight: -0.260 Max Output: 4.730 Min Output: -7.825 TNNetFullConnectLinear 10,1,1 Times: 0.10s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.516 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3354 minutes. 50 epochs: 1.9462 hours.\n", + "Epochs: 22. Working time: 1.29 hours.\n", + "880640 Examples seen. Accuracy: 0.7616 Error: 0.70495 Loss: 0.71932 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "881280 Examples seen. Accuracy: 0.7627 Error: 0.58435 Loss: 0.59232 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.21s\n", + "881920 Examples seen. Accuracy: 0.7646 Error: 0.63736 Loss: 0.61695 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.24s\n", + "882560 Examples seen. Accuracy: 0.7666 Error: 0.69517 Loss: 0.82518 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.30s\n", + "883200 Examples seen. Accuracy: 0.7698 Error: 0.52459 Loss: 0.50734 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "883840 Examples seen. Accuracy: 0.7706 Error: 0.58612 Loss: 0.73621 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.25s\n", + "884480 Examples seen. Accuracy: 0.7688 Error: 0.62014 Loss: 0.61913 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.25s\n", + "885120 Examples seen. Accuracy: 0.7668 Error: 0.83532 Loss: 0.90624 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "885760 Examples seen. Accuracy: 0.7693 Error: 0.47510 Loss: 0.47659 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.23s\n", + "886400 Examples seen. Accuracy: 0.7681 Error: 0.64918 Loss: 0.67379 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "887040 Examples seen. Accuracy: 0.7677 Error: 0.70544 Loss: 0.72988 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "887680 Examples seen. Accuracy: 0.7676 Error: 0.63556 Loss: 0.62112 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.26s\n", + "888320 Examples seen. Accuracy: 0.7686 Error: 0.55302 Loss: 0.61195 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "888960 Examples seen. Accuracy: 0.7734 Error: 0.49023 Loss: 0.48141 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.21s\n", + "889600 Examples seen. Accuracy: 0.7726 Error: 0.59947 Loss: 0.57789 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "890240 Examples seen. Accuracy: 0.7712 Error: 0.57190 Loss: 0.65621 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.23s\n", + "890880 Examples seen. Accuracy: 0.7698 Error: 0.77545 Loss: 0.84368 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "891520 Examples seen. Accuracy: 0.7688 Error: 0.77536 Loss: 0.80531 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "892160 Examples seen. Accuracy: 0.7683 Error: 0.75775 Loss: 0.69213 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "892800 Examples seen. Accuracy: 0.7686 Error: 0.61012 Loss: 0.61801 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "893440 Examples seen. Accuracy: 0.7683 Error: 0.65555 Loss: 0.69638 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "894080 Examples seen. Accuracy: 0.7677 Error: 0.68020 Loss: 0.74392 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.23s\n", + "894720 Examples seen. Accuracy: 0.7677 Error: 0.56300 Loss: 0.54726 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.22s\n", + "895360 Examples seen. Accuracy: 0.7655 Error: 0.66284 Loss: 0.71666 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "896000 Examples seen. Accuracy: 0.7666 Error: 0.59861 Loss: 0.65441 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.27s\n", + "896640 Examples seen. Accuracy: 0.7691 Error: 0.60854 Loss: 0.65854 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "897280 Examples seen. Accuracy: 0.7717 Error: 0.55297 Loss: 0.65215 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "897920 Examples seen. Accuracy: 0.7705 Error: 0.61866 Loss: 0.55535 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.20s\n", + "898560 Examples seen. Accuracy: 0.7709 Error: 0.62805 Loss: 0.80791 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.23s\n", + "899200 Examples seen. Accuracy: 0.7720 Error: 0.52441 Loss: 0.54705 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.21s\n", + "899840 Examples seen. Accuracy: 0.7671 Error: 0.64295 Loss: 0.69646 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "900480 Examples seen. Accuracy: 0.7668 Error: 0.70933 Loss: 0.69101 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.21s\n", + "901120 Examples seen. Accuracy: 0.7660 Error: 0.54374 Loss: 0.55234 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "901760 Examples seen. Accuracy: 0.7655 Error: 0.67515 Loss: 0.88840 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.29s\n", + "902400 Examples seen. Accuracy: 0.7678 Error: 0.61994 Loss: 0.62292 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "903040 Examples seen. Accuracy: 0.7664 Error: 0.59015 Loss: 0.57289 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.21s\n", + "903680 Examples seen. Accuracy: 0.7645 Error: 0.47992 Loss: 0.53261 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "904320 Examples seen. Accuracy: 0.7636 Error: 0.68922 Loss: 0.68339 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "904960 Examples seen. Accuracy: 0.7646 Error: 0.63338 Loss: 0.75119 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "905600 Examples seen. Accuracy: 0.7651 Error: 0.66149 Loss: 0.73324 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.18s\n", + "906240 Examples seen. Accuracy: 0.7634 Error: 0.59867 Loss: 0.57170 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "906880 Examples seen. Accuracy: 0.7621 Error: 0.62026 Loss: 0.66378 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.19s\n", + "907520 Examples seen. Accuracy: 0.7601 Error: 0.70996 Loss: 0.74844 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.18s\n", + "908160 Examples seen. Accuracy: 0.7617 Error: 0.59622 Loss: 0.68635 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.20s\n", + "908800 Examples seen. Accuracy: 0.7638 Error: 0.56440 Loss: 0.56130 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "909440 Examples seen. Accuracy: 0.7652 Error: 0.70686 Loss: 0.86884 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.21s\n", + "910080 Examples seen. Accuracy: 0.7644 Error: 0.64908 Loss: 0.68787 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "910720 Examples seen. Accuracy: 0.7647 Error: 0.65176 Loss: 0.61152 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.27s\n", + "911360 Examples seen. Accuracy: 0.7646 Error: 0.69344 Loss: 0.64317 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "912000 Examples seen. Accuracy: 0.7650 Error: 0.37225 Loss: 0.37295 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.30s\n", + "912640 Examples seen. Accuracy: 0.7651 Error: 0.58135 Loss: 0.66954 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.31s\n", + "913280 Examples seen. Accuracy: 0.7654 Error: 0.70493 Loss: 0.76048 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "913920 Examples seen. Accuracy: 0.7657 Error: 0.67307 Loss: 0.69807 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "914560 Examples seen. Accuracy: 0.7661 Error: 0.66885 Loss: 0.66073 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.26s\n", + "915200 Examples seen. Accuracy: 0.7654 Error: 0.47722 Loss: 0.42466 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "915840 Examples seen. Accuracy: 0.7657 Error: 0.62885 Loss: 0.61189 Threads: 2 Forward time: 0.65s Backward time: 0.42s Step time: 2.26s\n", + "916480 Examples seen. Accuracy: 0.7660 Error: 0.54882 Loss: 0.65040 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.27s\n", + "917120 Examples seen. Accuracy: 0.7649 Error: 0.60900 Loss: 0.63533 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "917760 Examples seen. Accuracy: 0.7646 Error: 0.59868 Loss: 0.59406 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.28s\n", + "918400 Examples seen. Accuracy: 0.7659 Error: 0.67289 Loss: 0.87526 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "919040 Examples seen. Accuracy: 0.7654 Error: 0.61307 Loss: 0.59825 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "919680 Examples seen. Accuracy: 0.7633 Error: 0.65447 Loss: 0.66826 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 23 Examples seen:920000 Validation Accuracy: 0.8147 Validation Error: 0.5183 Validation Loss: 0.5426 Total time: 80.88min\n", + "Epoch time: 2.3604 minutes. 50 epochs: 1.9670 hours.\n", + "Epochs: 23. Working time: 1.35 hours.\n", + "920640 Examples seen. Accuracy: 0.7626 Error: 0.78481 Loss: 0.78438 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "921280 Examples seen. Accuracy: 0.7612 Error: 0.72489 Loss: 0.77208 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "921920 Examples seen. Accuracy: 0.7588 Error: 0.58095 Loss: 0.60434 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.23s\n", + "922560 Examples seen. Accuracy: 0.7584 Error: 0.63413 Loss: 0.59732 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.23s\n", + "923200 Examples seen. Accuracy: 0.7612 Error: 0.49784 Loss: 0.38789 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "923840 Examples seen. Accuracy: 0.7611 Error: 0.70160 Loss: 0.72378 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "924480 Examples seen. Accuracy: 0.7591 Error: 0.75117 Loss: 0.80583 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "925120 Examples seen. Accuracy: 0.7617 Error: 0.50915 Loss: 0.49582 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.22s\n", + "925760 Examples seen. Accuracy: 0.7642 Error: 0.48395 Loss: 0.47056 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "926400 Examples seen. Accuracy: 0.7638 Error: 0.67441 Loss: 0.66033 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.25s\n", + "927040 Examples seen. Accuracy: 0.7636 Error: 0.66216 Loss: 0.98904 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "927680 Examples seen. Accuracy: 0.7623 Error: 0.57194 Loss: 0.61443 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.20s\n", + "928320 Examples seen. Accuracy: 0.7651 Error: 0.73074 Loss: 0.82002 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.20s\n", + "928960 Examples seen. Accuracy: 0.7663 Error: 0.57718 Loss: 0.68986 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "929600 Examples seen. Accuracy: 0.7704 Error: 0.59988 Loss: 0.67087 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "930240 Examples seen. Accuracy: 0.7699 Error: 0.62665 Loss: 0.75354 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "930880 Examples seen. Accuracy: 0.7684 Error: 0.61280 Loss: 0.74570 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "931520 Examples seen. Accuracy: 0.7675 Error: 0.78237 Loss: 0.87719 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "932160 Examples seen. Accuracy: 0.7659 Error: 0.65755 Loss: 0.69774 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "932800 Examples seen. Accuracy: 0.7632 Error: 0.71988 Loss: 0.76520 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "933440 Examples seen. Accuracy: 0.7617 Error: 0.74322 Loss: 0.80149 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.20s\n", + "934080 Examples seen. Accuracy: 0.7601 Error: 0.71708 Loss: 0.80695 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.19s\n", + "934720 Examples seen. Accuracy: 0.7627 Error: 0.81305 Loss: 0.76823 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "935360 Examples seen. Accuracy: 0.7627 Error: 0.63169 Loss: 0.76535 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "936000 Examples seen. Accuracy: 0.7626 Error: 0.59959 Loss: 0.64671 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.19s\n", + "936640 Examples seen. Accuracy: 0.7649 Error: 0.70246 Loss: 0.92566 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "937280 Examples seen. Accuracy: 0.7644 Error: 0.64844 Loss: 0.76428 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "937920 Examples seen. Accuracy: 0.7641 Error: 0.74687 Loss: 0.80044 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "938560 Examples seen. Accuracy: 0.7627 Error: 0.49691 Loss: 0.50920 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "939200 Examples seen. Accuracy: 0.7643 Error: 0.57989 Loss: 0.55219 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "939840 Examples seen. Accuracy: 0.7631 Error: 0.57539 Loss: 0.58670 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "940480 Examples seen. Accuracy: 0.7638 Error: 0.66974 Loss: 0.65169 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "941120 Examples seen. Accuracy: 0.7654 Error: 0.55228 Loss: 0.52621 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.19s\n", + "941760 Examples seen. Accuracy: 0.7616 Error: 0.60407 Loss: 0.73886 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.19s\n", + "942400 Examples seen. Accuracy: 0.7607 Error: 0.53183 Loss: 0.52798 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.18s\n", + "943040 Examples seen. Accuracy: 0.7606 Error: 0.50802 Loss: 0.48818 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "943680 Examples seen. Accuracy: 0.7625 Error: 0.56380 Loss: 0.49372 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "944320 Examples seen. Accuracy: 0.7629 Error: 0.56329 Loss: 0.59625 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.23s\n", + "944960 Examples seen. Accuracy: 0.7634 Error: 0.59402 Loss: 0.53200 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "945600 Examples seen. Accuracy: 0.7626 Error: 0.66829 Loss: 0.93153 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "946240 Examples seen. Accuracy: 0.7628 Error: 0.67695 Loss: 0.79435 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.25s\n", + "946880 Examples seen. Accuracy: 0.7625 Error: 0.59058 Loss: 0.63089 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "947520 Examples seen. Accuracy: 0.7593 Error: 0.68078 Loss: 0.83672 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.25s\n", + "948160 Examples seen. Accuracy: 0.7591 Error: 0.71990 Loss: 0.88984 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "948800 Examples seen. Accuracy: 0.7603 Error: 0.62395 Loss: 0.65760 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "949440 Examples seen. Accuracy: 0.7612 Error: 0.60551 Loss: 0.59695 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "950080 Examples seen. Accuracy: 0.7627 Error: 0.57479 Loss: 0.48827 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "950720 Examples seen. Accuracy: 0.7664 Error: 0.62581 Loss: 0.58703 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "951360 Examples seen. Accuracy: 0.7671 Error: 0.68239 Loss: 0.85353 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "952000 Examples seen. Accuracy: 0.7650 Error: 0.63266 Loss: 0.69446 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "952640 Examples seen. Accuracy: 0.7645 Error: 0.58067 Loss: 0.57198 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "953280 Examples seen. Accuracy: 0.7659 Error: 0.61572 Loss: 0.65453 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.20s\n", + "953920 Examples seen. Accuracy: 0.7650 Error: 0.70056 Loss: 0.76925 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "954560 Examples seen. Accuracy: 0.7624 Error: 0.75395 Loss: 0.83920 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.23s\n", + "955200 Examples seen. Accuracy: 0.7618 Error: 0.67570 Loss: 0.60460 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "955840 Examples seen. Accuracy: 0.7629 Error: 0.60492 Loss: 0.68417 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "956480 Examples seen. Accuracy: 0.7619 Error: 0.62038 Loss: 0.68500 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "957120 Examples seen. Accuracy: 0.7623 Error: 0.53159 Loss: 0.57759 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "957760 Examples seen. Accuracy: 0.7647 Error: 0.59932 Loss: 0.68073 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "958400 Examples seen. Accuracy: 0.7653 Error: 0.61748 Loss: 0.67631 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "959040 Examples seen. Accuracy: 0.7668 Error: 0.61338 Loss: 0.63171 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "959680 Examples seen. Accuracy: 0.7666 Error: 0.71023 Loss: 0.64759 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.21s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 24 Examples seen:960000 Validation Accuracy: 0.8167 Validation Error: 0.5124 Validation Loss: 0.5361 Total time: 84.24min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.460 Min Weight: -0.523 Max Output: 4.429 Min Output: -5.275 TNNetConvolutionLinear 32,32,64 Times: 30.14s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.429 Min Output: -1.008 TNNetMaxPool 8,8,64 Times: 6.90s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.793 Min Weight: 0.744 Max Output: 4.890 Min Output: -2.421 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.260 Min Weight: -0.261 Max Output: 9.584 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.22s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.266 Min Weight: -0.227 Max Output: 7.572 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.97s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.251 Min Weight: -0.213 Max Output: 4.910 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.224 Min Weight: -0.214 Max Output: 2.148 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.08s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.148 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.148 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.39s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.327 Min Weight: -0.266 Max Output: 4.651 Min Output: -7.718 TNNetFullConnectLinear 10,1,1 Times: 0.11s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.598 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3042 minutes. 50 epochs: 1.9201 hours.\n", + "Epochs: 24. Working time: 1.40 hours.\n", + "960640 Examples seen. Accuracy: 0.7657 Error: 0.70273 Loss: 0.80831 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "961280 Examples seen. Accuracy: 0.7667 Error: 0.60021 Loss: 0.61620 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.24s\n", + "961920 Examples seen. Accuracy: 0.7683 Error: 0.64095 Loss: 0.56290 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "962560 Examples seen. Accuracy: 0.7727 Error: 0.56868 Loss: 0.57817 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.31s\n", + "963200 Examples seen. Accuracy: 0.7745 Error: 0.51835 Loss: 0.49585 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.32s\n", + "963840 Examples seen. Accuracy: 0.7743 Error: 0.59188 Loss: 0.58959 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.26s\n", + "964480 Examples seen. Accuracy: 0.7725 Error: 0.58623 Loss: 0.59809 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "965120 Examples seen. Accuracy: 0.7712 Error: 0.68913 Loss: 0.72315 Threads: 2 Forward time: 0.74s Backward time: 0.38s Step time: 2.30s\n", + "965760 Examples seen. Accuracy: 0.7700 Error: 0.61661 Loss: 0.57838 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "966400 Examples seen. Accuracy: 0.7672 Error: 0.63911 Loss: 0.66763 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "967040 Examples seen. Accuracy: 0.7685 Error: 0.57004 Loss: 0.49748 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "967680 Examples seen. Accuracy: 0.7678 Error: 0.72484 Loss: 0.78594 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "968320 Examples seen. Accuracy: 0.7701 Error: 0.56807 Loss: 0.68791 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "968960 Examples seen. Accuracy: 0.7691 Error: 0.75824 Loss: 0.82020 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.32s\n", + "969600 Examples seen. Accuracy: 0.7684 Error: 0.69889 Loss: 0.73781 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "970240 Examples seen. Accuracy: 0.7676 Error: 0.69246 Loss: 0.94826 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.28s\n", + "970880 Examples seen. Accuracy: 0.7682 Error: 0.58095 Loss: 0.57332 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "971520 Examples seen. Accuracy: 0.7706 Error: 0.64592 Loss: 0.65757 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.26s\n", + "972160 Examples seen. Accuracy: 0.7671 Error: 0.66143 Loss: 0.75760 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.31s\n", + "972800 Examples seen. Accuracy: 0.7697 Error: 0.51329 Loss: 0.44416 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "973440 Examples seen. Accuracy: 0.7685 Error: 0.69100 Loss: 0.74069 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "974080 Examples seen. Accuracy: 0.7700 Error: 0.69336 Loss: 0.73041 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.26s\n", + "974720 Examples seen. Accuracy: 0.7714 Error: 0.47448 Loss: 0.49251 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "975360 Examples seen. Accuracy: 0.7723 Error: 0.57293 Loss: 0.64274 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "976000 Examples seen. Accuracy: 0.7713 Error: 0.71009 Loss: 0.77041 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "976640 Examples seen. Accuracy: 0.7694 Error: 0.71366 Loss: 0.67575 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "977280 Examples seen. Accuracy: 0.7708 Error: 0.53794 Loss: 0.54916 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.28s\n", + "977920 Examples seen. Accuracy: 0.7695 Error: 0.64693 Loss: 0.66017 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "978560 Examples seen. Accuracy: 0.7718 Error: 0.43777 Loss: 0.36920 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "979200 Examples seen. Accuracy: 0.7714 Error: 0.66631 Loss: 0.68272 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "979840 Examples seen. Accuracy: 0.7718 Error: 0.58005 Loss: 0.49689 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.32s\n", + "980480 Examples seen. Accuracy: 0.7713 Error: 0.65780 Loss: 0.79107 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.28s\n", + "981120 Examples seen. Accuracy: 0.7702 Error: 0.64567 Loss: 0.58171 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "981760 Examples seen. Accuracy: 0.7682 Error: 0.62929 Loss: 0.62051 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.29s\n", + "982400 Examples seen. Accuracy: 0.7653 Error: 0.70469 Loss: 0.69541 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "983040 Examples seen. Accuracy: 0.7682 Error: 0.52602 Loss: 0.54752 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "983680 Examples seen. Accuracy: 0.7684 Error: 0.62584 Loss: 0.60070 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "984320 Examples seen. Accuracy: 0.7680 Error: 0.56376 Loss: 0.58440 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "984960 Examples seen. Accuracy: 0.7683 Error: 0.56790 Loss: 0.62742 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "985600 Examples seen. Accuracy: 0.7720 Error: 0.54144 Loss: 0.51544 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "986240 Examples seen. Accuracy: 0.7700 Error: 0.62772 Loss: 0.58497 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "986880 Examples seen. Accuracy: 0.7704 Error: 0.65513 Loss: 0.65407 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "987520 Examples seen. Accuracy: 0.7701 Error: 0.74454 Loss: 0.73883 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "988160 Examples seen. Accuracy: 0.7677 Error: 0.57897 Loss: 0.58275 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.25s\n", + "988800 Examples seen. Accuracy: 0.7646 Error: 0.64738 Loss: 0.74001 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "989440 Examples seen. Accuracy: 0.7646 Error: 0.52954 Loss: 0.51862 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "990080 Examples seen. Accuracy: 0.7664 Error: 0.65639 Loss: 0.74434 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "990720 Examples seen. Accuracy: 0.7667 Error: 0.69605 Loss: 0.67447 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "991360 Examples seen. Accuracy: 0.7662 Error: 0.43483 Loss: 0.40303 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.30s\n", + "992000 Examples seen. Accuracy: 0.7678 Error: 0.54224 Loss: 0.65796 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "992640 Examples seen. Accuracy: 0.7669 Error: 0.54514 Loss: 0.45177 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "993280 Examples seen. Accuracy: 0.7679 Error: 0.48085 Loss: 0.41279 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "993920 Examples seen. Accuracy: 0.7693 Error: 0.60838 Loss: 0.58196 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.30s\n", + "994560 Examples seen. Accuracy: 0.7683 Error: 0.65785 Loss: 0.67545 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "995200 Examples seen. Accuracy: 0.7667 Error: 0.71601 Loss: 0.95200 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "995840 Examples seen. Accuracy: 0.7659 Error: 0.46075 Loss: 0.53384 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "996480 Examples seen. Accuracy: 0.7647 Error: 0.64373 Loss: 0.66603 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.27s\n", + "997120 Examples seen. Accuracy: 0.7670 Error: 0.47987 Loss: 0.41500 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "997760 Examples seen. Accuracy: 0.7661 Error: 0.65146 Loss: 0.86164 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "998400 Examples seen. Accuracy: 0.7668 Error: 0.71417 Loss: 0.77347 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.22s\n", + "999040 Examples seen. Accuracy: 0.7677 Error: 0.68442 Loss: 0.73742 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "999680 Examples seen. Accuracy: 0.7672 Error: 0.65885 Loss: 0.72615 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.21s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 25 Examples seen:1000000 Validation Accuracy: 0.8196 Validation Error: 0.5070 Validation Loss: 0.5317 Total time: 87.70min\n", + "Epoch time: 2.3000 minutes. 50 epochs: 1.9167 hours.\n", + "Epochs: 25. Working time: 1.46 hours.\n", + "1000640 Examples seen. Accuracy: 0.7688 Error: 0.50471 Loss: 0.54118 Threads: 2 Forward time: 0.75s Backward time: 0.44s Step time: 2.42s\n", + "1001280 Examples seen. Accuracy: 0.7693 Error: 0.56875 Loss: 0.67354 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.38s\n", + "1001920 Examples seen. Accuracy: 0.7695 Error: 0.64580 Loss: 0.75707 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.39s\n", + "1002560 Examples seen. Accuracy: 0.7703 Error: 0.58331 Loss: 0.63422 Threads: 2 Forward time: 0.81s Backward time: 0.52s Step time: 2.68s\n", + "1003200 Examples seen. Accuracy: 0.7725 Error: 0.58280 Loss: 0.57344 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.56s\n", + "1003840 Examples seen. Accuracy: 0.7717 Error: 0.61046 Loss: 0.55886 Threads: 2 Forward time: 0.75s Backward time: 0.48s Step time: 2.46s\n", + "1004480 Examples seen. Accuracy: 0.7694 Error: 0.67385 Loss: 0.69954 Threads: 2 Forward time: 0.77s Backward time: 0.46s Step time: 2.55s\n", + "1005120 Examples seen. Accuracy: 0.7710 Error: 0.68882 Loss: 0.77525 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.48s\n", + "1005760 Examples seen. Accuracy: 0.7730 Error: 0.75051 Loss: 0.71808 Threads: 2 Forward time: 0.75s Backward time: 0.48s Step time: 2.49s\n", + "1006400 Examples seen. Accuracy: 0.7751 Error: 0.63333 Loss: 0.57884 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.38s\n", + "1007040 Examples seen. Accuracy: 0.7750 Error: 0.62630 Loss: 0.63373 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.32s\n", + "1007680 Examples seen. Accuracy: 0.7755 Error: 0.56292 Loss: 0.53358 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1008320 Examples seen. Accuracy: 0.7763 Error: 0.56997 Loss: 0.66576 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.29s\n", + "1008960 Examples seen. Accuracy: 0.7761 Error: 0.65659 Loss: 0.65463 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.36s\n", + "1009600 Examples seen. Accuracy: 0.7736 Error: 0.86289 Loss: 1.00246 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1010240 Examples seen. Accuracy: 0.7730 Error: 0.79183 Loss: 0.89563 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1010880 Examples seen. Accuracy: 0.7741 Error: 0.62224 Loss: 0.60849 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1011520 Examples seen. Accuracy: 0.7764 Error: 0.43606 Loss: 0.39141 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.30s\n", + "1012160 Examples seen. Accuracy: 0.7775 Error: 0.52585 Loss: 0.62578 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "1012800 Examples seen. Accuracy: 0.7778 Error: 0.47595 Loss: 0.52312 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1013440 Examples seen. Accuracy: 0.7758 Error: 0.53799 Loss: 0.52272 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1014080 Examples seen. Accuracy: 0.7744 Error: 0.70497 Loss: 0.73876 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.31s\n", + "1014720 Examples seen. Accuracy: 0.7720 Error: 0.60608 Loss: 0.60127 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.30s\n", + "1015360 Examples seen. Accuracy: 0.7738 Error: 0.59289 Loss: 0.57069 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1016000 Examples seen. Accuracy: 0.7765 Error: 0.65931 Loss: 0.67396 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "1016640 Examples seen. Accuracy: 0.7748 Error: 0.52917 Loss: 0.52974 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1017280 Examples seen. Accuracy: 0.7726 Error: 0.57895 Loss: 0.66118 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.33s\n", + "1017920 Examples seen. Accuracy: 0.7746 Error: 0.59218 Loss: 0.53582 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.31s\n", + "1018560 Examples seen. Accuracy: 0.7740 Error: 0.65360 Loss: 0.79880 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1019200 Examples seen. Accuracy: 0.7732 Error: 0.74896 Loss: 0.77446 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1019840 Examples seen. Accuracy: 0.7746 Error: 0.63692 Loss: 0.66329 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.33s\n", + "1020480 Examples seen. Accuracy: 0.7733 Error: 0.75573 Loss: 0.84755 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.27s\n", + "1021120 Examples seen. Accuracy: 0.7743 Error: 0.62556 Loss: 0.74506 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1021760 Examples seen. Accuracy: 0.7755 Error: 0.61443 Loss: 0.62344 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1022400 Examples seen. Accuracy: 0.7758 Error: 0.64881 Loss: 0.61407 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.27s\n", + "1023040 Examples seen. Accuracy: 0.7751 Error: 0.65149 Loss: 0.60618 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.32s\n", + "1023680 Examples seen. Accuracy: 0.7753 Error: 0.51809 Loss: 0.50181 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.36s\n", + "1024320 Examples seen. Accuracy: 0.7748 Error: 0.56783 Loss: 0.65252 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1024960 Examples seen. Accuracy: 0.7733 Error: 0.60274 Loss: 0.65634 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.29s\n", + "1025600 Examples seen. Accuracy: 0.7739 Error: 0.39914 Loss: 0.39679 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.27s\n", + "1026240 Examples seen. Accuracy: 0.7739 Error: 0.58899 Loss: 0.56146 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1026880 Examples seen. Accuracy: 0.7740 Error: 0.55076 Loss: 0.48777 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.27s\n", + "1027520 Examples seen. Accuracy: 0.7747 Error: 0.47445 Loss: 0.40390 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.32s\n", + "1028160 Examples seen. Accuracy: 0.7746 Error: 0.59906 Loss: 0.68196 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.28s\n", + "1028800 Examples seen. Accuracy: 0.7756 Error: 0.69434 Loss: 0.70890 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.30s\n", + "1029440 Examples seen. Accuracy: 0.7759 Error: 0.56232 Loss: 0.52135 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.30s\n", + "1030080 Examples seen. Accuracy: 0.7753 Error: 0.53703 Loss: 0.63422 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.28s\n", + "1030720 Examples seen. Accuracy: 0.7712 Error: 0.71050 Loss: 0.68311 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1031360 Examples seen. Accuracy: 0.7702 Error: 0.50845 Loss: 0.49508 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1032000 Examples seen. Accuracy: 0.7719 Error: 0.57129 Loss: 0.54442 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.32s\n", + "1032640 Examples seen. Accuracy: 0.7731 Error: 0.51420 Loss: 0.58054 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.27s\n", + "1033280 Examples seen. Accuracy: 0.7716 Error: 0.65478 Loss: 0.70321 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1033920 Examples seen. Accuracy: 0.7732 Error: 0.64772 Loss: 0.71913 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1034560 Examples seen. Accuracy: 0.7710 Error: 0.64653 Loss: 0.81703 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1035200 Examples seen. Accuracy: 0.7697 Error: 0.57000 Loss: 0.57075 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1035840 Examples seen. Accuracy: 0.7712 Error: 0.51778 Loss: 0.54978 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.28s\n", + "1036480 Examples seen. Accuracy: 0.7691 Error: 0.60744 Loss: 0.58942 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1037120 Examples seen. Accuracy: 0.7685 Error: 0.61172 Loss: 0.70803 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1037760 Examples seen. Accuracy: 0.7716 Error: 0.71120 Loss: 0.75807 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1038400 Examples seen. Accuracy: 0.7696 Error: 0.66383 Loss: 0.64999 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.29s\n", + "1039040 Examples seen. Accuracy: 0.7690 Error: 0.57240 Loss: 0.71585 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.30s\n", + "1039680 Examples seen. Accuracy: 0.7689 Error: 0.52712 Loss: 0.50506 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 26 Examples seen:1040000 Validation Accuracy: 0.8223 Validation Error: 0.5000 Validation Loss: 0.5248 Total time: 91.17min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.479 Min Weight: -0.537 Max Output: 4.530 Min Output: -5.373 TNNetConvolutionLinear 32,32,64 Times: 30.29s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.530 Min Output: -1.085 TNNetMaxPool 8,8,64 Times: 6.95s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.807 Min Weight: 0.758 Max Output: 4.911 Min Output: -2.497 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.264 Min Weight: -0.270 Max Output: 9.563 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.29s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.276 Min Weight: -0.240 Max Output: 8.219 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.19s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.254 Min Weight: -0.218 Max Output: 5.593 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.29s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.229 Min Weight: -0.217 Max Output: 2.289 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.26s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.289 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.289 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.36s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.336 Min Weight: -0.270 Max Output: 4.672 Min Output: -7.835 TNNetFullConnectLinear 10,1,1 Times: 0.12s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.546 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3854 minutes. 50 epochs: 1.9878 hours.\n", + "Epochs: 26. Working time: 1.52 hours.\n", + "1040640 Examples seen. Accuracy: 0.7649 Error: 0.61200 Loss: 0.62400 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.25s\n", + "1041280 Examples seen. Accuracy: 0.7622 Error: 0.68391 Loss: 0.72871 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.24s\n", + "1041920 Examples seen. Accuracy: 0.7655 Error: 0.63478 Loss: 0.64761 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1042560 Examples seen. Accuracy: 0.7659 Error: 0.66454 Loss: 0.75863 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1043200 Examples seen. Accuracy: 0.7653 Error: 0.60650 Loss: 0.66562 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1043840 Examples seen. Accuracy: 0.7627 Error: 0.72505 Loss: 0.78411 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.36s\n", + "1044480 Examples seen. Accuracy: 0.7645 Error: 0.64140 Loss: 0.81219 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.32s\n", + "1045120 Examples seen. Accuracy: 0.7675 Error: 0.64084 Loss: 0.69836 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1045760 Examples seen. Accuracy: 0.7689 Error: 0.62481 Loss: 0.72662 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.31s\n", + "1046400 Examples seen. Accuracy: 0.7694 Error: 0.67196 Loss: 0.67580 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.28s\n", + "1047040 Examples seen. Accuracy: 0.7703 Error: 0.66269 Loss: 0.65764 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1047680 Examples seen. Accuracy: 0.7694 Error: 0.54606 Loss: 0.57851 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1048320 Examples seen. Accuracy: 0.7699 Error: 0.70745 Loss: 0.79667 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.31s\n", + "1048960 Examples seen. Accuracy: 0.7696 Error: 0.64145 Loss: 0.65407 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.31s\n", + "1049600 Examples seen. Accuracy: 0.7663 Error: 0.70753 Loss: 0.78658 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.28s\n", + "1050240 Examples seen. Accuracy: 0.7657 Error: 0.60931 Loss: 0.67479 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.34s\n", + "1050880 Examples seen. Accuracy: 0.7672 Error: 0.67088 Loss: 0.63827 Threads: 2 Forward time: 0.73s Backward time: 0.41s Step time: 2.29s\n", + "1051520 Examples seen. Accuracy: 0.7698 Error: 0.69628 Loss: 0.71167 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.30s\n", + "1052160 Examples seen. Accuracy: 0.7720 Error: 0.48660 Loss: 0.50095 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1052800 Examples seen. Accuracy: 0.7718 Error: 0.60956 Loss: 0.64610 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1053440 Examples seen. Accuracy: 0.7746 Error: 0.52746 Loss: 0.59267 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.26s\n", + "1054080 Examples seen. Accuracy: 0.7730 Error: 0.73125 Loss: 0.85383 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1054720 Examples seen. Accuracy: 0.7724 Error: 0.69876 Loss: 0.98279 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "1055360 Examples seen. Accuracy: 0.7750 Error: 0.59749 Loss: 0.68972 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1056000 Examples seen. Accuracy: 0.7741 Error: 0.76533 Loss: 0.89410 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1056640 Examples seen. Accuracy: 0.7721 Error: 0.52455 Loss: 0.53645 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.27s\n", + "1057280 Examples seen. Accuracy: 0.7711 Error: 0.48460 Loss: 0.47489 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1057920 Examples seen. Accuracy: 0.7699 Error: 0.56157 Loss: 0.61863 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.27s\n", + "1058560 Examples seen. Accuracy: 0.7694 Error: 0.59526 Loss: 0.51928 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "1059200 Examples seen. Accuracy: 0.7717 Error: 0.48730 Loss: 0.50844 Threads: 2 Forward time: 0.75s Backward time: 0.42s Step time: 2.30s\n", + "1059840 Examples seen. Accuracy: 0.7747 Error: 0.39828 Loss: 0.36854 Threads: 2 Forward time: 0.72s Backward time: 0.47s Step time: 2.44s\n", + "1060480 Examples seen. Accuracy: 0.7751 Error: 0.38394 Loss: 0.36463 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.42s\n", + "1061120 Examples seen. Accuracy: 0.7746 Error: 0.61423 Loss: 0.63737 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.35s\n", + "1061760 Examples seen. Accuracy: 0.7730 Error: 0.70864 Loss: 0.85128 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.36s\n", + "1062400 Examples seen. Accuracy: 0.7731 Error: 0.59273 Loss: 0.66422 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1063040 Examples seen. Accuracy: 0.7692 Error: 0.65597 Loss: 0.64625 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1063680 Examples seen. Accuracy: 0.7698 Error: 0.59310 Loss: 0.56844 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.28s\n", + "1064320 Examples seen. Accuracy: 0.7716 Error: 0.58413 Loss: 0.58618 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.34s\n", + "1064960 Examples seen. Accuracy: 0.7721 Error: 0.58101 Loss: 0.64491 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1065600 Examples seen. Accuracy: 0.7715 Error: 0.50464 Loss: 0.45315 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.28s\n", + "1066240 Examples seen. Accuracy: 0.7708 Error: 0.74233 Loss: 0.92730 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "1066880 Examples seen. Accuracy: 0.7721 Error: 0.65824 Loss: 0.60421 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.29s\n", + "1067520 Examples seen. Accuracy: 0.7753 Error: 0.48376 Loss: 0.55827 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.28s\n", + "1068160 Examples seen. Accuracy: 0.7757 Error: 0.62353 Loss: 0.57935 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.28s\n", + "1068800 Examples seen. Accuracy: 0.7764 Error: 0.65177 Loss: 0.72553 Threads: 2 Forward time: 0.72s Backward time: 0.45s Step time: 2.34s\n", + "1069440 Examples seen. Accuracy: 0.7733 Error: 0.73725 Loss: 0.83220 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.31s\n", + "1070080 Examples seen. Accuracy: 0.7750 Error: 0.53022 Loss: 0.46710 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1070720 Examples seen. Accuracy: 0.7743 Error: 0.70973 Loss: 0.73441 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1071360 Examples seen. Accuracy: 0.7744 Error: 0.67783 Loss: 0.65465 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1072000 Examples seen. Accuracy: 0.7743 Error: 0.61612 Loss: 0.59149 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1072640 Examples seen. Accuracy: 0.7721 Error: 0.67412 Loss: 0.74065 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1073280 Examples seen. Accuracy: 0.7717 Error: 0.49843 Loss: 0.46644 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1073920 Examples seen. Accuracy: 0.7706 Error: 0.65481 Loss: 0.66091 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "1074560 Examples seen. Accuracy: 0.7706 Error: 0.58088 Loss: 0.72890 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1075200 Examples seen. Accuracy: 0.7712 Error: 0.73258 Loss: 0.95148 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.34s\n", + "1075840 Examples seen. Accuracy: 0.7707 Error: 0.51011 Loss: 0.41506 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.30s\n", + "1076480 Examples seen. Accuracy: 0.7714 Error: 0.64267 Loss: 0.56943 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1077120 Examples seen. Accuracy: 0.7711 Error: 0.65202 Loss: 0.73068 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.27s\n", + "1077760 Examples seen. Accuracy: 0.7723 Error: 0.74949 Loss: 0.75692 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1078400 Examples seen. Accuracy: 0.7741 Error: 0.66644 Loss: 0.67929 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.28s\n", + "1079040 Examples seen. Accuracy: 0.7737 Error: 0.53330 Loss: 0.52250 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1079680 Examples seen. Accuracy: 0.7746 Error: 0.41760 Loss: 0.40439 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 27 Examples seen:1080000 Validation Accuracy: 0.8240 Validation Error: 0.4947 Validation Loss: 0.5198 Total time: 94.61min\n", + "Epoch time: 2.3344 minutes. 50 epochs: 1.9453 hours.\n", + "Epochs: 27. Working time: 1.58 hours.\n", + "1080640 Examples seen. Accuracy: 0.7713 Error: 0.67894 Loss: 0.71084 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1081280 Examples seen. Accuracy: 0.7728 Error: 0.53755 Loss: 0.49426 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1081920 Examples seen. Accuracy: 0.7691 Error: 0.76535 Loss: 0.76414 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "1082560 Examples seen. Accuracy: 0.7683 Error: 0.65598 Loss: 0.66660 Threads: 2 Forward time: 0.75s Backward time: 0.40s Step time: 2.31s\n", + "1083200 Examples seen. Accuracy: 0.7666 Error: 0.47416 Loss: 0.43963 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1083840 Examples seen. Accuracy: 0.7681 Error: 0.63682 Loss: 0.67082 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "1084480 Examples seen. Accuracy: 0.7713 Error: 0.66598 Loss: 0.74358 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1085120 Examples seen. Accuracy: 0.7728 Error: 0.70429 Loss: 0.83385 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.28s\n", + "1085760 Examples seen. Accuracy: 0.7753 Error: 0.63751 Loss: 0.68875 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1086400 Examples seen. Accuracy: 0.7742 Error: 0.51836 Loss: 0.56228 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.29s\n", + "1087040 Examples seen. Accuracy: 0.7775 Error: 0.66556 Loss: 0.64268 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1087680 Examples seen. Accuracy: 0.7738 Error: 0.63449 Loss: 0.68785 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "1088320 Examples seen. Accuracy: 0.7726 Error: 0.59835 Loss: 0.60566 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.27s\n", + "1088960 Examples seen. Accuracy: 0.7729 Error: 0.64772 Loss: 0.66562 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1089600 Examples seen. Accuracy: 0.7735 Error: 0.45638 Loss: 0.42367 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1090240 Examples seen. Accuracy: 0.7745 Error: 0.46694 Loss: 0.51519 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1090880 Examples seen. Accuracy: 0.7757 Error: 0.52814 Loss: 0.54169 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "1091520 Examples seen. Accuracy: 0.7767 Error: 0.48915 Loss: 0.50514 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.31s\n", + "1092160 Examples seen. Accuracy: 0.7759 Error: 0.69754 Loss: 0.81339 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1092800 Examples seen. Accuracy: 0.7739 Error: 0.81196 Loss: 0.88721 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.31s\n", + "1093440 Examples seen. Accuracy: 0.7744 Error: 0.57275 Loss: 0.52925 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1094080 Examples seen. Accuracy: 0.7740 Error: 0.57387 Loss: 0.59219 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.29s\n", + "1094720 Examples seen. Accuracy: 0.7720 Error: 0.61858 Loss: 0.62197 Threads: 2 Forward time: 0.72s Backward time: 0.46s Step time: 2.36s\n", + "1095360 Examples seen. Accuracy: 0.7733 Error: 0.58113 Loss: 0.66460 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.43s\n", + "1096000 Examples seen. Accuracy: 0.7715 Error: 0.55685 Loss: 0.53554 Threads: 2 Forward time: 0.75s Backward time: 0.45s Step time: 2.40s\n", + "1096640 Examples seen. Accuracy: 0.7762 Error: 0.55369 Loss: 0.60616 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.37s\n", + "1097280 Examples seen. Accuracy: 0.7755 Error: 0.55193 Loss: 0.61384 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1097920 Examples seen. Accuracy: 0.7774 Error: 0.59190 Loss: 0.70011 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.29s\n", + "1098560 Examples seen. Accuracy: 0.7754 Error: 0.71340 Loss: 0.68923 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.28s\n", + "1099200 Examples seen. Accuracy: 0.7770 Error: 0.51982 Loss: 0.51748 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1099840 Examples seen. Accuracy: 0.7757 Error: 0.55600 Loss: 0.51837 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1100480 Examples seen. Accuracy: 0.7738 Error: 0.78785 Loss: 0.91916 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.28s\n", + "1101120 Examples seen. Accuracy: 0.7715 Error: 0.67888 Loss: 0.66424 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1101760 Examples seen. Accuracy: 0.7711 Error: 0.63342 Loss: 0.68960 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1102400 Examples seen. Accuracy: 0.7709 Error: 0.61279 Loss: 0.67531 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1103040 Examples seen. Accuracy: 0.7736 Error: 0.63234 Loss: 0.62694 Threads: 2 Forward time: 0.77s Backward time: 0.42s Step time: 2.29s\n", + "1103680 Examples seen. Accuracy: 0.7722 Error: 0.62046 Loss: 0.58955 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.37s\n", + "1104320 Examples seen. Accuracy: 0.7725 Error: 0.53156 Loss: 0.65217 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.30s\n", + "1104960 Examples seen. Accuracy: 0.7724 Error: 0.53894 Loss: 0.57347 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1105600 Examples seen. Accuracy: 0.7745 Error: 0.61540 Loss: 0.61130 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.31s\n", + "1106240 Examples seen. Accuracy: 0.7732 Error: 0.61875 Loss: 0.57170 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1106880 Examples seen. Accuracy: 0.7724 Error: 0.77616 Loss: 0.93340 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1107520 Examples seen. Accuracy: 0.7720 Error: 0.69649 Loss: 0.71406 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1108160 Examples seen. Accuracy: 0.7706 Error: 0.64266 Loss: 0.65267 Threads: 2 Forward time: 0.74s Backward time: 0.41s Step time: 2.33s\n", + "1108800 Examples seen. Accuracy: 0.7697 Error: 0.63226 Loss: 0.60331 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "1109440 Examples seen. Accuracy: 0.7707 Error: 0.72177 Loss: 0.79441 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.31s\n", + "1110080 Examples seen. Accuracy: 0.7721 Error: 0.56079 Loss: 0.53028 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.36s\n", + "1110720 Examples seen. Accuracy: 0.7722 Error: 0.53931 Loss: 0.61064 Threads: 2 Forward time: 0.73s Backward time: 0.44s Step time: 2.34s\n", + "1111360 Examples seen. Accuracy: 0.7677 Error: 0.71927 Loss: 0.81796 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.32s\n", + "1112000 Examples seen. Accuracy: 0.7677 Error: 0.57221 Loss: 0.56836 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.35s\n", + "1112640 Examples seen. Accuracy: 0.7694 Error: 0.50521 Loss: 0.52993 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.35s\n", + "1113280 Examples seen. Accuracy: 0.7674 Error: 0.72137 Loss: 0.78678 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1113920 Examples seen. Accuracy: 0.7684 Error: 0.51623 Loss: 0.54745 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.30s\n", + "1114560 Examples seen. Accuracy: 0.7671 Error: 0.47534 Loss: 0.54274 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.28s\n", + "1115200 Examples seen. Accuracy: 0.7699 Error: 0.51134 Loss: 0.55922 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.30s\n", + "1115840 Examples seen. Accuracy: 0.7691 Error: 0.69697 Loss: 0.79744 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1116480 Examples seen. Accuracy: 0.7720 Error: 0.60532 Loss: 0.58824 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1117120 Examples seen. Accuracy: 0.7753 Error: 0.57749 Loss: 0.49632 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.29s\n", + "1117760 Examples seen. Accuracy: 0.7760 Error: 0.58438 Loss: 0.59893 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "1118400 Examples seen. Accuracy: 0.7733 Error: 0.53181 Loss: 0.54858 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.29s\n", + "1119040 Examples seen. Accuracy: 0.7732 Error: 0.59024 Loss: 0.53193 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.30s\n", + "1119680 Examples seen. Accuracy: 0.7740 Error: 0.68910 Loss: 0.71524 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.39s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 28 Examples seen:1120000 Validation Accuracy: 0.8261 Validation Error: 0.4891 Validation Loss: 0.5150 Total time: 98.09min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.494 Min Weight: -0.550 Max Output: 4.574 Min Output: -5.458 TNNetConvolutionLinear 32,32,64 Times: 30.77s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.574 Min Output: -1.136 TNNetMaxPool 8,8,64 Times: 7.03s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.821 Min Weight: 0.772 Max Output: 4.860 Min Output: -2.534 TNNetMovingStdNormalization 8,8,64 Times: 0.16s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.271 Min Weight: -0.277 Max Output: 9.686 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.52s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.286 Min Weight: -0.255 Max Output: 9.216 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.45s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.257 Min Weight: -0.225 Max Output: 6.026 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.60s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.235 Min Weight: -0.219 Max Output: 2.657 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.61s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.657 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.657 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.36s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.341 Min Weight: -0.271 Max Output: 4.850 Min Output: -8.163 TNNetFullConnectLinear 10,1,1 Times: 0.15s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.541 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.4896 minutes. 50 epochs: 2.0747 hours.\n", + "Epochs: 28. Working time: 1.63 hours.\n", + "1120640 Examples seen. Accuracy: 0.7794 Error: 0.52421 Loss: 0.63351 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.34s\n", + "1121280 Examples seen. Accuracy: 0.7815 Error: 0.52029 Loss: 0.55908 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.31s\n", + "1121920 Examples seen. Accuracy: 0.7798 Error: 0.64171 Loss: 0.63233 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.34s\n", + "1122560 Examples seen. Accuracy: 0.7798 Error: 0.64865 Loss: 0.75683 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1123200 Examples seen. Accuracy: 0.7778 Error: 0.61196 Loss: 0.56286 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.31s\n", + "1123840 Examples seen. Accuracy: 0.7766 Error: 0.46690 Loss: 0.43316 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1124480 Examples seen. Accuracy: 0.7785 Error: 0.60207 Loss: 0.61848 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1125120 Examples seen. Accuracy: 0.7767 Error: 0.59671 Loss: 0.69586 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1125760 Examples seen. Accuracy: 0.7766 Error: 0.56630 Loss: 0.57956 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.27s\n", + "1126400 Examples seen. Accuracy: 0.7776 Error: 0.47290 Loss: 0.49113 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1127040 Examples seen. Accuracy: 0.7764 Error: 0.64792 Loss: 0.63391 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1127680 Examples seen. Accuracy: 0.7781 Error: 0.49905 Loss: 0.43891 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1128320 Examples seen. Accuracy: 0.7755 Error: 0.38912 Loss: 0.35121 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.28s\n", + "1128960 Examples seen. Accuracy: 0.7733 Error: 0.59010 Loss: 0.61952 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.31s\n", + "1129600 Examples seen. Accuracy: 0.7736 Error: 0.62095 Loss: 0.74850 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.30s\n", + "1130240 Examples seen. Accuracy: 0.7718 Error: 0.65263 Loss: 0.64472 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1130880 Examples seen. Accuracy: 0.7735 Error: 0.79717 Loss: 0.83316 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.26s\n", + "1131520 Examples seen. Accuracy: 0.7732 Error: 0.56024 Loss: 0.56859 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.27s\n", + "1132160 Examples seen. Accuracy: 0.7738 Error: 0.59734 Loss: 0.54427 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1132800 Examples seen. Accuracy: 0.7727 Error: 0.55674 Loss: 0.45714 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1133440 Examples seen. Accuracy: 0.7713 Error: 0.53348 Loss: 0.55996 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1134080 Examples seen. Accuracy: 0.7736 Error: 0.63320 Loss: 0.73677 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1134720 Examples seen. Accuracy: 0.7747 Error: 0.71991 Loss: 0.77038 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.30s\n", + "1135360 Examples seen. Accuracy: 0.7730 Error: 0.57787 Loss: 0.60152 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1136000 Examples seen. Accuracy: 0.7726 Error: 0.50915 Loss: 0.46865 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1136640 Examples seen. Accuracy: 0.7775 Error: 0.51334 Loss: 0.57772 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1137280 Examples seen. Accuracy: 0.7775 Error: 0.47320 Loss: 0.46707 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1137920 Examples seen. Accuracy: 0.7785 Error: 0.73078 Loss: 0.76182 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1138560 Examples seen. Accuracy: 0.7759 Error: 0.64600 Loss: 0.81387 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1139200 Examples seen. Accuracy: 0.7787 Error: 0.65314 Loss: 0.79598 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "1139840 Examples seen. Accuracy: 0.7786 Error: 0.53289 Loss: 0.53779 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.32s\n", + "1140480 Examples seen. Accuracy: 0.7758 Error: 0.67408 Loss: 0.67357 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.31s\n", + "1141120 Examples seen. Accuracy: 0.7747 Error: 0.76437 Loss: 0.72462 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1141760 Examples seen. Accuracy: 0.7751 Error: 0.63911 Loss: 0.64265 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.30s\n", + "1142400 Examples seen. Accuracy: 0.7752 Error: 0.60393 Loss: 0.65330 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.29s\n", + "1143040 Examples seen. Accuracy: 0.7754 Error: 0.64088 Loss: 0.66254 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.29s\n", + "1143680 Examples seen. Accuracy: 0.7738 Error: 0.68539 Loss: 0.73513 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1144320 Examples seen. Accuracy: 0.7727 Error: 0.47767 Loss: 0.45383 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "1144960 Examples seen. Accuracy: 0.7762 Error: 0.50762 Loss: 0.50520 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1145600 Examples seen. Accuracy: 0.7757 Error: 0.78931 Loss: 0.85896 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.27s\n", + "1146240 Examples seen. Accuracy: 0.7749 Error: 0.56260 Loss: 0.63088 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1146880 Examples seen. Accuracy: 0.7759 Error: 0.60969 Loss: 0.80845 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1147520 Examples seen. Accuracy: 0.7791 Error: 0.55723 Loss: 0.60484 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1148160 Examples seen. Accuracy: 0.7771 Error: 0.62622 Loss: 0.56205 Threads: 2 Forward time: 0.73s Backward time: 0.45s Step time: 2.31s\n", + "1148800 Examples seen. Accuracy: 0.7764 Error: 0.53529 Loss: 0.55049 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.38s\n", + "1149440 Examples seen. Accuracy: 0.7758 Error: 0.59341 Loss: 0.56023 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.31s\n", + "1150080 Examples seen. Accuracy: 0.7761 Error: 0.62092 Loss: 0.63427 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1150720 Examples seen. Accuracy: 0.7769 Error: 0.57329 Loss: 0.64913 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.27s\n", + "1151360 Examples seen. Accuracy: 0.7748 Error: 0.45510 Loss: 0.52737 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1152000 Examples seen. Accuracy: 0.7739 Error: 0.63758 Loss: 0.68069 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1152640 Examples seen. Accuracy: 0.7742 Error: 0.50571 Loss: 0.58059 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "1153280 Examples seen. Accuracy: 0.7744 Error: 0.56878 Loss: 0.53177 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.28s\n", + "1153920 Examples seen. Accuracy: 0.7768 Error: 0.54415 Loss: 0.56553 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "1154560 Examples seen. Accuracy: 0.7790 Error: 0.50388 Loss: 0.71423 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.27s\n", + "1155200 Examples seen. Accuracy: 0.7778 Error: 0.78313 Loss: 0.97846 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1155840 Examples seen. Accuracy: 0.7759 Error: 0.69764 Loss: 0.67843 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1156480 Examples seen. Accuracy: 0.7744 Error: 0.53026 Loss: 0.49082 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.27s\n", + "1157120 Examples seen. Accuracy: 0.7754 Error: 0.50892 Loss: 0.53582 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1157760 Examples seen. Accuracy: 0.7776 Error: 0.63629 Loss: 0.65726 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.24s\n", + "1158400 Examples seen. Accuracy: 0.7767 Error: 0.60666 Loss: 0.67876 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1159040 Examples seen. Accuracy: 0.7769 Error: 0.47899 Loss: 0.47012 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1159680 Examples seen. Accuracy: 0.7756 Error: 0.53084 Loss: 0.52093 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.31s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 29 Examples seen:1160000 Validation Accuracy: 0.8287 Validation Error: 0.4835 Validation Loss: 0.5090 Total time: 101.52min\n", + "Epoch time: 2.4073 minutes. 50 epochs: 2.0061 hours.\n", + "Epochs: 29. Working time: 1.69 hours.\n", + "1160640 Examples seen. Accuracy: 0.7776 Error: 0.56986 Loss: 0.47305 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1161280 Examples seen. Accuracy: 0.7762 Error: 0.66140 Loss: 0.61581 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1161920 Examples seen. Accuracy: 0.7805 Error: 0.60814 Loss: 0.70295 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1162560 Examples seen. Accuracy: 0.7788 Error: 0.67714 Loss: 0.70537 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "1163200 Examples seen. Accuracy: 0.7826 Error: 0.59043 Loss: 0.67026 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1163840 Examples seen. Accuracy: 0.7801 Error: 0.64057 Loss: 0.77652 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1164480 Examples seen. Accuracy: 0.7774 Error: 0.49402 Loss: 0.45296 Threads: 2 Forward time: 0.73s Backward time: 0.40s Step time: 2.29s\n", + "1165120 Examples seen. Accuracy: 0.7785 Error: 0.54668 Loss: 0.60388 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.27s\n", + "1165760 Examples seen. Accuracy: 0.7782 Error: 0.72739 Loss: 0.65615 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1166400 Examples seen. Accuracy: 0.7805 Error: 0.52673 Loss: 0.46872 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1167040 Examples seen. Accuracy: 0.7820 Error: 0.62018 Loss: 0.74346 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1167680 Examples seen. Accuracy: 0.7808 Error: 0.58190 Loss: 0.60172 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1168320 Examples seen. Accuracy: 0.7816 Error: 0.37622 Loss: 0.34950 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1168960 Examples seen. Accuracy: 0.7794 Error: 0.65894 Loss: 0.81498 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1169600 Examples seen. Accuracy: 0.7765 Error: 0.67649 Loss: 0.76236 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "1170240 Examples seen. Accuracy: 0.7765 Error: 0.50140 Loss: 0.48591 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1170880 Examples seen. Accuracy: 0.7776 Error: 0.66763 Loss: 0.78585 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1171520 Examples seen. Accuracy: 0.7759 Error: 0.67202 Loss: 0.80705 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1172160 Examples seen. Accuracy: 0.7777 Error: 0.53117 Loss: 0.56495 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.25s\n", + "1172800 Examples seen. Accuracy: 0.7797 Error: 0.51295 Loss: 0.44868 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1173440 Examples seen. Accuracy: 0.7794 Error: 0.50560 Loss: 0.55629 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1174080 Examples seen. Accuracy: 0.7805 Error: 0.62676 Loss: 0.63596 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.29s\n", + "1174720 Examples seen. Accuracy: 0.7805 Error: 0.68616 Loss: 0.72264 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.33s\n", + "1175360 Examples seen. Accuracy: 0.7777 Error: 0.55185 Loss: 0.54884 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.32s\n", + "1176000 Examples seen. Accuracy: 0.7770 Error: 0.64244 Loss: 0.71392 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1176640 Examples seen. Accuracy: 0.7804 Error: 0.39786 Loss: 0.43744 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.29s\n", + "1177280 Examples seen. Accuracy: 0.7786 Error: 0.65243 Loss: 0.73349 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1177920 Examples seen. Accuracy: 0.7790 Error: 0.53043 Loss: 0.50502 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1178560 Examples seen. Accuracy: 0.7812 Error: 0.51034 Loss: 0.52732 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1179200 Examples seen. Accuracy: 0.7822 Error: 0.60129 Loss: 0.63602 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1179840 Examples seen. Accuracy: 0.7812 Error: 0.64255 Loss: 0.70390 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.30s\n", + "1180480 Examples seen. Accuracy: 0.7818 Error: 0.60750 Loss: 0.59077 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.25s\n", + "1181120 Examples seen. Accuracy: 0.7806 Error: 0.52028 Loss: 0.49569 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1181760 Examples seen. Accuracy: 0.7805 Error: 0.69940 Loss: 0.79032 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.32s\n", + "1182400 Examples seen. Accuracy: 0.7805 Error: 0.70332 Loss: 0.66928 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1183040 Examples seen. Accuracy: 0.7791 Error: 0.57775 Loss: 0.59930 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "1183680 Examples seen. Accuracy: 0.7800 Error: 0.51869 Loss: 0.51265 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.26s\n", + "1184320 Examples seen. Accuracy: 0.7806 Error: 0.51277 Loss: 0.53224 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "1184960 Examples seen. Accuracy: 0.7805 Error: 0.62983 Loss: 0.70943 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "1185600 Examples seen. Accuracy: 0.7793 Error: 0.64632 Loss: 0.76454 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1186240 Examples seen. Accuracy: 0.7814 Error: 0.52997 Loss: 0.51816 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "1186880 Examples seen. Accuracy: 0.7824 Error: 0.52129 Loss: 0.67619 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1187520 Examples seen. Accuracy: 0.7838 Error: 0.74656 Loss: 0.91833 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1188160 Examples seen. Accuracy: 0.7832 Error: 0.64505 Loss: 0.65476 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.26s\n", + "1188800 Examples seen. Accuracy: 0.7792 Error: 0.57545 Loss: 0.69557 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.23s\n", + "1189440 Examples seen. Accuracy: 0.7791 Error: 0.71102 Loss: 0.67482 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1190080 Examples seen. Accuracy: 0.7784 Error: 0.64396 Loss: 0.55848 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.27s\n", + "1190720 Examples seen. Accuracy: 0.7802 Error: 0.61249 Loss: 0.60549 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1191360 Examples seen. Accuracy: 0.7780 Error: 0.52606 Loss: 0.52067 Threads: 2 Forward time: 0.64s Backward time: 0.42s Step time: 2.24s\n", + "1192000 Examples seen. Accuracy: 0.7748 Error: 0.66464 Loss: 0.68711 Threads: 2 Forward time: 0.73s Backward time: 0.44s Step time: 2.30s\n", + "1192640 Examples seen. Accuracy: 0.7729 Error: 0.57977 Loss: 0.54087 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.36s\n", + "1193280 Examples seen. Accuracy: 0.7737 Error: 0.73024 Loss: 0.91881 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1193920 Examples seen. Accuracy: 0.7750 Error: 0.71196 Loss: 0.76247 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.34s\n", + "1194560 Examples seen. Accuracy: 0.7741 Error: 0.70257 Loss: 0.64790 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1195200 Examples seen. Accuracy: 0.7746 Error: 0.51348 Loss: 0.52483 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1195840 Examples seen. Accuracy: 0.7751 Error: 0.72426 Loss: 0.69242 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1196480 Examples seen. Accuracy: 0.7744 Error: 0.70227 Loss: 0.76354 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "1197120 Examples seen. Accuracy: 0.7759 Error: 0.66231 Loss: 0.63596 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.28s\n", + "1197760 Examples seen. Accuracy: 0.7767 Error: 0.75073 Loss: 0.87106 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.30s\n", + "1198400 Examples seen. Accuracy: 0.7773 Error: 0.64883 Loss: 0.62832 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.27s\n", + "1199040 Examples seen. Accuracy: 0.7749 Error: 0.44764 Loss: 0.47303 Threads: 2 Forward time: 0.75s Backward time: 0.43s Step time: 2.26s\n", + "1199680 Examples seen. Accuracy: 0.7749 Error: 0.49609 Loss: 0.45942 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.38s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 30 Examples seen:1200000 Validation Accuracy: 0.8315 Validation Error: 0.4787 Validation Loss: 0.5051 Total time: 104.94min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.510 Min Weight: -0.562 Max Output: 4.717 Min Output: -5.502 TNNetConvolutionLinear 32,32,64 Times: 30.28s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.717 Min Output: -1.156 TNNetMaxPool 8,8,64 Times: 6.94s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.834 Min Weight: 0.786 Max Output: 4.939 Min Output: -2.532 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.279 Min Weight: -0.284 Max Output: 9.980 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.32s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.291 Min Weight: -0.270 Max Output: 9.685 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.264 Min Weight: -0.232 Max Output: 6.380 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.29s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.240 Min Weight: -0.219 Max Output: 2.677 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.24s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.677 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.04s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.677 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.38s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.345 Min Weight: -0.272 Max Output: 4.576 Min Output: -8.332 TNNetFullConnectLinear 10,1,1 Times: 0.11s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.559 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Starting Testing.\n", + "Epochs: 30 Examples seen:1200000 Test Accuracy: 0.8226 Test Error: 0.4935 Test Loss: 0.5318 Total time: 105.98min\n", + "Epoch time: 2.4771 minutes. 50 epochs: 2.0642 hours.\n", + "Epochs: 30. Working time: 1.77 hours.\n", + "Learning rate set to: 0.00074\n", + "1200640 Examples seen. Accuracy: 0.7751 Error: 0.64286 Loss: 0.65344 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1201280 Examples seen. Accuracy: 0.7754 Error: 0.71721 Loss: 0.69562 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1201920 Examples seen. Accuracy: 0.7767 Error: 0.67096 Loss: 0.80500 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1202560 Examples seen. Accuracy: 0.7779 Error: 0.61637 Loss: 0.55140 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1203200 Examples seen. Accuracy: 0.7772 Error: 0.55723 Loss: 0.63485 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1203840 Examples seen. Accuracy: 0.7775 Error: 0.77592 Loss: 0.83950 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "1204480 Examples seen. Accuracy: 0.7767 Error: 0.71214 Loss: 0.67258 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.24s\n", + "1205120 Examples seen. Accuracy: 0.7787 Error: 0.67056 Loss: 0.83594 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1205760 Examples seen. Accuracy: 0.7808 Error: 0.49759 Loss: 0.45220 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1206400 Examples seen. Accuracy: 0.7814 Error: 0.72138 Loss: 0.79935 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1207040 Examples seen. Accuracy: 0.7844 Error: 0.36128 Loss: 0.36295 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "1207680 Examples seen. Accuracy: 0.7874 Error: 0.51051 Loss: 0.48343 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1208320 Examples seen. Accuracy: 0.7863 Error: 0.70855 Loss: 0.74752 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1208960 Examples seen. Accuracy: 0.7874 Error: 0.47668 Loss: 0.44527 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1209600 Examples seen. Accuracy: 0.7854 Error: 0.59715 Loss: 0.67875 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.24s\n", + "1210240 Examples seen. Accuracy: 0.7836 Error: 0.55964 Loss: 0.59544 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1210880 Examples seen. Accuracy: 0.7857 Error: 0.55520 Loss: 0.52169 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1211520 Examples seen. Accuracy: 0.7848 Error: 0.75426 Loss: 0.79197 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1212160 Examples seen. Accuracy: 0.7832 Error: 0.66075 Loss: 0.79864 Threads: 2 Forward time: 0.72s Backward time: 0.38s Step time: 2.24s\n", + "1212800 Examples seen. Accuracy: 0.7792 Error: 0.70873 Loss: 0.85938 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.27s\n", + "1213440 Examples seen. Accuracy: 0.7786 Error: 0.62843 Loss: 0.63079 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.26s\n", + "1214080 Examples seen. Accuracy: 0.7800 Error: 0.57805 Loss: 0.68733 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1214720 Examples seen. Accuracy: 0.7790 Error: 0.57427 Loss: 0.57693 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1215360 Examples seen. Accuracy: 0.7801 Error: 0.62025 Loss: 0.74760 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1216000 Examples seen. Accuracy: 0.7800 Error: 0.49520 Loss: 0.42426 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.26s\n", + "1216640 Examples seen. Accuracy: 0.7819 Error: 0.51242 Loss: 0.51837 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1217280 Examples seen. Accuracy: 0.7820 Error: 0.54005 Loss: 0.62845 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1217920 Examples seen. Accuracy: 0.7844 Error: 0.53553 Loss: 0.60004 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "1218560 Examples seen. Accuracy: 0.7873 Error: 0.50862 Loss: 0.49073 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1219200 Examples seen. Accuracy: 0.7834 Error: 0.58298 Loss: 0.65297 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.25s\n", + "1219840 Examples seen. Accuracy: 0.7789 Error: 0.68969 Loss: 0.75226 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.29s\n", + "1220480 Examples seen. Accuracy: 0.7782 Error: 0.57104 Loss: 0.78865 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "1221120 Examples seen. Accuracy: 0.7781 Error: 0.65082 Loss: 0.71729 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1221760 Examples seen. Accuracy: 0.7771 Error: 0.62464 Loss: 0.73031 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1222400 Examples seen. Accuracy: 0.7774 Error: 0.68074 Loss: 0.72782 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.31s\n", + "1223040 Examples seen. Accuracy: 0.7765 Error: 0.65501 Loss: 0.67829 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.36s\n", + "1223680 Examples seen. Accuracy: 0.7782 Error: 0.53044 Loss: 0.64561 Threads: 2 Forward time: 0.76s Backward time: 0.45s Step time: 2.71s\n", + "1224320 Examples seen. Accuracy: 0.7780 Error: 0.63073 Loss: 0.68233 Threads: 2 Forward time: 0.81s Backward time: 0.50s Step time: 2.71s\n", + "1224960 Examples seen. Accuracy: 0.7785 Error: 0.59606 Loss: 0.65647 Threads: 2 Forward time: 0.78s Backward time: 0.49s Step time: 2.54s\n", + "1225600 Examples seen. Accuracy: 0.7825 Error: 0.48693 Loss: 0.56173 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.45s\n", + "1226240 Examples seen. Accuracy: 0.7824 Error: 0.46022 Loss: 0.62631 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.34s\n", + "1226880 Examples seen. Accuracy: 0.7830 Error: 0.50223 Loss: 0.51936 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.32s\n", + "1227520 Examples seen. Accuracy: 0.7833 Error: 0.64159 Loss: 0.66163 Threads: 2 Forward time: 0.69s Backward time: 0.45s Step time: 2.36s\n", + "1228160 Examples seen. Accuracy: 0.7836 Error: 0.48403 Loss: 0.41012 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.39s\n", + "1228800 Examples seen. Accuracy: 0.7842 Error: 0.55769 Loss: 0.64978 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1229440 Examples seen. Accuracy: 0.7853 Error: 0.49699 Loss: 0.54006 Threads: 2 Forward time: 0.74s Backward time: 0.46s Step time: 2.36s\n", + "1230080 Examples seen. Accuracy: 0.7854 Error: 0.53543 Loss: 0.56210 Threads: 2 Forward time: 0.75s Backward time: 0.48s Step time: 2.49s\n", + "1230720 Examples seen. Accuracy: 0.7862 Error: 0.50619 Loss: 0.55176 Threads: 2 Forward time: 0.72s Backward time: 0.38s Step time: 2.33s\n", + "1231360 Examples seen. Accuracy: 0.7866 Error: 0.40496 Loss: 0.36965 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.30s\n", + "1232000 Examples seen. Accuracy: 0.7859 Error: 0.54203 Loss: 0.54539 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "1232640 Examples seen. Accuracy: 0.7857 Error: 0.57522 Loss: 0.53422 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.29s\n", + "1233280 Examples seen. Accuracy: 0.7859 Error: 0.68595 Loss: 0.76582 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.27s\n", + "1233920 Examples seen. Accuracy: 0.7869 Error: 0.51987 Loss: 0.61110 Threads: 2 Forward time: 0.73s Backward time: 0.46s Step time: 2.35s\n", + "1234560 Examples seen. Accuracy: 0.7885 Error: 0.51042 Loss: 0.58027 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.40s\n", + "1235200 Examples seen. Accuracy: 0.7878 Error: 0.57845 Loss: 0.60363 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.31s\n", + "1235840 Examples seen. Accuracy: 0.7868 Error: 0.49994 Loss: 0.50530 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.31s\n", + "1236480 Examples seen. Accuracy: 0.7873 Error: 0.63299 Loss: 0.71473 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1237120 Examples seen. Accuracy: 0.7867 Error: 0.62847 Loss: 0.84041 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.28s\n", + "1237760 Examples seen. Accuracy: 0.7878 Error: 0.59563 Loss: 0.73300 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1238400 Examples seen. Accuracy: 0.7871 Error: 0.53870 Loss: 0.51377 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1239040 Examples seen. Accuracy: 0.7853 Error: 0.63139 Loss: 0.66731 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1239680 Examples seen. Accuracy: 0.7846 Error: 0.61708 Loss: 0.73526 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 31 Examples seen:1240000 Validation Accuracy: 0.8329 Validation Error: 0.4742 Validation Loss: 0.5028 Total time: 109.45min\n", + "Epoch time: 2.3698 minutes. 50 epochs: 1.9748 hours.\n", + "Epochs: 31. Working time: 1.82 hours.\n", + "1240640 Examples seen. Accuracy: 0.7843 Error: 0.47725 Loss: 0.51584 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1241280 Examples seen. Accuracy: 0.7840 Error: 0.49573 Loss: 0.46569 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1241920 Examples seen. Accuracy: 0.7828 Error: 0.56171 Loss: 0.66530 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1242560 Examples seen. Accuracy: 0.7833 Error: 0.53505 Loss: 0.46275 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.23s\n", + "1243200 Examples seen. Accuracy: 0.7807 Error: 0.52023 Loss: 0.59308 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1243840 Examples seen. Accuracy: 0.7832 Error: 0.60766 Loss: 0.67507 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1244480 Examples seen. Accuracy: 0.7875 Error: 0.55527 Loss: 0.54208 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1245120 Examples seen. Accuracy: 0.7880 Error: 0.56765 Loss: 0.63586 Threads: 2 Forward time: 0.72s Backward time: 0.38s Step time: 2.27s\n", + "1245760 Examples seen. Accuracy: 0.7896 Error: 0.54940 Loss: 0.67471 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1246400 Examples seen. Accuracy: 0.7890 Error: 0.58934 Loss: 0.64301 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1247040 Examples seen. Accuracy: 0.7878 Error: 0.56561 Loss: 0.61911 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1247680 Examples seen. Accuracy: 0.7883 Error: 0.54601 Loss: 0.59486 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1248320 Examples seen. Accuracy: 0.7885 Error: 0.63256 Loss: 0.79630 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.28s\n", + "1248960 Examples seen. Accuracy: 0.7865 Error: 0.59277 Loss: 0.75957 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1249600 Examples seen. Accuracy: 0.7874 Error: 0.54872 Loss: 0.60920 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1250240 Examples seen. Accuracy: 0.7872 Error: 0.55110 Loss: 0.56751 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1250880 Examples seen. Accuracy: 0.7883 Error: 0.45490 Loss: 0.40343 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "1251520 Examples seen. Accuracy: 0.7912 Error: 0.38080 Loss: 0.34165 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.25s\n", + "1252160 Examples seen. Accuracy: 0.7930 Error: 0.54881 Loss: 0.54164 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1252800 Examples seen. Accuracy: 0.7915 Error: 0.52708 Loss: 0.58480 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1253440 Examples seen. Accuracy: 0.7926 Error: 0.48129 Loss: 0.51919 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1254080 Examples seen. Accuracy: 0.7921 Error: 0.55212 Loss: 0.58826 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1254720 Examples seen. Accuracy: 0.7909 Error: 0.44050 Loss: 0.45105 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1255360 Examples seen. Accuracy: 0.7887 Error: 0.54091 Loss: 0.61723 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1256000 Examples seen. Accuracy: 0.7906 Error: 0.53010 Loss: 0.43359 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1256640 Examples seen. Accuracy: 0.7885 Error: 0.58651 Loss: 0.54602 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1257280 Examples seen. Accuracy: 0.7884 Error: 0.57085 Loss: 0.60078 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1257920 Examples seen. Accuracy: 0.7876 Error: 0.70097 Loss: 0.76701 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.24s\n", + "1258560 Examples seen. Accuracy: 0.7859 Error: 0.58308 Loss: 0.54945 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1259200 Examples seen. Accuracy: 0.7874 Error: 0.60047 Loss: 0.65089 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1259840 Examples seen. Accuracy: 0.7873 Error: 0.46302 Loss: 0.41428 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "1260480 Examples seen. Accuracy: 0.7860 Error: 0.64550 Loss: 0.73407 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.30s\n", + "1261120 Examples seen. Accuracy: 0.7836 Error: 0.38562 Loss: 0.41699 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1261760 Examples seen. Accuracy: 0.7817 Error: 0.75661 Loss: 0.86641 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1262400 Examples seen. Accuracy: 0.7800 Error: 0.55889 Loss: 0.56879 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.28s\n", + "1263040 Examples seen. Accuracy: 0.7805 Error: 0.56653 Loss: 0.58501 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1263680 Examples seen. Accuracy: 0.7813 Error: 0.61508 Loss: 0.63592 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.27s\n", + "1264320 Examples seen. Accuracy: 0.7830 Error: 0.53914 Loss: 0.46992 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1264960 Examples seen. Accuracy: 0.7820 Error: 0.58157 Loss: 0.52403 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1265600 Examples seen. Accuracy: 0.7830 Error: 0.56299 Loss: 0.53784 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.23s\n", + "1266240 Examples seen. Accuracy: 0.7851 Error: 0.54177 Loss: 0.59488 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "1266880 Examples seen. Accuracy: 0.7851 Error: 0.64596 Loss: 0.79294 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.24s\n", + "1267520 Examples seen. Accuracy: 0.7836 Error: 0.75294 Loss: 0.82062 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "1268160 Examples seen. Accuracy: 0.7832 Error: 0.67580 Loss: 0.77809 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1268800 Examples seen. Accuracy: 0.7831 Error: 0.70731 Loss: 0.80799 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1269440 Examples seen. Accuracy: 0.7825 Error: 0.56960 Loss: 0.57981 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1270080 Examples seen. Accuracy: 0.7831 Error: 0.57833 Loss: 0.51488 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.23s\n", + "1270720 Examples seen. Accuracy: 0.7850 Error: 0.58764 Loss: 0.54039 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1271360 Examples seen. Accuracy: 0.7841 Error: 0.63652 Loss: 0.80827 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.23s\n", + "1272000 Examples seen. Accuracy: 0.7826 Error: 0.64770 Loss: 0.86617 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.27s\n", + "1272640 Examples seen. Accuracy: 0.7822 Error: 0.52765 Loss: 0.48528 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1273280 Examples seen. Accuracy: 0.7797 Error: 0.46494 Loss: 0.42500 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1273920 Examples seen. Accuracy: 0.7822 Error: 0.55058 Loss: 0.52238 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1274560 Examples seen. Accuracy: 0.7810 Error: 0.59736 Loss: 0.60811 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "1275200 Examples seen. Accuracy: 0.7814 Error: 0.54648 Loss: 0.51191 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1275840 Examples seen. Accuracy: 0.7817 Error: 0.52865 Loss: 0.64533 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "1276480 Examples seen. Accuracy: 0.7823 Error: 0.58322 Loss: 0.52430 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.31s\n", + "1277120 Examples seen. Accuracy: 0.7810 Error: 0.53212 Loss: 0.54407 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1277760 Examples seen. Accuracy: 0.7835 Error: 0.49180 Loss: 0.43472 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1278400 Examples seen. Accuracy: 0.7844 Error: 0.43271 Loss: 0.44015 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "1279040 Examples seen. Accuracy: 0.7855 Error: 0.57346 Loss: 0.62711 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "1279680 Examples seen. Accuracy: 0.7850 Error: 0.59628 Loss: 0.69473 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "Starting Validation.\n", + "Epochs: 32 Examples seen:1280000 Validation Accuracy: 0.8329 Validation Error: 0.4698 Validation Loss: 0.4996 Total time: 112.87min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.520 Min Weight: -0.573 Max Output: 4.786 Min Output: -5.553 TNNetConvolutionLinear 32,32,64 Times: 30.83s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.786 Min Output: -1.217 TNNetMaxPool 8,8,64 Times: 7.00s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.847 Min Weight: 0.800 Max Output: 4.926 Min Output: -2.581 TNNetMovingStdNormalization 8,8,64 Times: 0.17s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.284 Min Weight: -0.293 Max Output: 10.200 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.56s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.293 Min Weight: -0.282 Max Output: 9.815 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.45s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.274 Min Weight: -0.238 Max Output: 6.736 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.53s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.242 Min Weight: -0.217 Max Output: 2.852 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.43s 0.01s Parent:6\n", + "Layer 8 Max Output: 2.852 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.04s 0.00s Parent:7\n", + "Layer 9 Max Output: 2.852 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.40s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.348 Min Weight: -0.271 Max Output: 4.509 Min Output: -8.595 TNNetFullConnectLinear 10,1,1 Times: 0.11s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.565 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3667 minutes. 50 epochs: 1.9722 hours.\n", + "Epochs: 32. Working time: 1.88 hours.\n", + "1280640 Examples seen. Accuracy: 0.7832 Error: 0.64585 Loss: 0.69587 Threads: 2 Forward time: 0.74s Backward time: 0.41s Step time: 2.28s\n", + "1281280 Examples seen. Accuracy: 0.7843 Error: 0.61671 Loss: 0.70524 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "1281920 Examples seen. Accuracy: 0.7839 Error: 0.60757 Loss: 0.64053 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.34s\n", + "1282560 Examples seen. Accuracy: 0.7855 Error: 0.47518 Loss: 0.43346 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1283200 Examples seen. Accuracy: 0.7877 Error: 0.59297 Loss: 0.85653 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.28s\n", + "1283840 Examples seen. Accuracy: 0.7895 Error: 0.52170 Loss: 0.44359 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1284480 Examples seen. Accuracy: 0.7881 Error: 0.53714 Loss: 0.54465 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1285120 Examples seen. Accuracy: 0.7874 Error: 0.58090 Loss: 0.53135 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1285760 Examples seen. Accuracy: 0.7874 Error: 0.47550 Loss: 0.45915 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1286400 Examples seen. Accuracy: 0.7866 Error: 0.64166 Loss: 0.78682 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.24s\n", + "1287040 Examples seen. Accuracy: 0.7865 Error: 0.50802 Loss: 0.52723 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1287680 Examples seen. Accuracy: 0.7898 Error: 0.60484 Loss: 0.63673 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1288320 Examples seen. Accuracy: 0.7897 Error: 0.53018 Loss: 0.56199 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.27s\n", + "1288960 Examples seen. Accuracy: 0.7865 Error: 0.61655 Loss: 0.61443 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1289600 Examples seen. Accuracy: 0.7832 Error: 0.61269 Loss: 0.55876 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "1290240 Examples seen. Accuracy: 0.7863 Error: 0.57752 Loss: 0.67834 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "1290880 Examples seen. Accuracy: 0.7872 Error: 0.70037 Loss: 0.73452 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.29s\n", + "1291520 Examples seen. Accuracy: 0.7911 Error: 0.50310 Loss: 0.50242 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1292160 Examples seen. Accuracy: 0.7871 Error: 0.70449 Loss: 0.75903 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.26s\n", + "1292800 Examples seen. Accuracy: 0.7881 Error: 0.65345 Loss: 0.72811 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1293440 Examples seen. Accuracy: 0.7864 Error: 0.65485 Loss: 0.65287 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "1294080 Examples seen. Accuracy: 0.7883 Error: 0.59678 Loss: 0.56790 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.31s\n", + "1294720 Examples seen. Accuracy: 0.7878 Error: 0.66222 Loss: 0.83246 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.31s\n", + "1295360 Examples seen. Accuracy: 0.7895 Error: 0.46031 Loss: 0.37152 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "1296000 Examples seen. Accuracy: 0.7925 Error: 0.51558 Loss: 0.47107 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.32s\n", + "1296640 Examples seen. Accuracy: 0.7907 Error: 0.62717 Loss: 0.71559 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.26s\n", + "1297280 Examples seen. Accuracy: 0.7911 Error: 0.58214 Loss: 0.58279 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.27s\n", + "1297920 Examples seen. Accuracy: 0.7923 Error: 0.57659 Loss: 0.71769 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1298560 Examples seen. Accuracy: 0.7951 Error: 0.57408 Loss: 0.49613 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1299200 Examples seen. Accuracy: 0.7940 Error: 0.44094 Loss: 0.40444 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.27s\n", + "1299840 Examples seen. Accuracy: 0.7934 Error: 0.59908 Loss: 0.75478 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.32s\n", + "1300480 Examples seen. Accuracy: 0.7900 Error: 0.69863 Loss: 0.68214 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1301120 Examples seen. Accuracy: 0.7893 Error: 0.42779 Loss: 0.34304 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "1301760 Examples seen. Accuracy: 0.7860 Error: 0.60575 Loss: 0.59497 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1302400 Examples seen. Accuracy: 0.7869 Error: 0.59790 Loss: 0.64728 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.28s\n", + "1303040 Examples seen. Accuracy: 0.7853 Error: 0.73767 Loss: 0.79526 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.26s\n", + "1303680 Examples seen. Accuracy: 0.7838 Error: 0.67585 Loss: 0.65435 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1304320 Examples seen. Accuracy: 0.7853 Error: 0.52065 Loss: 0.42431 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.27s\n", + "1304960 Examples seen. Accuracy: 0.7861 Error: 0.36962 Loss: 0.45761 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1305600 Examples seen. Accuracy: 0.7895 Error: 0.60682 Loss: 0.60567 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.29s\n", + "1306240 Examples seen. Accuracy: 0.7884 Error: 0.66043 Loss: 0.75180 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1306880 Examples seen. Accuracy: 0.7884 Error: 0.50895 Loss: 0.53755 Threads: 2 Forward time: 0.70s Backward time: 0.37s Step time: 2.25s\n", + "1307520 Examples seen. Accuracy: 0.7872 Error: 0.62135 Loss: 0.63892 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1308160 Examples seen. Accuracy: 0.7863 Error: 0.45117 Loss: 0.41081 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.26s\n", + "1308800 Examples seen. Accuracy: 0.7856 Error: 0.51989 Loss: 0.44871 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1309440 Examples seen. Accuracy: 0.7842 Error: 0.70024 Loss: 0.87309 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1310080 Examples seen. Accuracy: 0.7844 Error: 0.51669 Loss: 0.46924 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1310720 Examples seen. Accuracy: 0.7848 Error: 0.57813 Loss: 0.66389 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1311360 Examples seen. Accuracy: 0.7871 Error: 0.46848 Loss: 0.52171 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1312000 Examples seen. Accuracy: 0.7884 Error: 0.62824 Loss: 0.64377 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.30s\n", + "1312640 Examples seen. Accuracy: 0.7890 Error: 0.51217 Loss: 0.53284 Threads: 2 Forward time: 0.67s Backward time: 0.45s Step time: 2.29s\n", + "1313280 Examples seen. Accuracy: 0.7912 Error: 0.58014 Loss: 0.65342 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.29s\n", + "1313920 Examples seen. Accuracy: 0.7947 Error: 0.42172 Loss: 0.47614 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1314560 Examples seen. Accuracy: 0.7940 Error: 0.64409 Loss: 0.62473 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.29s\n", + "1315200 Examples seen. Accuracy: 0.7945 Error: 0.42007 Loss: 0.39447 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1315840 Examples seen. Accuracy: 0.7944 Error: 0.51635 Loss: 0.62484 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1316480 Examples seen. Accuracy: 0.7935 Error: 0.46763 Loss: 0.57362 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1317120 Examples seen. Accuracy: 0.7925 Error: 0.60232 Loss: 0.60671 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1317760 Examples seen. Accuracy: 0.7912 Error: 0.58365 Loss: 0.57285 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "1318400 Examples seen. Accuracy: 0.7914 Error: 0.60825 Loss: 0.61843 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1319040 Examples seen. Accuracy: 0.7936 Error: 0.36862 Loss: 0.30941 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.24s\n", + "1319680 Examples seen. Accuracy: 0.7911 Error: 0.53451 Loss: 0.47788 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 33 Examples seen:1320000 Validation Accuracy: 0.8353 Validation Error: 0.4672 Validation Loss: 0.4969 Total time: 116.31min\n", + "Epoch time: 2.3656 minutes. 50 epochs: 1.9714 hours.\n", + "Epochs: 33. Working time: 1.94 hours.\n", + "1320640 Examples seen. Accuracy: 0.7906 Error: 0.53081 Loss: 0.54587 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.26s\n", + "1321280 Examples seen. Accuracy: 0.7917 Error: 0.63764 Loss: 0.69533 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1321920 Examples seen. Accuracy: 0.7936 Error: 0.46233 Loss: 0.40093 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1322560 Examples seen. Accuracy: 0.7922 Error: 0.67207 Loss: 0.76874 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1323200 Examples seen. Accuracy: 0.7914 Error: 0.53289 Loss: 0.55294 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1323840 Examples seen. Accuracy: 0.7892 Error: 0.52619 Loss: 0.68985 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.26s\n", + "1324480 Examples seen. Accuracy: 0.7894 Error: 0.54905 Loss: 0.58755 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1325120 Examples seen. Accuracy: 0.7892 Error: 0.50748 Loss: 0.51020 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1325760 Examples seen. Accuracy: 0.7916 Error: 0.57824 Loss: 0.56624 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1326400 Examples seen. Accuracy: 0.7924 Error: 0.61998 Loss: 0.69956 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1327040 Examples seen. Accuracy: 0.7929 Error: 0.55754 Loss: 0.56295 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.25s\n", + "1327680 Examples seen. Accuracy: 0.7925 Error: 0.54066 Loss: 0.54614 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1328320 Examples seen. Accuracy: 0.7922 Error: 0.58956 Loss: 0.56415 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1328960 Examples seen. Accuracy: 0.7887 Error: 0.54197 Loss: 0.67557 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1329600 Examples seen. Accuracy: 0.7877 Error: 0.44009 Loss: 0.34554 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "1330240 Examples seen. Accuracy: 0.7890 Error: 0.43382 Loss: 0.40314 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.28s\n", + "1330880 Examples seen. Accuracy: 0.7880 Error: 0.62319 Loss: 0.63072 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1331520 Examples seen. Accuracy: 0.7888 Error: 0.70559 Loss: 0.63921 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1332160 Examples seen. Accuracy: 0.7883 Error: 0.57248 Loss: 0.74999 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "1332800 Examples seen. Accuracy: 0.7859 Error: 0.57180 Loss: 0.57545 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1333440 Examples seen. Accuracy: 0.7854 Error: 0.43697 Loss: 0.37849 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.28s\n", + "1334080 Examples seen. Accuracy: 0.7840 Error: 0.60208 Loss: 0.56056 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1334720 Examples seen. Accuracy: 0.7837 Error: 0.75670 Loss: 0.72626 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1335360 Examples seen. Accuracy: 0.7844 Error: 0.47922 Loss: 0.43309 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1336000 Examples seen. Accuracy: 0.7831 Error: 0.54498 Loss: 0.50272 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.26s\n", + "1336640 Examples seen. Accuracy: 0.7853 Error: 0.55214 Loss: 0.54320 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.26s\n", + "1337280 Examples seen. Accuracy: 0.7874 Error: 0.62943 Loss: 0.78451 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.32s\n", + "1337920 Examples seen. Accuracy: 0.7876 Error: 0.60653 Loss: 0.65194 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.36s\n", + "1338560 Examples seen. Accuracy: 0.7861 Error: 0.63837 Loss: 0.61434 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.32s\n", + "1339200 Examples seen. Accuracy: 0.7865 Error: 0.52642 Loss: 0.46827 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.30s\n", + "1339840 Examples seen. Accuracy: 0.7861 Error: 0.62272 Loss: 0.70624 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.27s\n", + "1340480 Examples seen. Accuracy: 0.7862 Error: 0.55882 Loss: 0.48922 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.26s\n", + "1341120 Examples seen. Accuracy: 0.7891 Error: 0.67534 Loss: 0.67404 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.27s\n", + "1341760 Examples seen. Accuracy: 0.7875 Error: 0.53217 Loss: 0.49085 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1342400 Examples seen. Accuracy: 0.7871 Error: 0.52482 Loss: 0.57882 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.29s\n", + "1343040 Examples seen. Accuracy: 0.7879 Error: 0.50817 Loss: 0.51205 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.30s\n", + "1343680 Examples seen. Accuracy: 0.7894 Error: 0.71266 Loss: 0.76258 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.28s\n", + "1344320 Examples seen. Accuracy: 0.7901 Error: 0.50584 Loss: 0.42748 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1344960 Examples seen. Accuracy: 0.7886 Error: 0.44178 Loss: 0.44868 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1345600 Examples seen. Accuracy: 0.7877 Error: 0.60253 Loss: 0.61629 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.26s\n", + "1346240 Examples seen. Accuracy: 0.7858 Error: 0.46678 Loss: 0.36829 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1346880 Examples seen. Accuracy: 0.7864 Error: 0.49625 Loss: 0.57179 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.32s\n", + "1347520 Examples seen. Accuracy: 0.7856 Error: 0.56962 Loss: 0.51950 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.29s\n", + "1348160 Examples seen. Accuracy: 0.7869 Error: 0.41979 Loss: 0.40398 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1348800 Examples seen. Accuracy: 0.7879 Error: 0.52735 Loss: 0.65224 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1349440 Examples seen. Accuracy: 0.7880 Error: 0.52790 Loss: 0.57884 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1350080 Examples seen. Accuracy: 0.7902 Error: 0.43375 Loss: 0.47981 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1350720 Examples seen. Accuracy: 0.7901 Error: 0.76934 Loss: 0.74440 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1351360 Examples seen. Accuracy: 0.7894 Error: 0.52292 Loss: 0.56203 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1352000 Examples seen. Accuracy: 0.7917 Error: 0.45565 Loss: 0.46184 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "1352640 Examples seen. Accuracy: 0.7918 Error: 0.61015 Loss: 0.87905 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1353280 Examples seen. Accuracy: 0.7898 Error: 0.57097 Loss: 0.65333 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.26s\n", + "1353920 Examples seen. Accuracy: 0.7936 Error: 0.48828 Loss: 0.49402 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "1354560 Examples seen. Accuracy: 0.7947 Error: 0.51336 Loss: 0.54540 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1355200 Examples seen. Accuracy: 0.7927 Error: 0.62883 Loss: 0.57372 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "1355840 Examples seen. Accuracy: 0.7930 Error: 0.43752 Loss: 0.45187 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.27s\n", + "1356480 Examples seen. Accuracy: 0.7933 Error: 0.39392 Loss: 0.41745 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.25s\n", + "1357120 Examples seen. Accuracy: 0.7932 Error: 0.47532 Loss: 0.45899 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1357760 Examples seen. Accuracy: 0.7921 Error: 0.53262 Loss: 0.53002 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "1358400 Examples seen. Accuracy: 0.7923 Error: 0.56730 Loss: 0.47916 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.30s\n", + "1359040 Examples seen. Accuracy: 0.7900 Error: 0.67767 Loss: 0.79810 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1359680 Examples seen. Accuracy: 0.7905 Error: 0.48715 Loss: 0.47946 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 34 Examples seen:1360000 Validation Accuracy: 0.8358 Validation Error: 0.4639 Validation Loss: 0.4947 Total time: 119.74min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.531 Min Weight: -0.584 Max Output: 4.877 Min Output: -5.516 TNNetConvolutionLinear 32,32,64 Times: 30.56s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.877 Min Output: -1.259 TNNetMaxPool 8,8,64 Times: 6.99s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.859 Min Weight: 0.813 Max Output: 4.941 Min Output: -2.604 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.287 Min Weight: -0.305 Max Output: 10.358 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.44s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.300 Min Weight: -0.293 Max Output: 10.262 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.27s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.281 Min Weight: -0.239 Max Output: 7.517 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.41s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.246 Min Weight: -0.215 Max Output: 3.048 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.42s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.048 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.04s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.048 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.42s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.347 Min Weight: -0.268 Max Output: 4.734 Min Output: -9.179 TNNetFullConnectLinear 10,1,1 Times: 0.10s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.596 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3219 minutes. 50 epochs: 1.9349 hours.\n", + "Epochs: 34. Working time: 2.00 hours.\n", + "1360640 Examples seen. Accuracy: 0.7904 Error: 0.66551 Loss: 0.77258 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.31s\n", + "1361280 Examples seen. Accuracy: 0.7893 Error: 0.60228 Loss: 0.67187 Threads: 2 Forward time: 0.75s Backward time: 0.40s Step time: 2.29s\n", + "1361920 Examples seen. Accuracy: 0.7885 Error: 0.47757 Loss: 0.51428 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.29s\n", + "1362560 Examples seen. Accuracy: 0.7899 Error: 0.64353 Loss: 0.73542 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1363200 Examples seen. Accuracy: 0.7938 Error: 0.42913 Loss: 0.53795 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "1363840 Examples seen. Accuracy: 0.7930 Error: 0.53567 Loss: 0.56472 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1364480 Examples seen. Accuracy: 0.7929 Error: 0.47312 Loss: 0.46882 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.27s\n", + "1365120 Examples seen. Accuracy: 0.7896 Error: 0.53248 Loss: 0.55358 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.33s\n", + "1365760 Examples seen. Accuracy: 0.7913 Error: 0.51667 Loss: 0.54214 Threads: 2 Forward time: 0.70s Backward time: 0.45s Step time: 2.30s\n", + "1366400 Examples seen. Accuracy: 0.7898 Error: 0.60868 Loss: 0.59832 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.33s\n", + "1367040 Examples seen. Accuracy: 0.7895 Error: 0.55792 Loss: 0.63774 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.35s\n", + "1367680 Examples seen. Accuracy: 0.7903 Error: 0.68655 Loss: 0.78163 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.33s\n", + "1368320 Examples seen. Accuracy: 0.7885 Error: 0.63714 Loss: 0.68270 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1368960 Examples seen. Accuracy: 0.7876 Error: 0.57575 Loss: 0.63247 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.32s\n", + "1369600 Examples seen. Accuracy: 0.7886 Error: 0.74258 Loss: 0.91724 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.30s\n", + "1370240 Examples seen. Accuracy: 0.7857 Error: 0.75369 Loss: 1.01436 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.35s\n", + "1370880 Examples seen. Accuracy: 0.7871 Error: 0.56847 Loss: 0.56136 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.37s\n", + "1371520 Examples seen. Accuracy: 0.7876 Error: 0.58679 Loss: 0.62115 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.31s\n", + "1372160 Examples seen. Accuracy: 0.7861 Error: 0.69325 Loss: 0.73734 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1372800 Examples seen. Accuracy: 0.7870 Error: 0.55757 Loss: 0.56305 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1373440 Examples seen. Accuracy: 0.7897 Error: 0.53923 Loss: 0.55133 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.32s\n", + "1374080 Examples seen. Accuracy: 0.7915 Error: 0.41593 Loss: 0.44189 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.27s\n", + "1374720 Examples seen. Accuracy: 0.7926 Error: 0.44439 Loss: 0.37935 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1375360 Examples seen. Accuracy: 0.7926 Error: 0.48982 Loss: 0.47245 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1376000 Examples seen. Accuracy: 0.7918 Error: 0.62969 Loss: 0.91535 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1376640 Examples seen. Accuracy: 0.7948 Error: 0.59784 Loss: 0.64116 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.28s\n", + "1377280 Examples seen. Accuracy: 0.7954 Error: 0.44505 Loss: 0.44538 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.39s\n", + "1377920 Examples seen. Accuracy: 0.7974 Error: 0.47687 Loss: 0.42464 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1378560 Examples seen. Accuracy: 0.7950 Error: 0.46202 Loss: 0.48478 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.29s\n", + "1379200 Examples seen. Accuracy: 0.7921 Error: 0.62656 Loss: 0.57290 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.28s\n", + "1379840 Examples seen. Accuracy: 0.7911 Error: 0.52512 Loss: 0.43350 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1380480 Examples seen. Accuracy: 0.7949 Error: 0.45741 Loss: 0.49912 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.27s\n", + "1381120 Examples seen. Accuracy: 0.7921 Error: 0.53146 Loss: 0.51007 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.28s\n", + "1381760 Examples seen. Accuracy: 0.7928 Error: 0.52270 Loss: 0.56671 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.37s\n", + "1382400 Examples seen. Accuracy: 0.7944 Error: 0.58356 Loss: 0.57412 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1383040 Examples seen. Accuracy: 0.7940 Error: 0.74110 Loss: 0.82604 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1383680 Examples seen. Accuracy: 0.7940 Error: 0.67915 Loss: 0.80165 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1384320 Examples seen. Accuracy: 0.7960 Error: 0.55723 Loss: 0.58448 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.29s\n", + "1384960 Examples seen. Accuracy: 0.7951 Error: 0.49551 Loss: 0.46810 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1385600 Examples seen. Accuracy: 0.7968 Error: 0.62934 Loss: 0.89585 Threads: 2 Forward time: 0.70s Backward time: 0.46s Step time: 2.29s\n", + "1386240 Examples seen. Accuracy: 0.7942 Error: 0.61803 Loss: 0.55267 Threads: 2 Forward time: 0.70s Backward time: 0.47s Step time: 2.44s\n", + "1386880 Examples seen. Accuracy: 0.7925 Error: 0.40230 Loss: 0.39612 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.33s\n", + "1387520 Examples seen. Accuracy: 0.7933 Error: 0.60803 Loss: 0.75251 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.32s\n", + "1388160 Examples seen. Accuracy: 0.7930 Error: 0.69201 Loss: 0.77757 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.26s\n", + "1388800 Examples seen. Accuracy: 0.7913 Error: 0.63678 Loss: 0.72920 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1389440 Examples seen. Accuracy: 0.7923 Error: 0.36882 Loss: 0.28884 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1390080 Examples seen. Accuracy: 0.7945 Error: 0.48729 Loss: 0.46907 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1390720 Examples seen. Accuracy: 0.7958 Error: 0.42891 Loss: 0.45197 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.27s\n", + "1391360 Examples seen. Accuracy: 0.7944 Error: 0.41582 Loss: 0.33006 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.24s\n", + "1392000 Examples seen. Accuracy: 0.7927 Error: 0.53415 Loss: 0.51557 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.25s\n", + "1392640 Examples seen. Accuracy: 0.7920 Error: 0.58877 Loss: 0.60200 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1393280 Examples seen. Accuracy: 0.7918 Error: 0.50087 Loss: 0.51002 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1393920 Examples seen. Accuracy: 0.7913 Error: 0.59471 Loss: 0.60634 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1394560 Examples seen. Accuracy: 0.7919 Error: 0.62774 Loss: 0.73920 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "1395200 Examples seen. Accuracy: 0.7892 Error: 0.49100 Loss: 0.46820 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.29s\n", + "1395840 Examples seen. Accuracy: 0.7896 Error: 0.67802 Loss: 0.67544 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.28s\n", + "1396480 Examples seen. Accuracy: 0.7885 Error: 0.56594 Loss: 0.58914 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1397120 Examples seen. Accuracy: 0.7841 Error: 0.70194 Loss: 0.67783 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1397760 Examples seen. Accuracy: 0.7861 Error: 0.54178 Loss: 0.52979 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.27s\n", + "1398400 Examples seen. Accuracy: 0.7854 Error: 0.47421 Loss: 0.47343 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1399040 Examples seen. Accuracy: 0.7868 Error: 0.53248 Loss: 0.52474 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.29s\n", + "1399680 Examples seen. Accuracy: 0.7859 Error: 0.53881 Loss: 0.53190 Threads: 2 Forward time: 0.72s Backward time: 0.45s Step time: 2.33s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 35 Examples seen:1400000 Validation Accuracy: 0.8376 Validation Error: 0.4603 Validation Loss: 0.4909 Total time: 123.20min\n", + "Epoch time: 2.4302 minutes. 50 epochs: 2.0252 hours.\n", + "Epochs: 35. Working time: 2.05 hours.\n", + "1400640 Examples seen. Accuracy: 0.7871 Error: 0.37644 Loss: 0.33547 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1401280 Examples seen. Accuracy: 0.7890 Error: 0.49524 Loss: 0.45575 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.26s\n", + "1401920 Examples seen. Accuracy: 0.7863 Error: 0.53770 Loss: 0.55959 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1402560 Examples seen. Accuracy: 0.7884 Error: 0.38910 Loss: 0.38086 Threads: 2 Forward time: 0.73s Backward time: 0.41s Step time: 2.30s\n", + "1403200 Examples seen. Accuracy: 0.7862 Error: 0.55090 Loss: 0.52832 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.29s\n", + "1403840 Examples seen. Accuracy: 0.7871 Error: 0.46407 Loss: 0.54209 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.32s\n", + "1404480 Examples seen. Accuracy: 0.7879 Error: 0.60326 Loss: 0.55161 Threads: 2 Forward time: 0.71s Backward time: 0.46s Step time: 2.46s\n", + "1405120 Examples seen. Accuracy: 0.7883 Error: 0.61148 Loss: 0.64802 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.31s\n", + "1405760 Examples seen. Accuracy: 0.7879 Error: 0.37844 Loss: 0.40931 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "1406400 Examples seen. Accuracy: 0.7911 Error: 0.42469 Loss: 0.38576 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1407040 Examples seen. Accuracy: 0.7854 Error: 0.54161 Loss: 0.48758 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1407680 Examples seen. Accuracy: 0.7879 Error: 0.51393 Loss: 0.61240 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1408320 Examples seen. Accuracy: 0.7884 Error: 0.64943 Loss: 0.67040 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1408960 Examples seen. Accuracy: 0.7899 Error: 0.63990 Loss: 0.70231 Threads: 2 Forward time: 0.73s Backward time: 0.44s Step time: 2.39s\n", + "1409600 Examples seen. Accuracy: 0.7917 Error: 0.51016 Loss: 0.55920 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.34s\n", + "1410240 Examples seen. Accuracy: 0.7934 Error: 0.58073 Loss: 0.71511 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1410880 Examples seen. Accuracy: 0.7925 Error: 0.62490 Loss: 0.66567 Threads: 2 Forward time: 0.73s Backward time: 0.50s Step time: 2.41s\n", + "1411520 Examples seen. Accuracy: 0.7940 Error: 0.43440 Loss: 0.48871 Threads: 2 Forward time: 0.74s Backward time: 0.40s Step time: 2.36s\n", + "1412160 Examples seen. Accuracy: 0.7920 Error: 0.65292 Loss: 0.64483 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1412800 Examples seen. Accuracy: 0.7921 Error: 0.52433 Loss: 0.49698 Threads: 2 Forward time: 0.75s Backward time: 0.45s Step time: 2.43s\n", + "1413440 Examples seen. Accuracy: 0.7919 Error: 0.58720 Loss: 0.57653 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.31s\n", + "1414080 Examples seen. Accuracy: 0.7929 Error: 0.59628 Loss: 0.55744 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.25s\n", + "1414720 Examples seen. Accuracy: 0.7929 Error: 0.58368 Loss: 0.55869 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.26s\n", + "1415360 Examples seen. Accuracy: 0.7948 Error: 0.50377 Loss: 0.42479 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "1416000 Examples seen. Accuracy: 0.7955 Error: 0.50471 Loss: 0.58178 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.27s\n", + "1416640 Examples seen. Accuracy: 0.7946 Error: 0.60126 Loss: 0.67530 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.32s\n", + "1417280 Examples seen. Accuracy: 0.7974 Error: 0.55261 Loss: 0.53645 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.31s\n", + "1417920 Examples seen. Accuracy: 0.7964 Error: 0.53559 Loss: 0.56596 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.35s\n", + "1418560 Examples seen. Accuracy: 0.7969 Error: 0.44782 Loss: 0.44811 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.34s\n", + "1419200 Examples seen. Accuracy: 0.7970 Error: 0.52728 Loss: 0.43709 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.29s\n", + "1419840 Examples seen. Accuracy: 0.7973 Error: 0.55616 Loss: 0.65602 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.40s\n", + "1420480 Examples seen. Accuracy: 0.7956 Error: 0.58492 Loss: 0.71418 Threads: 2 Forward time: 0.75s Backward time: 0.41s Step time: 2.34s\n", + "1421120 Examples seen. Accuracy: 0.7954 Error: 0.63406 Loss: 0.69189 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.29s\n", + "1421760 Examples seen. Accuracy: 0.7964 Error: 0.54953 Loss: 0.57893 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1422400 Examples seen. Accuracy: 0.7968 Error: 0.53412 Loss: 0.66629 Threads: 2 Forward time: 0.70s Backward time: 0.37s Step time: 2.26s\n", + "1423040 Examples seen. Accuracy: 0.7970 Error: 0.65509 Loss: 0.63397 Threads: 2 Forward time: 0.73s Backward time: 0.38s Step time: 2.26s\n", + "1423680 Examples seen. Accuracy: 0.7960 Error: 0.70441 Loss: 0.73984 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1424320 Examples seen. Accuracy: 0.7966 Error: 0.62869 Loss: 0.59629 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.23s\n", + "1424960 Examples seen. Accuracy: 0.7958 Error: 0.55503 Loss: 0.57796 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.25s\n", + "1425600 Examples seen. Accuracy: 0.7982 Error: 0.46773 Loss: 0.44526 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1426240 Examples seen. Accuracy: 0.7983 Error: 0.53743 Loss: 0.59502 Threads: 2 Forward time: 0.74s Backward time: 0.41s Step time: 2.28s\n", + "1426880 Examples seen. Accuracy: 0.7995 Error: 0.52315 Loss: 0.64188 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.29s\n", + "1427520 Examples seen. Accuracy: 0.8011 Error: 0.59131 Loss: 0.59088 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.39s\n", + "1428160 Examples seen. Accuracy: 0.7991 Error: 0.41332 Loss: 0.39919 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.31s\n", + "1428800 Examples seen. Accuracy: 0.7987 Error: 0.51351 Loss: 0.57141 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1429440 Examples seen. Accuracy: 0.7975 Error: 0.57176 Loss: 0.76234 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.26s\n", + "1430080 Examples seen. Accuracy: 0.7966 Error: 0.54578 Loss: 0.53978 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1430720 Examples seen. Accuracy: 0.7971 Error: 0.59388 Loss: 0.70533 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1431360 Examples seen. Accuracy: 0.7976 Error: 0.48014 Loss: 0.44289 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1432000 Examples seen. Accuracy: 0.7974 Error: 0.42022 Loss: 0.37017 Threads: 2 Forward time: 0.66s Backward time: 0.44s Step time: 2.27s\n", + "1432640 Examples seen. Accuracy: 0.7971 Error: 0.44046 Loss: 0.39711 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1433280 Examples seen. Accuracy: 0.7944 Error: 0.70855 Loss: 0.81025 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.26s\n", + "1433920 Examples seen. Accuracy: 0.7954 Error: 0.55763 Loss: 0.58168 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1434560 Examples seen. Accuracy: 0.7952 Error: 0.49613 Loss: 0.47579 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1435200 Examples seen. Accuracy: 0.7937 Error: 0.58339 Loss: 0.58682 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.28s\n", + "1435840 Examples seen. Accuracy: 0.7919 Error: 0.57869 Loss: 0.59606 Threads: 2 Forward time: 0.76s Backward time: 0.41s Step time: 2.31s\n", + "1436480 Examples seen. Accuracy: 0.7929 Error: 0.37381 Loss: 0.34753 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1437120 Examples seen. Accuracy: 0.7932 Error: 0.49441 Loss: 0.52788 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1437760 Examples seen. Accuracy: 0.7940 Error: 0.48157 Loss: 0.39509 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1438400 Examples seen. Accuracy: 0.7939 Error: 0.48748 Loss: 0.49990 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1439040 Examples seen. Accuracy: 0.7972 Error: 0.50280 Loss: 0.39764 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.25s\n", + "1439680 Examples seen. Accuracy: 0.7945 Error: 0.71343 Loss: 0.84558 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.27s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 36 Examples seen:1440000 Validation Accuracy: 0.8388 Validation Error: 0.4580 Validation Loss: 0.4900 Total time: 126.64min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.541 Min Weight: -0.592 Max Output: 4.994 Min Output: -5.543 TNNetConvolutionLinear 32,32,64 Times: 30.23s 0.07s Parent:0\n", + "Layer 2 Max Output: 4.994 Min Output: -1.173 TNNetMaxPool 8,8,64 Times: 7.00s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.871 Min Weight: 0.826 Max Output: 4.990 Min Output: -2.474 TNNetMovingStdNormalization 8,8,64 Times: 0.16s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.287 Min Weight: -0.317 Max Output: 10.400 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.27s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.309 Min Weight: -0.301 Max Output: 10.716 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.21s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.284 Min Weight: -0.241 Max Output: 7.928 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.32s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.241 Min Weight: -0.215 Max Output: 3.236 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.33s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.236 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.236 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.37s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.346 Min Weight: -0.267 Max Output: 5.029 Min Output: -10.083 TNNetFullConnectLinear 10,1,1 Times: 0.12s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.582 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3635 minutes. 50 epochs: 1.9696 hours.\n", + "Epochs: 36. Working time: 2.11 hours.\n", + "1440640 Examples seen. Accuracy: 0.7952 Error: 0.48482 Loss: 0.42991 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.29s\n", + "1441280 Examples seen. Accuracy: 0.7974 Error: 0.67418 Loss: 0.67974 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.27s\n", + "1441920 Examples seen. Accuracy: 0.7988 Error: 0.66769 Loss: 0.87548 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "1442560 Examples seen. Accuracy: 0.7974 Error: 0.50733 Loss: 0.49361 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1443200 Examples seen. Accuracy: 0.7965 Error: 0.57954 Loss: 0.55871 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1443840 Examples seen. Accuracy: 0.7961 Error: 0.59387 Loss: 0.67577 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1444480 Examples seen. Accuracy: 0.7965 Error: 0.54834 Loss: 0.51276 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1445120 Examples seen. Accuracy: 0.7955 Error: 0.57495 Loss: 0.54622 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "1445760 Examples seen. Accuracy: 0.7956 Error: 0.57268 Loss: 0.68491 Threads: 2 Forward time: 0.68s Backward time: 0.46s Step time: 2.29s\n", + "1446400 Examples seen. Accuracy: 0.7956 Error: 0.58457 Loss: 0.57786 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1447040 Examples seen. Accuracy: 0.7944 Error: 0.60213 Loss: 0.74947 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.28s\n", + "1447680 Examples seen. Accuracy: 0.7976 Error: 0.52798 Loss: 0.55201 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "1448320 Examples seen. Accuracy: 0.7956 Error: 0.58146 Loss: 0.60742 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.29s\n", + "1448960 Examples seen. Accuracy: 0.7945 Error: 0.62271 Loss: 0.64394 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1449600 Examples seen. Accuracy: 0.7932 Error: 0.48969 Loss: 0.64876 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1450240 Examples seen. Accuracy: 0.7898 Error: 0.46913 Loss: 0.50004 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1450880 Examples seen. Accuracy: 0.7896 Error: 0.61804 Loss: 0.71222 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1451520 Examples seen. Accuracy: 0.7906 Error: 0.65456 Loss: 0.70613 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.32s\n", + "1452160 Examples seen. Accuracy: 0.7901 Error: 0.65538 Loss: 0.65123 Threads: 2 Forward time: 0.89s Backward time: 0.59s Step time: 2.64s\n", + "1452800 Examples seen. Accuracy: 0.7934 Error: 0.54640 Loss: 0.68874 Threads: 2 Forward time: 0.74s Backward time: 0.45s Step time: 2.64s\n", + "1453440 Examples seen. Accuracy: 0.7934 Error: 0.68985 Loss: 0.84280 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.43s\n", + "1454080 Examples seen. Accuracy: 0.7917 Error: 0.46903 Loss: 0.42788 Threads: 2 Forward time: 0.70s Backward time: 0.44s Step time: 2.30s\n", + "1454720 Examples seen. Accuracy: 0.7950 Error: 0.50513 Loss: 0.49651 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1455360 Examples seen. Accuracy: 0.7969 Error: 0.44944 Loss: 0.49679 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1456000 Examples seen. Accuracy: 0.7944 Error: 0.64455 Loss: 0.58242 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1456640 Examples seen. Accuracy: 0.7930 Error: 0.54146 Loss: 0.50384 Threads: 2 Forward time: 0.85s Backward time: 0.54s Step time: 2.35s\n", + "1457280 Examples seen. Accuracy: 0.7899 Error: 0.79088 Loss: 0.99216 Threads: 2 Forward time: 0.74s Backward time: 0.44s Step time: 2.78s\n", + "1457920 Examples seen. Accuracy: 0.7920 Error: 0.60145 Loss: 0.66871 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.30s\n", + "1458560 Examples seen. Accuracy: 0.7927 Error: 0.53262 Loss: 0.50378 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "1459200 Examples seen. Accuracy: 0.7950 Error: 0.58732 Loss: 0.75836 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.27s\n", + "1459840 Examples seen. Accuracy: 0.7958 Error: 0.52407 Loss: 0.49234 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.27s\n", + "1460480 Examples seen. Accuracy: 0.7943 Error: 0.72053 Loss: 0.87277 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1461120 Examples seen. Accuracy: 0.7940 Error: 0.48818 Loss: 0.45383 Threads: 2 Forward time: 0.77s Backward time: 0.42s Step time: 2.33s\n", + "1461760 Examples seen. Accuracy: 0.7923 Error: 0.53458 Loss: 0.54493 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "1462400 Examples seen. Accuracy: 0.7919 Error: 0.61114 Loss: 0.70675 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "1463040 Examples seen. Accuracy: 0.7926 Error: 0.47122 Loss: 0.48614 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1463680 Examples seen. Accuracy: 0.7914 Error: 0.45540 Loss: 0.38718 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.26s\n", + "1464320 Examples seen. Accuracy: 0.7904 Error: 0.59693 Loss: 0.85783 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1464960 Examples seen. Accuracy: 0.7929 Error: 0.45974 Loss: 0.53702 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1465600 Examples seen. Accuracy: 0.7940 Error: 0.54415 Loss: 0.59026 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1466240 Examples seen. Accuracy: 0.7946 Error: 0.63333 Loss: 0.78580 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1466880 Examples seen. Accuracy: 0.7955 Error: 0.58113 Loss: 0.61179 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.28s\n", + "1467520 Examples seen. Accuracy: 0.7961 Error: 0.64805 Loss: 0.65126 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.29s\n", + "1468160 Examples seen. Accuracy: 0.7967 Error: 0.53687 Loss: 0.55177 Threads: 2 Forward time: 0.71s Backward time: 0.38s Step time: 2.27s\n", + "1468800 Examples seen. Accuracy: 0.7973 Error: 0.48581 Loss: 0.47481 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1469440 Examples seen. Accuracy: 0.7950 Error: 0.61200 Loss: 0.70640 Threads: 2 Forward time: 0.71s Backward time: 0.45s Step time: 2.28s\n", + "1470080 Examples seen. Accuracy: 0.7955 Error: 0.48118 Loss: 0.56702 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.43s\n", + "1470720 Examples seen. Accuracy: 0.7969 Error: 0.41658 Loss: 0.39986 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.26s\n", + "1471360 Examples seen. Accuracy: 0.7975 Error: 0.46686 Loss: 0.47597 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1472000 Examples seen. Accuracy: 0.7963 Error: 0.56651 Loss: 0.69081 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.25s\n", + "1472640 Examples seen. Accuracy: 0.7945 Error: 0.50877 Loss: 0.49074 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1473280 Examples seen. Accuracy: 0.7935 Error: 0.58653 Loss: 0.54966 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.23s\n", + "1473920 Examples seen. Accuracy: 0.7962 Error: 0.51447 Loss: 0.62124 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "1474560 Examples seen. Accuracy: 0.7948 Error: 0.56459 Loss: 0.66240 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.30s\n", + "1475200 Examples seen. Accuracy: 0.7936 Error: 0.63402 Loss: 0.61693 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.28s\n", + "1475840 Examples seen. Accuracy: 0.7927 Error: 0.62608 Loss: 0.66371 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1476480 Examples seen. Accuracy: 0.7924 Error: 0.56012 Loss: 0.49800 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1477120 Examples seen. Accuracy: 0.7909 Error: 0.51056 Loss: 0.47419 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.33s\n", + "1477760 Examples seen. Accuracy: 0.7913 Error: 0.51500 Loss: 0.50281 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.29s\n", + "1478400 Examples seen. Accuracy: 0.7897 Error: 0.46979 Loss: 0.46062 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.26s\n", + "1479040 Examples seen. Accuracy: 0.7902 Error: 0.69819 Loss: 0.76152 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "1479680 Examples seen. Accuracy: 0.7904 Error: 0.55448 Loss: 0.53793 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "Starting Validation.\n", + "Epochs: 37 Examples seen:1480000 Validation Accuracy: 0.8380 Validation Error: 0.4552 Validation Loss: 0.4877 Total time: 130.08min\n", + "Epoch time: 2.3458 minutes. 50 epochs: 1.9549 hours.\n", + "Epochs: 37. Working time: 2.17 hours.\n", + "1480640 Examples seen. Accuracy: 0.7866 Error: 0.75347 Loss: 0.85586 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1481280 Examples seen. Accuracy: 0.7886 Error: 0.60225 Loss: 0.76428 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1481920 Examples seen. Accuracy: 0.7882 Error: 0.48668 Loss: 0.58719 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1482560 Examples seen. Accuracy: 0.7874 Error: 0.52782 Loss: 0.48245 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.22s\n", + "1483200 Examples seen. Accuracy: 0.7890 Error: 0.58961 Loss: 0.64006 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1483840 Examples seen. Accuracy: 0.7863 Error: 0.53571 Loss: 0.54080 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1484480 Examples seen. Accuracy: 0.7897 Error: 0.38843 Loss: 0.41312 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1485120 Examples seen. Accuracy: 0.7890 Error: 0.66746 Loss: 0.81835 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1485760 Examples seen. Accuracy: 0.7903 Error: 0.50619 Loss: 0.51885 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.26s\n", + "1486400 Examples seen. Accuracy: 0.7919 Error: 0.52483 Loss: 0.48389 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1487040 Examples seen. Accuracy: 0.7918 Error: 0.51182 Loss: 0.46692 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1487680 Examples seen. Accuracy: 0.7911 Error: 0.52891 Loss: 0.60808 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.23s\n", + "1488320 Examples seen. Accuracy: 0.7905 Error: 0.47468 Loss: 0.44027 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1488960 Examples seen. Accuracy: 0.7916 Error: 0.52007 Loss: 0.48119 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.42s\n", + "1489600 Examples seen. Accuracy: 0.7913 Error: 0.59431 Loss: 0.66019 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1490240 Examples seen. Accuracy: 0.7928 Error: 0.28465 Loss: 0.20264 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1490880 Examples seen. Accuracy: 0.7939 Error: 0.55236 Loss: 0.61460 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1491520 Examples seen. Accuracy: 0.7974 Error: 0.56037 Loss: 0.60860 Threads: 2 Forward time: 0.67s Backward time: 0.44s Step time: 2.23s\n", + "1492160 Examples seen. Accuracy: 0.7966 Error: 0.60995 Loss: 0.60463 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1492800 Examples seen. Accuracy: 0.7942 Error: 0.46108 Loss: 0.39231 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "1493440 Examples seen. Accuracy: 0.7929 Error: 0.58913 Loss: 0.53430 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.29s\n", + "1494080 Examples seen. Accuracy: 0.7897 Error: 0.62714 Loss: 0.68551 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "1494720 Examples seen. Accuracy: 0.7907 Error: 0.47702 Loss: 0.45045 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.26s\n", + "1495360 Examples seen. Accuracy: 0.7905 Error: 0.51511 Loss: 0.47296 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1496000 Examples seen. Accuracy: 0.7906 Error: 0.55911 Loss: 0.58831 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1496640 Examples seen. Accuracy: 0.7925 Error: 0.45635 Loss: 0.44314 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.30s\n", + "1497280 Examples seen. Accuracy: 0.7932 Error: 0.55970 Loss: 0.62575 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.31s\n", + "1497920 Examples seen. Accuracy: 0.7934 Error: 0.58497 Loss: 0.60486 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.29s\n", + "1498560 Examples seen. Accuracy: 0.7910 Error: 0.58976 Loss: 0.63906 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1499200 Examples seen. Accuracy: 0.7908 Error: 0.71239 Loss: 0.91936 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.25s\n", + "1499840 Examples seen. Accuracy: 0.7906 Error: 0.62715 Loss: 0.66625 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1500480 Examples seen. Accuracy: 0.7894 Error: 0.75906 Loss: 0.78093 Threads: 2 Forward time: 0.73s Backward time: 0.41s Step time: 2.25s\n", + "1501120 Examples seen. Accuracy: 0.7919 Error: 0.50715 Loss: 0.51536 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1501760 Examples seen. Accuracy: 0.7923 Error: 0.53881 Loss: 0.60699 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.27s\n", + "1502400 Examples seen. Accuracy: 0.7930 Error: 0.43168 Loss: 0.45120 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1503040 Examples seen. Accuracy: 0.7954 Error: 0.55112 Loss: 0.50520 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1503680 Examples seen. Accuracy: 0.7949 Error: 0.64072 Loss: 0.69666 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.27s\n", + "1504320 Examples seen. Accuracy: 0.7916 Error: 0.63412 Loss: 0.73455 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1504960 Examples seen. Accuracy: 0.7906 Error: 0.59459 Loss: 0.65094 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1505600 Examples seen. Accuracy: 0.7917 Error: 0.48038 Loss: 0.43522 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.29s\n", + "1506240 Examples seen. Accuracy: 0.7914 Error: 0.50443 Loss: 0.49689 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1506880 Examples seen. Accuracy: 0.7934 Error: 0.51415 Loss: 0.49254 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.29s\n", + "1507520 Examples seen. Accuracy: 0.7931 Error: 0.42593 Loss: 0.48589 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.30s\n", + "1508160 Examples seen. Accuracy: 0.7932 Error: 0.47379 Loss: 0.39951 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.26s\n", + "1508800 Examples seen. Accuracy: 0.7930 Error: 0.51432 Loss: 0.52523 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.33s\n", + "1509440 Examples seen. Accuracy: 0.7939 Error: 0.55133 Loss: 0.44992 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1510080 Examples seen. Accuracy: 0.7927 Error: 0.64993 Loss: 0.75052 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.28s\n", + "1510720 Examples seen. Accuracy: 0.7923 Error: 0.52962 Loss: 0.45140 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1511360 Examples seen. Accuracy: 0.7939 Error: 0.49794 Loss: 0.64944 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1512000 Examples seen. Accuracy: 0.7955 Error: 0.48969 Loss: 0.48337 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.25s\n", + "1512640 Examples seen. Accuracy: 0.7944 Error: 0.50908 Loss: 0.45286 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.27s\n", + "1513280 Examples seen. Accuracy: 0.7983 Error: 0.35618 Loss: 0.37822 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.33s\n", + "1513920 Examples seen. Accuracy: 0.7970 Error: 0.63261 Loss: 0.77343 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1514560 Examples seen. Accuracy: 0.7955 Error: 0.66367 Loss: 0.81705 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1515200 Examples seen. Accuracy: 0.7943 Error: 0.55908 Loss: 0.60761 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1515840 Examples seen. Accuracy: 0.7921 Error: 0.69640 Loss: 0.78736 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1516480 Examples seen. Accuracy: 0.7918 Error: 0.60858 Loss: 0.70102 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1517120 Examples seen. Accuracy: 0.7934 Error: 0.77586 Loss: 0.81878 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "1517760 Examples seen. Accuracy: 0.7935 Error: 0.51998 Loss: 0.48167 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.27s\n", + "1518400 Examples seen. Accuracy: 0.7936 Error: 0.60375 Loss: 0.79310 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "1519040 Examples seen. Accuracy: 0.7926 Error: 0.62412 Loss: 0.63009 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1519680 Examples seen. Accuracy: 0.7929 Error: 0.53028 Loss: 0.54054 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.25s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 38 Examples seen:1520000 Validation Accuracy: 0.8393 Validation Error: 0.4531 Validation Loss: 0.4848 Total time: 133.49min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.553 Min Weight: -0.601 Max Output: 5.046 Min Output: -5.599 TNNetConvolutionLinear 32,32,64 Times: 30.14s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.046 Min Output: -1.176 TNNetMaxPool 8,8,64 Times: 6.96s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.881 Min Weight: 0.838 Max Output: 4.969 Min Output: -2.454 TNNetMovingStdNormalization 8,8,64 Times: 0.12s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.284 Min Weight: -0.327 Max Output: 10.310 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.23s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.322 Min Weight: -0.306 Max Output: 10.485 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.10s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.286 Min Weight: -0.243 Max Output: 7.926 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.25s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.230 Min Weight: -0.216 Max Output: 3.227 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.18s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.227 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.227 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.42s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.339 Min Weight: -0.268 Max Output: 5.057 Min Output: -10.213 TNNetFullConnectLinear 10,1,1 Times: 0.13s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.566 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3406 minutes. 50 epochs: 1.9505 hours.\n", + "Epochs: 38. Working time: 2.22 hours.\n", + "1520640 Examples seen. Accuracy: 0.7928 Error: 0.67371 Loss: 0.73775 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1521280 Examples seen. Accuracy: 0.7945 Error: 0.58567 Loss: 0.77671 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1521920 Examples seen. Accuracy: 0.7960 Error: 0.46430 Loss: 0.41841 Threads: 2 Forward time: 0.74s Backward time: 0.41s Step time: 2.26s\n", + "1522560 Examples seen. Accuracy: 0.7958 Error: 0.55571 Loss: 0.58948 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1523200 Examples seen. Accuracy: 0.7980 Error: 0.44864 Loss: 0.43539 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1523840 Examples seen. Accuracy: 0.7966 Error: 0.69253 Loss: 0.85449 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1524480 Examples seen. Accuracy: 0.7939 Error: 0.44124 Loss: 0.43668 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.29s\n", + "1525120 Examples seen. Accuracy: 0.7961 Error: 0.62615 Loss: 0.66965 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1525760 Examples seen. Accuracy: 0.7952 Error: 0.54026 Loss: 0.54328 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "1526400 Examples seen. Accuracy: 0.7951 Error: 0.49684 Loss: 0.67531 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1527040 Examples seen. Accuracy: 0.7930 Error: 0.68212 Loss: 0.72117 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1527680 Examples seen. Accuracy: 0.7940 Error: 0.58617 Loss: 0.61499 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.22s\n", + "1528320 Examples seen. Accuracy: 0.7944 Error: 0.56039 Loss: 0.52445 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1528960 Examples seen. Accuracy: 0.7960 Error: 0.49814 Loss: 0.49748 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1529600 Examples seen. Accuracy: 0.7962 Error: 0.56546 Loss: 0.57337 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1530240 Examples seen. Accuracy: 0.7960 Error: 0.55079 Loss: 0.55246 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "1530880 Examples seen. Accuracy: 0.7953 Error: 0.54197 Loss: 0.65231 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1531520 Examples seen. Accuracy: 0.7964 Error: 0.47446 Loss: 0.46548 Threads: 2 Forward time: 0.75s Backward time: 0.38s Step time: 2.22s\n", + "1532160 Examples seen. Accuracy: 0.7978 Error: 0.46482 Loss: 0.49894 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.23s\n", + "1532800 Examples seen. Accuracy: 0.7991 Error: 0.53313 Loss: 0.51641 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1533440 Examples seen. Accuracy: 0.7986 Error: 0.39118 Loss: 0.34654 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.26s\n", + "1534080 Examples seen. Accuracy: 0.7995 Error: 0.46553 Loss: 0.41049 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1534720 Examples seen. Accuracy: 0.7979 Error: 0.49474 Loss: 0.53166 Threads: 2 Forward time: 0.74s Backward time: 0.39s Step time: 2.22s\n", + "1535360 Examples seen. Accuracy: 0.7967 Error: 0.61258 Loss: 0.70624 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "1536000 Examples seen. Accuracy: 0.7966 Error: 0.45353 Loss: 0.43459 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1536640 Examples seen. Accuracy: 0.7966 Error: 0.61230 Loss: 0.63005 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.18s\n", + "1537280 Examples seen. Accuracy: 0.7960 Error: 0.59669 Loss: 0.68752 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.20s\n", + "1537920 Examples seen. Accuracy: 0.7945 Error: 0.69669 Loss: 0.89655 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.27s\n", + "1538560 Examples seen. Accuracy: 0.7945 Error: 0.62914 Loss: 0.74424 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1539200 Examples seen. Accuracy: 0.7960 Error: 0.67901 Loss: 0.73963 Threads: 2 Forward time: 0.65s Backward time: 0.38s Step time: 2.20s\n", + "1539840 Examples seen. Accuracy: 0.7953 Error: 0.64537 Loss: 0.68970 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.17s\n", + "1540480 Examples seen. Accuracy: 0.7921 Error: 0.62359 Loss: 0.58386 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.18s\n", + "1541120 Examples seen. Accuracy: 0.7956 Error: 0.54447 Loss: 0.57641 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.19s\n", + "1541760 Examples seen. Accuracy: 0.7927 Error: 0.52883 Loss: 0.59555 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.17s\n", + "1542400 Examples seen. Accuracy: 0.7937 Error: 0.63052 Loss: 0.72026 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.17s\n", + "1543040 Examples seen. Accuracy: 0.7956 Error: 0.57521 Loss: 0.52067 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.17s\n", + "1543680 Examples seen. Accuracy: 0.7970 Error: 0.56016 Loss: 0.62935 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.20s\n", + "1544320 Examples seen. Accuracy: 0.7966 Error: 0.59682 Loss: 0.68506 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.18s\n", + "1544960 Examples seen. Accuracy: 0.7969 Error: 0.54919 Loss: 0.61232 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.19s\n", + "1545600 Examples seen. Accuracy: 0.7945 Error: 0.64745 Loss: 0.59091 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.17s\n", + "1546240 Examples seen. Accuracy: 0.7937 Error: 0.65913 Loss: 0.67844 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1546880 Examples seen. Accuracy: 0.7945 Error: 0.58297 Loss: 0.51839 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.20s\n", + "1547520 Examples seen. Accuracy: 0.7929 Error: 0.50542 Loss: 0.53786 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1548160 Examples seen. Accuracy: 0.7930 Error: 0.48890 Loss: 0.48153 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1548800 Examples seen. Accuracy: 0.7931 Error: 0.76413 Loss: 1.04752 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1549440 Examples seen. Accuracy: 0.7932 Error: 0.57961 Loss: 0.51512 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.18s\n", + "1550080 Examples seen. Accuracy: 0.7944 Error: 0.56650 Loss: 0.61709 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "1550720 Examples seen. Accuracy: 0.7924 Error: 0.43724 Loss: 0.45568 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.21s\n", + "1551360 Examples seen. Accuracy: 0.7929 Error: 0.66484 Loss: 0.78937 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.19s\n", + "1552000 Examples seen. Accuracy: 0.7945 Error: 0.39434 Loss: 0.36745 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1552640 Examples seen. Accuracy: 0.7984 Error: 0.43273 Loss: 0.42010 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "1553280 Examples seen. Accuracy: 0.7982 Error: 0.43916 Loss: 0.45716 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1553920 Examples seen. Accuracy: 0.7999 Error: 0.47695 Loss: 0.46539 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1554560 Examples seen. Accuracy: 0.7990 Error: 0.56959 Loss: 0.57689 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.21s\n", + "1555200 Examples seen. Accuracy: 0.7985 Error: 0.54629 Loss: 0.61258 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.22s\n", + "1555840 Examples seen. Accuracy: 0.7960 Error: 0.61928 Loss: 0.64982 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.25s\n", + "1556480 Examples seen. Accuracy: 0.7977 Error: 0.43986 Loss: 0.37436 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "1557120 Examples seen. Accuracy: 0.7967 Error: 0.51264 Loss: 0.48064 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1557760 Examples seen. Accuracy: 0.7958 Error: 0.67360 Loss: 0.67860 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.28s\n", + "1558400 Examples seen. Accuracy: 0.7958 Error: 0.33803 Loss: 0.38657 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1559040 Examples seen. Accuracy: 0.7974 Error: 0.64673 Loss: 0.65750 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.23s\n", + "1559680 Examples seen. Accuracy: 0.7957 Error: 0.57897 Loss: 0.54775 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 39 Examples seen:1560000 Validation Accuracy: 0.8402 Validation Error: 0.4503 Validation Loss: 0.4830 Total time: 136.86min\n", + "Epoch time: 2.3375 minutes. 50 epochs: 1.9479 hours.\n", + "Epochs: 39. Working time: 2.28 hours.\n", + "1560640 Examples seen. Accuracy: 0.7956 Error: 0.67319 Loss: 0.71352 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1561280 Examples seen. Accuracy: 0.7974 Error: 0.59394 Loss: 0.60337 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.21s\n", + "1561920 Examples seen. Accuracy: 0.7958 Error: 0.56277 Loss: 0.59270 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "1562560 Examples seen. Accuracy: 0.7972 Error: 0.52349 Loss: 0.46410 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1563200 Examples seen. Accuracy: 0.7975 Error: 0.62872 Loss: 0.69287 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "1563840 Examples seen. Accuracy: 0.7969 Error: 0.45314 Loss: 0.44901 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.19s\n", + "1564480 Examples seen. Accuracy: 0.7966 Error: 0.53668 Loss: 0.56319 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1565120 Examples seen. Accuracy: 0.7969 Error: 0.44478 Loss: 0.48647 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.21s\n", + "1565760 Examples seen. Accuracy: 0.7952 Error: 0.68136 Loss: 0.73749 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.20s\n", + "1566400 Examples seen. Accuracy: 0.7977 Error: 0.45363 Loss: 0.46525 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.20s\n", + "1567040 Examples seen. Accuracy: 0.7968 Error: 0.52275 Loss: 0.56796 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1567680 Examples seen. Accuracy: 0.7972 Error: 0.63848 Loss: 0.64375 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "1568320 Examples seen. Accuracy: 0.7973 Error: 0.51971 Loss: 0.52722 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.28s\n", + "1568960 Examples seen. Accuracy: 0.7962 Error: 0.55969 Loss: 0.58277 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.33s\n", + "1569600 Examples seen. Accuracy: 0.7960 Error: 0.39806 Loss: 0.34391 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1570240 Examples seen. Accuracy: 0.7971 Error: 0.44104 Loss: 0.46381 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1570880 Examples seen. Accuracy: 0.7964 Error: 0.53720 Loss: 0.53367 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1571520 Examples seen. Accuracy: 0.7968 Error: 0.46902 Loss: 0.49824 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1572160 Examples seen. Accuracy: 0.7974 Error: 0.61437 Loss: 0.61245 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.24s\n", + "1572800 Examples seen. Accuracy: 0.7973 Error: 0.50445 Loss: 0.66929 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.22s\n", + "1573440 Examples seen. Accuracy: 0.7979 Error: 0.54081 Loss: 0.58838 Threads: 2 Forward time: 0.66s Backward time: 0.43s Step time: 2.24s\n", + "1574080 Examples seen. Accuracy: 0.7998 Error: 0.52119 Loss: 0.54364 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1574720 Examples seen. Accuracy: 0.7993 Error: 0.68056 Loss: 0.72650 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1575360 Examples seen. Accuracy: 0.8020 Error: 0.67658 Loss: 0.84009 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.21s\n", + "1576000 Examples seen. Accuracy: 0.8001 Error: 0.53027 Loss: 0.65733 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1576640 Examples seen. Accuracy: 0.7987 Error: 0.48740 Loss: 0.48594 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1577280 Examples seen. Accuracy: 0.7986 Error: 0.63780 Loss: 0.77002 Threads: 2 Forward time: 0.69s Backward time: 0.36s Step time: 2.21s\n", + "1577920 Examples seen. Accuracy: 0.8005 Error: 0.49400 Loss: 0.55565 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.23s\n", + "1578560 Examples seen. Accuracy: 0.8013 Error: 0.27200 Loss: 0.24422 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.27s\n", + "1579200 Examples seen. Accuracy: 0.8006 Error: 0.42185 Loss: 0.36324 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.26s\n", + "1579840 Examples seen. Accuracy: 0.8019 Error: 0.60743 Loss: 0.67113 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "1580480 Examples seen. Accuracy: 0.8036 Error: 0.56529 Loss: 0.57365 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "1581120 Examples seen. Accuracy: 0.8012 Error: 0.53265 Loss: 0.50840 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1581760 Examples seen. Accuracy: 0.7972 Error: 0.55155 Loss: 0.48065 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1582400 Examples seen. Accuracy: 0.7953 Error: 0.55018 Loss: 0.59121 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.20s\n", + "1583040 Examples seen. Accuracy: 0.7922 Error: 0.62562 Loss: 0.69526 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.19s\n", + "1583680 Examples seen. Accuracy: 0.7930 Error: 0.53142 Loss: 0.60024 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.18s\n", + "1584320 Examples seen. Accuracy: 0.7934 Error: 0.60520 Loss: 0.64160 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1584960 Examples seen. Accuracy: 0.7939 Error: 0.50419 Loss: 0.44670 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1585600 Examples seen. Accuracy: 0.7924 Error: 0.54176 Loss: 0.58719 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.18s\n", + "1586240 Examples seen. Accuracy: 0.7924 Error: 0.67986 Loss: 0.67489 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.23s\n", + "1586880 Examples seen. Accuracy: 0.7932 Error: 0.50081 Loss: 0.43717 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.26s\n", + "1587520 Examples seen. Accuracy: 0.7935 Error: 0.51638 Loss: 0.50033 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.20s\n", + "1588160 Examples seen. Accuracy: 0.7921 Error: 0.61687 Loss: 0.77926 Threads: 2 Forward time: 0.65s Backward time: 0.38s Step time: 2.19s\n", + "1588800 Examples seen. Accuracy: 0.7926 Error: 0.59606 Loss: 0.63630 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.18s\n", + "1589440 Examples seen. Accuracy: 0.7950 Error: 0.45943 Loss: 0.47913 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.19s\n", + "1590080 Examples seen. Accuracy: 0.7978 Error: 0.40967 Loss: 0.40802 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.25s\n", + "1590720 Examples seen. Accuracy: 0.7993 Error: 0.54311 Loss: 0.59325 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.22s\n", + "1591360 Examples seen. Accuracy: 0.7994 Error: 0.53366 Loss: 0.64489 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.21s\n", + "1592000 Examples seen. Accuracy: 0.7997 Error: 0.50211 Loss: 0.46843 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.25s\n", + "1592640 Examples seen. Accuracy: 0.7990 Error: 0.47866 Loss: 0.45590 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "1593280 Examples seen. Accuracy: 0.8021 Error: 0.56508 Loss: 0.55671 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1593920 Examples seen. Accuracy: 0.8025 Error: 0.40057 Loss: 0.44647 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.20s\n", + "1594560 Examples seen. Accuracy: 0.8028 Error: 0.50300 Loss: 0.49433 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.19s\n", + "1595200 Examples seen. Accuracy: 0.8031 Error: 0.49374 Loss: 0.66467 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.20s\n", + "1595840 Examples seen. Accuracy: 0.8013 Error: 0.48335 Loss: 0.45182 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.18s\n", + "1596480 Examples seen. Accuracy: 0.8029 Error: 0.39189 Loss: 0.37119 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1597120 Examples seen. Accuracy: 0.8049 Error: 0.49278 Loss: 0.60319 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "1597760 Examples seen. Accuracy: 0.8031 Error: 0.65186 Loss: 0.76126 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1598400 Examples seen. Accuracy: 0.8031 Error: 0.46324 Loss: 0.48786 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.22s\n", + "1599040 Examples seen. Accuracy: 0.8021 Error: 0.53607 Loss: 0.71111 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1599680 Examples seen. Accuracy: 0.8019 Error: 0.61702 Loss: 0.64379 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "Starting Validation.\n", + "Epochs: 40 Examples seen:1600000 Validation Accuracy: 0.8396 Validation Error: 0.4481 Validation Loss: 0.4818 Total time: 140.22min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.567 Min Weight: -0.607 Max Output: 5.094 Min Output: -5.738 TNNetConvolutionLinear 32,32,64 Times: 30.15s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.094 Min Output: -1.141 TNNetMaxPool 8,8,64 Times: 7.07s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.890 Min Weight: 0.849 Max Output: 4.950 Min Output: -2.392 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.283 Min Weight: -0.333 Max Output: 10.168 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.07s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.326 Min Weight: -0.308 Max Output: 10.651 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.10s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.297 Min Weight: -0.245 Max Output: 8.100 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.23s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.218 Min Weight: -0.217 Max Output: 3.339 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.339 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.339 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.35s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.332 Min Weight: -0.268 Max Output: 5.123 Min Output: -10.639 TNNetFullConnectLinear 10,1,1 Times: 0.11s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.534 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Starting Testing.\n", + "Epochs: 40 Examples seen:1600000 Test Accuracy: 0.8323 Test Error: 0.4618 Test Loss: 0.5066 Total time: 141.26min\n", + "Epoch time: 2.3302 minutes. 50 epochs: 1.9418 hours.\n", + "Epochs: 40. Working time: 2.35 hours.\n", + "Learning rate set to: 0.00067\n", + "1600640 Examples seen. Accuracy: 0.8032 Error: 0.54834 Loss: 0.49500 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1601280 Examples seen. Accuracy: 0.8021 Error: 0.54158 Loss: 0.49562 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.24s\n", + "1601920 Examples seen. Accuracy: 0.8003 Error: 0.44752 Loss: 0.57778 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.31s\n", + "1602560 Examples seen. Accuracy: 0.7964 Error: 0.73845 Loss: 0.82155 Threads: 2 Forward time: 0.75s Backward time: 0.39s Step time: 2.29s\n", + "1603200 Examples seen. Accuracy: 0.7968 Error: 0.58723 Loss: 0.69386 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1603840 Examples seen. Accuracy: 0.7964 Error: 0.49952 Loss: 0.49230 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1604480 Examples seen. Accuracy: 0.7955 Error: 0.51424 Loss: 0.54972 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.28s\n", + "1605120 Examples seen. Accuracy: 0.7996 Error: 0.38084 Loss: 0.29860 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.25s\n", + "1605760 Examples seen. Accuracy: 0.7965 Error: 0.68793 Loss: 0.86853 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1606400 Examples seen. Accuracy: 0.7969 Error: 0.43971 Loss: 0.37113 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "1607040 Examples seen. Accuracy: 0.7968 Error: 0.45064 Loss: 0.45471 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.26s\n", + "1607680 Examples seen. Accuracy: 0.7952 Error: 0.47009 Loss: 0.53871 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1608320 Examples seen. Accuracy: 0.7946 Error: 0.49971 Loss: 0.46376 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.22s\n", + "1608960 Examples seen. Accuracy: 0.7914 Error: 0.42825 Loss: 0.39693 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1609600 Examples seen. Accuracy: 0.7919 Error: 0.54167 Loss: 0.49592 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1610240 Examples seen. Accuracy: 0.7950 Error: 0.49673 Loss: 0.48542 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.24s\n", + "1610880 Examples seen. Accuracy: 0.7963 Error: 0.60696 Loss: 0.66714 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1611520 Examples seen. Accuracy: 0.7986 Error: 0.58903 Loss: 0.56854 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1612160 Examples seen. Accuracy: 0.7966 Error: 0.55794 Loss: 0.54392 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.24s\n", + "1612800 Examples seen. Accuracy: 0.7966 Error: 0.57761 Loss: 0.69745 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1613440 Examples seen. Accuracy: 0.7978 Error: 0.62315 Loss: 0.78748 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1614080 Examples seen. Accuracy: 0.7989 Error: 0.59880 Loss: 0.64713 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1614720 Examples seen. Accuracy: 0.7970 Error: 0.51647 Loss: 0.45160 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.23s\n", + "1615360 Examples seen. Accuracy: 0.7964 Error: 0.59025 Loss: 0.59156 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "1616000 Examples seen. Accuracy: 0.7975 Error: 0.49351 Loss: 0.53102 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.21s\n", + "1616640 Examples seen. Accuracy: 0.7965 Error: 0.55126 Loss: 0.54281 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1617280 Examples seen. Accuracy: 0.7990 Error: 0.49378 Loss: 0.46101 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1617920 Examples seen. Accuracy: 0.7966 Error: 0.46944 Loss: 0.44067 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1618560 Examples seen. Accuracy: 0.7940 Error: 0.54247 Loss: 0.65517 Threads: 2 Forward time: 0.68s Backward time: 0.45s Step time: 2.29s\n", + "1619200 Examples seen. Accuracy: 0.7927 Error: 0.57825 Loss: 0.64135 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.34s\n", + "1619840 Examples seen. Accuracy: 0.7911 Error: 0.69701 Loss: 0.75156 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1620480 Examples seen. Accuracy: 0.7921 Error: 0.54611 Loss: 0.64435 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1621120 Examples seen. Accuracy: 0.7921 Error: 0.52289 Loss: 0.50301 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1621760 Examples seen. Accuracy: 0.7910 Error: 0.59768 Loss: 0.53358 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.26s\n", + "1622400 Examples seen. Accuracy: 0.7935 Error: 0.45171 Loss: 0.52506 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "1623040 Examples seen. Accuracy: 0.7933 Error: 0.50049 Loss: 0.56558 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1623680 Examples seen. Accuracy: 0.7970 Error: 0.53434 Loss: 0.56107 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.28s\n", + "1624320 Examples seen. Accuracy: 0.7976 Error: 0.59257 Loss: 0.82279 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.24s\n", + "1624960 Examples seen. Accuracy: 0.7990 Error: 0.49330 Loss: 0.45670 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "1625600 Examples seen. Accuracy: 0.8033 Error: 0.43791 Loss: 0.39391 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1626240 Examples seen. Accuracy: 0.8039 Error: 0.53872 Loss: 0.77483 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1626880 Examples seen. Accuracy: 0.8034 Error: 0.49363 Loss: 0.51382 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1627520 Examples seen. Accuracy: 0.8021 Error: 0.58264 Loss: 0.56444 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.26s\n", + "1628160 Examples seen. Accuracy: 0.7996 Error: 0.53911 Loss: 0.62169 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.30s\n", + "1628800 Examples seen. Accuracy: 0.8003 Error: 0.52876 Loss: 0.52727 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1629440 Examples seen. Accuracy: 0.7985 Error: 0.57780 Loss: 0.64174 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.21s\n", + "1630080 Examples seen. Accuracy: 0.8006 Error: 0.52410 Loss: 0.53068 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1630720 Examples seen. Accuracy: 0.8015 Error: 0.47819 Loss: 0.45263 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1631360 Examples seen. Accuracy: 0.8017 Error: 0.48907 Loss: 0.49822 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.28s\n", + "1632000 Examples seen. Accuracy: 0.8022 Error: 0.54620 Loss: 0.61435 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1632640 Examples seen. Accuracy: 0.8001 Error: 0.52847 Loss: 0.53528 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "1633280 Examples seen. Accuracy: 0.8035 Error: 0.42415 Loss: 0.48922 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1633920 Examples seen. Accuracy: 0.8019 Error: 0.69627 Loss: 0.83207 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1634560 Examples seen. Accuracy: 0.8040 Error: 0.42959 Loss: 0.43335 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "1635200 Examples seen. Accuracy: 0.8030 Error: 0.50978 Loss: 0.53222 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1635840 Examples seen. Accuracy: 0.8048 Error: 0.45571 Loss: 0.41322 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1636480 Examples seen. Accuracy: 0.8043 Error: 0.68396 Loss: 0.70279 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.28s\n", + "1637120 Examples seen. Accuracy: 0.8035 Error: 0.64402 Loss: 0.62521 Threads: 2 Forward time: 0.72s Backward time: 0.44s Step time: 2.36s\n", + "1637760 Examples seen. Accuracy: 0.8026 Error: 0.46955 Loss: 0.45105 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.32s\n", + "1638400 Examples seen. Accuracy: 0.8054 Error: 0.46528 Loss: 0.47117 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.25s\n", + "1639040 Examples seen. Accuracy: 0.8060 Error: 0.55940 Loss: 0.60628 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1639680 Examples seen. Accuracy: 0.8064 Error: 0.45515 Loss: 0.36650 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 41 Examples seen:1640000 Validation Accuracy: 0.8408 Validation Error: 0.4464 Validation Loss: 0.4813 Total time: 144.68min\n", + "Epoch time: 2.3635 minutes. 50 epochs: 1.9696 hours.\n", + "Epochs: 41. Working time: 2.41 hours.\n", + "1640640 Examples seen. Accuracy: 0.8036 Error: 0.46844 Loss: 0.47482 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1641280 Examples seen. Accuracy: 0.8056 Error: 0.45351 Loss: 0.50766 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1641920 Examples seen. Accuracy: 0.8055 Error: 0.63496 Loss: 0.66039 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1642560 Examples seen. Accuracy: 0.8050 Error: 0.52858 Loss: 0.50874 Threads: 2 Forward time: 0.69s Backward time: 0.44s Step time: 2.29s\n", + "1643200 Examples seen. Accuracy: 0.8056 Error: 0.51260 Loss: 0.52081 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.28s\n", + "1643840 Examples seen. Accuracy: 0.8061 Error: 0.53698 Loss: 0.52181 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.29s\n", + "1644480 Examples seen. Accuracy: 0.8049 Error: 0.73764 Loss: 0.86155 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1645120 Examples seen. Accuracy: 0.8033 Error: 0.66385 Loss: 0.64354 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.27s\n", + "1645760 Examples seen. Accuracy: 0.8022 Error: 0.65954 Loss: 0.68206 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1646400 Examples seen. Accuracy: 0.8027 Error: 0.53160 Loss: 0.47919 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1647040 Examples seen. Accuracy: 0.8025 Error: 0.60844 Loss: 0.66404 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1647680 Examples seen. Accuracy: 0.8004 Error: 0.49658 Loss: 0.52059 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1648320 Examples seen. Accuracy: 0.8008 Error: 0.54046 Loss: 0.61702 Threads: 2 Forward time: 0.73s Backward time: 0.39s Step time: 2.22s\n", + "1648960 Examples seen. Accuracy: 0.7993 Error: 0.54266 Loss: 0.56505 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1649600 Examples seen. Accuracy: 0.7972 Error: 0.56532 Loss: 0.52850 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1650240 Examples seen. Accuracy: 0.7972 Error: 0.54621 Loss: 0.50362 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1650880 Examples seen. Accuracy: 0.7958 Error: 0.54663 Loss: 0.54676 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1651520 Examples seen. Accuracy: 0.7970 Error: 0.59492 Loss: 0.54005 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "1652160 Examples seen. Accuracy: 0.7991 Error: 0.50497 Loss: 0.56636 Threads: 2 Forward time: 0.73s Backward time: 0.40s Step time: 2.25s\n", + "1652800 Examples seen. Accuracy: 0.7993 Error: 0.38165 Loss: 0.46440 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "1653440 Examples seen. Accuracy: 0.8015 Error: 0.54787 Loss: 0.53506 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.28s\n", + "1654080 Examples seen. Accuracy: 0.8039 Error: 0.41015 Loss: 0.37745 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "1654720 Examples seen. Accuracy: 0.8056 Error: 0.65196 Loss: 0.74162 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.26s\n", + "1655360 Examples seen. Accuracy: 0.8070 Error: 0.49937 Loss: 0.47713 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.21s\n", + "1656000 Examples seen. Accuracy: 0.8096 Error: 0.55126 Loss: 0.58818 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1656640 Examples seen. Accuracy: 0.8097 Error: 0.42111 Loss: 0.34261 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "1657280 Examples seen. Accuracy: 0.8091 Error: 0.59249 Loss: 0.57066 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "1657920 Examples seen. Accuracy: 0.8096 Error: 0.48823 Loss: 0.52563 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1658560 Examples seen. Accuracy: 0.8081 Error: 0.47901 Loss: 0.48341 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.24s\n", + "1659200 Examples seen. Accuracy: 0.8060 Error: 0.58616 Loss: 0.62689 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.21s\n", + "1659840 Examples seen. Accuracy: 0.8063 Error: 0.54445 Loss: 0.47752 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "1660480 Examples seen. Accuracy: 0.8058 Error: 0.43380 Loss: 0.47763 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1661120 Examples seen. Accuracy: 0.8074 Error: 0.48094 Loss: 0.53642 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1661760 Examples seen. Accuracy: 0.8079 Error: 0.53709 Loss: 0.56328 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.23s\n", + "1662400 Examples seen. Accuracy: 0.8040 Error: 0.66560 Loss: 0.62704 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.21s\n", + "1663040 Examples seen. Accuracy: 0.8011 Error: 0.60854 Loss: 0.60503 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1663680 Examples seen. Accuracy: 0.7995 Error: 0.57086 Loss: 0.73051 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "1664320 Examples seen. Accuracy: 0.7969 Error: 0.64232 Loss: 0.67945 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1664960 Examples seen. Accuracy: 0.7971 Error: 0.47593 Loss: 0.41808 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1665600 Examples seen. Accuracy: 0.7982 Error: 0.52872 Loss: 0.59126 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.21s\n", + "1666240 Examples seen. Accuracy: 0.7978 Error: 0.57924 Loss: 0.76161 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.19s\n", + "1666880 Examples seen. Accuracy: 0.7979 Error: 0.65772 Loss: 0.74640 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "1667520 Examples seen. Accuracy: 0.7947 Error: 0.52117 Loss: 0.49701 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1668160 Examples seen. Accuracy: 0.7959 Error: 0.44135 Loss: 0.41078 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1668800 Examples seen. Accuracy: 0.7943 Error: 0.68305 Loss: 0.80192 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.27s\n", + "1669440 Examples seen. Accuracy: 0.7942 Error: 0.66610 Loss: 0.72271 Threads: 2 Forward time: 0.74s Backward time: 0.40s Step time: 2.25s\n", + "1670080 Examples seen. Accuracy: 0.7948 Error: 0.53490 Loss: 0.71279 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1670720 Examples seen. Accuracy: 0.7960 Error: 0.52018 Loss: 0.68401 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.22s\n", + "1671360 Examples seen. Accuracy: 0.8003 Error: 0.41840 Loss: 0.36969 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1672000 Examples seen. Accuracy: 0.7997 Error: 0.54682 Loss: 0.58255 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1672640 Examples seen. Accuracy: 0.8000 Error: 0.38967 Loss: 0.36466 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1673280 Examples seen. Accuracy: 0.8007 Error: 0.57849 Loss: 0.58812 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.27s\n", + "1673920 Examples seen. Accuracy: 0.8012 Error: 0.57866 Loss: 0.71095 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1674560 Examples seen. Accuracy: 0.7975 Error: 0.52735 Loss: 0.53835 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1675200 Examples seen. Accuracy: 0.7987 Error: 0.58814 Loss: 0.70309 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1675840 Examples seen. Accuracy: 0.7979 Error: 0.59860 Loss: 0.59350 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.24s\n", + "1676480 Examples seen. Accuracy: 0.7984 Error: 0.52595 Loss: 0.59196 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1677120 Examples seen. Accuracy: 0.7990 Error: 0.48244 Loss: 0.52215 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1677760 Examples seen. Accuracy: 0.7980 Error: 0.74877 Loss: 0.91942 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "1678400 Examples seen. Accuracy: 0.7995 Error: 0.49146 Loss: 0.45821 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1679040 Examples seen. Accuracy: 0.7999 Error: 0.43567 Loss: 0.33887 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.21s\n", + "1679680 Examples seen. Accuracy: 0.7998 Error: 0.54667 Loss: 0.47788 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 42 Examples seen:1680000 Validation Accuracy: 0.8431 Validation Error: 0.4436 Validation Loss: 0.4792 Total time: 148.11min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.579 Min Weight: -0.612 Max Output: 5.170 Min Output: -5.810 TNNetConvolutionLinear 32,32,64 Times: 31.10s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.170 Min Output: -1.201 TNNetMaxPool 8,8,64 Times: 7.14s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.899 Min Weight: 0.859 Max Output: 4.970 Min Output: -2.444 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.281 Min Weight: -0.339 Max Output: 10.009 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.61s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.336 Min Weight: -0.312 Max Output: 11.004 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.49s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.308 Min Weight: -0.247 Max Output: 8.035 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.55s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.213 Min Weight: -0.218 Max Output: 3.255 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.61s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.255 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.04s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.255 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.41s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.329 Min Weight: -0.269 Max Output: 5.219 Min Output: -11.023 TNNetFullConnectLinear 10,1,1 Times: 0.13s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.453 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3135 minutes. 50 epochs: 1.9280 hours.\n", + "Epochs: 42. Working time: 2.47 hours.\n", + "1680640 Examples seen. Accuracy: 0.8000 Error: 0.67139 Loss: 0.76720 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.29s\n", + "1681280 Examples seen. Accuracy: 0.8009 Error: 0.46329 Loss: 0.44383 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.29s\n", + "1681920 Examples seen. Accuracy: 0.7987 Error: 0.45487 Loss: 0.42265 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1682560 Examples seen. Accuracy: 0.7991 Error: 0.53651 Loss: 0.58118 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.27s\n", + "1683200 Examples seen. Accuracy: 0.7983 Error: 0.62182 Loss: 0.72797 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.27s\n", + "1683840 Examples seen. Accuracy: 0.7974 Error: 0.51756 Loss: 0.49560 Threads: 2 Forward time: 0.73s Backward time: 0.43s Step time: 2.33s\n", + "1684480 Examples seen. Accuracy: 0.7976 Error: 0.42272 Loss: 0.50421 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.30s\n", + "1685120 Examples seen. Accuracy: 0.7954 Error: 0.59142 Loss: 0.70337 Threads: 2 Forward time: 0.71s Backward time: 0.37s Step time: 2.28s\n", + "1685760 Examples seen. Accuracy: 0.7987 Error: 0.62864 Loss: 0.75422 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1686400 Examples seen. Accuracy: 0.7967 Error: 0.58669 Loss: 0.61356 Threads: 2 Forward time: 0.73s Backward time: 0.39s Step time: 2.31s\n", + "1687040 Examples seen. Accuracy: 0.7964 Error: 0.37858 Loss: 0.36980 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.31s\n", + "1687680 Examples seen. Accuracy: 0.7974 Error: 0.66028 Loss: 0.80919 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1688320 Examples seen. Accuracy: 0.7989 Error: 0.44437 Loss: 0.47425 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.29s\n", + "1688960 Examples seen. Accuracy: 0.8005 Error: 0.43870 Loss: 0.43714 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.37s\n", + "1689600 Examples seen. Accuracy: 0.8001 Error: 0.43118 Loss: 0.44524 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1690240 Examples seen. Accuracy: 0.8022 Error: 0.45332 Loss: 0.43886 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1690880 Examples seen. Accuracy: 0.8031 Error: 0.65069 Loss: 0.68805 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.30s\n", + "1691520 Examples seen. Accuracy: 0.8031 Error: 0.49658 Loss: 0.51343 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.27s\n", + "1692160 Examples seen. Accuracy: 0.8040 Error: 0.50640 Loss: 0.56564 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.25s\n", + "1692800 Examples seen. Accuracy: 0.8037 Error: 0.53802 Loss: 0.51715 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.29s\n", + "1693440 Examples seen. Accuracy: 0.8067 Error: 0.44406 Loss: 0.38914 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.33s\n", + "1694080 Examples seen. Accuracy: 0.8060 Error: 0.49721 Loss: 0.53111 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.25s\n", + "1694720 Examples seen. Accuracy: 0.8076 Error: 0.45770 Loss: 0.45646 Threads: 2 Forward time: 0.72s Backward time: 0.40s Step time: 2.22s\n", + "1695360 Examples seen. Accuracy: 0.8062 Error: 0.52654 Loss: 0.57848 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1696000 Examples seen. Accuracy: 0.8063 Error: 0.63608 Loss: 0.70153 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1696640 Examples seen. Accuracy: 0.8037 Error: 0.37510 Loss: 0.31714 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.23s\n", + "1697280 Examples seen. Accuracy: 0.8039 Error: 0.51885 Loss: 0.45366 Threads: 2 Forward time: 0.67s Backward time: 0.43s Step time: 2.28s\n", + "1697920 Examples seen. Accuracy: 0.8046 Error: 0.43285 Loss: 0.45659 Threads: 2 Forward time: 0.75s Backward time: 0.38s Step time: 2.29s\n", + "1698560 Examples seen. Accuracy: 0.8078 Error: 0.60024 Loss: 0.66575 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "1699200 Examples seen. Accuracy: 0.8095 Error: 0.57150 Loss: 0.70263 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1699840 Examples seen. Accuracy: 0.8092 Error: 0.49861 Loss: 0.42160 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.23s\n", + "1700480 Examples seen. Accuracy: 0.8108 Error: 0.46779 Loss: 0.39972 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1701120 Examples seen. Accuracy: 0.8119 Error: 0.41481 Loss: 0.51118 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "1701760 Examples seen. Accuracy: 0.8125 Error: 0.44243 Loss: 0.36300 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.27s\n", + "1702400 Examples seen. Accuracy: 0.8124 Error: 0.44899 Loss: 0.49796 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.29s\n", + "1703040 Examples seen. Accuracy: 0.8098 Error: 0.52932 Loss: 0.53997 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1703680 Examples seen. Accuracy: 0.8097 Error: 0.60533 Loss: 0.59089 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1704320 Examples seen. Accuracy: 0.8084 Error: 0.54161 Loss: 0.53130 Threads: 2 Forward time: 0.71s Backward time: 0.44s Step time: 2.29s\n", + "1704960 Examples seen. Accuracy: 0.8092 Error: 0.53471 Loss: 0.56710 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1705600 Examples seen. Accuracy: 0.8077 Error: 0.61441 Loss: 0.65031 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1706240 Examples seen. Accuracy: 0.8092 Error: 0.46696 Loss: 0.45175 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1706880 Examples seen. Accuracy: 0.8095 Error: 0.60226 Loss: 0.57590 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1707520 Examples seen. Accuracy: 0.8106 Error: 0.52049 Loss: 0.79232 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.23s\n", + "1708160 Examples seen. Accuracy: 0.8089 Error: 0.55049 Loss: 0.64751 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1708800 Examples seen. Accuracy: 0.8073 Error: 0.52926 Loss: 0.57544 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.21s\n", + "1709440 Examples seen. Accuracy: 0.8057 Error: 0.44427 Loss: 0.47284 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1710080 Examples seen. Accuracy: 0.8034 Error: 0.67256 Loss: 0.80340 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1710720 Examples seen. Accuracy: 0.8020 Error: 0.55730 Loss: 0.56850 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.27s\n", + "1711360 Examples seen. Accuracy: 0.8025 Error: 0.55680 Loss: 0.51552 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1712000 Examples seen. Accuracy: 0.8018 Error: 0.58785 Loss: 0.76400 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1712640 Examples seen. Accuracy: 0.8020 Error: 0.48576 Loss: 0.47088 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1713280 Examples seen. Accuracy: 0.7984 Error: 0.59862 Loss: 0.80245 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1713920 Examples seen. Accuracy: 0.7998 Error: 0.61474 Loss: 0.67588 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1714560 Examples seen. Accuracy: 0.8006 Error: 0.56500 Loss: 0.65336 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "1715200 Examples seen. Accuracy: 0.8011 Error: 0.64712 Loss: 0.90739 Threads: 2 Forward time: 0.66s Backward time: 0.42s Step time: 2.21s\n", + "1715840 Examples seen. Accuracy: 0.8027 Error: 0.58675 Loss: 0.65706 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.21s\n", + "1716480 Examples seen. Accuracy: 0.8025 Error: 0.45281 Loss: 0.39598 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1717120 Examples seen. Accuracy: 0.8005 Error: 0.70375 Loss: 0.77210 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1717760 Examples seen. Accuracy: 0.7993 Error: 0.63193 Loss: 0.68640 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.26s\n", + "1718400 Examples seen. Accuracy: 0.7990 Error: 0.58053 Loss: 0.62891 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.20s\n", + "1719040 Examples seen. Accuracy: 0.7971 Error: 0.65807 Loss: 0.76720 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1719680 Examples seen. Accuracy: 0.7985 Error: 0.55384 Loss: 0.43992 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 43 Examples seen:1720000 Validation Accuracy: 0.8435 Validation Error: 0.4421 Validation Loss: 0.4766 Total time: 151.50min\n", + "Epoch time: 2.2948 minutes. 50 epochs: 1.9123 hours.\n", + "Epochs: 43. Working time: 2.53 hours.\n", + "1720640 Examples seen. Accuracy: 0.7981 Error: 0.55341 Loss: 0.57737 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1721280 Examples seen. Accuracy: 0.7995 Error: 0.50887 Loss: 0.50630 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.23s\n", + "1721920 Examples seen. Accuracy: 0.7963 Error: 0.68551 Loss: 0.70875 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1722560 Examples seen. Accuracy: 0.7965 Error: 0.67230 Loss: 0.82301 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1723200 Examples seen. Accuracy: 0.7953 Error: 0.46954 Loss: 0.48940 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1723840 Examples seen. Accuracy: 0.7980 Error: 0.51257 Loss: 0.44211 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1724480 Examples seen. Accuracy: 0.7994 Error: 0.50717 Loss: 0.45955 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.28s\n", + "1725120 Examples seen. Accuracy: 0.7985 Error: 0.65405 Loss: 0.76664 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.26s\n", + "1725760 Examples seen. Accuracy: 0.7988 Error: 0.62551 Loss: 0.62255 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1726400 Examples seen. Accuracy: 0.8007 Error: 0.49349 Loss: 0.49951 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "1727040 Examples seen. Accuracy: 0.7988 Error: 0.63706 Loss: 0.71263 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1727680 Examples seen. Accuracy: 0.8006 Error: 0.62528 Loss: 0.78108 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1728320 Examples seen. Accuracy: 0.8010 Error: 0.57656 Loss: 0.62641 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1728960 Examples seen. Accuracy: 0.8022 Error: 0.56029 Loss: 0.49488 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "1729600 Examples seen. Accuracy: 0.8029 Error: 0.34691 Loss: 0.37576 Threads: 2 Forward time: 0.73s Backward time: 0.41s Step time: 2.27s\n", + "1730240 Examples seen. Accuracy: 0.8026 Error: 0.49302 Loss: 0.60632 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1730880 Examples seen. Accuracy: 0.8039 Error: 0.47092 Loss: 0.50248 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.26s\n", + "1731520 Examples seen. Accuracy: 0.8048 Error: 0.62387 Loss: 0.60490 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.23s\n", + "1732160 Examples seen. Accuracy: 0.8028 Error: 0.49964 Loss: 0.48220 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.23s\n", + "1732800 Examples seen. Accuracy: 0.8049 Error: 0.56605 Loss: 0.55722 Threads: 2 Forward time: 0.68s Backward time: 0.44s Step time: 2.23s\n", + "1733440 Examples seen. Accuracy: 0.8039 Error: 0.59731 Loss: 0.67491 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1734080 Examples seen. Accuracy: 0.8050 Error: 0.50678 Loss: 0.57558 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.31s\n", + "1734720 Examples seen. Accuracy: 0.8064 Error: 0.53332 Loss: 0.51525 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.36s\n", + "1735360 Examples seen. Accuracy: 0.8066 Error: 0.54413 Loss: 0.67696 Threads: 2 Forward time: 0.69s Backward time: 0.43s Step time: 2.28s\n", + "1736000 Examples seen. Accuracy: 0.8046 Error: 0.53143 Loss: 0.56676 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.27s\n", + "1736640 Examples seen. Accuracy: 0.8022 Error: 0.56565 Loss: 0.59714 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1737280 Examples seen. Accuracy: 0.8029 Error: 0.56774 Loss: 0.55036 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1737920 Examples seen. Accuracy: 0.8029 Error: 0.34835 Loss: 0.31202 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.23s\n", + "1738560 Examples seen. Accuracy: 0.8033 Error: 0.51071 Loss: 0.64443 Threads: 2 Forward time: 0.70s Backward time: 0.43s Step time: 2.28s\n", + "1739200 Examples seen. Accuracy: 0.8059 Error: 0.36952 Loss: 0.33057 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1739840 Examples seen. Accuracy: 0.8097 Error: 0.50228 Loss: 0.56104 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1740480 Examples seen. Accuracy: 0.8066 Error: 0.48273 Loss: 0.45099 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1741120 Examples seen. Accuracy: 0.8078 Error: 0.45553 Loss: 0.37889 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "1741760 Examples seen. Accuracy: 0.8066 Error: 0.58246 Loss: 0.73300 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1742400 Examples seen. Accuracy: 0.8063 Error: 0.61806 Loss: 0.76036 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.31s\n", + "1743040 Examples seen. Accuracy: 0.8070 Error: 0.46658 Loss: 0.44036 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.26s\n", + "1743680 Examples seen. Accuracy: 0.8072 Error: 0.70367 Loss: 0.81154 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "1744320 Examples seen. Accuracy: 0.8074 Error: 0.46177 Loss: 0.46414 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.21s\n", + "1744960 Examples seen. Accuracy: 0.8063 Error: 0.47637 Loss: 0.48543 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1745600 Examples seen. Accuracy: 0.8041 Error: 0.44665 Loss: 0.38885 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.22s\n", + "1746240 Examples seen. Accuracy: 0.8007 Error: 0.54994 Loss: 0.59860 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1746880 Examples seen. Accuracy: 0.8025 Error: 0.46929 Loss: 0.40619 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.18s\n", + "1747520 Examples seen. Accuracy: 0.8033 Error: 0.50548 Loss: 0.53090 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1748160 Examples seen. Accuracy: 0.8021 Error: 0.56606 Loss: 0.61231 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1748800 Examples seen. Accuracy: 0.8033 Error: 0.56792 Loss: 0.64922 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1749440 Examples seen. Accuracy: 0.8041 Error: 0.58555 Loss: 0.69141 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.22s\n", + "1750080 Examples seen. Accuracy: 0.8037 Error: 0.54260 Loss: 0.64653 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.22s\n", + "1750720 Examples seen. Accuracy: 0.8020 Error: 0.53329 Loss: 0.52588 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.19s\n", + "1751360 Examples seen. Accuracy: 0.8048 Error: 0.45951 Loss: 0.48354 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "1752000 Examples seen. Accuracy: 0.8058 Error: 0.53471 Loss: 0.66714 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.24s\n", + "1752640 Examples seen. Accuracy: 0.8040 Error: 0.51177 Loss: 0.54987 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1753280 Examples seen. Accuracy: 0.8056 Error: 0.56275 Loss: 0.57194 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1753920 Examples seen. Accuracy: 0.8041 Error: 0.52118 Loss: 0.53013 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1754560 Examples seen. Accuracy: 0.8017 Error: 0.47195 Loss: 0.54014 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1755200 Examples seen. Accuracy: 0.8020 Error: 0.52556 Loss: 0.59282 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.20s\n", + "1755840 Examples seen. Accuracy: 0.8043 Error: 0.42051 Loss: 0.44183 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "1756480 Examples seen. Accuracy: 0.8041 Error: 0.40768 Loss: 0.52747 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "1757120 Examples seen. Accuracy: 0.8046 Error: 0.41115 Loss: 0.49730 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.27s\n", + "1757760 Examples seen. Accuracy: 0.8040 Error: 0.45498 Loss: 0.54977 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "1758400 Examples seen. Accuracy: 0.8006 Error: 0.62762 Loss: 0.56970 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "1759040 Examples seen. Accuracy: 0.8013 Error: 0.53627 Loss: 0.55708 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1759680 Examples seen. Accuracy: 0.8023 Error: 0.49772 Loss: 0.53613 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 44 Examples seen:1760000 Validation Accuracy: 0.8437 Validation Error: 0.4400 Validation Loss: 0.4751 Total time: 154.87min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.591 Min Weight: -0.617 Max Output: 5.223 Min Output: -5.903 TNNetConvolutionLinear 32,32,64 Times: 30.09s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.223 Min Output: -1.230 TNNetMaxPool 8,8,64 Times: 6.98s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.908 Min Weight: 0.869 Max Output: 4.966 Min Output: -2.460 TNNetMovingStdNormalization 8,8,64 Times: 0.13s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.280 Min Weight: -0.345 Max Output: 10.068 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.11s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.347 Min Weight: -0.319 Max Output: 11.124 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.00s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.316 Min Weight: -0.251 Max Output: 7.513 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.06s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.218 Min Weight: -0.219 Max Output: 3.292 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.18s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.292 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.02s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.292 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.38s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.330 Min Weight: -0.269 Max Output: 5.223 Min Output: -11.036 TNNetFullConnectLinear 10,1,1 Times: 0.07s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.435 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3323 minutes. 50 epochs: 1.9436 hours.\n", + "Epochs: 44. Working time: 2.58 hours.\n", + "1760640 Examples seen. Accuracy: 0.8019 Error: 0.61683 Loss: 0.80504 Threads: 2 Forward time: 0.65s Backward time: 0.36s Step time: 2.17s\n", + "1761280 Examples seen. Accuracy: 0.7988 Error: 0.48159 Loss: 0.66259 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.19s\n", + "1761920 Examples seen. Accuracy: 0.7978 Error: 0.67617 Loss: 0.70790 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.17s\n", + "1762560 Examples seen. Accuracy: 0.7988 Error: 0.44849 Loss: 0.47353 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "1763200 Examples seen. Accuracy: 0.8010 Error: 0.47647 Loss: 0.41273 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1763840 Examples seen. Accuracy: 0.8002 Error: 0.38395 Loss: 0.35873 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.18s\n", + "1764480 Examples seen. Accuracy: 0.8012 Error: 0.50008 Loss: 0.50155 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.25s\n", + "1765120 Examples seen. Accuracy: 0.8027 Error: 0.65825 Loss: 0.90716 Threads: 2 Forward time: 0.65s Backward time: 0.41s Step time: 2.22s\n", + "1765760 Examples seen. Accuracy: 0.8015 Error: 0.47736 Loss: 0.40542 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1766400 Examples seen. Accuracy: 0.8046 Error: 0.47484 Loss: 0.56903 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.18s\n", + "1767040 Examples seen. Accuracy: 0.8026 Error: 0.64641 Loss: 0.68534 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.18s\n", + "1767680 Examples seen. Accuracy: 0.7990 Error: 0.50818 Loss: 0.51614 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1768320 Examples seen. Accuracy: 0.8013 Error: 0.54735 Loss: 0.57290 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1768960 Examples seen. Accuracy: 0.8028 Error: 0.49311 Loss: 0.47599 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1769600 Examples seen. Accuracy: 0.8011 Error: 0.59937 Loss: 0.71031 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.29s\n", + "1770240 Examples seen. Accuracy: 0.7988 Error: 0.53670 Loss: 0.49683 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1770880 Examples seen. Accuracy: 0.8017 Error: 0.47663 Loss: 0.44828 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.22s\n", + "1771520 Examples seen. Accuracy: 0.8028 Error: 0.53370 Loss: 0.48148 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.27s\n", + "1772160 Examples seen. Accuracy: 0.8010 Error: 0.49904 Loss: 0.42435 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1772800 Examples seen. Accuracy: 0.8017 Error: 0.56659 Loss: 0.63192 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1773440 Examples seen. Accuracy: 0.8024 Error: 0.55688 Loss: 0.58150 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1774080 Examples seen. Accuracy: 0.8039 Error: 0.61437 Loss: 0.68375 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1774720 Examples seen. Accuracy: 0.8041 Error: 0.47213 Loss: 0.47361 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.28s\n", + "1775360 Examples seen. Accuracy: 0.8044 Error: 0.47128 Loss: 0.51124 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.25s\n", + "1776000 Examples seen. Accuracy: 0.8009 Error: 0.54083 Loss: 0.59915 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.28s\n", + "1776640 Examples seen. Accuracy: 0.8014 Error: 0.46656 Loss: 0.48497 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.24s\n", + "1777280 Examples seen. Accuracy: 0.8017 Error: 0.61647 Loss: 0.91066 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1777920 Examples seen. Accuracy: 0.8017 Error: 0.49758 Loss: 0.45129 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1778560 Examples seen. Accuracy: 0.8036 Error: 0.59772 Loss: 0.90901 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1779200 Examples seen. Accuracy: 0.8033 Error: 0.60793 Loss: 0.64957 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.24s\n", + "1779840 Examples seen. Accuracy: 0.8041 Error: 0.43762 Loss: 0.41248 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1780480 Examples seen. Accuracy: 0.8050 Error: 0.53764 Loss: 0.60561 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1781120 Examples seen. Accuracy: 0.8042 Error: 0.49296 Loss: 0.69129 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1781760 Examples seen. Accuracy: 0.8045 Error: 0.62751 Loss: 0.70030 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1782400 Examples seen. Accuracy: 0.8035 Error: 0.52960 Loss: 0.57779 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "1783040 Examples seen. Accuracy: 0.8046 Error: 0.49291 Loss: 0.46135 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1783680 Examples seen. Accuracy: 0.8032 Error: 0.54193 Loss: 0.57554 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.19s\n", + "1784320 Examples seen. Accuracy: 0.8047 Error: 0.43476 Loss: 0.38966 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1784960 Examples seen. Accuracy: 0.8047 Error: 0.65817 Loss: 0.69461 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.23s\n", + "1785600 Examples seen. Accuracy: 0.8065 Error: 0.40508 Loss: 0.42314 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.25s\n", + "1786240 Examples seen. Accuracy: 0.8082 Error: 0.39446 Loss: 0.36012 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1786880 Examples seen. Accuracy: 0.8100 Error: 0.64204 Loss: 0.78158 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.24s\n", + "1787520 Examples seen. Accuracy: 0.8108 Error: 0.45856 Loss: 0.47379 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.22s\n", + "1788160 Examples seen. Accuracy: 0.8075 Error: 0.52164 Loss: 0.56074 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1788800 Examples seen. Accuracy: 0.8078 Error: 0.55158 Loss: 0.52130 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "1789440 Examples seen. Accuracy: 0.8066 Error: 0.55669 Loss: 0.59806 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.20s\n", + "1790080 Examples seen. Accuracy: 0.8072 Error: 0.50236 Loss: 0.56735 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "1790720 Examples seen. Accuracy: 0.8062 Error: 0.54660 Loss: 0.49060 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1791360 Examples seen. Accuracy: 0.8034 Error: 0.53801 Loss: 0.56514 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "1792000 Examples seen. Accuracy: 0.8047 Error: 0.71923 Loss: 0.84937 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1792640 Examples seen. Accuracy: 0.8043 Error: 0.52414 Loss: 0.56046 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "1793280 Examples seen. Accuracy: 0.8037 Error: 0.45257 Loss: 0.46509 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "1793920 Examples seen. Accuracy: 0.8059 Error: 0.47616 Loss: 0.48805 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1794560 Examples seen. Accuracy: 0.8071 Error: 0.48401 Loss: 0.46580 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.21s\n", + "1795200 Examples seen. Accuracy: 0.8088 Error: 0.42652 Loss: 0.39704 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.20s\n", + "1795840 Examples seen. Accuracy: 0.8075 Error: 0.58858 Loss: 0.74968 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1796480 Examples seen. Accuracy: 0.8076 Error: 0.56355 Loss: 0.63541 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1797120 Examples seen. Accuracy: 0.8056 Error: 0.66625 Loss: 0.72501 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.22s\n", + "1797760 Examples seen. Accuracy: 0.8068 Error: 0.41951 Loss: 0.34286 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1798400 Examples seen. Accuracy: 0.8050 Error: 0.48299 Loss: 0.46655 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.19s\n", + "1799040 Examples seen. Accuracy: 0.8042 Error: 0.70356 Loss: 0.87311 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.19s\n", + "1799680 Examples seen. Accuracy: 0.8035 Error: 0.56777 Loss: 0.59480 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.18s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 45 Examples seen:1800000 Validation Accuracy: 0.8446 Validation Error: 0.4384 Validation Loss: 0.4724 Total time: 158.23min\n", + "Epoch time: 2.2729 minutes. 50 epochs: 1.8941 hours.\n", + "Epochs: 45. Working time: 2.64 hours.\n", + "1800640 Examples seen. Accuracy: 0.8050 Error: 0.52892 Loss: 0.57404 Threads: 2 Forward time: 0.67s Backward time: 0.36s Step time: 2.23s\n", + "1801280 Examples seen. Accuracy: 0.8031 Error: 0.67452 Loss: 0.67926 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1801920 Examples seen. Accuracy: 0.8040 Error: 0.48909 Loss: 0.47363 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1802560 Examples seen. Accuracy: 0.8037 Error: 0.57783 Loss: 0.59355 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "1803200 Examples seen. Accuracy: 0.8022 Error: 0.55752 Loss: 0.54343 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.20s\n", + "1803840 Examples seen. Accuracy: 0.8005 Error: 0.39555 Loss: 0.36763 Threads: 2 Forward time: 0.68s Backward time: 0.36s Step time: 2.20s\n", + "1804480 Examples seen. Accuracy: 0.7988 Error: 0.65284 Loss: 0.66711 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.18s\n", + "1805120 Examples seen. Accuracy: 0.8003 Error: 0.37873 Loss: 0.32789 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1805760 Examples seen. Accuracy: 0.7982 Error: 0.46833 Loss: 0.42251 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.23s\n", + "1806400 Examples seen. Accuracy: 0.7982 Error: 0.54267 Loss: 0.56125 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.20s\n", + "1807040 Examples seen. Accuracy: 0.7963 Error: 0.62307 Loss: 0.64502 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.21s\n", + "1807680 Examples seen. Accuracy: 0.7975 Error: 0.42875 Loss: 0.49366 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "1808320 Examples seen. Accuracy: 0.7986 Error: 0.54650 Loss: 0.53966 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1808960 Examples seen. Accuracy: 0.7973 Error: 0.61634 Loss: 0.60551 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.19s\n", + "1809600 Examples seen. Accuracy: 0.7984 Error: 0.53018 Loss: 0.53555 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.26s\n", + "1810240 Examples seen. Accuracy: 0.8032 Error: 0.44516 Loss: 0.45459 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.22s\n", + "1810880 Examples seen. Accuracy: 0.8017 Error: 0.60931 Loss: 0.72155 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.25s\n", + "1811520 Examples seen. Accuracy: 0.8038 Error: 0.49328 Loss: 0.48755 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.22s\n", + "1812160 Examples seen. Accuracy: 0.8020 Error: 0.55991 Loss: 0.49434 Threads: 2 Forward time: 0.68s Backward time: 0.36s Step time: 2.19s\n", + "1812800 Examples seen. Accuracy: 0.8016 Error: 0.54640 Loss: 0.48624 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.17s\n", + "1813440 Examples seen. Accuracy: 0.8023 Error: 0.44355 Loss: 0.47625 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.18s\n", + "1814080 Examples seen. Accuracy: 0.8051 Error: 0.42625 Loss: 0.48687 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.20s\n", + "1814720 Examples seen. Accuracy: 0.8052 Error: 0.45487 Loss: 0.46048 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.19s\n", + "1815360 Examples seen. Accuracy: 0.8074 Error: 0.39120 Loss: 0.37990 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.18s\n", + "1816000 Examples seen. Accuracy: 0.8047 Error: 0.48695 Loss: 0.57066 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.24s\n", + "1816640 Examples seen. Accuracy: 0.8069 Error: 0.43109 Loss: 0.46597 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.21s\n", + "1817280 Examples seen. Accuracy: 0.8094 Error: 0.39044 Loss: 0.32945 Threads: 2 Forward time: 0.65s Backward time: 0.38s Step time: 2.17s\n", + "1817920 Examples seen. Accuracy: 0.8115 Error: 0.47312 Loss: 0.45862 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.18s\n", + "1818560 Examples seen. Accuracy: 0.8107 Error: 0.45257 Loss: 0.45493 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.21s\n", + "1819200 Examples seen. Accuracy: 0.8089 Error: 0.48358 Loss: 0.39886 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.24s\n", + "1819840 Examples seen. Accuracy: 0.8078 Error: 0.66989 Loss: 0.74429 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1820480 Examples seen. Accuracy: 0.8076 Error: 0.54592 Loss: 0.60786 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1821120 Examples seen. Accuracy: 0.8081 Error: 0.65073 Loss: 0.64975 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1821760 Examples seen. Accuracy: 0.8073 Error: 0.51966 Loss: 0.51214 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.23s\n", + "1822400 Examples seen. Accuracy: 0.8078 Error: 0.41417 Loss: 0.51032 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.23s\n", + "1823040 Examples seen. Accuracy: 0.8092 Error: 0.44996 Loss: 0.39109 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.25s\n", + "1823680 Examples seen. Accuracy: 0.8089 Error: 0.36494 Loss: 0.31402 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.23s\n", + "1824320 Examples seen. Accuracy: 0.8080 Error: 0.40704 Loss: 0.40096 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.25s\n", + "1824960 Examples seen. Accuracy: 0.8068 Error: 0.39971 Loss: 0.44130 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1825600 Examples seen. Accuracy: 0.8072 Error: 0.43501 Loss: 0.42799 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.24s\n", + "1826240 Examples seen. Accuracy: 0.8093 Error: 0.49807 Loss: 0.48128 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1826880 Examples seen. Accuracy: 0.8089 Error: 0.51756 Loss: 0.49040 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.22s\n", + "1827520 Examples seen. Accuracy: 0.8085 Error: 0.61220 Loss: 0.69765 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1828160 Examples seen. Accuracy: 0.8074 Error: 0.57660 Loss: 0.54822 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.21s\n", + "1828800 Examples seen. Accuracy: 0.8056 Error: 0.64688 Loss: 0.74264 Threads: 2 Forward time: 0.65s Backward time: 0.40s Step time: 2.21s\n", + "1829440 Examples seen. Accuracy: 0.8065 Error: 0.48016 Loss: 0.44862 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.22s\n", + "1830080 Examples seen. Accuracy: 0.8066 Error: 0.55557 Loss: 0.69324 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.22s\n", + "1830720 Examples seen. Accuracy: 0.8078 Error: 0.52758 Loss: 0.65447 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.24s\n", + "1831360 Examples seen. Accuracy: 0.8101 Error: 0.40405 Loss: 0.36335 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1832000 Examples seen. Accuracy: 0.8082 Error: 0.76030 Loss: 0.83678 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1832640 Examples seen. Accuracy: 0.8085 Error: 0.49864 Loss: 0.50153 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.26s\n", + "1833280 Examples seen. Accuracy: 0.8099 Error: 0.52115 Loss: 0.52980 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.30s\n", + "1833920 Examples seen. Accuracy: 0.8100 Error: 0.56853 Loss: 0.58128 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.25s\n", + "1834560 Examples seen. Accuracy: 0.8107 Error: 0.43176 Loss: 0.40712 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1835200 Examples seen. Accuracy: 0.8092 Error: 0.41667 Loss: 0.50471 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1835840 Examples seen. Accuracy: 0.8095 Error: 0.55149 Loss: 0.55181 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.22s\n", + "1836480 Examples seen. Accuracy: 0.8084 Error: 0.65206 Loss: 0.68131 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1837120 Examples seen. Accuracy: 0.8089 Error: 0.54432 Loss: 0.49547 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1837760 Examples seen. Accuracy: 0.8083 Error: 0.53347 Loss: 0.57704 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1838400 Examples seen. Accuracy: 0.8097 Error: 0.44419 Loss: 0.43018 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "1839040 Examples seen. Accuracy: 0.8102 Error: 0.60324 Loss: 0.56386 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.25s\n", + "1839680 Examples seen. Accuracy: 0.8101 Error: 0.58823 Loss: 0.66150 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 46 Examples seen:1840000 Validation Accuracy: 0.8453 Validation Error: 0.4362 Validation Loss: 0.4698 Total time: 161.58min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.603 Min Weight: -0.621 Max Output: 5.279 Min Output: -5.942 TNNetConvolutionLinear 32,32,64 Times: 30.19s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.279 Min Output: -1.276 TNNetMaxPool 8,8,64 Times: 6.97s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.918 Min Weight: 0.878 Max Output: 4.964 Min Output: -2.498 TNNetMovingStdNormalization 8,8,64 Times: 0.15s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.283 Min Weight: -0.351 Max Output: 10.346 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.04s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.357 Min Weight: -0.322 Max Output: 11.125 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 5.91s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.329 Min Weight: -0.256 Max Output: 7.380 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.12s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.222 Min Weight: -0.222 Max Output: 3.244 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.02s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.244 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.244 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.36s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.325 Min Weight: -0.268 Max Output: 5.071 Min Output: -10.765 TNNetFullConnectLinear 10,1,1 Times: 0.08s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.502 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.3115 minutes. 50 epochs: 1.9262 hours.\n", + "Epochs: 46. Working time: 2.69 hours.\n", + "1840640 Examples seen. Accuracy: 0.8102 Error: 0.55662 Loss: 0.58351 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "1841280 Examples seen. Accuracy: 0.8109 Error: 0.41912 Loss: 0.41662 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.21s\n", + "1841920 Examples seen. Accuracy: 0.8099 Error: 0.45860 Loss: 0.40399 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.24s\n", + "1842560 Examples seen. Accuracy: 0.8089 Error: 0.46133 Loss: 0.45873 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.24s\n", + "1843200 Examples seen. Accuracy: 0.8083 Error: 0.58055 Loss: 0.62772 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.23s\n", + "1843840 Examples seen. Accuracy: 0.8087 Error: 0.58673 Loss: 0.63068 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.21s\n", + "1844480 Examples seen. Accuracy: 0.8083 Error: 0.52040 Loss: 0.48312 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1845120 Examples seen. Accuracy: 0.8067 Error: 0.43084 Loss: 0.39708 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1845760 Examples seen. Accuracy: 0.8076 Error: 0.51578 Loss: 0.42925 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1846400 Examples seen. Accuracy: 0.8048 Error: 0.48728 Loss: 0.52615 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.22s\n", + "1847040 Examples seen. Accuracy: 0.8057 Error: 0.58081 Loss: 0.60979 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1847680 Examples seen. Accuracy: 0.8068 Error: 0.50447 Loss: 0.52621 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "1848320 Examples seen. Accuracy: 0.8057 Error: 0.62777 Loss: 0.71009 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "1848960 Examples seen. Accuracy: 0.8046 Error: 0.45940 Loss: 0.41186 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.21s\n", + "1849600 Examples seen. Accuracy: 0.8074 Error: 0.42752 Loss: 0.38793 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1850240 Examples seen. Accuracy: 0.8056 Error: 0.40054 Loss: 0.42970 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1850880 Examples seen. Accuracy: 0.8046 Error: 0.50943 Loss: 0.52923 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.23s\n", + "1851520 Examples seen. Accuracy: 0.8040 Error: 0.44184 Loss: 0.55754 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1852160 Examples seen. Accuracy: 0.8045 Error: 0.64845 Loss: 0.69677 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1852800 Examples seen. Accuracy: 0.8033 Error: 0.62132 Loss: 0.77121 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.24s\n", + "1853440 Examples seen. Accuracy: 0.8050 Error: 0.51346 Loss: 0.55101 Threads: 2 Forward time: 0.74s Backward time: 0.40s Step time: 2.30s\n", + "1854080 Examples seen. Accuracy: 0.8043 Error: 0.47881 Loss: 0.49318 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.27s\n", + "1854720 Examples seen. Accuracy: 0.8035 Error: 0.57762 Loss: 0.56085 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.22s\n", + "1855360 Examples seen. Accuracy: 0.8055 Error: 0.48882 Loss: 0.54016 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1856000 Examples seen. Accuracy: 0.8059 Error: 0.39939 Loss: 0.41297 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.23s\n", + "1856640 Examples seen. Accuracy: 0.8084 Error: 0.48090 Loss: 0.48291 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.25s\n", + "1857280 Examples seen. Accuracy: 0.8089 Error: 0.44803 Loss: 0.52942 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1857920 Examples seen. Accuracy: 0.8083 Error: 0.47875 Loss: 0.53443 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1858560 Examples seen. Accuracy: 0.8069 Error: 0.48345 Loss: 0.49016 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.25s\n", + "1859200 Examples seen. Accuracy: 0.8073 Error: 0.47541 Loss: 0.49879 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1859840 Examples seen. Accuracy: 0.8093 Error: 0.35205 Loss: 0.33276 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1860480 Examples seen. Accuracy: 0.8083 Error: 0.48212 Loss: 0.58720 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.22s\n", + "1861120 Examples seen. Accuracy: 0.8092 Error: 0.71481 Loss: 0.79775 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.18s\n", + "1861760 Examples seen. Accuracy: 0.8098 Error: 0.50361 Loss: 0.50614 Threads: 2 Forward time: 0.66s Backward time: 0.37s Step time: 2.18s\n", + "1862400 Examples seen. Accuracy: 0.8084 Error: 0.55415 Loss: 0.58423 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "1863040 Examples seen. Accuracy: 0.8089 Error: 0.62718 Loss: 0.66836 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.23s\n", + "1863680 Examples seen. Accuracy: 0.8090 Error: 0.37687 Loss: 0.32353 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.25s\n", + "1864320 Examples seen. Accuracy: 0.8090 Error: 0.51290 Loss: 0.55429 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1864960 Examples seen. Accuracy: 0.8084 Error: 0.41410 Loss: 0.40580 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1865600 Examples seen. Accuracy: 0.8061 Error: 0.50324 Loss: 0.53725 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.19s\n", + "1866240 Examples seen. Accuracy: 0.8048 Error: 0.59008 Loss: 0.80487 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "1866880 Examples seen. Accuracy: 0.8053 Error: 0.51714 Loss: 0.64627 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1867520 Examples seen. Accuracy: 0.8049 Error: 0.61171 Loss: 0.63743 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.18s\n", + "1868160 Examples seen. Accuracy: 0.8050 Error: 0.58211 Loss: 0.60876 Threads: 2 Forward time: 0.67s Backward time: 0.36s Step time: 2.19s\n", + "1868800 Examples seen. Accuracy: 0.8063 Error: 0.39926 Loss: 0.38141 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.20s\n", + "1869440 Examples seen. Accuracy: 0.8059 Error: 0.44298 Loss: 0.57650 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.23s\n", + "1870080 Examples seen. Accuracy: 0.8031 Error: 0.39993 Loss: 0.36993 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.27s\n", + "1870720 Examples seen. Accuracy: 0.8033 Error: 0.51379 Loss: 0.64816 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1871360 Examples seen. Accuracy: 0.8020 Error: 0.35818 Loss: 0.35101 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.24s\n", + "1872000 Examples seen. Accuracy: 0.7990 Error: 0.52422 Loss: 0.48197 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.31s\n", + "1872640 Examples seen. Accuracy: 0.8000 Error: 0.43256 Loss: 0.50256 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1873280 Examples seen. Accuracy: 0.8009 Error: 0.55520 Loss: 0.60948 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1873920 Examples seen. Accuracy: 0.8036 Error: 0.44829 Loss: 0.39442 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1874560 Examples seen. Accuracy: 0.8031 Error: 0.54034 Loss: 0.50079 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "1875200 Examples seen. Accuracy: 0.8047 Error: 0.43847 Loss: 0.47462 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1875840 Examples seen. Accuracy: 0.8076 Error: 0.34572 Loss: 0.26925 Threads: 2 Forward time: 0.71s Backward time: 0.43s Step time: 2.25s\n", + "1876480 Examples seen. Accuracy: 0.8081 Error: 0.48546 Loss: 0.46712 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1877120 Examples seen. Accuracy: 0.8082 Error: 0.44968 Loss: 0.56125 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1877760 Examples seen. Accuracy: 0.8119 Error: 0.48711 Loss: 0.47384 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1878400 Examples seen. Accuracy: 0.8125 Error: 0.46647 Loss: 0.43919 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.26s\n", + "1879040 Examples seen. Accuracy: 0.8119 Error: 0.48567 Loss: 0.48658 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.26s\n", + "1879680 Examples seen. Accuracy: 0.8086 Error: 0.50921 Loss: 0.54014 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 47 Examples seen:1880000 Validation Accuracy: 0.8461 Validation Error: 0.4358 Validation Loss: 0.4672 Total time: 164.95min\n", + "Epoch time: 2.3156 minutes. 50 epochs: 1.9297 hours.\n", + "Epochs: 47. Working time: 2.75 hours.\n", + "1880640 Examples seen. Accuracy: 0.8078 Error: 0.54139 Loss: 0.56009 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.26s\n", + "1881280 Examples seen. Accuracy: 0.8081 Error: 0.56727 Loss: 0.68376 Threads: 2 Forward time: 0.70s Backward time: 0.39s Step time: 2.21s\n", + "1881920 Examples seen. Accuracy: 0.8099 Error: 0.49809 Loss: 0.43852 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1882560 Examples seen. Accuracy: 0.8106 Error: 0.61307 Loss: 0.66965 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1883200 Examples seen. Accuracy: 0.8106 Error: 0.58100 Loss: 0.75292 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1883840 Examples seen. Accuracy: 0.8100 Error: 0.47796 Loss: 0.54201 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.18s\n", + "1884480 Examples seen. Accuracy: 0.8087 Error: 0.60912 Loss: 0.61059 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.20s\n", + "1885120 Examples seen. Accuracy: 0.8078 Error: 0.50626 Loss: 0.60628 Threads: 2 Forward time: 0.72s Backward time: 0.38s Step time: 2.26s\n", + "1885760 Examples seen. Accuracy: 0.8063 Error: 0.40853 Loss: 0.41381 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1886400 Examples seen. Accuracy: 0.8082 Error: 0.39194 Loss: 0.36214 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "1887040 Examples seen. Accuracy: 0.8087 Error: 0.56075 Loss: 0.75945 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1887680 Examples seen. Accuracy: 0.8104 Error: 0.56582 Loss: 0.70844 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1888320 Examples seen. Accuracy: 0.8086 Error: 0.55529 Loss: 0.61516 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.24s\n", + "1888960 Examples seen. Accuracy: 0.8080 Error: 0.54487 Loss: 0.69047 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.28s\n", + "1889600 Examples seen. Accuracy: 0.8081 Error: 0.47768 Loss: 0.49453 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1890240 Examples seen. Accuracy: 0.8070 Error: 0.50376 Loss: 0.44492 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "1890880 Examples seen. Accuracy: 0.8088 Error: 0.55881 Loss: 0.52958 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1891520 Examples seen. Accuracy: 0.8093 Error: 0.51281 Loss: 0.48524 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.25s\n", + "1892160 Examples seen. Accuracy: 0.8078 Error: 0.49099 Loss: 0.53273 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.20s\n", + "1892800 Examples seen. Accuracy: 0.8055 Error: 0.48062 Loss: 0.52319 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.20s\n", + "1893440 Examples seen. Accuracy: 0.8066 Error: 0.54917 Loss: 0.69473 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1894080 Examples seen. Accuracy: 0.8054 Error: 0.54562 Loss: 0.82806 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.20s\n", + "1894720 Examples seen. Accuracy: 0.8063 Error: 0.54859 Loss: 0.55954 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "1895360 Examples seen. Accuracy: 0.8057 Error: 0.53813 Loss: 0.62381 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1896000 Examples seen. Accuracy: 0.8054 Error: 0.58170 Loss: 0.62785 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.28s\n", + "1896640 Examples seen. Accuracy: 0.8037 Error: 0.59521 Loss: 0.63108 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1897280 Examples seen. Accuracy: 0.8029 Error: 0.43521 Loss: 0.44068 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1897920 Examples seen. Accuracy: 0.8008 Error: 0.56656 Loss: 0.59633 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "1898560 Examples seen. Accuracy: 0.8048 Error: 0.56983 Loss: 0.61642 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.21s\n", + "1899200 Examples seen. Accuracy: 0.8038 Error: 0.62338 Loss: 0.77100 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1899840 Examples seen. Accuracy: 0.8056 Error: 0.50801 Loss: 0.58874 Threads: 2 Forward time: 0.71s Backward time: 0.41s Step time: 2.19s\n", + "1900480 Examples seen. Accuracy: 0.8072 Error: 0.51230 Loss: 0.65778 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.24s\n", + "1901120 Examples seen. Accuracy: 0.8053 Error: 0.44799 Loss: 0.44683 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1901760 Examples seen. Accuracy: 0.8059 Error: 0.53390 Loss: 0.66761 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.22s\n", + "1902400 Examples seen. Accuracy: 0.8093 Error: 0.48644 Loss: 0.55300 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1903040 Examples seen. Accuracy: 0.8082 Error: 0.49504 Loss: 0.52673 Threads: 2 Forward time: 0.71s Backward time: 0.40s Step time: 2.20s\n", + "1903680 Examples seen. Accuracy: 0.8057 Error: 0.50122 Loss: 0.60549 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.20s\n", + "1904320 Examples seen. Accuracy: 0.8043 Error: 0.63480 Loss: 0.67013 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1904960 Examples seen. Accuracy: 0.8055 Error: 0.47658 Loss: 0.59252 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1905600 Examples seen. Accuracy: 0.8044 Error: 0.53787 Loss: 0.60134 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.20s\n", + "1906240 Examples seen. Accuracy: 0.8060 Error: 0.46180 Loss: 0.49688 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1906880 Examples seen. Accuracy: 0.8052 Error: 0.60323 Loss: 0.84103 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.21s\n", + "1907520 Examples seen. Accuracy: 0.8063 Error: 0.38955 Loss: 0.35543 Threads: 2 Forward time: 0.72s Backward time: 0.39s Step time: 2.23s\n", + "1908160 Examples seen. Accuracy: 0.8086 Error: 0.32895 Loss: 0.30417 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.24s\n", + "1908800 Examples seen. Accuracy: 0.8081 Error: 0.51247 Loss: 0.53960 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.26s\n", + "1909440 Examples seen. Accuracy: 0.8078 Error: 0.49790 Loss: 0.46333 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.26s\n", + "1910080 Examples seen. Accuracy: 0.8107 Error: 0.57926 Loss: 0.70562 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.26s\n", + "1910720 Examples seen. Accuracy: 0.8104 Error: 0.37037 Loss: 0.34442 Threads: 2 Forward time: 0.70s Backward time: 0.42s Step time: 2.23s\n", + "1911360 Examples seen. Accuracy: 0.8117 Error: 0.47477 Loss: 0.43443 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1912000 Examples seen. Accuracy: 0.8113 Error: 0.57675 Loss: 0.71690 Threads: 2 Forward time: 0.69s Backward time: 0.38s Step time: 2.23s\n", + "1912640 Examples seen. Accuracy: 0.8114 Error: 0.60334 Loss: 0.70678 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1913280 Examples seen. Accuracy: 0.8095 Error: 0.54639 Loss: 0.49200 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.21s\n", + "1913920 Examples seen. Accuracy: 0.8086 Error: 0.65630 Loss: 0.67223 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.22s\n", + "1914560 Examples seen. Accuracy: 0.8084 Error: 0.37847 Loss: 0.35262 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.21s\n", + "1915200 Examples seen. Accuracy: 0.8067 Error: 0.54743 Loss: 0.54633 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "1915840 Examples seen. Accuracy: 0.8074 Error: 0.67685 Loss: 0.81249 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.22s\n", + "1916480 Examples seen. Accuracy: 0.8070 Error: 0.48081 Loss: 0.54769 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "1917120 Examples seen. Accuracy: 0.8069 Error: 0.62720 Loss: 0.60286 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "1917760 Examples seen. Accuracy: 0.8077 Error: 0.59288 Loss: 0.66478 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "1918400 Examples seen. Accuracy: 0.8069 Error: 0.45460 Loss: 0.45116 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1919040 Examples seen. Accuracy: 0.8099 Error: 0.40712 Loss: 0.30144 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1919680 Examples seen. Accuracy: 0.8110 Error: 0.57006 Loss: 0.55709 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at SimpleImageClassifier-64.nn\n", + "Epochs: 48 Examples seen:1920000 Validation Accuracy: 0.8471 Validation Error: 0.4340 Validation Loss: 0.4655 Total time: 168.31min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.615 Min Weight: -0.624 Max Output: 5.370 Min Output: -5.961 TNNetConvolutionLinear 32,32,64 Times: 30.17s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.370 Min Output: -1.308 TNNetMaxPool 8,8,64 Times: 6.89s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.928 Min Weight: 0.888 Max Output: 5.003 Min Output: -2.518 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.287 Min Weight: -0.361 Max Output: 10.704 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.26s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.366 Min Weight: -0.329 Max Output: 11.567 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.11s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.341 Min Weight: -0.262 Max Output: 7.479 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.27s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.220 Min Weight: -0.222 Max Output: 3.229 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.17s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.229 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.04s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.229 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.40s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.322 Min Weight: -0.269 Max Output: 5.344 Min Output: -10.851 TNNetFullConnectLinear 10,1,1 Times: 0.12s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.541 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Epoch time: 2.2833 minutes. 50 epochs: 1.9028 hours.\n", + "Epochs: 48. Working time: 2.81 hours.\n", + "1920640 Examples seen. Accuracy: 0.8138 Error: 0.50093 Loss: 0.50409 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.21s\n", + "1921280 Examples seen. Accuracy: 0.8136 Error: 0.42382 Loss: 0.38492 Threads: 2 Forward time: 0.67s Backward time: 0.42s Step time: 2.25s\n", + "1921920 Examples seen. Accuracy: 0.8121 Error: 0.64389 Loss: 0.69866 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.22s\n", + "1922560 Examples seen. Accuracy: 0.8096 Error: 0.59103 Loss: 0.71368 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1923200 Examples seen. Accuracy: 0.8098 Error: 0.49093 Loss: 0.49587 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.27s\n", + "1923840 Examples seen. Accuracy: 0.8110 Error: 0.56455 Loss: 0.58051 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1924480 Examples seen. Accuracy: 0.8114 Error: 0.47479 Loss: 0.55061 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "1925120 Examples seen. Accuracy: 0.8111 Error: 0.46263 Loss: 0.50340 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.20s\n", + "1925760 Examples seen. Accuracy: 0.8095 Error: 0.60998 Loss: 0.71820 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.22s\n", + "1926400 Examples seen. Accuracy: 0.8105 Error: 0.36097 Loss: 0.40560 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.20s\n", + "1927040 Examples seen. Accuracy: 0.8106 Error: 0.50679 Loss: 0.46585 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1927680 Examples seen. Accuracy: 0.8109 Error: 0.55296 Loss: 0.54762 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.22s\n", + "1928320 Examples seen. Accuracy: 0.8120 Error: 0.55677 Loss: 0.64495 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.20s\n", + "1928960 Examples seen. Accuracy: 0.8130 Error: 0.46066 Loss: 0.44279 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.18s\n", + "1929600 Examples seen. Accuracy: 0.8140 Error: 0.41416 Loss: 0.38152 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.24s\n", + "1930240 Examples seen. Accuracy: 0.8148 Error: 0.45348 Loss: 0.44263 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.25s\n", + "1930880 Examples seen. Accuracy: 0.8099 Error: 0.63283 Loss: 0.67863 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.21s\n", + "1931520 Examples seen. Accuracy: 0.8086 Error: 0.51092 Loss: 0.49371 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.27s\n", + "1932160 Examples seen. Accuracy: 0.8102 Error: 0.44514 Loss: 0.43048 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.25s\n", + "1932800 Examples seen. Accuracy: 0.8094 Error: 0.63867 Loss: 0.62604 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.25s\n", + "1933440 Examples seen. Accuracy: 0.8124 Error: 0.47405 Loss: 0.44067 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.21s\n", + "1934080 Examples seen. Accuracy: 0.8132 Error: 0.36214 Loss: 0.34664 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.21s\n", + "1934720 Examples seen. Accuracy: 0.8126 Error: 0.48852 Loss: 0.40766 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.25s\n", + "1935360 Examples seen. Accuracy: 0.8107 Error: 0.55911 Loss: 0.59137 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1936000 Examples seen. Accuracy: 0.8097 Error: 0.63318 Loss: 0.56502 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.24s\n", + "1936640 Examples seen. Accuracy: 0.8102 Error: 0.48249 Loss: 0.45195 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.21s\n", + "1937280 Examples seen. Accuracy: 0.8136 Error: 0.52887 Loss: 0.48031 Threads: 2 Forward time: 0.65s Backward time: 0.37s Step time: 2.20s\n", + "1937920 Examples seen. Accuracy: 0.8133 Error: 0.37443 Loss: 0.36349 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.19s\n", + "1938560 Examples seen. Accuracy: 0.8113 Error: 0.59044 Loss: 0.69063 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.21s\n", + "1939200 Examples seen. Accuracy: 0.8103 Error: 0.54198 Loss: 0.54411 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1939840 Examples seen. Accuracy: 0.8099 Error: 0.48984 Loss: 0.50818 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.27s\n", + "1940480 Examples seen. Accuracy: 0.8121 Error: 0.59723 Loss: 0.68765 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.25s\n", + "1941120 Examples seen. Accuracy: 0.8104 Error: 0.61404 Loss: 0.65054 Threads: 2 Forward time: 0.66s Backward time: 0.39s Step time: 2.19s\n", + "1941760 Examples seen. Accuracy: 0.8110 Error: 0.58600 Loss: 0.83993 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.18s\n", + "1942400 Examples seen. Accuracy: 0.8119 Error: 0.42922 Loss: 0.44746 Threads: 2 Forward time: 0.65s Backward time: 0.39s Step time: 2.20s\n", + "1943040 Examples seen. Accuracy: 0.8103 Error: 0.47263 Loss: 0.55942 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.21s\n", + "1943680 Examples seen. Accuracy: 0.8069 Error: 0.48092 Loss: 0.45713 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.19s\n", + "1944320 Examples seen. Accuracy: 0.8077 Error: 0.46355 Loss: 0.42463 Threads: 2 Forward time: 0.73s Backward time: 0.42s Step time: 2.25s\n", + "1944960 Examples seen. Accuracy: 0.8068 Error: 0.48739 Loss: 0.46850 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.23s\n", + "1945600 Examples seen. Accuracy: 0.8078 Error: 0.58375 Loss: 0.79021 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1946240 Examples seen. Accuracy: 0.8083 Error: 0.44738 Loss: 0.39088 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "1946880 Examples seen. Accuracy: 0.8089 Error: 0.52736 Loss: 0.59547 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1947520 Examples seen. Accuracy: 0.8101 Error: 0.47553 Loss: 0.45973 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1948160 Examples seen. Accuracy: 0.8104 Error: 0.58103 Loss: 0.77457 Threads: 2 Forward time: 0.70s Backward time: 0.37s Step time: 2.23s\n", + "1948800 Examples seen. Accuracy: 0.8092 Error: 0.55348 Loss: 0.60071 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1949440 Examples seen. Accuracy: 0.8118 Error: 0.47113 Loss: 0.43825 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.22s\n", + "1950080 Examples seen. Accuracy: 0.8140 Error: 0.46416 Loss: 0.47955 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.23s\n", + "1950720 Examples seen. Accuracy: 0.8129 Error: 0.49415 Loss: 0.45426 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1951360 Examples seen. Accuracy: 0.8123 Error: 0.57079 Loss: 0.56431 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.25s\n", + "1952000 Examples seen. Accuracy: 0.8126 Error: 0.61713 Loss: 0.60112 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.21s\n", + "1952640 Examples seen. Accuracy: 0.8140 Error: 0.33224 Loss: 0.29115 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.21s\n", + "1953280 Examples seen. Accuracy: 0.8129 Error: 0.53382 Loss: 0.50491 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.20s\n", + "1953920 Examples seen. Accuracy: 0.8121 Error: 0.54572 Loss: 0.58553 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.19s\n", + "1954560 Examples seen. Accuracy: 0.8092 Error: 0.54420 Loss: 0.49624 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.21s\n", + "1955200 Examples seen. Accuracy: 0.8116 Error: 0.46305 Loss: 0.45468 Threads: 2 Forward time: 0.68s Backward time: 0.37s Step time: 2.20s\n", + "1955840 Examples seen. Accuracy: 0.8116 Error: 0.53085 Loss: 0.60465 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.22s\n", + "1956480 Examples seen. Accuracy: 0.8125 Error: 0.60005 Loss: 0.62657 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.20s\n", + "1957120 Examples seen. Accuracy: 0.8133 Error: 0.62648 Loss: 0.67181 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.19s\n", + "1957760 Examples seen. Accuracy: 0.8141 Error: 0.59660 Loss: 0.64000 Threads: 2 Forward time: 0.67s Backward time: 0.37s Step time: 2.19s\n", + "1958400 Examples seen. Accuracy: 0.8153 Error: 0.53871 Loss: 0.60181 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.20s\n", + "1959040 Examples seen. Accuracy: 0.8145 Error: 0.54917 Loss: 0.50352 Threads: 2 Forward time: 0.68s Backward time: 0.40s Step time: 2.19s\n", + "1959680 Examples seen. Accuracy: 0.8110 Error: 0.57082 Loss: 0.70858 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.21s\n", + "Starting Validation.\n", + "Epochs: 49 Examples seen:1960000 Validation Accuracy: 0.8467 Validation Error: 0.4330 Validation Loss: 0.4670 Total time: 171.67min\n", + "Epoch time: 2.3000 minutes. 50 epochs: 1.9167 hours.\n", + "Epochs: 49. Working time: 2.86 hours.\n", + "1960640 Examples seen. Accuracy: 0.8100 Error: 0.45957 Loss: 0.40462 Threads: 2 Forward time: 0.68s Backward time: 0.43s Step time: 2.34s\n", + "1961280 Examples seen. Accuracy: 0.8089 Error: 0.57411 Loss: 0.71178 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.32s\n", + "1961920 Examples seen. Accuracy: 0.8070 Error: 0.58835 Loss: 0.72774 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.32s\n", + "1962560 Examples seen. Accuracy: 0.8071 Error: 0.51441 Loss: 0.56713 Threads: 2 Forward time: 0.79s Backward time: 0.45s Step time: 2.38s\n", + "1963200 Examples seen. Accuracy: 0.8057 Error: 0.60466 Loss: 0.61726 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.40s\n", + "1963840 Examples seen. Accuracy: 0.8063 Error: 0.42496 Loss: 0.37403 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.29s\n", + "1964480 Examples seen. Accuracy: 0.8067 Error: 0.57526 Loss: 0.63215 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.25s\n", + "1965120 Examples seen. Accuracy: 0.8054 Error: 0.55087 Loss: 0.53794 Threads: 2 Forward time: 0.72s Backward time: 0.43s Step time: 2.24s\n", + "1965760 Examples seen. Accuracy: 0.8055 Error: 0.45622 Loss: 0.43673 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.24s\n", + "1966400 Examples seen. Accuracy: 0.8067 Error: 0.58231 Loss: 0.64266 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1967040 Examples seen. Accuracy: 0.8060 Error: 0.54395 Loss: 0.53295 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.22s\n", + "1967680 Examples seen. Accuracy: 0.8037 Error: 0.65669 Loss: 0.63776 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.23s\n", + "1968320 Examples seen. Accuracy: 0.8030 Error: 0.59404 Loss: 0.74615 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.24s\n", + "1968960 Examples seen. Accuracy: 0.8041 Error: 0.67324 Loss: 0.71918 Threads: 2 Forward time: 0.67s Backward time: 0.41s Step time: 2.24s\n", + "1969600 Examples seen. Accuracy: 0.8062 Error: 0.46650 Loss: 0.51092 Threads: 2 Forward time: 0.69s Backward time: 0.39s Step time: 2.26s\n", + "1970240 Examples seen. Accuracy: 0.8065 Error: 0.43729 Loss: 0.37835 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.26s\n", + "1970880 Examples seen. Accuracy: 0.8077 Error: 0.53524 Loss: 0.63282 Threads: 2 Forward time: 0.71s Backward time: 0.42s Step time: 2.28s\n", + "1971520 Examples seen. Accuracy: 0.8070 Error: 0.64358 Loss: 0.71935 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.29s\n", + "1972160 Examples seen. Accuracy: 0.8073 Error: 0.48978 Loss: 0.41765 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.27s\n", + "1972800 Examples seen. Accuracy: 0.8065 Error: 0.49182 Loss: 0.59439 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1973440 Examples seen. Accuracy: 0.8052 Error: 0.54001 Loss: 0.56961 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.28s\n", + "1974080 Examples seen. Accuracy: 0.8065 Error: 0.42105 Loss: 0.43186 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.23s\n", + "1974720 Examples seen. Accuracy: 0.8100 Error: 0.35631 Loss: 0.31772 Threads: 2 Forward time: 0.72s Backward time: 0.41s Step time: 2.24s\n", + "1975360 Examples seen. Accuracy: 0.8102 Error: 0.60557 Loss: 0.63095 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "1976000 Examples seen. Accuracy: 0.8126 Error: 0.60133 Loss: 0.68636 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.29s\n", + "1976640 Examples seen. Accuracy: 0.8126 Error: 0.46255 Loss: 0.44511 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.27s\n", + "1977280 Examples seen. Accuracy: 0.8142 Error: 0.42302 Loss: 0.47326 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.26s\n", + "1977920 Examples seen. Accuracy: 0.8155 Error: 0.52442 Loss: 0.52183 Threads: 2 Forward time: 0.70s Backward time: 0.38s Step time: 2.27s\n", + "1978560 Examples seen. Accuracy: 0.8158 Error: 0.51094 Loss: 0.46228 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1979200 Examples seen. Accuracy: 0.8150 Error: 0.59783 Loss: 0.59793 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.31s\n", + "1979840 Examples seen. Accuracy: 0.8158 Error: 0.47901 Loss: 0.51368 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1980480 Examples seen. Accuracy: 0.8152 Error: 0.39612 Loss: 0.40619 Threads: 2 Forward time: 0.72s Backward time: 0.42s Step time: 2.27s\n", + "1981120 Examples seen. Accuracy: 0.8149 Error: 0.50504 Loss: 0.49437 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.23s\n", + "1981760 Examples seen. Accuracy: 0.8124 Error: 0.49318 Loss: 0.53465 Threads: 2 Forward time: 0.71s Backward time: 0.37s Step time: 2.24s\n", + "1982400 Examples seen. Accuracy: 0.8100 Error: 0.62628 Loss: 0.69793 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1983040 Examples seen. Accuracy: 0.8098 Error: 0.49406 Loss: 0.49361 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.26s\n", + "1983680 Examples seen. Accuracy: 0.8098 Error: 0.48432 Loss: 0.47630 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.32s\n", + "1984320 Examples seen. Accuracy: 0.8094 Error: 0.53666 Loss: 0.54689 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1984960 Examples seen. Accuracy: 0.8061 Error: 0.48903 Loss: 0.50320 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.22s\n", + "1985600 Examples seen. Accuracy: 0.8062 Error: 0.57331 Loss: 0.61513 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1986240 Examples seen. Accuracy: 0.8065 Error: 0.47005 Loss: 0.43056 Threads: 2 Forward time: 0.66s Backward time: 0.41s Step time: 2.22s\n", + "1986880 Examples seen. Accuracy: 0.8076 Error: 0.44742 Loss: 0.49716 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.24s\n", + "1987520 Examples seen. Accuracy: 0.8073 Error: 0.57827 Loss: 0.53313 Threads: 2 Forward time: 0.69s Backward time: 0.41s Step time: 2.25s\n", + "1988160 Examples seen. Accuracy: 0.8077 Error: 0.54712 Loss: 0.60738 Threads: 2 Forward time: 0.67s Backward time: 0.40s Step time: 2.23s\n", + "1988800 Examples seen. Accuracy: 0.8114 Error: 0.34752 Loss: 0.36562 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.23s\n", + "1989440 Examples seen. Accuracy: 0.8105 Error: 0.47211 Loss: 0.54768 Threads: 2 Forward time: 0.68s Backward time: 0.38s Step time: 2.24s\n", + "1990080 Examples seen. Accuracy: 0.8114 Error: 0.48211 Loss: 0.48761 Threads: 2 Forward time: 0.69s Backward time: 0.40s Step time: 2.26s\n", + "1990720 Examples seen. Accuracy: 0.8129 Error: 0.38580 Loss: 0.37487 Threads: 2 Forward time: 0.66s Backward time: 0.40s Step time: 2.25s\n", + "1991360 Examples seen. Accuracy: 0.8147 Error: 0.37795 Loss: 0.31157 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.23s\n", + "1992000 Examples seen. Accuracy: 0.8120 Error: 0.55512 Loss: 0.75219 Threads: 2 Forward time: 0.68s Backward time: 0.42s Step time: 2.25s\n", + "1992640 Examples seen. Accuracy: 0.8124 Error: 0.46599 Loss: 0.44235 Threads: 2 Forward time: 0.67s Backward time: 0.38s Step time: 2.24s\n", + "1993280 Examples seen. Accuracy: 0.8118 Error: 0.38527 Loss: 0.33272 Threads: 2 Forward time: 0.70s Backward time: 0.40s Step time: 2.24s\n", + "1993920 Examples seen. Accuracy: 0.8093 Error: 0.70269 Loss: 0.79818 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.22s\n", + "1994560 Examples seen. Accuracy: 0.8082 Error: 0.52381 Loss: 0.50207 Threads: 2 Forward time: 0.69s Backward time: 0.37s Step time: 2.21s\n", + "1995200 Examples seen. Accuracy: 0.8065 Error: 0.45808 Loss: 0.43119 Threads: 2 Forward time: 0.66s Backward time: 0.38s Step time: 2.22s\n", + "1995840 Examples seen. Accuracy: 0.8091 Error: 0.48418 Loss: 0.61899 Threads: 2 Forward time: 0.68s Backward time: 0.39s Step time: 2.24s\n", + "1996480 Examples seen. Accuracy: 0.8083 Error: 0.53391 Loss: 0.53823 Threads: 2 Forward time: 0.68s Backward time: 0.41s Step time: 2.24s\n", + "1997120 Examples seen. Accuracy: 0.8079 Error: 0.47216 Loss: 0.51692 Threads: 2 Forward time: 0.69s Backward time: 0.42s Step time: 2.25s\n", + "1997760 Examples seen. Accuracy: 0.8078 Error: 0.56156 Loss: 0.68294 Threads: 2 Forward time: 0.67s Backward time: 0.39s Step time: 2.24s\n", + "1998400 Examples seen. Accuracy: 0.8047 Error: 0.52817 Loss: 0.55287 Threads: 2 Forward time: 0.71s Backward time: 0.39s Step time: 2.29s\n", + "1999040 Examples seen. Accuracy: 0.8064 Error: 0.52653 Loss: 0.52088 Threads: 2 Forward time: 0.70s Backward time: 0.37s Step time: 2.27s\n", + "1999680 Examples seen. Accuracy: 0.8079 Error: 0.45205 Loss: 0.43995 Threads: 2 Forward time: 0.70s Backward time: 0.41s Step time: 2.22s\n", + "Starting Validation.\n", + "Epochs: 50 Examples seen:2000000 Validation Accuracy: 0.8461 Validation Error: 0.4314 Validation Loss: 0.4663 Total time: 175.07min\n", + "Layer 0 Max Output: 1.672 Min Output: -1.922 TNNetInput 32,32,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 64 Max Weight: 0.626 Min Weight: -0.628 Max Output: 5.432 Min Output: -5.954 TNNetConvolutionLinear 32,32,64 Times: 30.24s 0.07s Parent:0\n", + "Layer 2 Max Output: 5.432 Min Output: -1.371 TNNetMaxPool 8,8,64 Times: 7.01s 0.00s Parent:1\n", + "Layer 3 Neurons: 1 Max Weight: 0.937 Min Weight: 0.897 Max Output: 5.009 Min Output: -2.571 TNNetMovingStdNormalization 8,8,64 Times: 0.14s 0.00s Parent:2\n", + "Layer 4 Neurons: 64 Max Weight: 0.290 Min Weight: -0.370 Max Output: 10.887 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.22s 0.04s Parent:3\n", + "Layer 5 Neurons: 64 Max Weight: 0.376 Min Weight: -0.336 Max Output: 11.827 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.13s 0.03s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.346 Min Weight: -0.269 Max Output: 7.334 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.21s 0.04s Parent:5\n", + "Layer 7 Neurons: 64 Max Weight: 0.215 Min Weight: -0.224 Max Output: 3.276 Min Output: 0.000 TNNetConvolutionReLU 8,8,64 Times: 6.15s 0.01s Parent:6\n", + "Layer 8 Max Output: 3.276 Min Output: 0.000 TNNetDropout 8,8,64 Times: 0.03s 0.00s Parent:7\n", + "Layer 9 Max Output: 3.276 Min Output: 0.000 TNNetMaxPool 4,4,64 Times: 0.35s 0.00s Parent:8\n", + "Layer 10 Neurons: 10 Max Weight: 0.319 Min Weight: -0.273 Max Output: 5.777 Min Output: -10.742 TNNetFullConnectLinear 10,1,1 Times: 0.13s 0.00s Parent:9\n", + "Layer 11 Max Output: 0.608 Min Output: 0.000 TNNetSoftMax 10,1,1 Times: 0.00s 0.00s Parent:10\n", + "Starting Testing.\n", + "Epochs: 50 Examples seen:2000000 Test Accuracy: 0.8393 Test Error: 0.4457 Test Loss: 0.4874 Total time: 176.12min\n", + "Epoch time: 2.3167 minutes. 50 epochs: 1.9306 hours.\n", + "Epochs: 50. Working time: 2.94 hours.\n", + "Finished.\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "gx8P5ODRCC3e", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "1341f4ea-3778-4ff6-f8ed-c68646624989" + }, + "source": [ + "from google.colab import files\n", + "!ls -l" + ], + "execution_count": 21, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "total 348464\n", + "-rw-r--r-- 1 root root 61 Sep 23 08:51 batches.meta.txt\n", + "drwxr-xr-x 2 2156 1103 4096 Jun 4 2009 cifar-10-batches-bin\n", + "-rw-r--r-- 1 root root 30730000 Sep 23 08:51 data_batch_1.bin\n", + "-rw-r--r-- 1 root root 30730000 Sep 23 08:51 data_batch_2.bin\n", + "-rw-r--r-- 1 root root 30730000 Sep 23 08:51 data_batch_3.bin\n", + "-rw-r--r-- 1 root root 30730000 Sep 23 08:51 data_batch_4.bin\n", + "-rw-r--r-- 1 root root 30730000 Sep 23 08:51 data_batch_5.bin\n", + "-rw-r--r-- 1 root root 170052171 Sep 23 08:46 file.tar\n", + "drwxr-xr-x 5 root root 4096 Sep 23 08:39 mtprocs\n", + "drwxr-xr-x 7 root root 4096 Sep 23 08:42 neural-api\n", + "-rw-r--r-- 1 root root 88 Sep 23 08:51 readme.html\n", + "drwxr-xr-x 1 root root 4096 Sep 16 13:40 sample_data\n", + "-rw-r--r-- 1 root root 3390 Sep 23 11:48 SimpleImageClassifier-64.csv\n", + "-rw-r--r-- 1 root root 2349757 Sep 23 11:41 SimpleImageClassifier-64.nn\n", + "-rw-r--r-- 1 root root 30730000 Sep 23 08:51 test_batch.bin\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "aZ4Tp6D6Pqq6", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 17 + }, + "outputId": "b48bcd6d-523d-4a9e-e120-acda4fb48050" + }, + "source": [ + "files.download('SimpleImageClassifier-64.nn')" + ], + "execution_count": 22, + "outputs": [ + { + "output_type": "display_data", + "data": { + "application/javascript": [ + "\n", + " async function download(id, filename, size) {\n", + " if (!google.colab.kernel.accessAllowed) {\n", + " return;\n", + " }\n", + " const div = document.createElement('div');\n", + " const label = document.createElement('label');\n", + " label.textContent = `Downloading \"${filename}\": `;\n", + " div.appendChild(label);\n", + " const progress = document.createElement('progress');\n", + " progress.max = size;\n", + " div.appendChild(progress);\n", + " document.body.appendChild(div);\n", + "\n", + " const buffers = [];\n", + " let downloaded = 0;\n", + "\n", + " const channel = await google.colab.kernel.comms.open(id);\n", + " // Send a message to notify the kernel that we're ready.\n", + " channel.send({})\n", + "\n", + " for await (const message of channel.messages) {\n", + " // Send a message to notify the kernel that we're ready.\n", + " channel.send({})\n", + " if (message.buffers) {\n", + " for (const buffer of message.buffers) {\n", + " buffers.push(buffer);\n", + " downloaded += buffer.byteLength;\n", + " progress.value = downloaded;\n", + " }\n", + " }\n", + " }\n", + " const blob = new Blob(buffers, {type: 'application/binary'});\n", + " const a = document.createElement('a');\n", + " a.href = window.URL.createObjectURL(blob);\n", + " a.download = filename;\n", + " div.appendChild(a);\n", + " a.click();\n", + " div.remove();\n", + " }\n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "application/javascript": [ + "download(\"download_f9e6a61e-8527-4027-82f9-c13e9eb9a6d9\", \"SimpleImageClassifier-64.nn\", 2349757)" + ], + "text/plain": [ + "" + ] + }, + "metadata": {} + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "ZnSKco6Ene3u" + }, + "source": [ + "" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "zHtuMFPQLsYf", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 17 + }, + "outputId": "f49eb45f-c2b3-4c3c-f44f-b78634ce7eb8" + }, + "source": [ + "files.download('SimpleImageClassifier-64.csv')" + ], + "execution_count": 23, + "outputs": [ + { + "output_type": "display_data", + "data": { + "application/javascript": [ + "\n", + " async function download(id, filename, size) {\n", + " if (!google.colab.kernel.accessAllowed) {\n", + " return;\n", + " }\n", + " const div = document.createElement('div');\n", + " const label = document.createElement('label');\n", + " label.textContent = `Downloading \"${filename}\": `;\n", + " div.appendChild(label);\n", + " const progress = document.createElement('progress');\n", + " progress.max = size;\n", + " div.appendChild(progress);\n", + " document.body.appendChild(div);\n", + "\n", + " const buffers = [];\n", + " let downloaded = 0;\n", + "\n", + " const channel = await google.colab.kernel.comms.open(id);\n", + " // Send a message to notify the kernel that we're ready.\n", + " channel.send({})\n", + "\n", + " for await (const message of channel.messages) {\n", + " // Send a message to notify the kernel that we're ready.\n", + " channel.send({})\n", + " if (message.buffers) {\n", + " for (const buffer of message.buffers) {\n", + " buffers.push(buffer);\n", + " downloaded += buffer.byteLength;\n", + " progress.value = downloaded;\n", + " }\n", + " }\n", + " }\n", + " const blob = new Blob(buffers, {type: 'application/binary'});\n", + " const a = document.createElement('a');\n", + " a.href = window.URL.createObjectURL(blob);\n", + " a.download = filename;\n", + " div.appendChild(a);\n", + " a.click();\n", + " div.remove();\n", + " }\n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "application/javascript": [ + "download(\"download_68bea886-9e4e-4c29-83a3-c0d90357eb6d\", \"SimpleImageClassifier-64.csv\", 3390)" + ], + "text/plain": [ + "" + ] + }, + "metadata": {} + } + ] + } + ] +} \ No newline at end of file diff --git a/Packages/maXbox47580.zip b/Packages/maXbox47580.zip new file mode 100644 index 00000000..9ca9c940 Binary files /dev/null and b/Packages/maXbox47580.zip differ diff --git a/Packages/maXbox47580_3.zip b/Packages/maXbox47580_3.zip new file mode 100644 index 00000000..19e1740e Binary files /dev/null and b/Packages/maXbox47580_3.zip differ diff --git a/Packages/p4dmodel2.png b/Packages/p4dmodel2.png new file mode 100644 index 00000000..476aef62 Binary files /dev/null and b/Packages/p4dmodel2.png differ diff --git a/Packages/p4dmodel2walker.png b/Packages/p4dmodel2walker.png new file mode 100644 index 00000000..b8b2ac95 Binary files /dev/null and b/Packages/p4dmodel2walker.png differ diff --git a/Packages/p4dmodelvect.pac b/Packages/p4dmodelvect.pac new file mode 100644 index 00000000..13f63493 Binary files /dev/null and b/Packages/p4dmodelvect.pac differ diff --git a/README.md b/README.md index 15caeffb..35e28fa4 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,41 @@ Visit the [support forum](https://en.delphipraxis.net/forum/39-python4delphi/) t ### License The project is licensed under the MIT [license](https://github.com/pyscripter/python4delphi/blob/master/LICENSE). + +### maXbox Integration +On maXbox4 theres a scripting integration with Eval and Ecec. +The eval() is not just limited to simple expression. We can execute functions, call methods, reference variables and so on. +For instance you can install packages from your script: +eng.ExecString(‘import subprocess’); +eng.ExecString(‘subprocess.call([“pip”, “install”, “langdetect”])’) +eng.ExecString(‘from langdetect import detect’); +println(‘detect: ‘+eng.EvalStr(‘detect(“bonjour mes ordinateurs”)’)); +>>> detect: fr + +The minimal configuration depends on your Python-installation and the UseLastKnownVersion property +in TDynamicDll but once known it goes like this with raiseError to get the Python exceptions: + +with TPythonEngine.Create(Nil) do begin + pythonhome:= PYHOME; + try + loadDLL; + Println('Decimal: '+ + EvalStr('__import__("decimal").Decimal(0.1)')); + except + raiseError; + finally + free; + end; +end; + +https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/ + +![1096_2022-11-12_svg_delphi_maxbox_seaborn3](https://user-images.githubusercontent.com/3393121/201485057-67adfb62-24ba-4d91-b2b6-335c93da133c.png) + +Compiler and Interpreter with interactive shell in one hell + +![1096_2022-11-12_svg_delphi_maxbox_seaborn4](https://user-images.githubusercontent.com/3393121/201486768-11bfa00c-05e7-4a19-a335-cd1b271de8a3.png) + + + + diff --git a/Source/PythonEngine_mX4.pas b/Source/PythonEngine_mX4.pas new file mode 100644 index 00000000..6e223cd7 --- /dev/null +++ b/Source/PythonEngine_mX4.pas @@ -0,0 +1,9335 @@ +(**************************************************************************) +(* *) +(* Module: Unit 'PythonEngine' Copyright (c) 1997 *) +(* *) +(* Dr. Dietmar Budelsky *) +(* dbudelsky@web.de *) +(* Germany *) +(* *) +(* Morgan Martinet *) +(* 4723 rue Brebeuf *) +(* H2J 3L2 MONTREAL (QC) *) +(* CANADA *) +(* e-mail: p4d@mmm-experts.com *) +(* *) +(* PyScripter *) +(* e-mail: pyscripter@gmail.com *) +(* *) +(* Project page: https://github.com/pyscripter/python4delphi *) +(**************************************************************************) +(* Functionality: Delphi Components that provide an interface to the *) +(* Python language (see python.txt for more infos on *) +(* Python itself). *) +(* *) +(**************************************************************************) +(* Contributors: *) +(* Grzegorz Makarewicz (mak@mikroplan.com.pl) *) +(* Andrew Robinson (andy@hps1.demon.co.uk) *) +(* Mark Watts(mark_watts@hotmail.com) *) +(* Olivier Deckmyn (olivier.deckmyn@mail.dotcom.fr) *) +(* Sigve Tjora (public@tjora.no) *) +(* Mark Derricutt (mark@talios.com) *) +(* Igor E. Poteryaev (jah@mail.ru) *) +(* Yuri Filimonov (fil65@mail.ru) *) +(* Stefan Hoffmeister (Stefan.Hoffmeister@Econos.de) *) +(* Michiel du Toit (micdutoit@hsbfn.com) - Lazarus Port *) +(* Chris Nicolai (nicolaitanes@gmail.com) *) +(* Andrey Gruzdev (andrey.gruzdev@gmail.com) *) +(**************************************************************************) +(* This source code is distributed with no WARRANTY, for no reason or use.*) +(* Everyone is allowed to use and change this code free for his own tasks *) +(* and projects, as long as this header and its copyright text is intact. *) +(* For changed versions of this code, which are public distributed the *) +(* following additional conditions have to be fullfilled: *) +(* 1) The header has to contain a comment on the change and the author of *) +(* it. *) +(* 2) A copy of the changed source has to be sent to the above E-Mail *) +(* address or my then valid address, if this is possible to the *) +(* author. *) +(* The second condition has the target to maintain an up to date central *) +(* version of the component. If this condition is not acceptable for *) +(* confidential or legal reasons, everyone is free to derive a component *) +(* or to generate a diff file to my or other original sources. *) +(* Dr. Dietmar Budelsky, 1997-11-17 *) +(**************************************************************************) +// changes for maXbox4 integration tester frame - dll run exception +// PyUnicode_Check error --> pyUnicodeAsUTF8String( obj : PPyObject ) : RawByteString; +// check encodestring and cleanstring + +{$I Definition.Inc} +//{$POINTERMATH ON} + +unit PythonEngine; + +{ TODO -oMMM : implement tp_as_buffer slot } +{ TODO -oMMM : implement Attribute descriptor and subclassing stuff } + +{$IFNDEF FPC} + {$IFNDEF DELPHI2010_OR_HIGHER} + //Error! Delphi 2010 or higher is required! + {$ENDIF} +{$ENDIF} + +{$IF defined(LINUX) or (defined(BSD) and not defined(DARWIN)) or defined(SOLARIS) or defined(HAIKU)} + {$define _so_files} +{$IFEND} + +interface + +uses + Types, +{$IFDEF MSWINDOWS} + Windows, +{$ELSE} +{$IFDEF FPC} + Dl, + DynLibs, +{$ELSE} + Posix.DLfcn, + Posix.Pthread, +{$ENDIF} +{$ENDIF} + Classes, + SysUtils, + SyncObjs, + Variants, + MethodCallBack; + +{$IF not Defined(FPC) and (CompilerVersion >= 23)} +const + {$IF CompilerVersion >= 33} + pidSupportedPlatforms = pidWin32 or pidWin64 or pidOSX32 or pidOSX64 or pidLinux64; + {$ELSE} + pidSupportedPlatforms = pidWin32 or pidWin64 or pidOSX32; + {$IFEND} +{$IFEND} + + +//####################################################### +//## ## +//## PYTHON specific constants ## +//## ## +//####################################################### + +type + TPythonVersionProp = record + DllName : string; + RegVersion : string; + APIVersion : Integer; + end; +const +{$IFDEF MSWINDOWS} + PYTHON_KNOWN_VERSIONS: array[1..8] of TPythonVersionProp = + ( + (DllName: 'python33.dll'; RegVersion: '3.3'; APIVersion: 1013), + (DllName: 'python34.dll'; RegVersion: '3.4'; APIVersion: 1013), + (DllName: 'python35.dll'; RegVersion: '3.5'; APIVersion: 1013), + (DllName: 'python36.dll'; RegVersion: '3.6'; APIVersion: 1013), + (DllName: 'python37.dll'; RegVersion: '3.7'; APIVersion: 1013), + (DllName: 'python38.dll'; RegVersion: '3.8'; APIVersion: 1013), + (DllName: 'python39.dll'; RegVersion: '3.9'; APIVersion: 1013), + (DllName: 'python310.dll'; RegVersion: '3.10'; APIVersion: 1013) + ); +{$ENDIF} +{$IFDEF _so_files} + PYTHON_KNOWN_VERSIONS: array[1..8] of TPythonVersionProp = + ( + (DllName: 'libpython3.3m.so'; RegVersion: '3.3'; APIVersion: 1013), + (DllName: 'libpython3.4m.so'; RegVersion: '3.4'; APIVersion: 1013), + (DllName: 'libpython3.5m.so'; RegVersion: '3.5'; APIVersion: 1013), + (DllName: 'libpython3.6m.so'; RegVersion: '3.6'; APIVersion: 1013), + (DllName: 'libpython3.7m.so'; RegVersion: '3.7'; APIVersion: 1013), + (DllName: 'libpython3.8.so'; RegVersion: '3.8'; APIVersion: 1013), + (DllName: 'libpython3.9.so'; RegVersion: '3.9'; APIVersion: 1013), + (DllName: 'libpython3.10.so'; RegVersion: '3.10'; APIVersion: 1013) + ); +{$ENDIF} +{$IFDEF DARWIN} + PYTHON_KNOWN_VERSIONS: array[1..8] of TPythonVersionProp = + ( + (DllName: 'libpython3.3.dylib'; RegVersion: '3.3'; APIVersion: 1013), + (DllName: 'libpython3.4.dylib'; RegVersion: '3.4'; APIVersion: 1013), + (DllName: 'libpython3.5.dylib'; RegVersion: '3.5'; APIVersion: 1013), + (DllName: 'libpython3.6.dylib'; RegVersion: '3.6'; APIVersion: 1013), + (DllName: 'libpython3.7.dylib'; RegVersion: '3.7'; APIVersion: 1013), + (DllName: 'libpython3.8.dylib'; RegVersion: '3.8'; APIVersion: 1013), + (DllName: 'libpython3.9.dylib'; RegVersion: '3.9'; APIVersion: 1013), + (DllName: 'libpython3.10.dylib'; RegVersion: '3.10'; APIVersion: 1013) + ); +{$ENDIF} + + COMPILED_FOR_PYTHON_VERSION_INDEX = High(PYTHON_KNOWN_VERSIONS); + + PYT_METHOD_BUFFER_INCREASE = 10; + PYT_MEMBER_BUFFER_INCREASE = 10; + PYT_GETSET_BUFFER_INCREASE = 10; + + METH_VARARGS = $0001; + METH_KEYWORDS = $0002; + + // Masks for the co_flags field of PyCodeObject + CO_OPTIMIZED = $0001; + CO_NEWLOCALS = $0002; + CO_VARARGS = $0004; + CO_VARKEYWORDS = $0008; + + // Rich comparison opcodes introduced in version 2.1 + Py_LT = 0; + Py_LE = 1; + Py_EQ = 2; + Py_NE = 3; + Py_GT = 4; + Py_GE = 5; +type + // Delphi equivalent used by TPyObject + TRichComparisonOpcode = (pyLT, pyLE, pyEQ, pyNE, pyGT, pyGE); + +{$IFDEF MSWINDOWS} + C_Long = Integer; + C_ULong = Cardinal; +{$ELSE} + C_Long= NativeInt; + C_ULong = NativeUInt; +{$ENDIF} + + const +{ +Type flags (tp_flags) + +These flags are used to change expected features and behavior for a +particular type. + +Arbitration of the flag bit positions will need to be coordinated among +all extension writers who publicly release their extensions (this will +be fewer than you might expect!). + +Most flags were removed as of Python 3.0 to make room for new flags. (Some +flags are not for backwards compatibility but to indicate the presence of an +optional feature; these flags remain of course.) + +Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value. + +Code can use PyType_HasFeature(type_ob, flag_value) to test whether the +given type object has a specified feature. +} + +// Set if the type object is dynamically allocated + Py_TPFLAGS_HEAPTYPE = (C_ULong(1) shl 9); + +// Set if the type allows subclassing + Py_TPFLAGS_BASETYPE = (C_ULong(1) shl 10); + +// Set if the type is 'ready' -- fully initialized + Py_TPFLAGS_READY = (C_ULong(1) shl 12); + +// Set while the type is being 'readied', to prevent recursive ready calls + Py_TPFLAGS_READYING = (C_ULong(1) shl 13); + +// Objects support garbage collection (see objimp.h) + Py_TPFLAGS_HAVE_GC = (C_ULong(1) shl 14); + +// Set if the type implements the vectorcall protocol (PEP 590) */ + _Py_TPFLAGS_HAVE_VECTORCALL = (C_ULong(1) shl 11); + +// Objects behave like an unbound method + Py_TPFLAGS_METHOD_DESCRIPTOR = (C_ULong(1) shl 17); + +// Objects support type attribute cache + Py_TPFLAGS_HAVE_VERSION_TAG = (C_ULong(1) shl 18); + Py_TPFLAGS_VALID_VERSION_TAG = (C_ULong(1) shl 19); + +// Type is abstract and cannot be instantiated + Py_TPFLAGS_IS_ABSTRACT = (C_ULong(1) shl 20); + +// These flags are used to determine if a type is a subclass. + Py_TPFLAGS_LONG_SUBCLASS = (C_ULong(1) shl 24); + Py_TPFLAGS_LIST_SUBCLASS = (C_ULong(1) shl 25); + Py_TPFLAGS_TUPLE_SUBCLASS = (C_ULong(1) shl 26); + Py_TPFLAGS_BYTES_SUBCLASS = (C_ULong(1) shl 27); + Py_TPFLAGS_UNICODE_SUBCLASS = (C_ULong(1) shl 28); + Py_TPFLAGS_DICT_SUBCLASS = (C_ULong(1) shl 29); + Py_TPFLAGS_BASE_EXC_SUBCLASS = (C_ULong(1) shl 30); + Py_TPFLAGS_TYPE_SUBCLASS = (C_ULong(1) shl 31); + + Py_TPFLAGS_DEFAULT = Py_TPFLAGS_BASETYPE or Py_TPFLAGS_HAVE_VERSION_TAG; + +// See function PyType_HasFeature below for testing the flags. + +// Delphi equivalent used by TPythonType +type + TPFlag = (tpfHeapType, tpfBaseType, tpfReady, tpfReadying, tpfHaveGC, + tpVectorCall, tpMethodDescriptor, tpHaveVersionTag, + tpValidVersionTag, tpIsAbstract, tpLongSubclass, + tpListSubClass, tpTupleSubclass, tpBytesSubclass, + tpBaseExcSubclass, tpTypeSubclass); + TPFlags = set of TPFlag; + +const + TPFLAGS_DEFAULT = [tpfBaseType, tpHaveVersionTag]; + +//------- Python opcodes ----------// +const + single_input = 256; + file_input = 257; + eval_input = 258; + + // UnicodeObject.h +const + // Return values of the PyUnicode_KIND() macro + + { + PyUnicode_WCHAR_KIND is deprecated. Will be removed in Python 12. + String contains only wstr byte characters. This is only possible + when the string was created with a legacy API and _PyUnicode_Ready() + has not been called yet. + } + PyUnicode_WCHAR_KIND = 0; + + PyUnicode_1BYTE_KIND = 1; + PyUnicode_2BYTE_KIND = 2; + PyUnicode_4BYTE_KIND = 4; + + // structmember.h +const +//* Types */ + T_SHORT = 0; + T_INT = 1; + T_LONG = 2; + T_FLOAT = 3; + T_DOUBLE = 4; + T_STRING = 5; + T_OBJECT = 6; +//* XXX the ordering here is weird for binary compatibility */ + T_CHAR = 7; //* 1-character string */ + T_BYTE = 8; //* 8-bit signed int */ +//* unsigned variants: */ + T_UBYTE = 9; + T_USHORT = 10; + T_UINT = 11; + T_ULONG = 12; + +//* Added by Jack: strings contained in the structure */ + T_STRING_INPLACE= 13; + + T_OBJECT_EX = 16;{* Like T_OBJECT, but raises AttributeError + when the value is NULL, instead of + converting to None. *} + +//* Flags */ + READONLY = 1; + RO = READONLY; //* Shorthand */ + READ_RESTRICTED = 2; + PY_WRITE_RESTRICTED = 4; + RESTRICTED = (READ_RESTRICTED or PY_WRITE_RESTRICTED); +type + TPyMemberType = (mtShort, mtInt, mtLong, mtFloat, mtDouble, mtString, mtObject, + mtChar, mtByte, mtUByte, mtUShort, mtUInt, mtULong, + mtStringInplace, mtObjectEx); + TPyMemberFlag = (mfDefault, mfReadOnly, mfReadRestricted, mfWriteRestricted, mfRestricted); + +//####################################################### +//## ## +//## Non-Python specific constants ## +//## ## +//####################################################### + +const + CR = #13; + LF = #10; + TAB = #09; + CRLF = CR+LF; + +//####################################################### +//## ## +//## Python specific interface ## +//## ## +//####################################################### + +type + PP_frozen = ^P_frozen; + P_frozen = ^_frozen; + PPyObject = ^PyObject; + PPPyObject = ^PPyObject; + PPPPyObject = ^PPPyObject; + PPyTypeObject = ^PyTypeObject; + PPySliceObject = ^PySliceObject; + + AtExitProc = procedure; + PyCFunction = function( self, args:PPyObject): PPyObject; cdecl; + PyCFunctionWithKW = function( self, args, keywords:PPyObject): PPyObject; cdecl; + + unaryfunc = function( ob1 : PPyObject): PPyObject; cdecl; + binaryfunc = function( ob1,ob2 : PPyObject): PPyObject; cdecl; + ternaryfunc = function( ob1,ob2,ob3 : PPyObject): PPyObject; cdecl; + inquiry = function( ob1 : PPyObject): integer; cdecl; + lenfunc = function( ob1 : PPyObject): NativeInt; cdecl; + coercion = function( ob1,ob2 : PPPyObject): integer; cdecl; + ssizeargfunc = function( ob1 : PPyObject; i: NativeInt): PPyObject; cdecl; + ssizeobjargproc = function( ob1 : PPyObject; i: NativeInt; ob2 : PPyObject): + integer; cdecl; + objobjargproc = function( ob1,ob2,ob3 : PPyObject): integer; cdecl; + + pydestructor = procedure(ob: PPyObject); cdecl; + getattrfunc = function( ob1: PPyObject; name: PAnsiChar): PPyObject; cdecl; + setattrfunc = function( ob1: PPyObject; name: PAnsiChar; ob2: PPyObject): integer; cdecl; + reprfunc = function( ob: PPyObject): PPyObject; cdecl; + hashfunc = function( ob: PPyObject): NativeInt; cdecl; // !! in 2.x it is still a LongInt + getattrofunc = function( ob1,ob2: PPyObject): PPyObject; cdecl; + setattrofunc = function( ob1,ob2,ob3: PPyObject): integer; cdecl; + + objobjproc = function ( ob1, ob2: PPyObject): integer; cdecl; + visitproc = function ( ob1: PPyObject; ptr: Pointer): integer; cdecl; + traverseproc = function ( ob1: PPyObject; proc: visitproc; ptr: Pointer): integer; cdecl; + + richcmpfunc = function ( ob1, ob2 : PPyObject; i : Integer) : PPyObject; cdecl; + getiterfunc = function ( ob1 : PPyObject) : PPyObject; cdecl; + iternextfunc = function ( ob1 : PPyObject) : PPyObject; cdecl; + descrgetfunc = function ( ob1, ob2, ob3 : PPyObject) : PPyObject; cdecl; + descrsetfunc = function ( ob1, ob2, ob3 : PPyObject) : Integer; cdecl; + initproc = function ( self, args, kwds : PPyObject) : Integer; cdecl; + newfunc = function ( subtype: PPyTypeObject; args, kwds : PPyObject) : PPyObject; cdecl; + allocfunc = function ( self: PPyTypeObject; nitems : NativeInt) : PPyObject; cdecl; + + PyNumberMethods = {$IFNDEF CPUX64}packed{$ENDIF} record + nb_add : binaryfunc; + nb_subtract : binaryfunc; + nb_multiply : binaryfunc; + nb_remainder : binaryfunc; + nb_divmod : binaryfunc; + nb_power : ternaryfunc; + nb_negative : unaryfunc; + nb_positive : unaryfunc; + nb_absolute : unaryfunc; + nb_bool : inquiry; + nb_invert : unaryfunc; + nb_lshift : binaryfunc; + nb_rshift : binaryfunc; + nb_and : binaryfunc; + nb_xor : binaryfunc; + nb_or : binaryfunc; + nb_int : unaryfunc; + nb_reserved : Pointer; // not used + nb_float : unaryfunc; + nb_inplace_add : binaryfunc; + nb_inplace_subtract : binaryfunc; + nb_inplace_multiply : binaryfunc; + nb_inplace_remainder : binaryfunc; + nb_inplace_power : ternaryfunc; + nb_inplace_lshift : binaryfunc; + nb_inplace_rshift : binaryfunc; + nb_inplace_and : binaryfunc; + nb_inplace_xor : binaryfunc; + nb_inplace_or : binaryfunc; + nb_floor_divide : binaryfunc; + nb_true_divide : binaryfunc; + nb_inplace_floor_divide : binaryfunc; + nb_inplace_true_divide : binaryfunc; + nb_index : unaryfunc; + nb_matrix_multiply : binaryfunc; // new in python 3.5 + nb_inplace_matrix_multiply : binaryfunc; // new in python 3.5 + end; + PPyNumberMethods = ^PyNumberMethods; + + PySequenceMethods = {$IFNDEF CPUX64}packed{$ENDIF} record + sq_length : lenfunc; + sq_concat : binaryfunc; + sq_repeat : ssizeargfunc; + sq_item : ssizeargfunc; + was_sq_slice : Pointer; // empty slot in python 3.x + sq_ass_item : ssizeobjargproc; + was_sq_ass_slice : Pointer; // empty slot in python 3.x + sq_contains : objobjproc; + sq_inplace_concat : binaryfunc; + sq_inplace_repeat : ssizeargfunc; + end; + PPySequenceMethods = ^PySequenceMethods; + + PyMappingMethods = {$IFNDEF CPUX64}packed{$ENDIF} record + mp_length : lenfunc; + mp_subscript : binaryfunc; + mp_ass_subscript : objobjargproc; + end; + PPyMappingMethods = ^PyMappingMethods; + + Py_complex = {$IFNDEF CPUX64}packed{$ENDIF} record + real : double; + imag : double; + end; + + PyObject = {$IFNDEF CPUX64}packed{$ENDIF} record + ob_refcnt: NativeInt; + ob_type: PPyTypeObject; + end; + + _frozen = {$IFNDEF CPUX64}packed{$ENDIF} record + name : PAnsiChar; + code : PByte; + size : Integer; + end; + + PySliceObject = {$IFNDEF CPUX64}packed{$ENDIF} record + ob_refcnt: NativeInt; + ob_type: PPyTypeObject; + start, stop, step: PPyObject; + end; + + PPyMethodDef = ^PyMethodDef; + PyMethodDef = {$IFNDEF CPUX64}packed{$ENDIF} record + ml_name: PAnsiChar; + ml_meth: PyCFunction; + ml_flags: Integer; + ml_doc: PAnsiChar; + end; + + // structmember.h + PPyMemberDef = ^PyMemberDef; + PyMemberDef = {$IFNDEF CPUX64}packed{$ENDIF} record + name : PAnsiChar; + _type : integer; + offset : NativeInt; + flags : integer; + doc : PAnsiChar; + end; + + // descrobject.h + + // Descriptors + + getter = function ( obj : PPyObject; context : Pointer) : PPyObject; cdecl; + setter = function ( obj, value : PPyObject; context : Pointer) : integer; cdecl; + + PPyGetSetDef = ^PyGetSetDef; + PyGetSetDef = {$IFNDEF CPUX64}packed{$ENDIF} record + name : PAnsiChar; + get : getter; + _set : setter; + doc : PAnsiChar; + closure : Pointer; + end; + + wrapperfunc = function (self, args: PPyObject; wrapped : Pointer) : PPyObject; cdecl; + + pwrapperbase = ^wrapperbase; + wrapperbase = {$IFNDEF CPUX64}packed{$ENDIF} record + name : PAnsiChar; + wrapper : wrapperfunc; + doc : PAnsiChar; + end; + + // Various kinds of descriptor objects + + {#define PyDescr_COMMON \ + PyObject_HEAD \ + PyTypeObject *d_type; \ + PyObject *d_name + } + + PPyDescrObject = ^PyDescrObject; + PyDescrObject = {$IFNDEF CPUX64}packed{$ENDIF} record + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + d_type : PPyTypeObject; + d_name : PPyObject; + end; + + PPyMethodDescrObject = ^PyMethodDescrObject; + PyMethodDescrObject = {$IFNDEF CPUX64}packed{$ENDIF} record + // Start of PyDescr_COMMON + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + d_type : PPyTypeObject; + d_name : PPyObject; + // End of PyDescr_COMMON + d_method : PPyMethodDef; + end; + + PPyMemberDescrObject = ^PyMemberDescrObject; + PyMemberDescrObject = {$IFNDEF CPUX64}packed{$ENDIF} record + // Start of PyDescr_COMMON + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + d_type : PPyTypeObject; + d_name : PPyObject; + // End of PyDescr_COMMON + d_member : PPyMemberDef; + end; + + PPyGetSetDescrObject = ^PyGetSetDescrObject; + PyGetSetDescrObject = {$IFNDEF CPUX64}packed{$ENDIF} record + // Start of PyDescr_COMMON + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + d_type : PPyTypeObject; + d_name : PPyObject; + // End of PyDescr_COMMON + d_getset : PPyGetSetDef; + end; + + PPyWrapperDescrObject = ^PyWrapperDescrObject; + PyWrapperDescrObject = {$IFNDEF CPUX64}packed{$ENDIF} record + // Start of PyDescr_COMMON + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + d_type : PPyTypeObject; + d_name : PPyObject; + // End of PyDescr_COMMON + d_base : pwrapperbase; + d_wrapped : Pointer; // This can be any function pointer + end; + + PPyModuleDef_Base = ^PyModuleDef_Base; + PyModuleDef_Base = {$IFNDEF CPUX64}packed{$ENDIF} record + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + m_init : function( ) : PPyObject; cdecl; + m_index : NativeInt; + m_copy : PPyObject; + end; + + PPyModuleDef = ^PyModuleDef; + PyModuleDef = {$IFNDEF CPUX64}packed{$ENDIF} record + m_base : PyModuleDef_Base; + m_name : PAnsiChar; + m_doc : PAnsiChar; + m_size : NativeInt; + m_methods : PPyMethodDef; + m_reload : inquiry; + m_traverse : traverseproc; + m_clear : inquiry; + m_free : inquiry; + end; + + + // object.h + PyTypeObject = {$IFNDEF CPUX64}packed{$ENDIF} record + ob_refcnt: NativeInt; + ob_type: PPyTypeObject; + ob_size: NativeInt; // Number of items in variable part + tp_name: PAnsiChar; // For printing + tp_basicsize, + tp_itemsize: NativeInt; // For allocation + + // Methods to implement standard operations + + tp_dealloc: pydestructor; + tp_vectorcall_offset: NativeInt; + tp_getattr: getattrfunc; + tp_setattr: setattrfunc; + tp_as_async: Pointer; // not implemented + tp_repr: reprfunc; + + // Method suites for standard classes + + tp_as_number: PPyNumberMethods; + tp_as_sequence: PPySequenceMethods; + tp_as_mapping: PPyMappingMethods; + + // More standard operations (here for binary compatibility) + + tp_hash: hashfunc; + tp_call: ternaryfunc; + tp_str: reprfunc; + tp_getattro: getattrofunc; + tp_setattro: setattrofunc; + + // Functions to access object as input/output buffer + tp_as_buffer: Pointer; // PPyBufferProcs - not implemented + // Flags to define presence of optional/expanded features + tp_flags: C_ULong; + + tp_doc: PAnsiChar; // Documentation string + + // call function for all accessible objects + tp_traverse: traverseproc; + + // delete references to contained objects + tp_clear: inquiry; + + // rich comparisons + tp_richcompare: richcmpfunc; + + // weak reference enabler + tp_weaklistoffset: NativeInt; + // Iterators + tp_iter : getiterfunc; + tp_iternext : iternextfunc; + + // Attribute descriptor and subclassing stuff + tp_methods : PPyMethodDef; + tp_members : PPyMemberDef; + tp_getset : PPyGetSetDef; + tp_base : PPyTypeObject; + tp_dict : PPyObject; + tp_descr_get : descrgetfunc; + tp_descr_set : descrsetfunc; + tp_dictoffset : NativeInt; + tp_init : initproc; + tp_alloc : allocfunc; + tp_new : newfunc; + tp_free : pydestructor; // Low-level free-memory routine + tp_is_gc : inquiry; // For PyObject_IS_GC + tp_bases : PPyObject; + tp_mro : PPyObject; // method resolution order + tp_cache : PPyObject; + tp_subclasses : PPyObject; + tp_weaklist : PPyObject; + tp_del : PyDestructor; + tp_version_tag : Cardinal; // Type attribute cache version tag. Added in version 2.6 + tp_finalize : PyDestructor; + tp_vectorcall : Pointer; // not implemented + //More spares + tp_xxx1 : NativeInt; + tp_xxx2 : NativeInt; + tp_xxx3 : NativeInt; + tp_xxx4 : NativeInt; + tp_xxx5 : NativeInt; + tp_xxx6 : NativeInt; + tp_xxx7 : NativeInt; + tp_xxx8 : NativeInt; + tp_xxx9 : NativeInt; + tp_xxx10 : NativeInt; + end; + + // from pystate.h + // the structure of PyInterpreterState and PyThreadState is considered + // an implementation detail. It has been changing between python versions + // and there is no real use of accessing these structures directly. + PPyInterpreterState = Pointer; + PPyThreadState = Pointer; + + // Parse tree node interface + + PNode = ^node; + node = {$IFNDEF CPUX64}packed{$ENDIF} record + n_type : smallint; + n_str : PAnsiChar; + n_lineno : integer; + n_col_offset: integer; + n_nchildren : integer; + n_child : PNode; + end; + + PPyCompilerFlags = ^PyCompilerFlags; + PyCompilerFlags = {$IFNDEF CPUX64}packed{$ENDIF} record + flags : integer; + cf_feature_version : integer; //added in Python 3.8 + end; + + // from datetime.h + + +{* Fields are packed into successive bytes, each viewed as unsigned and + * big-endian, unless otherwise noted: + * + * byte offset + * 0 year 2 bytes, 1-9999 + * 2 month 1 byte, 1-12 + * 3 day 1 byte, 1-31 + * 4 hour 1 byte, 0-23 + * 5 minute 1 byte, 0-59 + * 6 second 1 byte, 0-59 + * 7 usecond 3 bytes, 0-999999 + * 10 + *} + +const + { # of bytes for year, month, and day. } + _PyDateTime_DATE_DATASIZE = 4; + + { # of bytes for hour, minute, second, and usecond. } + _PyDateTime_TIME_DATASIZE = 6; + + { # of bytes for year, month, day, hour, minute, second, and usecond. } + _PyDateTime_DATETIME_DATASIZE = 10; +type + PyDateTime_Delta = {$IFNDEF CPUX64}packed{$ENDIF} record + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : NativeInt; // -1 when unknown + days : Integer; // -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS + seconds : Integer; // 0 <= seconds < 24*3600 is invariant + microseconds: Integer; // 0 <= microseconds < 1000000 is invariant + end; + PPyDateTime_Delta = ^PyDateTime_Delta; + + PyDateTime_TZInfo = {$IFNDEF CPUX64}packed{$ENDIF} record // a pure abstract base clase + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + end; + PPyDateTime_TZInfo = ^PyDateTime_TZInfo; + +{ +/* The datetime and time types have hashcodes, and an optional tzinfo member, + * present if and only if hastzinfo is true. + */ +#define _PyTZINFO_HEAD \ + PyObject_HEAD \ + long hashcode; \ + char hastzinfo; /* boolean flag */ +} + +{* No _PyDateTime_BaseTZInfo is allocated; it's just to have something + * convenient to cast to, when getting at the hastzinfo member of objects + * starting with _PyTZINFO_HEAD. + *} + _PyDateTime_BaseTZInfo = {$IFNDEF CPUX64}packed{$ENDIF} record + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + end; + _PPyDateTime_BaseTZInfo = ^_PyDateTime_BaseTZInfo; + +{* All time objects are of PyDateTime_TimeType, but that can be allocated + * in two ways, with or without a tzinfo member. Without is the same as + * tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an + * internal struct used to allocate the right amount of space for the + * "without" case. + *} +{#define _PyDateTime_TIMEHEAD \ + _PyTZINFO_HEAD \ + unsigned char data[_PyDateTime_TIME_DATASIZE]; +} + + _PyDateTime_BaseTime = {$IFNDEF CPUX64}packed{$ENDIF} record // hastzinfo false + // Start of _PyDateTime_TIMEHEAD + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + data : array[0..Pred(_PyDateTime_TIME_DATASIZE)] of Byte; + // End of _PyDateTime_TIMEHEAD + end; + _PPyDateTime_BaseTime = ^_PyDateTime_BaseTime; + + PyDateTime_Time = {$IFNDEF CPUX64}packed{$ENDIF} record // hastzinfo true + // Start of _PyDateTime_TIMEHEAD + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + data : array[0..Pred(_PyDateTime_TIME_DATASIZE)] of Byte; + // End of _PyDateTime_TIMEHEAD + tzinfo : PPyObject; + end; + PPyDateTime_Time = ^PyDateTime_Time; + + + +{* All datetime objects are of PyDateTime_DateTimeType, but that can be + * allocated in two ways too, just like for time objects above. In addition, + * the plain date type is a base class for datetime, so it must also have + * a hastzinfo member (although it's unused there). + *} + PyDateTime_Date = {$IFNDEF CPUX64}packed{$ENDIF} record + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + data : array[0..Pred(_PyDateTime_DATE_DATASIZE)] of Byte; + end; + PPyDateTime_Date = ^PyDateTime_Date; + + { +#define _PyDateTime_DATETIMEHEAD \ + _PyTZINFO_HEAD \ + unsigned char data[_PyDateTime_DATETIME_DATASIZE]; +} + + _PyDateTime_BaseDateTime = {$IFNDEF CPUX64}packed{$ENDIF} record // hastzinfo false + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + data : array[0..Pred(_PyDateTime_DATETIME_DATASIZE)] of Byte; + end; + _PPyDateTime_BaseDateTime = ^_PyDateTime_BaseDateTime; + + PyDateTime_DateTime = {$IFNDEF CPUX64}packed{$ENDIF} record // hastzinfo true + // Start of _PyDateTime_DATETIMEHEAD + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + data : array[0..Pred(_PyDateTime_DATETIME_DATASIZE)] of Byte; + // End of _PyDateTime_DATETIMEHEAD + tzinfo : PPyObject; + end; + PPyDateTime_DateTime = ^PyDateTime_DateTime; + +//####################################################### +//## ## +//## GIL state ## +//## ## +//####################################################### + PyGILState_STATE = (PyGILState_LOCKED, PyGILState_UNLOCKED); + +//####################################################### +//## ## +//## New exception classes ## +//## ## +//####################################################### + + // Components' exceptions + EDLLLoadError = class(Exception); + EDLLImportError = class(Exception) + public + WrongFunc : AnsiString; + ErrorCode : Integer; + end; + + // Python's exceptions + EPythonError = class(Exception) + public + EName : string; + EValue : string; + end; + EPyExecError = class(EPythonError); + + + + + // Standard exception classes of Python and maXbox + +{ Hierarchy of Python exceptions, Python 2.3, copied from \Python\exceptions.c + +Exception\n\ + |\n\ + +-- SystemExit\n\ + +-- StopIteration\n\ + +-- StandardError\n\ + | |\n\ + | +-- KeyboardInterrupt\n\ + | +-- ImportError\n\ + | +-- EnvironmentError\n\ + | | |\n\ + | | +-- IOError\n\ + | | +-- OSError\n\ + | | |\n\ + | | +-- WindowsError\n\ + | | +-- VMSError\n\ + | |\n\ + | +-- EOFError\n\ + | +-- RuntimeError\n\ + | | |\n\ + | | +-- NotImplementedError\n\ + | |\n\ + | +-- NameError\n\ + | | |\n\ + | | +-- UnboundLocalError\n\ + | |\n\ + | +-- AttributeError\n\ + | +-- SyntaxError\n\ + | | |\n\ + | | +-- IndentationError\n\ + | | |\n\ + | | +-- TabError\n\ + | |\n\ + | +-- TypeError\n\ + | +-- AssertionError\n\ + | +-- LookupError\n\ + | | |\n\ + | | +-- IndexError\n\ + | | +-- KeyError\n\ + | |\n\ + | +-- ArithmeticError\n\ + | | |\n\ + | | +-- OverflowError\n\ + | | +-- ZeroDivisionError\n\ + | | +-- FloatingPointError\n\ + | |\n\ + | +-- ValueError\n\ + | | |\n\ + | | +-- UnicodeError\n\ + | | |\n\ + | | +-- UnicodeEncodeError\n\ + | | +-- UnicodeDecodeError\n\ + | | +-- UnicodeTranslateError\n\ + | |\n\ + | +-- ReferenceError\n\ + | +-- SystemError\n\ + | +-- MemoryError\n\ + |\n\ + +---Warning\n\ + |\n\ + +-- UserWarning\n\ + +-- DeprecationWarning\n\ + +-- PendingDeprecationWarning\n\ + +-- SyntaxWarning\n\ + +-- RuntimeWarning\n\ + +-- FutureWarning" +} + EPyException = class (EPythonError); + EPyStandardError = class (EPyException); + EPyArithmeticError = class (EPyStandardError); + EPyLookupError = class (EPyStandardError); + EPyAssertionError = class (EPyStandardError); + EPyAttributeError = class (EPyStandardError); + EPyEOFError = class (EPyStandardError); + EPyFloatingPointError = class (EPyArithmeticError); + EPyEnvironmentError = class (EPyStandardError); + EPyIOError = class (EPyEnvironmentError); + EPyOSError = class (EPyEnvironmentError); + EPyImportError = class (EPyStandardError); + EPyIndexError = class (EPyLookupError); + EPyKeyError = class (EPyLookupError); + EPyKeyboardInterrupt = class (EPyStandardError); + EPyMemoryError = class (EPyStandardError); + EPyNameError = class (EPyStandardError); + EPyOverflowError = class (EPyArithmeticError); + EPyRuntimeError = class (EPyStandardError); + EPyNotImplementedError = class (EPyRuntimeError); + EPySyntaxError = class (EPyStandardError) + public + EFileName: String; + ELineStr: String; + ELineNumber: Integer; + EOffset: Integer; + end; + EPyIndentationError = class (EPySyntaxError); + EPyTabError = class (EPyIndentationError); + EPySystemError = class (EPyStandardError); + EPySystemExit = class (EPyException); + EPyTypeError = class (EPyStandardError); + EPyUnboundLocalError = class (EPyNameError); + EPyValueError = class (EPyStandardError); + EPyUnicodeError = class (EPyValueError); + UnicodeEncodeError = class (EPyUnicodeError); + UnicodeDecodeError = class (EPyUnicodeError); + UnicodeTranslateError = class (EPyUnicodeError); + EPyZeroDivisionError = class (EPyArithmeticError); + EPyStopIteration = class(EPyException); + EPyWarning = class (EPyException); + EPyUserWarning = class (EPyWarning); + EPyDeprecationWarning = class (EPyWarning); + PendingDeprecationWarning = class (EPyWarning); + FutureWarning = class (EPyWarning); + EPySyntaxWarning = class (EPyWarning); + EPyRuntimeWarning = class (EPyWarning); + EPyReferenceError = class (EPyStandardError); + {$IFDEF MSWINDOWS} + EPyWindowsError = class (EPyOSError); + {$ENDIF} + +//####################################################### +//## ## +//## Components ## +//## ## +//####################################################### + +//------------------------------------------------------- +//-- -- +//-- class: TPythonInputOutput -- +//-- Works as a console for Python outputs -- +//-- It's a virtual Base class -- +//------------------------------------------------------- + +const + kMaxLines = 1000; + kMaxLineLength = 256; + +type + TSendDataEvent = procedure (Sender: TObject; const Data : AnsiString ) of object; + TReceiveDataEvent = procedure (Sender: TObject; var Data : AnsiString ) of object; + TSendUniDataEvent = procedure (Sender: TObject; const Data : String ) of object; + TReceiveUniDataEvent = procedure (Sender: TObject; var Data : String ) of object; + IOChar = WideChar; + UnicodeString = Ansistring; + //UnicodeString = WideString; + RawByteString = String; + IOString = UnicodeString; + TIOStringList = TStringList; + + {$IF not Defined(FPC) and (CompilerVersion >= 23)} + [ComponentPlatformsAttribute(pidSupportedPlatforms)] + {$IFEND} + TPythonInputOutput = class(TComponent) + protected + FMaxLines : Integer; + FLine_Buffer : IOString; + FLinesPerThread : TIOStringList; + FLock : TCriticalSection; + FQueue : TIOStringList; + FDelayWrites : Boolean; + FMaxLineLength : Integer; + FOnSendData : TSendDataEvent; + FOnReceiveData : TReceiveDataEvent; + FOnSendUniData : TSendUniDataEvent; + FOnReceiveUniData: TReceiveUniDataEvent; + FUnicodeIO : Boolean; + FRawOutput : Boolean; + + procedure Lock; + procedure Unlock; + procedure AddWrite( const str : IOString ); + // Virtual methods for handling the input/output of text + procedure SendData( const Data : AnsiString ); virtual; + function ReceiveData : AnsiString; virtual; + procedure SendUniData( const Data : UnicodeString ); virtual; + function ReceiveUniData : UnicodeString; virtual; + procedure AddPendingWrite; virtual; + function GetCurrentThreadSlotIdx : Integer; + function GetCurrentThreadLine : IOString; + procedure UpdateCurrentThreadLine; + + public + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + procedure Write( const str : IOString ); + procedure WriteLine( const str : IOString ); + + published + property MaxLines : Integer read FMaxLines write FMaxLines default kMaxLines; + property MaxLineLength : Integer read FMaxLineLength write FMaxLineLength default kMaxLineLength; + property DelayWrites : Boolean read FDelayWrites write FDelayWrites default False; + property OnSendData : TSendDataEvent read FOnSendData write FOnSendData; + property OnReceiveData : TReceiveDataEvent read FOnReceiveData write FOnReceiveData; + property OnSendUniData : TSendUniDataEvent read FOnSendUniData write FOnSendUniData; + property OnReceiveUniData : TReceiveUniDataEvent read FOnReceiveUniData write FOnReceiveUniData; + property UnicodeIO: Boolean read FUnicodeIO write FUnicodeIO; + property RawOutput: Boolean read FRawOutput write FRawOutput; + end; + +//------------------------------------------------------- +//-- -- +//-- Base class: TDynamicDll -- +//-- -- +//------------------------------------------------------- + +type + TDynamicDll = class(TComponent) + private + function IsAPIVersionStored: Boolean; + function IsDllNameStored: Boolean; + function IsRegVersionStored: Boolean; + procedure SetDllName(const Value: string); + protected + FDllName : string; + FDllPath : string; + FAPIVersion : Integer; + FRegVersion : string; + FAutoLoad : Boolean; + FAutoUnload : Boolean; + FFatalMsgDlg : Boolean; + FFatalAbort : Boolean; + FDLLHandle : THandle; + FUseLastKnownVersion: Boolean; + FOnBeforeLoad : TNotifyEvent; + FOnAfterLoad : TNotifyEvent; + FOnBeforeUnload : TNotifyEvent; + + function Import(const funcname: AnsiString; canFail : Boolean = True): Pointer; + procedure Loaded; override; + procedure BeforeLoad; virtual; + procedure AfterLoad; virtual; + procedure BeforeUnload; virtual; + function GetQuitMessage : string; virtual; + procedure DoOpenDll(const aDllName : string); virtual; + function GetDllPath : string; + + public + // Constructors & Destructors + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + // Public methods + procedure OpenDll(const aDllName : string); + function IsHandleValid : Boolean; + procedure LoadDll; + procedure UnloadDll; + procedure Quit; + + // Public properties + published + property AutoLoad : Boolean read FAutoLoad write FAutoLoad default True; + property AutoUnload : Boolean read FAutoUnload write FAutoUnload default True; + property DllName : string read FDllName write SetDllName stored IsDllNameStored; + property DllPath : string read FDllPath write FDllPath; + property APIVersion : Integer read FAPIVersion write FAPIVersion stored IsAPIVersionStored; + property RegVersion : string read FRegVersion write FRegVersion stored IsRegVersionStored; + property FatalAbort : Boolean read FFatalAbort write FFatalAbort default True; + property FatalMsgDlg : Boolean read FFatalMsgDlg write FFatalMsgDlg default True; + property UseLastKnownVersion: Boolean read FUseLastKnownVersion write FUseLastKnownVersion default True; + property OnAfterLoad : TNotifyEvent read FOnAfterLoad write FOnAfterLoad; + property OnBeforeLoad : TNotifyEvent read FOnBeforeLoad write FOnBeforeLoad; + property OnBeforeUnload : TNotifyEvent read FOnBeforeUnload write FOnBeforeUnload; + end; + +//------------------------------------------------------- +//-- -- +//-- class: TPythonInterface derived from TDynamicDll-- +//-- This class maps the functions imported -- +//-- from the Python Dll, and adds some -- +//-- Delphi implementations. -- +//------------------------------------------------------- + +type + (*$HPPEMIT 'typedef int __cdecl (*TPyArg_Parse)(void * args, char * format, ...);' *) + TPyArg_Parse = function( args: PPyObject; format: PAnsiChar {;....}) : Integer; cdecl varargs; + {$EXTERNALSYM TPyArg_Parse} + + (*$HPPEMIT 'typedef int __cdecl (*TPyArg_ParseTupleAndKeywords)(void * args, void * kw, char * format, char** kwargs, ...);' *) + TPyArg_ParseTupleAndKeywords = function( args: PPyObject; kw: PPyObject; format: PAnsiChar; kwargs: PPAnsiChar {;...}): Integer; cdecl varargs; + {$EXTERNALSYM TPyArg_ParseTupleAndKeywords} + + (*$HPPEMIT 'typedef int __cdecl (*TPy_BuildValue)(char * format, ...);' *) + TPy_BuildValue = function( format: PAnsiChar {;...}): Pointer; cdecl varargs; + {$EXTERNALSYM TPy_BuildValue} + + PNativeInt = ^NativeInt; + + TPythonInterface=class(TDynamicDll) + protected + FInitialized: Boolean; + FFinalizing: Boolean; + FMajorVersion: integer; + FMinorVersion: integer; + FBuiltInModuleName: string; + + procedure AfterLoad; override; + function GetQuitMessage : string; override; + procedure CheckPython; + function GetUnicodeTypeSuffix : string; + + public + // define Python flags. See file pyDebug.h + Py_DebugFlag: PInteger; + Py_VerboseFlag: PInteger; + Py_InteractiveFlag: PInteger; + Py_OptimizeFlag: PInteger; + Py_NoSiteFlag: PInteger; + Py_FrozenFlag: PInteger; + Py_IgnoreEnvironmentFlag: PInteger; + + PyImport_FrozenModules: PP_frozen; + + Py_None: PPyObject; + Py_Ellipsis: PPyObject; + Py_False: PPyObject; + Py_True: PPyObject; + Py_NotImplemented: PPyObject; + + PyExc_AttributeError: PPPyObject; + PyExc_EOFError: PPPyObject; + PyExc_IOError: PPPyObject; + PyExc_ImportError: PPPyObject; + PyExc_IndexError: PPPyObject; + PyExc_KeyError: PPPyObject; + PyExc_KeyboardInterrupt: PPPyObject; + PyExc_MemoryError: PPPyObject; + PyExc_NameError: PPPyObject; + PyExc_OverflowError: PPPyObject; + PyExc_RuntimeError: PPPyObject; + PyExc_SyntaxError: PPPyObject; + PyExc_SystemError: PPPyObject; + PyExc_SystemExit: PPPyObject; + PyExc_TypeError: PPPyObject; + PyExc_ValueError: PPPyObject; + PyExc_ZeroDivisionError: PPPyObject; + PyExc_ArithmeticError: PPPyObject; + PyExc_Exception: PPPyObject; + PyExc_FloatingPointError: PPPyObject; + PyExc_LookupError: PPPyObject; + PyExc_AssertionError: PPPyObject; + PyExc_EnvironmentError: PPPyObject; + PyExc_IndentationError: PPPyObject; + PyExc_NotImplementedError: PPPyObject; + PyExc_OSError: PPPyObject; + PyExc_TabError: PPPyObject; + PyExc_UnboundLocalError: PPPyObject; + PyExc_UnicodeError: PPPyObject; + {$IFDEF MSWINDOWS} + PyExc_WindowsError: PPPyObject; + {$ENDIF} + PyExc_Warning: PPPyObject; + PyExc_DeprecationWarning: PPPyObject; + PyExc_RuntimeWarning: PPPyObject; + PyExc_SyntaxWarning: PPPyObject; + PyExc_UserWarning: PPPyObject; + PyExc_ReferenceError: PPPyObject; + PyExc_StopIteration: PPPyObject; + PyExc_FutureWarning: PPPyObject; + PyExc_PendingDeprecationWarning: PPPyObject; + PyExc_UnicodeDecodeError: PPPyObject; + PyExc_UnicodeEncodeError: PPPyObject; + PyExc_UnicodeTranslateError: PPPyObject; + + PyCode_Type: PPyTypeObject; + PyType_Type: PPyTypeObject; + PyCFunction_Type: PPyTypeObject; + PyComplex_Type: PPyTypeObject; + PyDict_Type: PPyTypeObject; + PyFloat_Type: PPyTypeObject; + PyFrame_Type: PPyTypeObject; + PyFunction_Type: PPyTypeObject; + PyList_Type: PPyTypeObject; + PyLong_Type: PPyTypeObject; + PyMethod_Type: PPyTypeObject; + PyModule_Type: PPyTypeObject; + PyObject_Type: PPyTypeObject; + PyRange_Type: PPyTypeObject; + PySlice_Type: PPyTypeObject; + PyBytes_Type: PPyTypeObject; + PyTuple_Type: PPyTypeObject; + PyBaseObject_Type: PPyTypeObject; + PyCallIter_Type: PPyTypeObject; + PyCell_Type: PPyTypeObject; + PyClassMethod_Type: PPyTypeObject; + PyProperty_Type: PPyTypeObject; + PySeqIter_Type: PPyTypeObject; + PyStaticMethod_Type: PPyTypeObject; + PySuper_Type: PPyTypeObject; + PyTraceBack_Type: PPyTypeObject; + PyUnicode_Type: PPyTypeObject; + PyWrapperDescr_Type: PPyTypeObject; + _PyWeakref_RefType: PPyTypeObject; + _PyWeakref_ProxyType: PPyTypeObject; + _PyWeakref_CallableProxyType: PPyTypeObject; + PyBool_Type: PPyTypeObject; + PyEnum_Type: PPyTypeObject; + + Py_GetBuildInfo: function : PAnsiChar; cdecl; + PyImport_ExecCodeModule: function ( const name : AnsiString; codeobject : PPyObject) : PPyObject; cdecl; + PyComplex_FromCComplex: function(c: Py_complex):PPyObject; cdecl; + PyComplex_FromDoubles: function(realv,imag : double):PPyObject; cdecl; + PyComplex_RealAsDouble: function(op : PPyObject ): double; cdecl; + PyComplex_ImagAsDouble: function(op : PPyObject ): double; cdecl; + PyComplex_AsCComplex: function(op : PPyObject ): Py_complex; cdecl; + PyCFunction_GetFunction: function(ob : PPyObject): Pointer; cdecl; + PyCFunction_GetSelf: function(ob : PPyObject): PPyObject; cdecl; + PyCallable_Check: function(ob : PPyObject): integer; cdecl; + + PyModule_Create2: function(moduledef: PPyModuleDef; Api_Version: Integer):PPyObject; cdecl; + PyErr_BadArgument: function: integer; cdecl; + PyErr_BadInternalCall: procedure; cdecl; + PyErr_CheckSignals: function: integer; cdecl; + PyErr_Clear: procedure; cdecl; + PyErr_Fetch: procedure(out errtype, errvalue, errtraceback: PPyObject); cdecl; + PyErr_NoMemory: function: PPyObject; cdecl; + PyErr_Occurred: function: PPyObject; cdecl; + PyErr_Print: procedure; cdecl; + PyErr_Restore: procedure (errtype, errvalue, errtraceback: PPyObject); cdecl; + PyErr_SetFromErrno: function (ob : PPyObject):PPyObject; cdecl; + PyErr_SetNone: procedure(value: PPyObject); cdecl; + PyErr_SetObject: procedure (ob1, ob2 : PPyObject); cdecl; + PyErr_SetString: procedure( ErrorObject: PPyObject; text: PAnsiChar); cdecl; + PyErr_WarnEx: function (ob: PPyObject; text: PAnsiChar; stack_level: NativeInt): integer; cdecl; + PyErr_WarnExplicit: function (ob: PPyObject; text: PAnsiChar; filename: PAnsiChar; lineno: integer; module: PAnsiChar; registry: PPyObject): integer; cdecl; + PyImport_GetModuleDict: function: PPyObject; cdecl; + + PyArg_Parse: TPyArg_Parse; + PyArg_ParseTuple: TPyArg_Parse; + PyArg_ParseTupleAndKeywords: TPyArg_ParseTupleAndKeywords; + Py_BuildValue: TPy_BuildValue; + + Py_Initialize: procedure; cdecl; + Py_Exit: procedure( RetVal: Integer); cdecl; + PyEval_GetBuiltins: function: PPyObject; cdecl; + PyDict_Copy: function(mp: PPyObject):PPyObject; cdecl; + PyDict_GetItem: function(mp, key : PPyObject):PPyObject; cdecl; + PyDict_SetItem: function(mp, key, item :PPyObject ):integer; cdecl; + PyDict_DelItem: function(mp, key : PPyObject ):integer; cdecl; + PyDict_Clear: procedure(mp : PPyObject); cdecl; + PyDict_Next: function(mp : PPyObject; pos: PNativeInt; key, value: PPPyObject):integer; cdecl; + PyDict_Keys: function(mp: PPyObject):PPyObject; cdecl; + PyDict_Values: function(mp: PPyObject):PPyObject; cdecl; + PyDict_Items: function(mp: PPyObject):PPyObject; cdecl; + PyDict_Size: function(mp: PPyObject):NativeInt; cdecl; + PyDict_Update: function (a: PPyObject; b: PPyObject):Integer; cdecl; + PyDict_DelItemString: function(dp : PPyObject;key : PAnsiChar ):integer; cdecl; + PyDict_New: function: PPyObject; cdecl; + PyDict_GetItemString: function( dp: PPyObject; key: PAnsiChar): PPyObject; cdecl; + PyDict_SetItemString: function( dp: PPyObject; key: PAnsiChar; item: PPyObject): + Integer; cdecl; + PyDictProxy_New: function (obj : PPyObject) : PPyObject; cdecl; + PyModule_GetDict: function( module:PPyObject): PPyObject; cdecl; + PyObject_Str: function( v: PPyObject): PPyObject; cdecl; + PyRun_String: function( str: PAnsiChar; start: Integer; globals: PPyObject; + locals: PPyObject): PPyObject; cdecl; + PyRun_SimpleString: function( str: PAnsiChar): Integer; cdecl; + PyBytes_AsString: function( ob: PPyObject): PAnsiChar; cdecl; + PyBytes_AsStringAndSize: function( ob: PPyObject; var buffer: PAnsiChar; var size: NativeInt): integer; cdecl; + PySys_SetArgv: procedure( argc: Integer; argv: PPWideChar); cdecl; + + PyCFunction_NewEx: function(md:PPyMethodDef;self, ob:PPyObject):PPyObject; cdecl; +// Removed. Use PyEval_CallObjectWithKeywords with third argument nil +// PyEval_CallObject: function(callable_obj, args:PPyObject):PPyObject; cdecl; + PyEval_CallObjectWithKeywords:function (callable_obj, args, kw:PPyObject):PPyObject; cdecl; + PyEval_GetFrame:function :PPyObject; cdecl; + PyEval_GetGlobals:function :PPyObject; cdecl; + PyEval_GetLocals:function :PPyObject; cdecl; + + PyEval_InitThreads:procedure; cdecl; + PyEval_RestoreThread:procedure( tstate: PPyThreadState); cdecl; + PyEval_SaveThread:function :PPyThreadState; cdecl; + + PyFile_GetLine:function (ob:PPyObject;i:integer):PPyObject; cdecl; + PyFile_WriteObject:function (ob1,ob2:PPyObject;i:integer):integer; cdecl; + PyFile_WriteString:procedure(s:PAnsiChar;ob:PPyObject); cdecl; + PyFloat_AsDouble:function (ob:PPyObject):DOUBLE; cdecl; + PyFloat_FromDouble:function (db:double):PPyObject; cdecl; + PyFloat_FromString:function (str:PPyObject):PPyObject; cdecl; + PyFunction_GetCode:function (ob:PPyObject):PPyObject; cdecl; + PyFunction_GetGlobals:function (ob:PPyObject):PPyObject; cdecl; + PyFunction_New:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyImport_AddModule:function (name:PAnsiChar):PPyObject; cdecl; + PyImport_GetMagicNumber:function :C_Long; cdecl; + PyImport_ImportFrozenModule:function (key:PAnsiChar):integer; cdecl; + PyImport_ImportModule:function (name:PAnsiChar):PPyObject; cdecl; + PyImport_Import:function (name:PPyObject):PPyObject; cdecl; + PyImport_ReloadModule:function (ob:PPyObject):PPyObject; cdecl; + PyList_Append:function (ob1,ob2:PPyObject):integer; cdecl; + PyList_AsTuple:function (ob:PPyObject):PPyObject; cdecl; + PyList_GetItem:function (ob:PPyObject;i:NativeInt):PPyObject; cdecl; + PyList_GetSlice:function (ob:PPyObject;i1,i2:NativeInt):PPyObject; cdecl; + PyList_Insert:function (dp:PPyObject;idx:NativeInt;item:PPyObject):integer; cdecl; + PyList_New:function (size:NativeInt):PPyObject; cdecl; + PyList_Reverse:function (ob:PPyObject):integer; cdecl; + PyList_SetItem:function (dp:PPyObject;idx:NativeInt;item:PPyObject):integer; cdecl; + PyList_SetSlice:function (ob:PPyObject;i1,i2:NativeInt;ob2:PPyObject):integer; cdecl; + PyList_Size:function (ob:PPyObject):NativeInt; cdecl; + PyList_Sort:function (ob:PPyObject):integer; cdecl; + PyLong_AsDouble:function (ob:PPyObject):DOUBLE; cdecl; + PyLong_AsLong:function (ob:PPyObject):C_Long; cdecl; + PyLong_FromDouble:function (db:double):PPyObject; cdecl; + PyLong_FromLong:function (l:C_Long):PPyObject; cdecl; + PyLong_FromString:function (pc:PAnsiChar;var ppc:PAnsiChar;i:integer):PPyObject; cdecl; + PyLong_FromUnsignedLong:function(val:C_ULong): PPyObject; cdecl; + PyLong_AsUnsignedLong:function(ob:PPyObject): C_ULong; cdecl; + PyLong_FromUnicodeObject:function(ob:PPyObject; base : integer): PPyObject; cdecl; + PyLong_FromLongLong:function(val:Int64): PPyObject; cdecl; + PyLong_FromUnsignedLongLong:function(val:UInt64) : PPyObject; cdecl; + PyLong_AsLongLong:function(ob:PPyObject): Int64; cdecl; + PyLong_FromVoidPtr:function(p: Pointer): PPyObject; cdecl; + PyMapping_Check:function (ob:PPyObject):integer; cdecl; + PyMapping_GetItemString:function (ob:PPyObject;key:PAnsiChar):PPyObject; cdecl; + PyMapping_HasKey:function (ob,key:PPyObject):integer; cdecl; + PyMapping_HasKeyString:function (ob:PPyObject;key:PAnsiChar):integer; cdecl; + PyMapping_Length:function (ob:PPyObject):NativeInt; cdecl; + PyMapping_SetItemString:function (ob:PPyObject; key:PAnsiChar; value:PPyObject):integer; cdecl; + PyMethod_Function:function (ob:PPyObject):PPyObject; cdecl; + PyMethod_New:function (ob1,ob2,ob3:PPyObject):PPyObject; cdecl; + PyMethod_Self:function (ob:PPyObject):PPyObject; cdecl; + PyModule_GetName:function (ob:PPyObject):PAnsiChar; cdecl; + PyModule_New:function (key:PAnsiChar):PPyObject; cdecl; + PyNumber_Absolute:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Add:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_And:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Check:function (ob:PPyObject):integer; cdecl; + PyNumber_FloorDivide:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_TrueDivide:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Divmod:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Float:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Invert:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Long:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Lshift:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Multiply:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Negative:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Or:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Positive:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Power:function (ob1,ob2,ob3:PPyObject):PPyObject; cdecl; + PyNumber_Remainder:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Rshift:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Subtract:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Xor:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyOS_InterruptOccurred:function :integer; cdecl; + PyObject_CallObject:function (ob,args:PPyObject):PPyObject; cdecl; + PyObject_CallMethod : function ( obj : PPyObject; method, format : PAnsiChar {...}) : PPyObject; cdecl varargs; + PyObject_RichCompare:function (ob1,ob2:PPyObject;opid:integer):PPyObject; cdecl; + PyObject_RichCompareBool:function (ob1,ob2:PPyObject;opid:integer):Integer; cdecl; + PyObject_GetAttr:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyObject_GetAttrString:function (ob:PPyObject;c:PAnsiChar):PPyObject; cdecl; + PyObject_GetItem:function (ob,key:PPyObject):PPyObject; cdecl; + PyObject_DelItem:function (ob,key:PPyObject):PPyObject; cdecl; + PyObject_HasAttrString:function (ob:PPyObject;key:PAnsiChar):integer; cdecl; + PyObject_Hash:function (ob:PPyObject):NativeInt; cdecl; + PyObject_IsTrue:function (ob:PPyObject):integer; cdecl; + PyObject_Length:function (ob:PPyObject):NativeInt; cdecl; + PyObject_Repr:function (ob:PPyObject):PPyObject; cdecl; + PyObject_SetAttr:function (ob1,ob2,ob3:PPyObject):integer; cdecl; + PyObject_SetAttrString:function (ob:PPyObject;key:PAnsiChar;value:PPyObject):integer; cdecl; + PyObject_SetItem:function (ob1,ob2,ob3:PPyObject):integer; cdecl; + PyObject_Init:function (ob:PPyObject; t:PPyTypeObject):PPyObject; cdecl; + PyObject_InitVar:function (ob:PPyObject; t:PPyTypeObject; size:NativeInt):PPyObject; cdecl; + PyObject_New:function (t:PPyTypeObject):PPyObject; cdecl; + PyObject_NewVar:function (t:PPyTypeObject; size:NativeInt):PPyObject; cdecl; + PyObject_Free:procedure (ob:PPyObject); cdecl; + PyObject_GetIter: function (obj: PPyObject) : PPyObject; cdecl; + PyIter_Next: function (obj: PPyObject) : PPyObject; cdecl; + PyObject_IsInstance:function (inst, cls:PPyObject):integer; cdecl; + PyObject_IsSubclass:function (derived, cls:PPyObject):integer; cdecl; + PyObject_Call:function (ob, args, kw:PPyObject):PPyObject; cdecl; + PyObject_GenericGetAttr:function (obj, name : PPyObject) : PPyObject; cdecl; + PyObject_GenericSetAttr:function (obj, name, value : PPyObject) : Integer; cdecl; + PyObject_GC_Malloc:function (size:NativeUInt):PPyObject; cdecl; + PyObject_GC_New:function (t:PPyTypeObject):PPyObject; cdecl; + PyObject_GC_NewVar:function (t:PPyTypeObject; size:NativeInt):PPyObject; cdecl; + PyObject_GC_Resize:function (t:PPyObject; newsize:NativeInt):PPyObject; cdecl; + PyObject_GC_Del:procedure (ob:PPyObject); cdecl; + PyObject_GC_Track:procedure (ob:PPyObject); cdecl; + PyObject_GC_UnTrack:procedure (ob:PPyObject); cdecl; + PySequence_Check:function (ob:PPyObject):integer; cdecl; + PySequence_Concat:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PySequence_Count:function (ob1,ob2:PPyObject):integer; cdecl; + PySequence_GetItem:function (ob:PPyObject;i:NativeInt):PPyObject; cdecl; + PySequence_GetSlice:function (ob:PPyObject;i1,i2:NativeInt):PPyObject; cdecl; + PySequence_In:function (ob1,ob2:PPyObject):integer; cdecl; + PySequence_Index:function (ob1,ob2:PPyObject):NativeInt; cdecl; + PySequence_Length:function (ob:PPyObject):NativeInt; cdecl; + PySequence_Repeat:function (ob:PPyObject;count:NativeInt):PPyObject; cdecl; + PySequence_SetItem:function (ob:PPyObject;i:NativeInt;value:PPyObject):integer; cdecl; + PySequence_SetSlice:function (ob:PPyObject;i1,i2:NativeInt;value:PPyObject):integer; cdecl; + PySequence_DelSlice:function (ob:PPyObject;i1,i2:NativeInt):integer; cdecl; + PySequence_Tuple:function (ob:PPyObject):PPyObject; cdecl; + PySequence_Contains:function (ob, value:PPyObject):integer; cdecl; + PySequence_List:function (o:PPyObject):PPyObject; cdecl; + PySeqIter_New: function(obj : PPyObject) : PPyObject; cdecl; + PySlice_GetIndices:function (ob:PPySliceObject;length:NativeInt;var start,stop,step:NativeInt):integer; cdecl; + PySlice_GetIndicesEx:function (ob:PPySliceObject;length:NativeInt;var start,stop,step,slicelength:NativeInt):integer; cdecl; + PySlice_New:function (start,stop,step:PPyObject):PPyObject; cdecl; + PyBytes_Concat:procedure(var ob1:PPyObject;ob2:PPyObject); cdecl; + PyBytes_ConcatAndDel:procedure(var ob1:PPyObject;ob2:PPyObject); cdecl; + PyBytes_FromString:function (s:PAnsiChar):PPyObject; cdecl; + PyBytes_FromStringAndSize:function (s:PAnsiChar;i:NativeInt):PPyObject; cdecl; + PyBytes_Size:function (ob:PPyObject):NativeInt; cdecl; + PyBytes_DecodeEscape:function(s:PAnsiChar; len:NativeInt; errors:PAnsiChar; unicode:NativeInt; recode_encoding:PAnsiChar):PPyObject; cdecl; + PyBytes_Repr:function(ob:PPyObject; smartquotes:integer):PPyObject; cdecl; + PySys_GetObject:function (s:PAnsiChar):PPyObject; cdecl; + PySys_SetObject:function (s:PAnsiChar;ob:PPyObject):integer; cdecl; + PySys_SetPath:procedure(path:PAnsiChar); cdecl; + PyTraceBack_Here:function (p:pointer):integer; cdecl; + PyTraceBack_Print:function (ob1,ob2:PPyObject):integer; cdecl; + PyTuple_GetItem:function (ob:PPyObject;i:NativeInt):PPyObject; cdecl; + PyTuple_GetSlice:function (ob:PPyObject;i1,i2:NativeInt):PPyObject; cdecl; + PyTuple_New:function (size:NativeInt):PPyObject; cdecl; + PyTuple_SetItem:function (ob:PPyObject;key:NativeInt;value:PPyObject):integer; cdecl; + PyTuple_Size:function (ob:PPyObject):NativeInt; cdecl; + PyType_IsSubtype:function (a, b : PPyTypeObject):integer; cdecl; + PyType_GenericAlloc:function(atype: PPyTypeObject; nitems:NativeInt) : PPyObject; cdecl; + PyType_GenericNew:function(atype: PPyTypeObject; args, kwds : PPyObject) : PPyObject; cdecl; + PyType_Ready:function(atype: PPyTypeObject) : integer; cdecl; + PyUnicode_FromWideChar:function (const w:PWideChar; size:NativeInt):PPyObject; cdecl; + PyUnicode_FromString:function (s:PAnsiChar):PPyObject; cdecl; + PyUnicode_FromStringAndSize:function (s:PAnsiChar;i:NativeInt):PPyObject; cdecl; + PyUnicode_FromKindAndData:function (kind:integer;const buffer:pointer;size:NativeInt):PPyObject; cdecl; + PyUnicode_AsWideChar:function (unicode: PPyObject; w:PWideChar; size:NativeInt):integer; cdecl; + PyUnicode_AsUTF8:function (unicode: PPyObject):PAnsiChar; cdecl; + PyUnicode_AsUTF8AndSize:function (unicode: PPyObject; size: PNativeInt):PAnsiChar; cdecl; + PyUnicode_Decode:function (const s:PAnsiChar; size: NativeInt; const encoding : PAnsiChar; const errors: PAnsiChar):PPyObject; cdecl; + PyUnicode_DecodeUTF16:function (const s:PAnsiChar; size: NativeInt; const errors: PAnsiChar; byteoder: PInteger):PPyObject; cdecl; + PyUnicode_AsEncodedString:function (unicode:PPyObject; const encoding:PAnsiChar; const errors:PAnsiChar):PPyObject; cdecl; + PyUnicode_FromOrdinal:function (ordinal:integer):PPyObject; cdecl; + PyUnicode_GetSize:function (unicode:PPyObject):NativeInt; cdecl; + PyWeakref_GetObject: function ( ref : PPyObject) : PPyObject; cdecl; + PyWeakref_NewProxy: function ( ob, callback : PPyObject) : PPyObject; cdecl; + PyWeakref_NewRef: function ( ob, callback : PPyObject) : PPyObject; cdecl; + PyWrapper_New: function ( ob1, ob2 : PPyObject) : PPyObject; cdecl; + PyBool_FromLong: function ( ok : Integer) : PPyObject; cdecl; + PyThreadState_SetAsyncExc: function(t_id:C_ULong; exc:PPyObject) : Integer; cdecl; + Py_AtExit:function (proc: AtExitProc):integer; cdecl; + Py_CompileStringExFlags:function (str,filename:PAnsiChar;start:integer;flags:PPyCompilerFlags;optimize:integer):PPyObject; cdecl; + Py_FatalError:procedure(s:PAnsiChar); cdecl; + _PyObject_New:function (obt:PPyTypeObject;ob:PPyObject):PPyObject; cdecl; + _PyBytes_Resize:function (var ob:PPyObject;i:NativeInt):integer; cdecl; + Py_Finalize : procedure; cdecl; + PyErr_ExceptionMatches : function ( exc : PPyObject) : Integer; cdecl; + PyErr_GivenExceptionMatches : function ( raised_exc, exc : PPyObject) : Integer; cdecl; + PyEval_EvalCode : function ( co : PPyObject; globals, locals : PPyObject) : PPyObject; cdecl; + Py_GetVersion : function : PAnsiChar; cdecl; + Py_GetCopyright : function : PAnsiChar; cdecl; + Py_GetExecPrefix : function : PAnsiChar; cdecl; + Py_GetPath : function : PAnsiChar; cdecl; + Py_SetPythonHome : procedure (home : PWideChar); cdecl; + Py_GetPythonHome : function : PWideChar; cdecl; + Py_GetPrefix : function : PAnsiChar; cdecl; + Py_GetProgramName : function : PAnsiChar; cdecl; + + PyParser_SimpleParseStringFlags : function ( str : PAnsiChar; start, flags : Integer) : PNode; cdecl; + PyNode_Free : procedure( n : PNode ); cdecl; + PyErr_NewException : function ( name : PAnsiChar; base, dict : PPyObject ) : PPyObject; cdecl; + PyMem_Malloc : function ( size : NativeUInt ) : Pointer; + + Py_SetProgramName : procedure( name: PWideChar); cdecl; + Py_IsInitialized : function : integer; cdecl; + Py_GetProgramFullPath : function : PAnsiChar; cdecl; + Py_NewInterpreter : function : PPyThreadState; cdecl; + Py_EndInterpreter : procedure( tstate: PPyThreadState); cdecl; + PyEval_AcquireLock : procedure; cdecl; + PyEval_ReleaseLock : procedure; cdecl; + PyEval_AcquireThread : procedure( tstate: PPyThreadState); cdecl; + PyEval_ReleaseThread : procedure( tstate: PPyThreadState); cdecl; + PyInterpreterState_New : function : PPyInterpreterState; cdecl; + PyInterpreterState_Clear : procedure( interp: PPyInterpreterState); cdecl; + PyInterpreterState_Delete : procedure( interp: PPyInterpreterState); cdecl; + PyThreadState_New : function ( interp: PPyInterpreterState): PPyThreadState; cdecl; + PyThreadState_Clear : procedure( tstate: PPyThreadState); cdecl; + PyThreadState_Delete : procedure( tstate: PPyThreadState); cdecl; + PyThreadState_Get : function : PPyThreadState; cdecl; + PyThreadState_Swap : function ( tstate: PPyThreadState): PPyThreadState; cdecl; + PyErr_SetInterrupt : procedure; cdecl; + PyGILState_Ensure : function() : PyGILstate_STATE; cdecl; + PyGILState_Release : procedure(gilstate : PyGILState_STATE); cdecl; + + // Not exported in Python 3.8 and implemented as functions - this has been fixed + // TODO - deal with the following: + // the PyParser_* functions are deprecated in python 3.9 and will be removed in + // Python 3.10 + function PyParser_SimpleParseString(str : PAnsiChar; start : Integer) : PNode; cdecl; + function Py_CompileString(str,filename:PAnsiChar;start:integer) : PPyObject; cdecl; + + // functions redefined in Delphi + class procedure Py_INCREF(op: PPyObject); static; inline; + class procedure Py_DECREF(op: PPyObject); static; inline; + class procedure Py_XINCREF(op: PPyObject); static; inline; + class procedure Py_XDECREF(op: PPyObject); static; inline; + (* Safely decref `op` and set `op` to NULL, especially useful in tp_clear + * and tp_dealloc implementations. + * + * Note that "the obvious" code can be deadly: + * + * Py_XDECREF(op); + * op = NULL; + * + * Typically, `op` is something like self->containee, and `self` is done + * using its `containee` member. In the code sequence above, suppose + * `containee` is non-NULL with a refcount of 1. Its refcount falls to + * 0 on the first line, which can trigger an arbitrary amount of code, + * possibly including finalizers (like __del__ methods or weakref callbacks) + * coded in Python, which in turn can release the GIL and allow other threads + * to run, etc. Such code may even invoke methods of `self` again, or cause + * cyclic gc to trigger, but-- oops! --self->containee still points to the + * object being torn down, and it may be in an insane state while being torn + * down. This has in fact been a rich historic source of miserable (rare & + * hard-to-diagnose) segfaulting (and other) bugs. + * + * The safe way is: + * + * Py_CLEAR(op); + * + * That arranges to set `op` to NULL _before_ decref'ing, so that any code + * triggered as a side-effect of `op` getting torn down no longer believes + * `op` points to a valid object. + * + * There are cases where it's safe to use the naive code, but they're brittle. + * For example, if `op` points to a Python integer, you know that destroying + * one of those can't cause problems -- but in part that relies on that + * Python integers aren't currently weakly referencable. Best practice is + * to use Py_CLEAR() even if you can't think of a reason for why you need to. + *) + class procedure Py_CLEAR(var op: PPyObject); static; inline; + + function PyBytes_Check( obj : PPyObject ) : Boolean; + function PyBytes_CheckExact( obj : PPyObject ) : Boolean; + function PyFloat_Check( obj : PPyObject ) : Boolean; + function PyFloat_CheckExact( obj : PPyObject ) : Boolean; + function PyLong_Check( obj : PPyObject ) : Boolean; + function PyLong_CheckExact( obj : PPyObject ) : Boolean; + function PyTuple_Check( obj : PPyObject ) : Boolean; + function PyTuple_CheckExact( obj : PPyObject ) : Boolean; + function PyClass_Check( obj : PPyObject ) : Boolean; + function PyType_CheckExact( obj : PPyObject ) : Boolean; + function PyMethod_Check( obj : PPyObject ) : Boolean; + function PyList_Check( obj : PPyObject ) : Boolean; + function PyList_CheckExact( obj : PPyObject ) : Boolean; + function PyDict_Check( obj : PPyObject ) : Boolean; + function PyDict_CheckExact( obj : PPyObject ) : Boolean; + function PyModule_Check( obj : PPyObject ) : Boolean; + function PyModule_CheckExact( obj : PPyObject ) : Boolean; + function PySlice_Check( obj : PPyObject ) : Boolean; + function PyFunction_Check( obj : PPyObject ) : Boolean; + function PyIter_Check( obj : PPyObject ) : Boolean; + function PyUnicode_Check( obj : PPyObject ) : Boolean; + function PyUnicode_CheckExact( obj : PPyObject ) : Boolean; + function PyType_IS_GC(t : PPyTypeObject ) : Boolean; + function PyObject_IS_GC( obj : PPyObject ) : Boolean; + function PyWeakref_Check( obj : PPyObject ) : Boolean; + function PyWeakref_CheckRef( obj : PPyObject ) : Boolean; + function PyWeakref_CheckProxy( obj : PPyObject ) : Boolean; + function PyBool_Check( obj : PPyObject ) : Boolean; + function PyEnum_Check( obj : PPyObject ) : Boolean; + function PyObject_TypeCheck(obj:PPyObject; t:PPyTypeObject) : Boolean; + function Py_InitModule( const md : PyModuleDef) : PPyObject; + + // Constructors & Destructors + constructor Create(AOwner: TComponent); override; + + // Public methods + procedure MapDll; + + // Public properties + property Initialized : Boolean read FInitialized; + property Finalizing : Boolean read FFinalizing; + property MajorVersion : integer read FMajorVersion; + property MinorVersion : integer read FMinorVersion; + property BuiltInModuleName: string read FBuiltInModuleName write FBuiltInModuleName; +end; + +//-------------------------------------------------------- +//-- -- +//-- class: TPythonEngine derived from TPythonInterface-- +//-- Pytrunobject providing interface for -- +//-- running Python into Delphi -- +//-------------------------------------------------------- +type + TDatetimeConversionMode = (dcmToTuple, dcmToDatetime); +const + DEFAULT_DATETIME_CONVERSION_MODE = dcmToTuple; +type + TEngineClient = class; + TPathInitializationEvent = procedure ( Sender : TObject; var Path : string ) of Object; + TSysPathInitEvent = procedure ( Sender : TObject; PathList : PPyObject ) of Object; + TPythonFlag = (pfDebug, pfInteractive, pfNoSite, pfOptimize, pfVerbose, + pfFrozenFlag, pfIgnoreEnvironmentFlag); + TPythonFlags = set of TPythonFlag; + + + TTracebackItem = class + public + FileName : string; + LineNo : Integer; + Context : string; + end; + + TPythonTraceback = class + protected + FItems : TList; + FLimit : Integer; + + function GetItemCount : Integer; + function GetItem( idx : Integer ) : TTracebackItem; + public + constructor Create; + destructor Destroy; override; + + procedure Clear; + procedure Refresh(pytraceback: PPyObject = nil); + procedure AddItem(const Context, FileName: string; LineNo: Integer); + + property ItemCount : Integer read GetItemCount; + property Items[ idx : Integer ] : TTracebackItem read GetItem; + property Limit : Integer read FLimit write FLimit; + end; + + {$IF not Defined(FPC) and (CompilerVersion >= 23)} + [ComponentPlatformsAttribute(pidSupportedPlatforms)] + {$IFEND} + TPythonEngine = class(TPythonInterface) + private + FVenvPythonExe: string; + FInitScript: TStrings; + FIO: TPythonInputOutput; + FRedirectIO: Boolean; + FOnAfterInit: TNotifyEvent; + FClients: TList; + FExecModule: AnsiString; + FAutoFinalize: Boolean; + FProgramName: UnicodeString; + FPythonHome: UnicodeString; + FInitThreads: Boolean; + FOnPathInitialization: TPathInitializationEvent; + FOnSysPathInit: TSysPathInitEvent; + FTraceback: TPythonTraceback; + FUseWindowsConsole: Boolean; + FGlobalVars: PPyObject; + FLocalVars: PPyObject; + FPyFlags: TPythonFlags; + FIORedirected: Boolean; + FIOPythonModule: TObject; + FDatetimeConversionMode: TDatetimeConversionMode; + FTimeStruct: PPyObject; + FPyDateTime_DateType: PPyObject; + FPyDateTime_DateTimeType: PPyObject; + FPyDateTime_DeltaType: PPyObject; + FPyDateTime_TimeType: PPyObject; + FPyDateTime_TZInfoType: PPyObject; + FPyDateTime_TimeTZType: PPyObject; + FPyDateTime_DateTimeTZType: PPyObject; + + protected + procedure Initialize; + procedure Finalize; + procedure AfterLoad; override; + procedure BeforeLoad; override; + procedure DoOpenDll(const aDllName : string); override; + procedure SetInitScript(Value: TStrings); + function GetThreadState: PPyThreadState; + procedure SetInitThreads(Value: Boolean); + function GetClientCount : Integer; + function GetClients( idx : Integer ) : TEngineClient; + procedure Notification(AComponent: TComponent; + Operation: TOperation); override; + procedure CheckRegistry; + procedure SetProgramArgs; + procedure InitWinConsole; + procedure SetUseWindowsConsole( const Value : Boolean ); + procedure SetGlobalVars(const Value: PPyObject); + procedure SetLocalVars(const Value: PPyObject); + procedure SetPyFlags(const Value: TPythonFlags); + procedure SetIO(InputOutput: TPythonInputOutput); + procedure AssignPyFlags; + + public + // Constructors & Destructors + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + procedure Initialize2; + procedure DoOpenDll2(const aDllName : string); //override; + procedure SetProgramArgs2; + + + // Public methods + procedure SetPythonHome(const PythonHome: UnicodeString); + procedure SetProgramName(const ProgramName: UnicodeString); + function IsType(ob: PPyObject; obt: PPyTypeObject): Boolean; + function Run_CommandAsString(const command : AnsiString; mode : Integer) : string; + function Run_CommandAsObject(const command : AnsiString; mode : Integer) : PPyObject; + function Run_CommandAsObjectWithDict(const command : AnsiString; mode : Integer; locals, globals : PPyObject) : PPyObject; + function EncodeString (const str: UnicodeString): AnsiString; {$IFDEF FPC}overload;{$ENDIF} + {$IFDEF FPC} + overload; + function EncodeString (const str: AnsiString): AnsiString; overload; + {$ENDIF} + function EncodeWindowsFilePath (const str: string): AnsiString; + procedure ExecString(const command : AnsiString); overload; + procedure ExecStrings( strings : TStrings ); overload; + function EvalString(const command : AnsiString) : PPyObject; overload; + function EvalStringAsStr(const command : AnsiString) : string; + function EvalStrings( strings : TStrings ) : PPyObject; overload; + procedure ExecString(const command : AnsiString; locals, globals : PPyObject ); overload; + procedure ExecStrings( strings : TStrings; locals, globals : PPyObject ); overload; + function EvalString( const command : AnsiString; locals, globals : PPyObject ) : PPyObject; overload; + function EvalStrings( strings : TStrings; locals, globals : PPyObject ) : PPyObject; overload; + function EvalStringsAsStr( strings : TStrings ) : string; + function EvalPyFunction(pyfunc, pyargs:PPyObject): Variant; + function EvalFunction(pyfunc:PPyObject; const args: array of const): Variant; + function EvalFunctionNoArgs(pyfunc:PPyObject): Variant; + function CheckEvalSyntax( const str : AnsiString ) : Boolean; + function CheckExecSyntax( const str : AnsiString ) : Boolean; + function CheckSyntax( const str : AnsiString; mode : Integer ) : Boolean; + procedure RaiseError; + function PyObjectAsString( obj : PPyObject ) : string; + procedure DoRedirectIO; + procedure AddClient( client : TEngineClient ); + procedure RemoveClient( client : TEngineClient ); + function FindClient( const aName : string ) : TEngineClient; + function TypeByName( const aTypeName : AnsiString ) : PPyTypeObject; + function ModuleByName( const aModuleName : AnsiString ) : PPyObject; + function MethodsByName( const aMethodsContainer: string ) : PPyMethodDef; + function VariantAsPyObject( const V : Variant ) : PPyObject; virtual; + function PyObjectAsVariant( obj : PPyObject ) : Variant; virtual; + function VarRecAsPyObject( const v : TVarRec ) : PPyObject; + function MakePyTuple( const objects : array of PPyObject ) : PPyObject; + function MakePyList( const objects : array of PPyObject ) : PPyObject; + function ArrayToPyTuple( const items : array of const) : PPyObject; + function ArrayToPyList( const items : array of const) : PPyObject; + function ArrayToPyDict( const items : array of const) : PPyObject; + function StringsToPyList( strings : TStrings ) : PPyObject; + function StringsToPyTuple( strings : TStrings ) : PPyObject; + procedure PyListToStrings( list : PPyObject; strings : TStrings ); + procedure PyTupleToStrings( tuple: PPyObject; strings : TStrings ); + function ReturnNone : PPyObject; + function ReturnTrue : PPyObject; + function ReturnFalse : PPyObject; + function FindModule( const ModuleName : AnsiString ) : PPyObject; + function FindFunction(const ModuleName,FuncName: AnsiString): PPyObject; + function SetToList( data : Pointer; size : Integer ) : PPyObject; + procedure ListToSet( List : PPyObject; data : Pointer; size : Integer ); + procedure CheckError(ACatchStopEx : Boolean = False); + function GetMainModule : PPyObject; + function PyTimeStruct_Check( obj : PPyObject ) : Boolean; + { Date, Time, DateTime and related objects check functions } + function PyDate_Check( obj : PPyObject ) : Boolean; + function PyDate_CheckExact( obj : PPyObject ) : Boolean; + function PyDateTime_Check( obj : PPyObject ) : Boolean; + function PyDateTime_CheckExact( obj : PPyObject ) : Boolean; + function PyTime_Check( obj : PPyObject ) : Boolean; + function PyTime_CheckExact( obj : PPyObject ) : Boolean; + function PyDelta_Check( obj : PPyObject ) : Boolean; + function PyDelta_CheckExact( obj : PPyObject ) : Boolean; + function PyTZInfo_Check( obj : PPyObject ) : Boolean; + function PyTZInfo_CheckExact( obj : PPyObject ) : Boolean; + + { String conversion } + //function PyUnicodeFromString(const AString : UnicodeString) : PPyObject; overload; + function PyUnicodeFromString(const AString: AnsiString): PPyObject; //overload; + function PyUnicodeAsString( obj : PPyObject ) : UnicodeString; + function PyUnicodeAsUTF8String( obj : PPyObject ) : RawByteString; + function PyBytesAsAnsiString( obj : PPyObject ) : AnsiString; + + // Public Properties + property ClientCount : Integer read GetClientCount; + property Clients[ idx : Integer ] : TEngineClient read GetClients; + property ExecModule : AnsiString read FExecModule write FExecModule; + property ThreadState: PPyThreadState read GetThreadState; + property Traceback : TPythonTraceback read FTraceback; + property LocalVars : PPyObject read FLocalVars Write SetLocalVars; + property GlobalVars : PPyObject read FGlobalVars Write SetGlobalVars; + property IOPythonModule: TObject read FIOPythonModule; {TPythonModule} + property PythonHome: UnicodeString read FPythonHome write SetPythonHome; + property ProgramName: UnicodeString read FProgramName write SetProgramName; + published + property AutoFinalize: Boolean read FAutoFinalize write FAutoFinalize default True; + property VenvPythonExe: string read FVenvPythonExe write FVenvPythonExe; + property DatetimeConversionMode: TDatetimeConversionMode read FDatetimeConversionMode write FDatetimeConversionMode default DEFAULT_DATETIME_CONVERSION_MODE; + property InitScript: TStrings read FInitScript write SetInitScript; + property InitThreads: Boolean read FInitThreads write SetInitThreads default False; + property IO: TPythonInputOutput read FIO write SetIO; + property PyFlags: TPythonFlags read FPyFlags write SetPyFlags default []; + property RedirectIO: Boolean read FRedirectIO write FRedirectIO default True; + property UseWindowsConsole: Boolean read FUseWindowsConsole write FUseWindowsConsole default False; + property OnAfterInit: TNotifyEvent read FOnAfterInit write FOnAfterInit; + property OnPathInitialization: TPathInitializationEvent read FOnPathInitialization write FOnPathInitialization; + property OnSysPathInit: TSysPathInitEvent read FOnSysPathInit write FOnSysPathInit; + end; + + +//------------------------------------------------------- +//-- -- +//-- Base class: TEngineClient -- +//-- -- +//------------------------------------------------------- + + TEngineClient = class(TComponent) + protected + FEngine : TPythonEngine; + FOnInitialization : TNotifyEvent; + FOnFinalization : TNotifyEvent; + FOnCreate : TNotifyEvent; + FOnDestroy : TNotifyEvent; + FInitialized : Boolean; + + procedure SetEngine( val : TPythonEngine ); virtual; + procedure Loaded; override; + procedure Notification( AComponent: TComponent; + Operation: TOperation); override; + procedure ModuleReady(Sender : TObject); virtual; + public + // Constructors & destructors + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + // Public Methods + procedure Initialize; virtual; + procedure Finalize; virtual; + procedure ClearEngine; + procedure CheckEngine; + + // Public Properties + property Initialized: Boolean read FInitialized; + + published + property Engine : TPythonEngine read FEngine write SetEngine; + property OnCreate : TNotifyEvent read FOnCreate write FOnCreate; + property OnDestroy : TNotifyEvent read FOnDestroy write FOnDestroy; + property OnFinalization : TNotifyEvent read FOnFinalization write FOnFinalization; + property OnInitialization : TNotifyEvent read FOnInitialization write FOnInitialization; + end; + +//------------------------------------------------------- +//-- -- +//--class: TMethodsContainer derived from TEngineClient-- +//-- -- +//------------------------------------------------------- + + TDelphiMethod = function ( self, args : PPyObject ) : PPyObject of object; cdecl; + TDelphiMethodWithKW = function ( self, args, keywords : PPyObject ) : PPyObject of object; cdecl; + TPythonEvent = procedure(Sender: TObject; PSelf, Args: PPyObject; var Result: PPyObject) of object; + TMethodsContainer = class; // forward declaration + TEventDefs = class; // forward declaration + + // Event Collection Item + TEventDef = class(TCollectionItem) + private + FName: AnsiString; + FTmpDocString: AnsiString; + FOnExecute: TPythonEvent; + FDocString: TStringList; + procedure SetDocString(const Value: TStringList); + protected + function GetDisplayName: string; override; + procedure SetDisplayName(const Value: string); override; + public + constructor Create(ACollection: TCollection); override; + destructor Destroy; override; + + procedure Assign(Source: TPersistent); override; + function GetDocString : AnsiString; + function PythonEvent(pself, args: PPyObject): PPyObject; cdecl; + function Owner : TEventDefs; + published + property Name: string read GetDisplayName write SetDisplayName; + property OnExecute: TPythonEvent read FOnExecute write FOnExecute; + property DocString: TStringList read FDocString write SetDocString; + end; + + // Event Collection + TEventDefs = class(TCollection) + protected + FMethodsContainer : TMethodsContainer; + + function GetItems( idx : Integer ) : TEventDef; + procedure SetItems( idx : Integer; Value : TEventDef ); + function GetOwner: TPersistent; override; + public + constructor Create( AMethodsContainer : TMethodsContainer ); + + function Add : TEventDef; + procedure RegisterEvents; + + property Items[ idx : Integer ] : TEventDef read GetItems; + property Container : TMethodsContainer read FMethodsContainer; + end; + + // class TMethodsContainer + TMethodsContainer = class(TEngineClient) + private + FMethodCount : Integer; + FAllocatedMethodCount : Integer; + FMethods : PPyMethodDef; + FModuleDef : PyModuleDef; + FEventDefs: TEventDefs; + + procedure AllocMethods; + procedure FreeMethods; + function GetMethods( idx : Integer ) : PPyMethodDef; + function StoreEventDefs: Boolean; + + protected + procedure ReallocMethods; virtual; + + public + // Constructors & destructors + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + // public methods + procedure Initialize; override; + procedure Finalize; override; + + function AddMethod( AMethodName : PAnsiChar; + AMethod : PyCFunction; + ADocString : PAnsiChar ) : PPyMethodDef; + function AddMethodWithKeywords( AMethodName : PAnsiChar; + AMethod : PyCFunctionWithKW; + ADocString : PAnsiChar ) : PPyMethodDef; + function AddDelphiMethod( AMethodName : PAnsiChar; + ADelphiMethod: TDelphiMethod; + ADocString : PAnsiChar ) : PPyMethodDef; + function AddDelphiMethodWithKeywords( AMethodName : PAnsiChar; + ADelphiMethod: TDelphiMethodWithKW; + ADocString : PAnsiChar ) : PPyMethodDef; + procedure ClearMethods; + + // properties + property MethodCount : Integer read FMethodCount; + property Methods[ idx : Integer ] : PPyMethodDef read GetMethods; + property MethodsData : PPyMethodDef read FMethods; + property ModuleDef : PyModuleDef read FModuleDef; + + published + property Events: TEventDefs read fEventDefs write fEventDefs stored StoreEventDefs; + end; + + +//------------------------------------------------------------ +//-- -- +//--class: TMembersContainer derived from TMethodsContainer -- +//-- -- +//------------------------------------------------------------ + + // class TMembersContainer + TMembersContainer = class(TMethodsContainer) + protected + function GetMembersStartOffset : Integer; virtual; + private + FMemberCount : Integer; + FAllocatedMemberCount : Integer; + FMembers : PPyMemberDef; + + procedure AllocMembers; + procedure FreeMembers; + function GetMembers( idx : Integer ) : PPyMemberDef; + + protected + procedure ReallocMembers; virtual; + + public + // Constructors & destructors + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + // public methods + procedure AddMember( MemberName : PAnsiChar; + MemberType : TPyMemberType; + MemberOffset : NativeInt; + MemberFlags : TPyMemberFlag; + MemberDoc : PAnsiChar ); + procedure ClearMembers; + procedure Finalize; override; + + // properties + property MemberCount : Integer read FMemberCount; + property Members[ idx : Integer ] : PPyMemberDef read GetMembers; + property MembersData : PPyMemberDef read FMembers; + end; + +//------------------------------------------------------------ +//-- -- +//--class: TGetSetContainer derived from TMembersContainer -- +//-- -- +//------------------------------------------------------------ + + // class TGetSetContainer + TGetSetContainer = class(TMembersContainer) + private + FGetSetCount : Integer; + FAllocatedGetSetCount : Integer; + FGetSets : PPyGetSetDef; + + procedure AllocGetSets; + procedure FreeGetSets; + function GetGetSet( idx : Integer ) : PPyGetSetDef; + + protected + procedure ReallocGetSets; virtual; + + public + // Constructors & destructors + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + // public methods + procedure AddGetSet( AName : PAnsiChar; + AGet : getter; + ASet : setter; + ADoc : PAnsiChar; + AClosure : Pointer); + procedure ClearGetSets; + procedure Finalize; override; + + // properties + property GetSetCount : Integer read FGetSetCount; + property GetSet[ idx : Integer ] : PPyGetSetDef read GetGetSet; + property GetSetData : PPyGetSetDef read FGetSets; + end; + +//------------------------------------------------------- +//-- -- +//--class: TPythonModule derived from TMethodsContainer-- +//-- -- +//------------------------------------------------------- + + TPythonModule = class; // forward declaration + TErrors = class; // forward declaration + + TErrorType = (etString, etClass); + + TParentClassError = class(TPersistent) + protected + FName : AnsiString; + FModule : AnsiString; + public + procedure AssignTo( Dest: TPersistent ); override; + published + property Module : AnsiString read FModule write FModule; + property Name : AnsiString read FName write FName; + end; + + TError = class(TCollectionItem) + protected + FName : AnsiString; + FText : AnsiString; + FError : PPyObject; + FErrorType : TErrorType; + FParentClass : TParentClassError; + + function GetDisplayName: string; override; + procedure SetName( const Value : AnsiString ); + procedure SetText( const Value : AnsiString ); + procedure SetErrorType( Value : TErrorType ); + procedure SetParentClass( Value : TParentClassError ); + public + constructor Create(ACollection: TCollection); override; + destructor Destroy; override; + procedure Assign(Source: TPersistent); override; + procedure BuildError( const ModuleName : AnsiString ); + procedure RaiseError( const msg : AnsiString ); + procedure RaiseErrorObj( const msg : AnsiString; obj : PPyObject ); + function Owner : TErrors; + property Error : PPyObject read FError write FError; + published + property Name : AnsiString read FName write SetName; + property Text : AnsiString read FText write SetText; + property ErrorType : TErrorType read FErrorType write SetErrorType; + property ParentClass : TParentClassError read FParentClass write SetParentClass; + end; + + TErrors = class(TCollection) + private + FModule: TPythonModule; + function GetError(Index: Integer): TError; + procedure SetError(Index: Integer; Value: TError); + protected + function GetOwner: TPersistent; override; + procedure Update(Item: TCollectionItem); override; + public + constructor Create(Module: TPythonModule); + function Add: TError; + function Owner : TPythonModule; + property Items[Index: Integer]: TError read GetError write SetError; default; + end; + + {$IF not Defined(FPC) and (CompilerVersion >= 23)} + [ComponentPlatformsAttribute(pidSupportedPlatforms)] + {$IFEND} + TPythonModule = class(TMethodsContainer) + protected + FModuleName : AnsiString; + FModule : PPyObject; + FClients : TList; + FErrors : TErrors; + FOnAfterInitialization : TNotifyEvent; + FDocString : TStringList; + + function GetClientCount : Integer; + function GetClients( idx : Integer ) : TEngineClient; + procedure SetErrors( val : TErrors ); + procedure SetModuleName( const val : AnsiString ); + procedure SetDocString( value : TStringList ); + + public + // Constructors & destructors + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + // Public methods + procedure MakeModule; + procedure DefineDocString; + procedure Initialize; override; + procedure InitializeForNewInterpreter; + procedure AddClient( client : TEngineClient ); + function ErrorByName( const AName : AnsiString ) : TError; + procedure RaiseError( const error, msg : AnsiString ); + procedure RaiseErrorFmt( const error, format : AnsiString; const Args : array of const ); + procedure RaiseErrorObj( const error, msg : AnsiString; obj : PPyObject ); + procedure BuildErrors; + procedure SetVar( const varName : AnsiString; value : PPyObject ); + function GetVar( const varName : AnsiString ) : PPyObject; + procedure DeleteVar( const varName : AnsiString ); + procedure ClearVars; + procedure SetVarFromVariant( const varName : AnsiString; const value : Variant ); + function GetVarAsVariant( const varName: AnsiString ) : Variant; + + // Public properties + property Module : PPyObject read FModule; + property Clients[ idx : Integer ] : TEngineClient read GetClients; + property ClientCount : Integer read GetClientCount; + + published + property DocString : TStringList read FDocString write SetDocString; + property ModuleName : AnsiString read FModuleName write SetModuleName; + property Errors : TErrors read FErrors write SetErrors; + property OnAfterInitialization : TNotifyEvent read FOnAfterInitialization write FOnAfterInitialization; + end; + + +//------------------------------------------------------- +//-- -- +//--class: TPythonType derived from TGetSetContainer -- +//-- -- +//------------------------------------------------------- + +type + TPythonType = class; //forward declaration + +{ + A B C + +-------------------++------------------------------------------------------+ + | PyObject header || TPyObject class | + +----------+--------++-----------------+------------+----------+------------+ + |ob_refcnt |ob_type ||hidden Class Ptr |PythonType |IsSubType |PythonAlloc | + |integer |pointer ||pointer |TPythonType |Boolean |Boolean | + |4 bytes |4 bytes ||4 bytes |4 bytes |1 byte |1 byte | + +----------+--------++-----------------+------------+----------+------------+ + + ^ ^ + | | + ptr returned ptr returned by Adjust + by GetSelf + + - a Python object must start at A. + - a Delphi class class must start at B + - TPyObject.InstanceSize will return C-B + - Sizeof(TPyObject) will return C-B + - The total memory allocated for a TPyObject instance will be C-A, + even if its InstanceSize is C-B. + - When turning a Python object pointer into a Delphi instance pointer, PythonToDelphi + will offset the pointer from A to B. + - When turning a Delphi instance into a Python object pointer, GetSelf will offset + Self from B to A. + - Properties ob_refcnt and ob_type will call GetSelf to access their data. +} + // The base class of all new Python types + TPyObject = class + private + function Get_ob_refcnt: NativeInt; + function Get_ob_type: PPyTypeObject; + procedure Set_ob_refcnt(const Value: NativeInt); + procedure Set_ob_type(const Value: PPyTypeObject); + public + PythonType : TPythonType; + IsSubtype : Boolean; + PythonAlloc : Boolean; + + // Constructors & Destructors + constructor Create( APythonType : TPythonType ); virtual; + constructor CreateWith( APythonType : TPythonType; args : PPyObject ); virtual; + destructor Destroy; override; + + class function NewInstance: TObject; override; + procedure FreeInstance; override; + + // Misc + function GetSelf : PPyObject; + procedure IncRef; + procedure Adjust(PyPointer: Pointer); + function GetModule : TPythonModule; + + property ob_refcnt : NativeInt read Get_ob_refcnt write Set_ob_refcnt; + property ob_type : PPyTypeObject read Get_ob_type write Set_ob_type; + + // Type services + //////////////// + + // Basic services + function Print( var f: file; i: integer) : Integer; virtual; + function GetAttr(key : PAnsiChar) : PPyObject; virtual; + function SetAttr(key : PAnsiChar; value : PPyObject) : Integer; virtual; + function Repr : PPyObject; virtual; + function Compare( obj: PPyObject) : Integer; virtual; + function Hash : NativeInt; virtual; + function Str: PPyObject; virtual; + function GetAttrO( key: PPyObject) : PPyObject; virtual; + function SetAttrO( key, value: PPyObject) : Integer; virtual; + function Call( ob1, ob2 : PPyObject) : PPyObject; virtual; + function Traverse( proc: visitproc; ptr: Pointer) : integer; virtual; + function Clear: integer; virtual; + function RichCompare( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject; virtual; + function Iter : PPyObject; virtual; + function IterNext : PPyObject; virtual; + function Init( args, kwds : PPyObject ) : Integer; virtual; + + // Number services + function NbAdd( obj : PPyObject) : PPyObject; virtual; + function NbSubtract( obj : PPyObject) : PPyObject; virtual; + function NbMultiply( obj : PPyObject) : PPyObject; virtual; + function NbFloorDivide( obj : PPyObject) : PPyObject; virtual; + function NbTrueDivide( obj : PPyObject) : PPyObject; virtual; + function NbMatrixMultiply( obj : PPyObject) : PPyObject; virtual; + function NbRemainder( obj : PPyObject) : PPyObject; virtual; + function NbDivmod( obj : PPyObject) : PPyObject; virtual; + function NbPower( ob1, ob2 : PPyObject) : PPyObject; virtual; + function NbNegative : PPyObject; virtual; + function NbPositive : PPyObject; virtual; + function NbAbsolute : PPyObject; virtual; + function NbBool : Integer; virtual; + function NbInvert : PPyObject; virtual; + function NbLShift( obj : PPyObject) : PPyObject; virtual; + function NbRShift( obj : PPyObject) : PPyObject; virtual; + function NbAnd( obj : PPyObject) : PPyObject; virtual; + function NbXor( obj : PPyObject) : PPyObject; virtual; + function NbOr( obj : PPyObject) : PPyObject; virtual; + function NbInt : PPyObject; virtual; + function NbFloat : PPyObject; virtual; + function NbInplaceAdd( obj : PPyObject): PPyObject; virtual; + function NbInplaceSubtract( obj : PPyObject): PPyObject; virtual; + function NbInplaceMultiply( obj : PPyObject): PPyObject; virtual; + function NbInplaceDivide( obj : PPyObject): PPyObject; virtual; + function NbInplaceFloorDivide( obj : PPyObject) : PPyObject; virtual; + function NbInplaceTrueDivide( obj : PPyObject) : PPyObject; virtual; + function NbInplaceRemainder( obj : PPyObject): PPyObject; virtual; + function NbInplacePower( ob1, ob2 : PPyObject): PPyObject; virtual; + function NbInplaceLshift( obj : PPyObject): PPyObject; virtual; + function NbInplaceRshift( obj : PPyObject): PPyObject; virtual; + function NbInplaceAnd( obj : PPyObject): PPyObject; virtual; + function NbInplaceXor( obj : PPyObject): PPyObject; virtual; + function NbInplaceOr( obj : PPyObject): PPyObject; virtual; + function NbInplaceMatrixMultiply(obj: PPyObject): PPyObject; virtual; + // Sequence services + function SqLength : NativeInt; virtual; + function SqConcat( obj : PPyObject) : PPyObject; virtual; + function SqRepeat( val : NativeInt ) : PPyObject; virtual; + function SqItem( idx : NativeInt ) : PPyObject; virtual; + function SqAssItem( idx : NativeInt; obj : PPyObject) : Integer; virtual; + function SqContains( obj: PPyObject): integer; virtual; + function SqInplaceConcat( obj : PPyObject): PPyObject; virtual; + function SqInplaceRepeat( i: NativeInt): PPyObject; virtual; + // Mapping services + function MpLength : NativeInt; virtual; + function MpSubscript( obj : PPyObject) : PPyObject; virtual; + function MpAssSubscript( obj1, obj2 : PPyObject) : Integer; virtual; + + // Class methods + class procedure RegisterMethods( APythonType : TPythonType ); virtual; + class procedure RegisterMembers( APythonType : TPythonType ); virtual; + class procedure RegisterGetSets( APythonType : TPythonType ); virtual; + class procedure SetupType( APythonType : TPythonType ); virtual; + end; + TPyObjectClass = class of TPyObject; + + TBasicServices = set of (bsGetAttr, bsSetAttr, + bsRepr, bsCompare, bsHash, + bsStr, bsGetAttrO, bsSetAttrO, + bsCall, + // since version 2.0 + bsTraverse, bsClear, + // since version 2.1 + bsRichCompare, + // since version 2.2 + bsIter, bsIterNext); + TNumberServices = set of (nsAdd, nsSubtract, nsMultiply, + nsRemainder, nsDivmod, + nsPower, nsNegative, nsPositive, + nsAbsolute, nsInvert, + nsLShift, nsRShift, nsAnd, + nsXor, nsOr, + nsInt, nsFloat, + nsFloorDivide, nsTrueDivide, + // since version 3.0 + nsMatrixMultiply, nsBool); + + // TInplaceNumberServices exists since version 2.0 + TInplaceNumberServices = set of (nsInplaceAdd, nsInplaceSubtract, + nsInplaceMultiply, + nsInplaceRemainder, nsInplacePower, + nsInplaceLShift, nsInplaceRShift, + nsInplaceAnd, nsInplaceXor, nsInplaceOr, + nsInplaceFloorDivide, nsInplaceTrueDivide, + // since version 3.0 + nsInplaceMatrixMultiply); + + TSequenceServices = set of (ssLength, ssConcat, ssRepeat, + ssItem, ssAssItem, + ssContains, ssInplaceConcat, + ssInplaceRepeat + ); + + TMappingServices = set of (msLength, msSubscript, msAssSubscript); + + TTypeServices = class(TPersistent) + protected + FBasic : TBasicServices; + FNumber : TNumberServices; + FSequence : TSequenceServices; + FMapping : TMappingServices; + FInplaceNumber : TInplaceNumberServices; + + public + constructor Create; + procedure AssignTo( Dest: TPersistent ); override; + + published + property Basic : TBasicServices read FBasic write FBasic; + property InplaceNumber : TInplaceNumberServices read FInplaceNumber Write FInplaceNumber; + property Number : TNumberServices read FNumber write FNumber; + property Sequence : TSequenceServices read FSequence write FSequence; + property Mapping : TMappingServices read FMapping write FMapping; + end; + + // The component that initializes the Python type and + // that creates instances of itself. + {$IF not Defined(FPC) and (CompilerVersion >= 23)} + [ComponentPlatformsAttribute(pidSupportedPlatforms)] + {$IFEND} + TPythonType = class(TGetSetContainer) + protected + FType : PyTypeObject; + FTypeName : AnsiString; + FModule : TPythonModule; + FPyObjectClass : TPyObjectClass; + FPrefix : AnsiString; + FCreateFuncName : AnsiString; + FServices : TTypeServices; + FNumber: PyNumberMethods; + FSequence: PySequenceMethods; + FMapping: PyMappingMethods; + FCurrentDocString: AnsiString; + FDocString: TStringList; + FCreateFuncDoc : AnsiString; + FInstanceCount : Integer; + FCreateHits : Integer; + FDeleteHits : Integer; + FTypeFlags : TPFlags; + FCreateFunc : PPyObject; + FCreateFuncDef : PyMethodDef; + FGenerateCreateFunction: Boolean; + + procedure Notification( AComponent: TComponent; + Operation: TOperation); override; + function GetTypePtr : PPyTypeObject; + procedure SetPyObjectClass( val : TPyObjectClass ); + procedure SetModule( val : TPythonModule ); + procedure SetServices( val : TTypeServices ); + procedure SetTypeName( const val : AnsiString ); + function CreateMethod( pSelf, args : PPyObject ) : PPyObject; cdecl; + procedure InitServices; + procedure SetDocString( value : TStringList ); + function TypeFlagsAsInt : C_ULong; + function GetMembersStartOffset : Integer; override; + procedure ModuleReady(Sender : TObject); override; + procedure ReallocMethods; override; + procedure ReallocMembers; override; + procedure ReallocGetSets; override; + + // Type services + // They will be all forwarded to the Delphi class that + // implements the object through the use of virtual + // methods + /////////////////////////////////////// + function NewSubtypeInst( aType: PPyTypeObject; args, kwds : PPyObject) : PPyObject; cdecl; + + public + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + procedure Initialize; override; + procedure Finalize; override; + function CreateInstance : PPyObject; + function CreateInstanceWith( args : PPyObject ) : PPyObject; + procedure AddTypeVar; + + property TheType : PyTypeObject read FType write FType; + property TheTypePtr : PPyTypeObject read GetTypePtr; + property PyObjectClass : TPyObjectClass read FPyObjectClass write SetPyObjectClass stored False; + property InstanceCount : Integer read FInstanceCount; + property CreateHits : Integer read FCreateHits; + property DeleteHits : Integer read FDeleteHits; + + published + property DocString : TStringList read FDocString write SetDocString; + property TypeName : AnsiString read FTypeName write SetTypeName; + property TypeFlags : TPFlags read FTypeFlags write FTypeFlags default TPFLAGS_DEFAULT; + property Prefix : AnsiString read FPrefix write FPrefix; + property Module : TPythonModule read FModule write SetModule; + property Services : TTypeServices read FServices write SetServices; + property GenerateCreateFunction : Boolean read fGenerateCreateFunction write fGenerateCreateFunction default True; + end; + +//------------------------------------------------------- +//-- -- +//-- class: TPythonVar derived from TEngineClient -- +//-- -- +//------------------------------------------------------- + + TGetDataEvent = procedure ( Sender : TObject; var Data : Variant ) of Object; + TSetDataEvent = procedure ( Sender : TObject; Data : Variant ) of Object; + TExtGetDataEvent = procedure ( Sender : TObject; var Data : PPyObject ) of Object; + TExtSetDataEvent = procedure ( Sender : TObject; Data : PPyObject) of Object; + + {$IF not Defined(FPC) and (CompilerVersion >= 23)} + [ComponentPlatformsAttribute(pidSupportedPlatforms)] + {$IFEND} + TPythonDelphiVar = class( TEngineClient ) + protected + FModule : AnsiString; + FVarName : AnsiString; + FVarObject : PPyObject; + FOnGetData : TGetDataEvent; + FOnSetData : TSetDataEvent; + FOnExtGetData : TExtGetDataEvent; + FOnExtSetData : TExtSetDataEvent; + FOnChange : TNotifyEvent; + + procedure CreateVarType; + procedure CreateVar; + function GetValue : Variant; + procedure SetValue( const val : Variant ); + function GetValueAsPyObject : PPyObject; + procedure SetValueFromPyObject( val : PPyObject ); + function GetValueAsString : string; + procedure SetVarName( const val : AnsiString ); + + public + // Constructors & Destructors + constructor Create( AOwner : TComponent ); override; + + // Public methods + procedure Initialize; override; + procedure Finalize; override; + function IsVariantOk( const v : Variant ) : Boolean; + + // Public properties + property Value : Variant read GetValue write SetValue; + // Warning: ValueObject returns a preincremented object ! + property ValueObject : PPyObject read GetValueAsPyObject write SetValueFromPyObject; + property ValueAsString : string read GetValueAsString; + property VarObject : PPyObject read FVarObject write FVarObject; + + published + property Module : AnsiString read FModule write FModule; + property VarName : AnsiString read FVarName write SetVarName; + property OnGetData : TGetDataEvent read FOnGetData write FOnGetData; + property OnSetData : TSetDataEvent read FOnSetData write FOnSetData; + property OnExtGetData : TExtGetDataEvent read FOnExtGetData write FOnExtGetData; + property OnExtSetData : TExtSetDataEvent read FOnExtSetData write FOnExtSetData; + property OnChange : TNotifyEvent read FOnChange write FOnChange; + end; + + TPyVar = class(TPyObject) + public + dv_var : Variant; + dv_component : TPythonDelphiVar; + dv_object : PPyObject; + + // Constructors & Destructors + constructor Create( APythonType : TPythonType ); override; + constructor CreateWith( APythonType : TPythonType; args : PPyObject ); override; + destructor Destroy; override; + + // Type services + //////////////// + + // Basic services + function GetAttrO( key: PPyObject) : PPyObject; override; + function SetAttrO( key, value: PPyObject) : Integer; override; + function Repr : PPyObject; override; + + // Class methods + class procedure RegisterMethods( APythonType : TPythonType ); override; + + // Methods of TPyVar + function GetValue : PPyObject; + function GetValueAsVariant : Variant; + procedure SetValue( value : PPyObject ); + procedure SetValueFromVariant( const value : Variant ); + + // Interface methods + end; + +//####################################################### +//## ## +//## Thread Object with Python interpreter lock ## +//## ## +//####################################################### + TThreadExecMode = (emNewState, emNewInterpreter); + +{$HINTS OFF} + TPythonThread = class(TThread) + private + fThreadState: PPyThreadState; + fThreadExecMode: TThreadExecMode; + //private class threadvar + f_savethreadstate: PPyThreadState; + + // Do not overwrite Execute! Use ExecuteWithPython instead! + procedure Execute; override; + protected + procedure ExecuteWithPython; virtual; abstract; + public + class procedure Py_Begin_Allow_Threads; + class procedure Py_End_Allow_Threads; + // The following procedures are redundant and only for + // compatibility to the C API documentation. + class procedure Py_Begin_Block_Threads; + class procedure Py_Begin_Unblock_Threads; + + property ThreadState : PPyThreadState read fThreadState; + property ThreadExecMode: TThreadExecMode read fThreadExecMode write fThreadExecMode; + end; +{$HINTS ON} + +//####################################################### +//## ## +//## New Python objects ## +//## ## +//####################################################### + +//####################################################### +//## ## +//## Methods for new Python objects or modules ## +//## ## +//####################################################### + +// Module pyio for Python Input/Outputs +function pyio_write(self, args : PPyObject) : PPyObject; cdecl; +function pyio_read(self, args : PPyObject) : PPyObject; cdecl; +function pyio_SetDelayWrites(self, args : PPyObject) : PPyObject; cdecl; +function pyio_SetMaxLines(self, args : PPyObject) : PPyObject; cdecl; +function pyio_GetTypesStats(self, args : PPyObject) : PPyObject; cdecl; + + +//####################################################### +//## ## +//## Global procedures ## +//## ## +//####################################################### + +function GetPythonEngine : TPythonEngine; +function PythonOK : Boolean; +function PythonToDelphi( obj : PPyObject ) : TPyObject; +function IsDelphiObject( obj : PPyObject ) : Boolean; +procedure PyObjectDestructor( pSelf : PPyObject); cdecl; +procedure FreeSubtypeInst(ob:PPyObject); cdecl; +procedure Register; +function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean; +function SysVersionFromDLLName(const DLLFileName : string): string; +procedure PythonVersionFromDLLName(LibName: string; out MajorVersion, MinorVersion: integer); + +{ Helper functions} +(* + Checks whether the PythonVersion x.x is Registered +*) +{$IFDEF MSWINDOWS} +function IsPythonVersionRegistered(PythonVersion : string; + out InstallPath: string; out AllUserInstall: Boolean) : Boolean; +{$ENDIF} +(* + Mask FPU Excptions - Useful for importing SciPy and other Python libs + See http://bugs.python.org/issue9980 and + http://stackoverflow.com/questions/3933851/ +*) +procedure MaskFPUExceptions(ExceptionsMasked : boolean; + MatchPythonPrecision : Boolean = True); +(* + Converts line breaks to LF and optionally adds a line break at the end +*) +function CleanString(const s : AnsiString; AppendLF : Boolean = True) : AnsiString; //overload; +//function CleanString(const s : UnicodeString; AppendLF : Boolean = True) : UnicodeString; overload; + +procedure setgPythonEngine(mypyengine: TPythonEngine); +function getgPythonEngine: TPythonEngine; + +implementation + +uses +{$IFDEF FPC} + StrUtils, +{$ELSE} + //AnsiStrings, + StrUtils, +{$ENDIF} +{$IFDEF MSWINDOWS} + Registry, +{$ENDIF} + Math; + +(*******************************************************) +(** **) +(** Resource strings **) +(** **) +(*******************************************************) +resourcestring +SPyConvertionError = 'Conversion Error: %s expects a %s Python object'; +SPyExcStopIteration = 'Stop Iteration'; +SPyExcSystemError = 'Unhandled SystemExit exception. Code: %s'; + +(*******************************************************) +(** **) +(** Globals **) +(** **) +(*******************************************************) + +var + gPythonEngine : TPythonEngine; + gVarType : TPythonType; + + +procedure setgPythonEngine(mypyengine: TPythonEngine); +begin + gPythonEngine := mypyengine; +end; + +function getgPythonEngine: TPythonEngine; +begin + result:= gPythonEngine; +end; + + +(*******************************************************) +(** **) +(** class TPythonInputOutput **) +(** **) +(*******************************************************) + +constructor TPythonInputOutput.Create( AOwner : TComponent ); +begin + inherited; + FMaxLines := kMaxLines; + FQueue := TIOStringList.Create; + FDelayWrites := False; + FMaxLineLength := kMaxLineLength; + FLinesPerThread:= TIOStringList.Create; + FLock := TCriticalSection.Create; +end; + +destructor TPythonInputOutput.Destroy; +begin + FLinesPerThread.Free; + FQueue.Free; + FLock.Free; + inherited; +end; + +procedure TPythonInputOutput.Lock; +begin + FLock.Enter; +end; + +procedure TPythonInputOutput.Unlock; +begin + FLock.Leave; +end; + +procedure TPythonInputOutput.Write( const str : IOString ); + + procedure DropLine; + begin +{$IFDEF MSWINDOWS} + if DelayWrites then + AddWrite( FLine_Buffer ) + else +{$ENDIF} + if UnicodeIO then + SendUniData( FLine_Buffer ) + else + SendData( AnsiString(FLine_Buffer) ); + FLine_Buffer := ''; + UpdateCurrentThreadLine; + end; + +var + i : Integer; + c : IOChar; +begin + Lock; + try + FLine_Buffer := GetCurrentThreadLine; + if FRawOutput then begin + FLine_Buffer := FLine_Buffer + str; + DropLine; + end else begin + for i := 1 to length(str) do + begin + //c := str[i]; + if c = #10 then + DropLine + else if (c >= ' ') or (c = #09) then + begin + Insert( c, FLine_Buffer, length(FLine_Buffer)+1 ); + if Length(FLine_Buffer) > MaxLineLength then + DropLine; + end; + end; + end; + UpdateCurrentThreadLine; + finally + Unlock; + end; +end; + +procedure TPythonInputOutput.WriteLine( const str : IOString ); +begin + Write( str+#10 ); +end; + +procedure TPythonInputOutput.AddWrite( const str : IOString ); +begin + FQueue.Add( string(str) ); + if FQueue.Count > FMaxLines then + FQueue.Delete(0) + else + AddPendingWrite; +end; + +procedure TPythonInputOutput.SendData( const Data : AnsiString ); +begin + if Assigned(FOnSendData) then + FOnSendData( Self, Data ); +end; + +procedure TPythonInputOutput.SendUniData(const Data: UnicodeString); +begin + if Assigned(FOnSendUniData) then + FOnSendUniData( Self, Data ); +end; + +function TPythonInputOutput.ReceiveData : AnsiString; +begin + Result := ''; + if Assigned(FOnReceiveData) then + FOnReceiveData( Self, Result ); +end; + +function TPythonInputOutput.ReceiveUniData: UnicodeString; +begin + Result := ''; + if Assigned(FOnReceiveUniData) then + FOnReceiveUniData( Self, Result ); +end; + +procedure TPythonInputOutput.AddPendingWrite; +begin +end; + +function TPythonInputOutput.GetCurrentThreadSlotIdx : Integer; +var + thread_id : TObject; + i : Integer; +begin + thread_id := TObject(GetCurrentThreadId); + for i := 0 to FLinesPerThread.Count-1 do + if FLinesPerThread.Objects[i] = thread_id then + begin + Result := i; + Exit; + end; + Result := FLinesPerThread.AddObject( '', thread_id ); +end; + +function TPythonInputOutput.GetCurrentThreadLine : IOString; +begin + Result := IOString(FLinesPerThread.Strings[ GetCurrentThreadSlotIdx ]); +end; + +procedure TPythonInputOutput.UpdateCurrentThreadLine; +begin + FLinesPerThread.Strings[ GetCurrentThreadSlotIdx ] := string(FLine_Buffer); +end; + +(*******************************************************) +(** **) +(** class TDynamicDll **) +(** **) +(*******************************************************) + +procedure TDynamicDll.DoOpenDll(const aDllName : string); +{$IFDEF MSWINDOWS} +const + LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = $00000100; + LOAD_LIBRARY_DEFAULT_DIRS = $00001000; +Var + ExceptMask: TFPUExceptionMask; +{$ENDIF} +begin + if not IsHandleValid then + begin + FDllName := aDllName; + {$IFDEF MSWINDOWS} + ExceptMask := GetExceptionMask; + try + {$IFDEF FPC} + FDLLHandle := LoadLibraryExA(PAnsiChar(AnsiString(GetDllPath+DllName)), + {$ELSE} + FDLLHandle := LoadLibraryEx(PAnsichar(GetDllPath+DllName), + {$ENDIF} + 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR or LOAD_LIBRARY_DEFAULT_DIRS); + finally + SetExceptionMask(ExceptMask); + end; + {$ELSE} + //Linux: need here RTLD_GLOBAL, so Python can do "import ctypes" + FDLLHandle := THandle(dlopen(PAnsiChar(AnsiString(GetDllPath+DllName)), + RTLD_LAZY+RTLD_GLOBAL)); + {$ENDIF} + end; +end; + +function TDynamicDll.GetDllPath : string; +{$IFDEF MSWINDOWS} +var + AllUserInstall: Boolean; +{$ENDIF} +begin + Result := DllPath; + + if DLLPath = '' then begin + {$IFDEF MSWINDOWS} + IsPythonVersionRegistered(RegVersion, Result, AllUserInstall); + {$ENDIF} + {$IFDEF DARWIN} + Result := '/Library/Frameworks/Python.framework/Versions/' + RegVersion + '/lib/'; + {$ENDIF} + end; + + if Result <> '' then + begin + Result := IncludeTrailingPathDelimiter(Result); + end; +end; + +procedure TDynamicDll.OpenDll(const aDllName : string); +var + s : string; +begin + UnloadDll; + + BeforeLoad; + + FDLLHandle := 0; + + DoOpenDll(aDllName); + + if not IsHandleValid then begin + {$IFDEF MSWINDOWS} + s := Format('Error %d: Could not open Dll "%s"',[GetLastError, DllName]); + {$ELSE} + s := Format('Error: Could not open Dll "%s"',[DllName]); + {$ENDIF} + if FatalMsgDlg then + {$IFDEF MSWINDOWS} + MessageBox( GetActiveWindow, PChar(s), 'Error', MB_TASKMODAL or MB_ICONSTOP ); + {$ELSE} + WriteLn(ErrOutput, s); + {$ENDIF} + + if FatalAbort then + Quit; + end else + AfterLoad; +end; + +constructor TDynamicDll.Create(AOwner: TComponent); +begin + inherited; + FFatalMsgDlg := True; + FFatalAbort := True; + FAutoLoad := True; + FUseLastKnownVersion := True; +end; + +destructor TDynamicDll.Destroy; +begin + if AutoUnload then + UnloadDll; + inherited; +end; + +function TDynamicDll.Import(const funcname: AnsiString; canFail : Boolean = True): Pointer; +var + E : EDllImportError; + {$IF not Defined(FPC) and not Defined(MSWINDOWS)} + S : string; + {$IFEND} +begin + {$IF Defined(FPC) or Defined(MSWINDOWS)} + Result := GetProcAddress( FDLLHandle, PAnsiChar(funcname) ); + {$ELSE} + S := string(funcname); + Result := GetProcAddress( FDLLHandle, PWideChar(S) ); + {$IFEND} + if (Result = nil) and canFail then begin + {$IFDEF MSWINDOWS} + E := EDllImportError.CreateFmt('Error %d: could not map symbol "%s"', [GetLastError, funcname]); + E.ErrorCode := GetLastError; + {$ELSE} + E := EDllImportError.CreateFmt('Error: could not map symbol "%s"', [funcname]); + {$ENDIF} + E.WrongFunc := funcname; + raise E; + end; +end; + +procedure TDynamicDll.Loaded; +begin + inherited; + if AutoLoad and not (csDesigning in ComponentState) then + LoadDll; +end; + +function TDynamicDll.IsHandleValid : Boolean; +begin +{$IFDEF MSWINDOWS} + Result := (FDLLHandle >= 32); +{$ELSE} + Result := FDLLHandle <> 0; +{$ENDIF} +end; + +procedure TDynamicDll.LoadDll; +begin + OpenDll( DllName ); +end; + +procedure TDynamicDll.UnloadDll; +begin + if IsHandleValid then begin + BeforeUnload; + FreeLibrary(FDLLHandle); + FDLLHandle := 0; + end; +end; + +procedure TDynamicDll.BeforeLoad; +begin + if Assigned( FOnBeforeLoad ) then + FOnBeforeLoad( Self ); +end; + +procedure TDynamicDll.AfterLoad; +begin + if Assigned( FOnAfterLoad ) then + FOnAfterLoad( Self ); +end; + +procedure TDynamicDll.BeforeUnload; +begin + if Assigned( FOnBeforeUnload ) then + FOnBeforeUnload( Self ); +end; + +function TDynamicDll.GetQuitMessage : string; +begin + Result := Format( 'Dll %s could not be loaded. We must quit.', [DllName]); +end; + +procedure TDynamicDll.Quit; +begin + if not( csDesigning in ComponentState ) then begin +{$IFDEF MSWINDOWS} + MessageBox( GetActiveWindow, PChar(GetQuitMessage), 'Error', MB_TASKMODAL or MB_ICONSTOP ); + ExitProcess( 1 ); +{$ELSE} + WriteLn(ErrOutput, GetQuitMessage); + Halt( 1 ); +{$ENDIF} + end; +end; + +function TDynamicDll.IsAPIVersionStored: Boolean; +begin + Result := not UseLastKnownVersion; +end; + +function TDynamicDll.IsDllNameStored: Boolean; +begin + Result := not UseLastKnownVersion; +end; + +function TDynamicDll.IsRegVersionStored: Boolean; +begin + Result := not UseLastKnownVersion; +end; + +procedure TDynamicDll.SetDllName(const Value: string); +begin + FDllName := Value; +end; + + +(*******************************************************) +(** **) +(** class TPythonInterface **) +(** **) +(*******************************************************) + +constructor TPythonInterface.Create(AOwner: TComponent); +var + i : Integer; +begin + inherited; + FInitialized := False; + i := COMPILED_FOR_PYTHON_VERSION_INDEX; + DllName := PYTHON_KNOWN_VERSIONS[i].DllName; + FAPIVersion := PYTHON_KNOWN_VERSIONS[i].APIVersion; + FRegVersion := PYTHON_KNOWN_VERSIONS[i].RegVersion; + FAutoUnload := True; +end; + +procedure TPythonInterface.AfterLoad; +begin + inherited; + PythonVersionFromDLLName(DLLName, FMajorVersion, FMinorVersion); + + FBuiltInModuleName := 'builtins'; + + try + MapDll; + except + on E: Exception do begin + if FatalMsgDlg then +{$IFDEF MSWINDOWS} + MessageBox( GetActiveWindow, PChar(E.Message), 'Error', MB_TASKMODAL or MB_ICONSTOP ); +{$ELSE} + WriteLn( ErrOutput, E.Message ); +{$ENDIF} + if FatalAbort then Quit; + end; + end; +end; + +function TPythonInterface.GetQuitMessage : string; +begin + Result := Format( 'Python could not be properly initialized. We must quit.', [DllName]); +end; + +procedure TPythonInterface.CheckPython; +begin + if not Initialized then + raise Exception.Create('Python is not properly initialized' ); +end; + +function TPythonInterface.GetUnicodeTypeSuffix : string; +begin + if (fMajorVersion > 3) or ((fMajorVersion = 3) and (fMinorVersion >= 3)) then + Result := '' + else if APIVersion >= 1011 then + Result := + {$IF DEFINED(MSWINDOWS) or DEFINED(DARWIN) or DEFINED(SOLARIS)} + 'UCS2' + {$ELSE} + 'UCS4' + {$IFEND} + else + Result := ''; +end; + +procedure TPythonInterface.MapDll; +Var + UnicodeSuffix : string; + +begin + UnicodeSuffix := GetUnicodeTypeSuffix; + + Py_DebugFlag := Import('Py_DebugFlag'); + Py_VerboseFlag := Import('Py_VerboseFlag'); + Py_InteractiveFlag := Import('Py_InteractiveFlag'); + Py_OptimizeFlag := Import('Py_OptimizeFlag'); + Py_NoSiteFlag := Import('Py_NoSiteFlag'); + Py_FrozenFlag := Import('Py_FrozenFlag'); + + Py_IgnoreEnvironmentFlag := Import('Py_IgnoreEnvironmentFlag'); + + Py_None := Import('_Py_NoneStruct'); + Py_Ellipsis := Import('_Py_EllipsisObject'); + Py_False := Import('_Py_FalseStruct'); + Py_True := Import('_Py_TrueStruct'); + Py_NotImplemented := Import('_Py_NotImplementedStruct'); + + PyImport_FrozenModules := Import('PyImport_FrozenModules'); + + PyExc_AttributeError := Import('PyExc_AttributeError'); + PyExc_EOFError := Import('PyExc_EOFError'); + PyExc_IOError := Import('PyExc_IOError'); + PyExc_ImportError := Import('PyExc_ImportError'); + PyExc_IndexError := Import('PyExc_IndexError'); + PyExc_KeyError := Import('PyExc_KeyError'); + PyExc_KeyboardInterrupt := Import('PyExc_KeyboardInterrupt'); + PyExc_MemoryError := Import('PyExc_MemoryError'); + PyExc_NameError := Import('PyExc_NameError'); + PyExc_OverflowError := Import('PyExc_OverflowError'); + PyExc_RuntimeError := Import('PyExc_RuntimeError'); + PyExc_SyntaxError := Import('PyExc_SyntaxError'); + PyExc_SystemError := Import('PyExc_SystemError'); + PyExc_SystemExit := Import('PyExc_SystemExit'); + PyExc_TypeError := Import('PyExc_TypeError'); + PyExc_ValueError := Import('PyExc_ValueError'); + PyExc_ZeroDivisionError := Import('PyExc_ZeroDivisionError'); + PyExc_ArithmeticError := Import('PyExc_ArithmeticError'); + PyExc_Exception := Import('PyExc_Exception'); + PyExc_FloatingPointError := Import('PyExc_FloatingPointError'); + PyExc_LookupError := Import('PyExc_LookupError'); + PyExc_AssertionError := Import('PyExc_AssertionError'); + PyExc_EnvironmentError := Import('PyExc_EnvironmentError'); + PyExc_IndentationError := Import('PyExc_IndentationError'); + PyExc_NotImplementedError := Import('PyExc_NotImplementedError'); + PyExc_OSError := Import('PyExc_OSError'); + PyExc_TabError := Import('PyExc_TabError'); + PyExc_UnboundLocalError := Import('PyExc_UnboundLocalError'); + PyExc_UnicodeError := Import('PyExc_UnicodeError'); + {$IFDEF MSWINDOWS} + PyExc_WindowsError := Import('PyExc_WindowsError'); + {$ENDIF} + PyExc_Warning := Import('PyExc_Warning'); + PyExc_DeprecationWarning := Import('PyExc_DeprecationWarning'); + PyExc_RuntimeWarning := Import('PyExc_RuntimeWarning'); + PyExc_SyntaxWarning := Import('PyExc_SyntaxWarning'); + PyExc_UserWarning := Import('PyExc_UserWarning'); + PyExc_ReferenceError := Import('PyExc_ReferenceError'); + PyExc_StopIteration := Import('PyExc_StopIteration'); + PyExc_FutureWarning := Import('PyExc_FutureWarning'); + PyExc_PendingDeprecationWarning:= Import('PyExc_PendingDeprecationWarning'); + PyExc_UnicodeDecodeError := Import('PyExc_UnicodeDecodeError'); + PyExc_UnicodeEncodeError := Import('PyExc_UnicodeEncodeError'); + PyExc_UnicodeTranslateError:= Import('PyExc_UnicodeTranslateError'); + PyType_Type := Import('PyType_Type'); + PyCFunction_Type := Import('PyCFunction_Type'); + PyCode_Type := Import('PyCode_Type'); + PyComplex_Type := Import('PyComplex_Type'); + PyDict_Type := Import('PyDict_Type'); + PyFloat_Type := Import('PyFloat_Type'); + PyFrame_Type := Import('PyFrame_Type'); + PyFunction_Type := Import('PyFunction_Type'); + PyList_Type := Import('PyList_Type'); + PyLong_Type := Import('PyLong_Type'); + PyMethod_Type := Import('PyMethod_Type'); + PyModule_Type := Import('PyModule_Type'); + PyObject_Type := Import('PyObject_Type'); + PyRange_Type := Import('PyRange_Type'); + PySlice_Type := Import('PySlice_Type'); + PyBytes_Type := Import('PyBytes_Type'); + PyTuple_Type := Import('PyTuple_Type'); + PyUnicode_Type := Import('PyUnicode_Type'); + PyBaseObject_Type := Import('PyBaseObject_Type'); + PyCallIter_Type := Import('PyCallIter_Type'); + PyCell_Type := Import('PyCell_Type'); + PyClassMethod_Type := Import('PyClassMethod_Type'); + PyProperty_Type := Import('PyProperty_Type'); + PySeqIter_Type := Import('PySeqIter_Type'); + PyStaticMethod_Type := Import('PyStaticMethod_Type'); + PySuper_Type := Import('PySuper_Type'); + PyTraceBack_Type := Import('PyTraceBack_Type'); + PyWrapperDescr_Type := Import('PyWrapperDescr_Type'); + _PyWeakref_RefType := Import('_PyWeakref_RefType'); + _PyWeakref_ProxyType := Import('_PyWeakref_ProxyType'); + _PyWeakref_CallableProxyType:=Import('_PyWeakref_CallableProxyType'); + PyBool_Type := Import('PyBool_Type'); + PyEnum_Type := Import('PyEnum_Type'); + + PyComplex_FromCComplex := Import('PyComplex_FromCComplex'); + PyComplex_FromDoubles := Import('PyComplex_FromDoubles'); + PyComplex_RealAsDouble := Import('PyComplex_RealAsDouble'); + PyComplex_ImagAsDouble := Import('PyComplex_ImagAsDouble'); + PyComplex_AsCComplex := Import('PyComplex_AsCComplex'); + PyCFunction_GetFunction := Import('PyCFunction_GetFunction'); + PyCFunction_GetSelf := Import('PyCFunction_GetSelf'); + PyCallable_Check := Import('PyCallable_Check'); + PyDict_GetItem := Import('PyDict_GetItem'); + PyDict_SetItem := Import('PyDict_SetItem'); + PyDict_DelItem := Import('PyDict_DelItem'); + PyDict_Clear := Import('PyDict_Clear'); + PyDict_Next := Import('PyDict_Next'); + PyDict_Keys := Import('PyDict_Keys'); + PyDict_Values := Import('PyDict_Values'); + PyDict_Items := Import('PyDict_Items'); + PyDict_Size := Import('PyDict_Size'); + PyDict_DelItemString := Import('PyDict_DelItemString'); + PyDict_Copy := Import('PyDict_Copy'); + PyDict_New := Import('PyDict_New'); + PyDict_Update := Import('PyDict_Update'); + PyDict_SetItemString := Import('PyDict_SetItemString'); + PyDictProxy_New := Import('PyDictProxy_New'); + PyModule_Create2 := Import('PyModule_Create2'); + PyErr_Print := Import('PyErr_Print'); + PyErr_SetNone := Import('PyErr_SetNone'); + PyErr_SetObject := Import('PyErr_SetObject'); + PyErr_Restore := Import('PyErr_Restore'); + PyErr_BadArgument := Import('PyErr_BadArgument'); + PyErr_NoMemory := Import('PyErr_NoMemory'); + PyErr_SetFromErrno := Import('PyErr_SetFromErrno'); + PyErr_BadInternalCall := Import('PyErr_BadInternalCall'); + PyErr_CheckSignals := Import('PyErr_CheckSignals'); + PyErr_Occurred := Import('PyErr_Occurred'); + PyErr_Clear := Import('PyErr_Clear'); + PyErr_Fetch := Import('PyErr_Fetch'); + PyErr_SetString := Import('PyErr_SetString'); + PyErr_WarnEx := Import('PyErr_WarnEx'); + PyErr_WarnExplicit := Import('PyErr_WarnExplicit'); + PyEval_GetBuiltins := Import('PyEval_GetBuiltins'); + PyImport_GetModuleDict := Import('PyImport_GetModuleDict'); + PyArg_Parse := Import('PyArg_Parse'); + PyArg_ParseTuple := Import('PyArg_ParseTuple'); + PyArg_ParseTupleAndKeywords := Import('PyArg_ParseTupleAndKeywords'); + Py_BuildValue := Import('Py_BuildValue'); + Py_Initialize := Import('Py_Initialize'); + PyModule_GetDict := Import('PyModule_GetDict'); + PyObject_Str := Import('PyObject_Str'); + PyRun_String := Import('PyRun_String'); + PyRun_SimpleString := Import('PyRun_SimpleString'); + PyDict_GetItemString := Import('PyDict_GetItemString'); + PySys_SetArgv := Import('PySys_SetArgv'); + Py_Exit := Import('Py_Exit'); + + PyCFunction_NewEx := Import('PyCFunction_NewEx'); + + PyEval_CallObjectWithKeywords:= Import('PyEval_CallObjectWithKeywords'); + PyEval_GetFrame := Import('PyEval_GetFrame'); + PyEval_GetGlobals := Import('PyEval_GetGlobals'); + PyEval_GetLocals := Import('PyEval_GetLocals'); + PyEval_InitThreads := Import('PyEval_InitThreads'); + PyEval_RestoreThread := Import('PyEval_RestoreThread'); + PyEval_SaveThread := Import('PyEval_SaveThread'); + PyFile_GetLine := Import('PyFile_GetLine'); + PyFile_WriteObject := Import('PyFile_WriteObject'); + PyFile_WriteString := Import('PyFile_WriteString'); + PyFloat_AsDouble := Import('PyFloat_AsDouble'); + PyFloat_FromDouble := Import('PyFloat_FromDouble'); + PyFloat_FromString := Import('PyFloat_FromString'); + PyFunction_GetCode := Import('PyFunction_GetCode'); + PyFunction_GetGlobals := Import('PyFunction_GetGlobals'); + PyFunction_New := Import('PyFunction_New'); + PyImport_AddModule := Import('PyImport_AddModule'); + PyImport_GetMagicNumber := Import('PyImport_GetMagicNumber'); + PyImport_ImportFrozenModule:= Import('PyImport_ImportFrozenModule'); + PyImport_ImportModule := Import('PyImport_ImportModule'); + PyImport_Import := Import('PyImport_Import'); + PyImport_ReloadModule := Import('PyImport_ReloadModule'); + PyList_Append := Import('PyList_Append'); + PyList_AsTuple := Import('PyList_AsTuple'); + PyList_GetItem := Import('PyList_GetItem'); + PyList_GetSlice := Import('PyList_GetSlice'); + PyList_Insert := Import('PyList_Insert'); + PyList_New := Import('PyList_New'); + PyList_Reverse := Import('PyList_Reverse'); + PyList_SetItem := Import('PyList_SetItem'); + PyList_SetSlice := Import('PyList_SetSlice'); + PyList_Size := Import('PyList_Size'); + PyList_Sort := Import('PyList_Sort'); + PyLong_AsDouble := Import('PyLong_AsDouble'); + PyLong_AsLong := Import('PyLong_AsLong'); + PyLong_FromDouble := Import('PyLong_FromDouble'); + PyLong_FromLong := Import('PyLong_FromLong'); + PyLong_FromString := Import('PyLong_FromString'); + PyLong_FromString := Import('PyLong_FromString'); + PyLong_FromUnsignedLong := Import('PyLong_FromUnsignedLong'); + PyLong_AsUnsignedLong := Import('PyLong_AsUnsignedLong'); + PyLong_FromUnicodeObject := Import('PyLong_FromUnicodeObject'); + PyLong_FromLongLong := Import('PyLong_FromLongLong'); + PyLong_FromUnsignedLongLong := Import('PyLong_FromUnsignedLongLong'); + PyLong_AsLongLong := Import('PyLong_AsLongLong'); + PyLong_FromVoidPtr := Import('PyLong_FromVoidPtr'); + PyMapping_Check := Import('PyMapping_Check'); + PyMapping_GetItemString := Import('PyMapping_GetItemString'); + PyMapping_HasKey := Import('PyMapping_HasKey'); + PyMapping_HasKeyString := Import('PyMapping_HasKeyString'); + PyMapping_Length := Import('PyMapping_Length'); + PyMapping_SetItemString := Import('PyMapping_SetItemString'); + PyMethod_Function := Import('PyMethod_Function'); + PyMethod_New := Import('PyMethod_New'); + PyMethod_Self := Import('PyMethod_Self'); + PyModule_GetName := Import('PyModule_GetName'); + PyModule_New := Import('PyModule_New'); + PyNumber_Absolute := Import('PyNumber_Absolute'); + PyNumber_Add := Import('PyNumber_Add'); + PyNumber_And := Import('PyNumber_And'); + PyNumber_Check := Import('PyNumber_Check'); + PyNumber_FloorDivide := Import('PyNumber_FloorDivide'); + PyNumber_TrueDivide := Import('PyNumber_TrueDivide'); + PyNumber_Divmod := Import('PyNumber_Divmod'); + PyNumber_Float := Import('PyNumber_Float'); + PyNumber_Invert := Import('PyNumber_Invert'); + PyNumber_Long := Import('PyNumber_Long'); + PyNumber_Lshift := Import('PyNumber_Lshift'); + PyNumber_Multiply := Import('PyNumber_Multiply'); + PyNumber_Negative := Import('PyNumber_Negative'); + PyNumber_Or := Import('PyNumber_Or'); + PyNumber_Positive := Import('PyNumber_Positive'); + PyNumber_Power := Import('PyNumber_Power'); + PyNumber_Remainder := Import('PyNumber_Remainder'); + PyNumber_Rshift := Import('PyNumber_Rshift'); + PyNumber_Subtract := Import('PyNumber_Subtract'); + PyNumber_Xor := Import('PyNumber_Xor'); + PyOS_InterruptOccurred := Import('PyOS_InterruptOccurred'); + PyObject_CallObject := Import('PyObject_CallObject'); + PyObject_CallMethod := Import('PyObject_CallMethod'); + PyObject_RichCompare := Import('PyObject_RichCompare'); + PyObject_RichCompareBool := Import('PyObject_RichCompareBool'); + PyObject_GetAttr := Import('PyObject_GetAttr'); + PyObject_GetAttrString := Import('PyObject_GetAttrString'); + PyObject_GetItem := Import('PyObject_GetItem'); + PyObject_DelItem := Import('PyObject_DelItem'); + PyObject_HasAttrString := Import('PyObject_HasAttrString'); + PyObject_Hash := Import('PyObject_Hash'); + PyObject_IsTrue := Import('PyObject_IsTrue'); + PyObject_Length := Import('PyObject_Length'); + PyObject_Repr := Import('PyObject_Repr'); + PyObject_SetAttr := Import('PyObject_SetAttr'); + PyObject_SetAttrString := Import('PyObject_SetAttrString'); + PyObject_SetItem := Import('PyObject_SetItem'); + PyObject_Init := Import('PyObject_Init'); + PyObject_InitVar := Import('PyObject_InitVar'); + PyObject_New := Import('_PyObject_New'); + PyObject_NewVar := Import('_PyObject_NewVar'); + PyObject_Free := Import('PyObject_Free'); + PyObject_GetIter := Import('PyObject_GetIter'); + PyIter_Next := Import('PyIter_Next'); + PyObject_IsInstance := Import('PyObject_IsInstance'); + PyObject_IsSubclass := Import('PyObject_IsSubclass'); + PyObject_Call := Import('PyObject_Call'); + PyObject_GenericGetAttr := Import('PyObject_GenericGetAttr'); + PyObject_GenericSetAttr := Import('PyObject_GenericSetAttr'); + PyObject_GC_Malloc := Import('_PyObject_GC_Malloc'); + PyObject_GC_New := Import('_PyObject_GC_New'); + PyObject_GC_NewVar := Import('_PyObject_GC_NewVar'); + PyObject_GC_Resize := Import('_PyObject_GC_Resize'); + PyObject_GC_Del := Import('PyObject_GC_Del'); + PyObject_GC_Track := Import('PyObject_GC_Track'); + PyObject_GC_UnTrack := Import('PyObject_GC_UnTrack'); + PySequence_Check := Import('PySequence_Check'); + PySequence_Concat := Import('PySequence_Concat'); + PySequence_Count := Import('PySequence_Count'); + PySequence_GetItem := Import('PySequence_GetItem'); + PySequence_GetSlice := Import('PySequence_GetSlice'); + PySequence_In := Import('PySequence_In'); + PySequence_Index := Import('PySequence_Index'); + PySequence_Length := Import('PySequence_Length'); + PySequence_Repeat := Import('PySequence_Repeat'); + PySequence_SetItem := Import('PySequence_SetItem'); + PySequence_SetSlice := Import('PySequence_SetSlice'); + PySequence_DelSlice := Import('PySequence_DelSlice'); + PySequence_Tuple := Import('PySequence_Tuple'); + PySequence_Contains := Import('PySequence_Contains'); + PySequence_List := Import('PySequence_List'); + PySlice_GetIndices := Import('PySlice_GetIndices'); + PySeqIter_New := Import('PySeqIter_New'); + PySlice_GetIndicesEx := Import('PySlice_GetIndicesEx'); + PySlice_New := Import('PySlice_New'); + PyBytes_AsString := Import('PyBytes_AsString'); + PyBytes_AsStringAndSize := Import('PyBytes_AsStringAndSize'); + PyBytes_Concat := Import('PyBytes_Concat'); + PyBytes_ConcatAndDel := Import('PyBytes_ConcatAndDel'); + PyBytes_FromString := Import('PyBytes_FromString'); + PyBytes_FromStringAndSize := Import('PyBytes_FromStringAndSize'); + PyBytes_Size := Import('PyBytes_Size'); + PyBytes_DecodeEscape := Import('PyBytes_DecodeEscape'); + PyBytes_Repr := Import('PyBytes_Repr'); + _PyBytes_Resize := Import('_PyBytes_Resize'); + PySys_GetObject := Import('PySys_GetObject'); + PySys_SetObject := Import('PySys_SetObject'); + PySys_SetPath := Import('PySys_SetPath'); + PyTraceBack_Here := Import('PyTraceBack_Here'); + PyTraceBack_Print := Import('PyTraceBack_Print'); + PyTuple_GetItem := Import('PyTuple_GetItem'); + PyTuple_GetSlice := Import('PyTuple_GetSlice'); + PyTuple_New := Import('PyTuple_New'); + PyTuple_SetItem := Import('PyTuple_SetItem'); + PyTuple_Size := Import('PyTuple_Size'); + PyType_IsSubtype := Import('PyType_IsSubtype'); + PyType_GenericAlloc := Import('PyType_GenericAlloc'); + PyType_GenericNew := Import('PyType_GenericNew'); + PyType_Ready := Import('PyType_Ready'); + PyUnicode_FromWideChar := Import(AnsiString(Format('PyUnicode%s_FromWideChar',[UnicodeSuffix]))); + PyUnicode_FromString := Import(AnsiString(Format('PyUnicode%s_FromString',[UnicodeSuffix]))); + PyUnicode_FromStringAndSize := Import(AnsiString(Format('PyUnicode%s_FromStringAndSize',[UnicodeSuffix]))); + PyUnicode_FromKindAndData := Import(AnsiString(Format('PyUnicode%s_FromKindAndData',[UnicodeSuffix]))); + PyUnicode_AsWideChar := Import(AnsiString(Format('PyUnicode%s_AsWideChar',[UnicodeSuffix]))); + PyUnicode_AsUTF8 := Import(AnsiString(Format('PyUnicode%s_AsUTF8',[UnicodeSuffix]))); + PyUnicode_AsUTF8AndSize := Import(AnsiString(Format('PyUnicode%s_AsUTF8AndSize',[UnicodeSuffix]))); + PyUnicode_Decode := Import(AnsiString(Format('PyUnicode%s_Decode',[UnicodeSuffix]))); + PyUnicode_DecodeUTF16 := Import(AnsiString(Format('PyUnicode%s_DecodeUTF16',[UnicodeSuffix]))); + PyUnicode_AsEncodedString := Import(AnsiString(Format('PyUnicode%s_AsEncodedString',[UnicodeSuffix]))); + PyUnicode_FromOrdinal := Import(AnsiString(Format('PyUnicode%s_FromOrdinal',[UnicodeSuffix]))); + PyUnicode_GetSize := Import(AnsiString(Format('PyUnicode%s_GetSize',[UnicodeSuffix]))); + PyWeakref_GetObject := Import('PyWeakref_GetObject'); + PyWeakref_NewProxy := Import('PyWeakref_NewProxy'); + PyWeakref_NewRef := Import('PyWeakref_NewRef'); + PyWrapper_New := Import('PyWrapper_New'); + PyBool_FromLong := Import('PyBool_FromLong'); + PyThreadState_SetAsyncExc := Import('PyThreadState_SetAsyncExc'); + Py_AtExit := Import('Py_AtExit'); + Py_FatalError := Import('Py_FatalError'); + Py_CompileStringExFlags := Import('Py_CompileStringExFlags'); + _PyObject_New := Import('_PyObject_New'); + Py_Finalize := Import('Py_Finalize'); + PyImport_ExecCodeModule := Import('PyImport_ExecCodeModule'); + PyErr_ExceptionMatches := Import('PyErr_ExceptionMatches'); + PyErr_GivenExceptionMatches := Import('PyErr_GivenExceptionMatches'); + PyEval_EvalCode := Import('PyEval_EvalCode'); + Py_GetVersion := Import('Py_GetVersion'); + Py_GetCopyright := Import('Py_GetCopyright'); + Py_GetExecPrefix := Import('Py_GetExecPrefix'); + Py_GetPath := Import('Py_GetPath'); + Py_SetPythonHome := Import('Py_SetPythonHome'); + Py_GetPythonHome := Import('Py_GetPythonHome'); + Py_GetPrefix := Import('Py_GetPrefix'); + Py_GetProgramName := Import('Py_GetProgramName'); + + if (FMajorVersion = 3) and (MinorVersion < 10) then + begin + PyParser_SimpleParseStringFlags := Import('PyParser_SimpleParseStringFlags'); + PyNode_Free := Import('PyNode_Free'); + end; + + PyErr_NewException := Import('PyErr_NewException'); + try + PyMem_Malloc := Import ('PyMem_Malloc'); + except + end; + Py_SetProgramName := Import('Py_SetProgramName'); + Py_IsInitialized := Import('Py_IsInitialized'); + Py_GetProgramFullPath := Import('Py_GetProgramFullPath'); + Py_GetBuildInfo := Import('Py_GetBuildInfo'); + Py_NewInterpreter := Import('Py_NewInterpreter'); + Py_EndInterpreter := Import('Py_EndInterpreter'); + PyEval_AcquireLock := Import('PyEval_AcquireLock'); + PyEval_ReleaseLock := Import('PyEval_ReleaseLock'); + PyEval_AcquireThread := Import('PyEval_AcquireThread'); + PyEval_ReleaseThread := Import('PyEval_ReleaseThread'); + PyInterpreterState_New := Import('PyInterpreterState_New'); + PyInterpreterState_Clear := Import('PyInterpreterState_Clear'); + PyInterpreterState_Delete:= Import('PyInterpreterState_Delete'); + PyThreadState_New := Import('PyThreadState_New'); + PyThreadState_Clear := Import('PyThreadState_Clear'); + PyThreadState_Delete := Import('PyThreadState_Delete'); + PyThreadState_Get := Import('PyThreadState_Get'); + PyThreadState_Swap := Import('PyThreadState_Swap'); + PyErr_SetInterrupt := Import('PyErr_SetInterrupt'); + PyGILState_Ensure := Import('PyGILState_Ensure'); + PyGILState_Release := Import('PyGILState_Release'); +end; + +function TPythonInterface.Py_CompileString(str,filename:PAnsiChar;start:integer):PPyObject; +begin + Result := Py_CompileStringExFlags(str, filename, start, nil, -1); +end; + +function TPythonInterface.PyParser_SimpleParseString( str : PAnsiChar; start : integer) : PNode; cdecl; +begin + Result := PyParser_SimpleParseStringFlags(str, start, 0); +end; + +class procedure TPythonInterface.Py_INCREF(op: PPyObject); +begin + Inc(op^.ob_refcnt); +end; + +class procedure TPythonInterface.Py_DECREF(op: PPyObject); +begin + with op^ do begin + Dec(ob_refcnt); + if ob_refcnt = 0 then begin + ob_type^.tp_dealloc(op); + end; + end; +end; + +class procedure TPythonInterface.Py_XINCREF(op: PPyObject); +begin + if op <> nil then Py_INCREF(op); +end; + +class procedure TPythonInterface.Py_XDECREF(op: PPyObject); +begin + if op <> nil then Py_DECREF(op); +end; + + +class procedure TPythonInterface.Py_CLEAR(var op: PPyObject); +Var + _py_tmp : PPyObject; +begin + _py_tmp := op; + if _py_tmp <> nil then + begin + op := nil; + Py_DECREF(_py_tmp); + end; +end; + +function TPythonInterface.PyBytes_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyBytes_Type); +end; + +function TPythonInterface.PyBytes_CheckExact(obj: PPyObject): Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyBytes_Type)); +end; + +function TPythonInterface.PyFloat_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyFloat_Type); +end; + +function TPythonInterface.PyFloat_CheckExact(obj: PPyObject): Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyFloat_Type)); +end; + +function TPythonInterface.PyLong_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyLong_Type); +end; + +function TPythonInterface.PyLong_CheckExact(obj: PPyObject): Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyLong_Type)); +end; + +function TPythonInterface.PyTuple_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyTuple_Type); +end; + +function TPythonInterface.PyTuple_CheckExact(obj: PPyObject): Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyTuple_Type)); +end; + +function TPythonInterface.PyClass_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (PyObject_IsInstance(obj, PPyObject(PyType_Type)) = 1); +end; + +function TPythonInterface.PyType_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyType_Type)); +end; + +function TPythonInterface.PyMethod_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyMethod_Type)); +end; + +function TPythonInterface.PyList_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyList_Type); +end; + +function TPythonInterface.PyList_CheckExact(obj: PPyObject): Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyList_Type)); +end; + +function TPythonInterface.PyDict_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyDict_Type); +end; + +function TPythonInterface.PyDict_CheckExact(obj: PPyObject): Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyDict_Type)); +end; + +function TPythonInterface.PyModule_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyModule_Type); +end; + +function TPythonInterface.PyModule_CheckExact(obj: PPyObject): Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyModule_Type)); +end; + +function TPythonInterface.PySlice_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PySlice_Type)); +end; + +function TPythonInterface.PyFunction_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and + ((obj^.ob_type = PPyTypeObject(PyCFunction_Type)) or + (obj^.ob_type = PPyTypeObject(PyFunction_Type))); +end; + +function TPythonInterface.PyIter_Check(obj: PPyObject): Boolean; +begin + Result := Assigned(obj) and Assigned(obj^.ob_type^.tp_iternext); +end; + +function TPythonInterface.PyUnicode_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyUnicode_Type); +end; + +function TPythonInterface.PyUnicode_CheckExact(obj: PPyObject): Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyUnicode_Type)); +end; + +function TPythonInterface.PyType_IS_GC(t : PPyTypeObject ) : Boolean; +begin + Result := PyType_HasFeature(t, Py_TPFLAGS_HAVE_GC); +end; + +function TPythonInterface.PyObject_IS_GC( obj : PPyObject ) : Boolean; +begin + Result := PyType_IS_GC(obj^.ob_type) and + (not Assigned(obj^.ob_type^.tp_is_gc) or (obj^.ob_type^.tp_is_gc(obj) = 1)); +end; + +function TPythonInterface.PyWeakref_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (PyWeakref_CheckRef(obj) or PyWeakref_CheckProxy(obj)); +end; + +function TPythonInterface.PyWeakref_CheckRef( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(_PyWeakref_RefType)); +end; + +function TPythonInterface.PyWeakref_CheckProxy( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and + ( (obj^.ob_type = PPyTypeObject(_PyWeakref_ProxyType)) or + (obj^.ob_type = PPyTypeObject(_PyWeakref_CallableProxyType)) ); +end; + +function TPythonInterface.PyBool_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyBool_Type); +end; + +function TPythonInterface.PyEnum_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyEnum_Type)); +end; + +function TPythonInterface.PyObject_TypeCheck(obj : PPyObject; t : PPyTypeObject) : Boolean; +begin + Result := Assigned(obj) and (obj^.ob_type = t); + if not Result and Assigned(obj) and Assigned(t) then + Result := PyType_IsSubtype(obj^.ob_type, t) = 1; +end; + +function TPythonInterface.Py_InitModule(const md: PyModuleDef): PPyObject; +Var + modules : PPyObject; +begin + CheckPython; + Result:= PyModule_Create2(@md, APIVersion); + if not Assigned(Result) then + GetPythonEngine.CheckError; + // To emulate Py_InitModule4 we need to add the module to sys.modules + modules := PyImport_GetModuleDict; + if PyDict_SetItemString(modules, md.m_name, Result) <> 0 then + GetPythonEngine.CheckError; +end; + + +(*******************************************************) +(** **) +(** class TPythonTraceback **) +(** **) +(*******************************************************) + +function TPythonTraceback.GetItemCount : Integer; +begin + Result := FItems.Count; +end; + +function TPythonTraceback.GetItem( idx : Integer ) : TTracebackItem; +begin + Result := TTracebackItem(FItems.Items[idx]); +end; + +constructor TPythonTraceback.Create; +begin + inherited; + FLimit := 1000; + FItems := TList.Create; +end; + +destructor TPythonTraceback.Destroy; +begin + Clear; + FItems.Free; + inherited; +end; + +procedure TPythonTraceback.AddItem(const Context, FileName: string; + LineNo: Integer); +var + Item: TTracebackItem; +begin + Item := TTracebackItem.Create; + Item.Context := Context; + Item.FileName := FileName; + Item.LineNo := LineNo; + FItems.Add(Item); +end; + +procedure TPythonTraceback.Clear; +var + i : Integer; +begin + for i := 0 to ItemCount - 1 do + Items[i].Free; + FItems.Clear; +end; + +{****** + * Warning ! + * This method must be called after the PyErr_Print function, + * otherwise it can't extract the traceback informations. + * + * This method is automatically called by the Exec/Eval methods of + * TPythonEngine. But if you use the Python core API, then don't + * forget to refresh the traceback yourself. Or much better, + * simply use the method CheckError wich will call PyErr_Print, + * Traceback.Refresh and RaiseError for you. +} +procedure TPythonTraceback.Refresh(pytraceback: PPyObject); +var + tb, tb1 : PPyObject; + obj : PPyObject; + frame : PPyObject; + code : PPyObject; + depth : Integer; + limitv : PPyObject; + aLimit : Integer; + item : TTracebackItem; +begin + Clear; + with GetPythonEngine do + begin + // get the limit of the traceback + alimit := FLimit; + limitv := PySys_GetObject('tracebacklimit'); + if Assigned(limitv) and PyLong_Check(limitv) then + alimit := PyLong_AsLong(limitv); + tb := pytraceback; + if tb = nil then + tb := PySys_GetObject('last_traceback'); + tb1 := tb; + Py_XIncRef(tb1); + depth := 0; + // Evaluate the depth of the traceback + while Assigned(tb1) and (tb1 <> Py_None) do + begin + Inc(depth); + Py_XDecRef(tb1); + tb1 := PyObject_GetAttrString(tb1, 'tb_next'); + CheckError(False); + end; + Py_XDecRef(tb1); + // build the trace back + Py_XIncRef(tb); + while Assigned(tb) and (tb <> Py_None) do + begin + try + if depth <= alimit then + begin + item := TTracebackItem.Create; + try + obj := PyObject_GetAttrString(tb, 'tb_lineno'); + CheckError(False); + try + item.LineNo := PyObjectAsVariant(obj); + finally + Py_XDecRef(obj); + end; + frame := PyObject_GetAttrString(tb, 'tb_frame'); + CheckError(False); + try + if Assigned(frame) and (frame <> Py_None) then + begin + code := PyObject_GetAttrString(frame, 'f_code'); + CheckError(False); + try + obj := PyObject_GetAttrString(code, 'co_filename'); + CheckError(False); + try + item.Filename := PyObjectAsVariant( obj ); + finally + Py_XDecRef(obj); + end; + obj := PyObject_GetAttrString(code, 'co_name'); + CheckError(False); + try + item.Context := PyObjectAsVariant( obj ); + finally + Py_XDecRef(obj); + end; + finally + Py_XDecRef(code); + end; + end; + finally + Py_XDecRef(frame); + end; + except + item.Free; + raise; + end; + FItems.Add( item ); + end; + Dec( depth ); + finally + Py_XDecRef(tb); + end; + tb := PyObject_GetAttrString(tb, 'tb_next'); + CheckError(False); + end; + Py_XDecRef(tb); + end; +end; + + +(*******************************************************) +(** **) +(** class TPythonEngine **) +(** **) +(*******************************************************) + + +constructor TPythonEngine.Create(AOwner: TComponent); +var + i : Integer; +begin + inherited; + FInitScript := TstringList.Create; + FClients := TList.Create; + FRedirectIO := True; + FExecModule := '__main__'; + FAutoFinalize := True; + FInitThreads := False; + FTraceback := TPythonTraceback.Create; + FUseWindowsConsole := False; + FPyFlags := []; + FDatetimeConversionMode := DEFAULT_DATETIME_CONVERSION_MODE; + if csDesigning in ComponentState then + begin + for i := 0 to AOwner.ComponentCount - 1 do + if (AOwner.Components[i] is TPythonEngine) and + (AOwner.Components[i] <> Self) then + raise Exception.Create('You can''t drop more than one TPythonEngine component'); + end; +end; + +destructor TPythonEngine.Destroy; +begin + LocalVars := nil; + GlobalVars := nil; + Destroying; + Finalize; + FClients.Free; + FInitScript.Free; + FTraceback.Free; + inherited; +end; + +procedure TPythonEngine.Finalize; +var + i: integer; + canDetachClients : Boolean; +begin + // switch off redirection when the component is destroying, + // because the form or datamodule is beeing closed, and + // redirecting output may crash the application. + if FIORedirected and not (csDestroying in ComponentState) and Initialized then + begin + RedirectIO := False; + // restore the initial streams also. + ExecString('import sys'+LF+ + 'if hasattr(sys, "old_stdin"): sys.stdin=sys.old_stdin'+LF+ + 'if hasattr(sys, "old_stdout"): sys.stdout=sys.old_stdout'+LF+ + 'if hasattr(sys, "old_stderr"): sys.stderr=sys.old_stderr' ); + end; + // First finalize our clients + if Initialized then + for i := 0 to ClientCount - 1 do + with Clients[i] do + begin + if Initialized then + Finalize; + end; + // Then finalize Python, if we have to + if Initialized and FAutoFinalize then begin + try + try + FFinalizing := True; + Py_Finalize; + finally + FFinalizing := False; + FInitialized := False; + end; + except + end; + end; + // Detach our clients, when engine is being destroyed or one of its clients. + canDetachClients := csDestroying in ComponentState; + if not canDetachClients then + for i := 0 to ClientCount - 1 do + if csDestroying in Clients[i].ComponentState then + begin + canDetachClients := True; + Break; + end; + if canDetachClients then + begin + for i := 0 to ClientCount - 1 do + Clients[i].ClearEngine; + FClients.Clear; + end; + // Free our reference + gPythonEngine := nil; + FTimeStruct := nil; + FPyDateTime_DateType := nil; + FPyDateTime_DateTimeType := nil; + FPyDateTime_DeltaType := nil; + FPyDateTime_TimeType := nil; + FPyDateTime_TZInfoType := nil; + FPyDateTime_TimeTZType := nil; + FPyDateTime_DateTimeTZType := nil; +end; + +procedure TPythonEngine.AfterLoad; +begin + inherited; + Initialize; +end; + +procedure TPythonEngine.BeforeLoad; +begin + if UseWindowsConsole then + InitWinConsole; + inherited; +end; + +procedure TPythonEngine.DoOpenDll(const aDllName : string); +var + i : Integer; +begin + if UseLastKnownVersion then + for i:= Integer(COMPILED_FOR_PYTHON_VERSION_INDEX) downto 1 do + begin + RegVersion := PYTHON_KNOWN_VERSIONS[i].RegVersion; + inherited DoOpenDll(PYTHON_KNOWN_VERSIONS[i].DllName); + if IsHandleValid then + begin + DllName := PYTHON_KNOWN_VERSIONS[i].DllName; + APIVersion := PYTHON_KNOWN_VERSIONS[i].APIVersion; + Exit; + end; + end + else + RegVersion := SysVersionFromDLLName(aDllName); + inherited; +end; + +procedure TPythonEngine.DoOpenDll2(const aDllName : string); +var + i : Integer; +begin + if UseLastKnownVersion then + for i:= Integer(COMPILED_FOR_PYTHON_VERSION_INDEX) downto 1 do + begin + RegVersion := PYTHON_KNOWN_VERSIONS[i].RegVersion; + inherited DoOpenDll(PYTHON_KNOWN_VERSIONS[i].DllName); + if IsHandleValid then + begin + DllName := PYTHON_KNOWN_VERSIONS[i].DllName; + APIVersion := PYTHON_KNOWN_VERSIONS[i].APIVersion; + Exit; + end; + end + else + RegVersion := SysVersionFromDLLName(aDllName); + inherited; +end; + +procedure TPythonEngine.AssignPyFlags; + + procedure SetFlag( AFlag: PInteger; AValue : Boolean ); + begin + if AValue then + AFlag^ := 1 + else + AFlag^ := 0; + end; + +begin + // define each Python flag. See file pyDebug.h + SetFlag(Py_DebugFlag, pfDebug in FPyFlags); + SetFlag(Py_VerboseFlag, pfVerbose in FPyFlags); + SetFlag(Py_InteractiveFlag, pfInteractive in FPyFlags); + SetFlag(Py_OptimizeFlag, pfOptimize in FPyFlags); + SetFlag(Py_NoSiteFlag, pfNoSite in FPyFlags); + SetFlag(Py_FrozenFlag, pfFrozenFlag in FPyFlags); + SetFlag(Py_IgnoreEnvironmentFlag, pfIgnoreEnvironmentFlag in FPyFlags); +end; + +procedure TPythonEngine.Initialize; + + procedure InitSysPath; + var + _path : PPyObject; + const Script = + 'import sys' + sLineBreak + + 'sys.executable = r"%s"' + sLineBreak + + 'path = sys.path' + sLineBreak + + 'for i in range(len(path)-1, -1, -1):' + sLineBreak + + ' if path[i].find("site-packages") > 0:' + sLineBreak + + ' path.pop(i)' + sLineBreak + + 'import site' + sLineBreak + + 'site.main()' + sLineBreak + + 'del sys, path, i, site'; + begin + if VenvPythonExe <> '' then + ExecString(AnsiString(Format(Script, [VenvPythonExe]))); + _path := PySys_GetObject('path'); + if Assigned(FOnSysPathInit) then + FOnSysPathInit(Self, _path); + end; + + function GetVal(AModule : PPyObject; AVarName : AnsiString) : PPyObject; + begin + Result := PyObject_GetAttrString(AModule, PAnsiChar(AVarName)); + if PyErr_Occurred <> nil then + PyErr_Clear + else + Py_XDecRef(Result); // keep a borrowed reference. + end; + + procedure GetTimeStructType; + var + timeModule : PPyObject; + begin + timeModule := PyImport_ImportModule('time'); + try + if Assigned(timeModule) then + FTimeStruct := GetVal(timeModule, 'struct_time') + else + PyErr_Clear; + finally + Py_XDecRef(timeModule); + end; + end; + + procedure GetDateTimeTypes; + var + dateTimeModule : PPyObject; + begin + dateTimeModule := PyImport_ImportModule('datetime'); + try + if Assigned(dateTimeModule) then + begin + FPyDateTime_DateType := GetVal(dateTimeModule, 'date'); + FPyDateTime_DateTimeType := GetVal(dateTimeModule, 'datetime'); + FPyDateTime_DeltaType := GetVal(dateTimeModule, 'timedelta'); + FPyDateTime_TimeType := GetVal(dateTimeModule, 'time'); + FPyDateTime_TZInfoType := GetVal(dateTimeModule, 'tzinfo'); + FPyDateTime_TimeTZType := GetVal(dateTimeModule, 'timetz'); + FPyDateTime_DateTimeTZType := GetVal(dateTimeModule, 'datetimetz'); + end + else + PyErr_Clear; + finally + Py_XDecRef(dateTimeModule); + end; + end; + +var + i : Integer; +begin + if Assigned(gPythonEngine) then + raise Exception.Create('There is already one instance of TPythonEngine running' ); + + gPythonEngine := Self; + CheckRegistry; + if Assigned(Py_SetProgramName) then + begin + if FProgramName = '' then + FProgramName := UnicodeString(ParamStr(0)); + Py_SetProgramName(PWideChar(FProgramName)); + end; + AssignPyFlags; + if FPythonHome <> '' then + Py_SetPythonHome(PWideChar(FPythonHome)); + Py_Initialize; + if Assigned(Py_IsInitialized) then + FInitialized := Py_IsInitialized() <> 0 + else + FInitialized := True; + FIORedirected := False; + InitSysPath; + SetProgramArgs; + GetTimeStructType; + GetDateTimeTypes; + if InitThreads and Assigned(PyEval_InitThreads) then + PyEval_InitThreads; + if RedirectIO and Assigned(FIO) then + DoRedirectIO; + for i := 0 to ClientCount - 1 do + with Clients[i] do + if not Initialized then + Initialize; + if InitScript.Count > 0 then + ExecStrings( InitScript ); + if Assigned(FOnAfterInit) then + FOnAfterInit(Self); +end; + + +procedure TPythonEngine.Initialize2; + + procedure InitSysPath; + var + _path : PPyObject; + const Script = + 'import sys' + sLineBreak + + 'sys.executable = r"%s"' + sLineBreak + + 'path = sys.path' + sLineBreak + + 'for i in range(len(path)-1, -1, -1):' + sLineBreak + + ' if path[i].find("site-packages") > 0:' + sLineBreak + + ' path.pop(i)' + sLineBreak + + 'import site' + sLineBreak + + 'site.main()' + sLineBreak + + 'del sys, path, i, site'; + begin + if VenvPythonExe <> '' then + ExecString(AnsiString(Format(Script, [VenvPythonExe]))); + _path := PySys_GetObject('path'); + if Assigned(FOnSysPathInit) then + FOnSysPathInit(Self, _path); + end; + + function GetVal(AModule : PPyObject; AVarName : AnsiString) : PPyObject; + begin + Result := PyObject_GetAttrString(AModule, PAnsiChar(AVarName)); + if PyErr_Occurred <> nil then + PyErr_Clear + else + Py_XDecRef(Result); // keep a borrowed reference. + end; + + procedure GetTimeStructType; + var + timeModule : PPyObject; + begin + timeModule := PyImport_ImportModule('time'); + try + if Assigned(timeModule) then + FTimeStruct := GetVal(timeModule, 'struct_time') + else + PyErr_Clear; + finally + Py_XDecRef(timeModule); + end; + end; + + procedure GetDateTimeTypes; + var + dateTimeModule : PPyObject; + begin + dateTimeModule := PyImport_ImportModule('datetime'); + try + if Assigned(dateTimeModule) then + begin + FPyDateTime_DateType := GetVal(dateTimeModule, 'date'); + FPyDateTime_DateTimeType := GetVal(dateTimeModule, 'datetime'); + FPyDateTime_DeltaType := GetVal(dateTimeModule, 'timedelta'); + FPyDateTime_TimeType := GetVal(dateTimeModule, 'time'); + FPyDateTime_TZInfoType := GetVal(dateTimeModule, 'tzinfo'); + FPyDateTime_TimeTZType := GetVal(dateTimeModule, 'timetz'); + FPyDateTime_DateTimeTZType := GetVal(dateTimeModule, 'datetimetz'); + end + else + PyErr_Clear; + finally + Py_XDecRef(dateTimeModule); + end; + end; + +var + i : Integer; +begin + if Assigned(gPythonEngine) then + raise Exception.Create('There is already one instance of TPythonEngine running' ); + + gPythonEngine := Self; + CheckRegistry; + if Assigned(Py_SetProgramName) then + begin + if FProgramName = '' then + FProgramName := UnicodeString(ParamStr(0)); + Py_SetProgramName(PWideChar(FProgramName)); + end; + //AssignPyFlags; + if FPythonHome <> '' then + Py_SetPythonHome(PWideChar(FPythonHome)); + Py_Initialize; + if Assigned(Py_IsInitialized) then + FInitialized := Py_IsInitialized() <> 0 + else + FInitialized := True; + FIORedirected := False; + InitSysPath; + SetProgramArgs; + GetTimeStructType; + GetDateTimeTypes; + if InitThreads and Assigned(PyEval_InitThreads) then + PyEval_InitThreads; + if RedirectIO and Assigned(FIO) then + DoRedirectIO; + for i := 0 to ClientCount - 1 do + with Clients[i] do + if not Initialized then + Initialize; + if InitScript.Count > 0 then + ExecStrings( InitScript ); + if Assigned(FOnAfterInit) then + FOnAfterInit(Self); +end; + +procedure TPythonEngine.SetInitScript(Value: TStrings); +begin + FInitScript.Assign(Value); +end; + +function TPythonEngine.GetThreadState: PPyThreadState; +begin + if Assigned(PyThreadState_Get) then + Result := PyThreadState_Get + else + Result := nil; +end; + +procedure TPythonEngine.SetInitThreads(Value: Boolean); +begin + if Value <> FInitThreads then + begin + if Value and Assigned(PyEval_InitThreads) then + PyEval_InitThreads; + FInitThreads := Value; + end; +end; + +procedure TPythonEngine.SetIO(InputOutput: TPythonInputOutput); +begin + if InputOutput <> fIO then + begin + if Assigned(fIO) then + fIO.RemoveFreeNotification(Self); + fIO := InputOutput; + if Assigned(fIO) then + fIO.FreeNotification(Self); + end; +end; + +function TPythonEngine.GetClientCount : Integer; +begin + Result := FClients.Count; +end; + +function TPythonEngine.GetClients( idx : Integer ) : TEngineClient; +begin + Result := TEngineClient( FClients.Items[idx] ); +end; + +procedure TPythonEngine.Notification( AComponent: TComponent; + Operation: TOperation); +var + i : Integer; +begin + inherited; + if Operation = opRemove then + begin + if AComponent = IO then + IO := nil + else + begin + for i := 0 to ClientCount - 1 do + if Clients[i] = AComponent then + begin + RemoveClient( Clients[i] ); + Break; + end; + end; + end; +end; + +procedure TPythonEngine.CheckRegistry; +{$IFDEF MSWINDOWS} +var + key : string; + Path : string; + NewPath : string; +{$IFDEF CPUX86} + MajorVersion : integer; + MinorVersion : integer; +{$ENDIF} + VersionSuffix: string; +{$ENDIF} +begin +{$IFDEF MSWINDOWS} + if Assigned( FOnPathInitialization ) then + try + with TRegistry.Create(KEY_ALL_ACCESS and not KEY_NOTIFY) do + try + VersionSuffix := ''; +{$IFDEF CPUX86} + MajorVersion := StrToInt(RegVersion[1]); + MinorVersion := StrToInt(Copy(RegVersion, 3)); + if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 5)) then + VersionSuffix := '-32'; +{$ENDIF} + key := Format('\Software\Python\PythonCore\%s%s\PythonPath', [RegVersion, VersionSuffix]); + + RootKey := HKEY_LOCAL_MACHINE; + if not KeyExists( key ) then + begin + // try a current user installation + RootKey := HKEY_CURRENT_USER; + if not KeyExists( key ) then Exit; + end; + // Key found + OpenKey( key, True ); + try + Path := ReadString(''); + NewPath := Path; + FOnPathInitialization( Self, NewPath ); + if NewPath <> Path then + begin + WriteString( '', NewPath ); + end; + finally + CloseKey; + end; + finally + Free; + end; + except + // under WinNT, with a user without admin rights, the access to the + // LocalMachine keys would raise an exception. + end; +{$ENDIF} +end; + +procedure TPythonEngine.SetProgramArgs; +var + i, argc : Integer; + wargv : array of PWideChar; + {$IFDEF POSIX} + UCS4L : array of UCS4String; + {$ELSE} + WL : array of UnicodeString; + {$ENDIF} +begin + // we build a string list of the arguments, because ParamStr returns a volatile string + // and we want to build an array of PAnsiChar, pointing to valid strings. + argc := ParamCount; + SetLength(wargv, argc + 1); + // build the PWideChar array + {$IFDEF POSIX} + // Note that Linux uses UCS4 strings, whereas it declares using UCS2 strings!!! + SetLength(UCS4L, argc+1); + for i := 0 to argc do begin + UCS4L[i] := WideStringToUCS4String(ParamStr(i)); + wargv[i] := @UCS4L[i][0]; + end; + {$ELSE} + SetLength(WL, argc+1); + for i := 0 to argc do begin + WL[i] := UnicodeString(ParamStr(i)); + wargv[i] := PWideChar(WL[i]); + end; + {$ENDIF} + // set the argv list of the sys module with the application arguments + PySys_SetArgv( argc + 1, PPWideChar(wargv) ); +end; + +procedure TPythonEngine.SetProgramArgs2; +var + i, argc : Integer; + wargv : array of PWideChar; + {$IFDEF POSIX} + UCS4L : array of UCS4String; + {$ELSE} + WL : array of UnicodeString; + {$ENDIF} +begin + // we build a string list of the arguments, because ParamStr returns a volatile string + // and we want to build an array of PAnsiChar, pointing to valid strings. + argc := ParamCount; + SetLength(wargv, argc + 1); + // build the PWideChar array + {$IFDEF POSIX} + // Note that Linux uses UCS4 strings, whereas it declares using UCS2 strings!!! + SetLength(UCS4L, argc+1); + for i := 0 to argc do begin + UCS4L[i] := WideStringToUCS4String(ParamStr(i)); + wargv[i] := @UCS4L[i][0]; + end; + {$ELSE} + SetLength(WL, argc+1); + for i := 0 to argc do begin + WL[i] := UnicodeString(ParamStr(i)); + wargv[i] := PWideChar(WL[i]); + end; + {$ENDIF} + // set the argv list of the sys module with the application arguments + PySys_SetArgv( argc + 1, PPWideChar(wargv) ); +end; + +procedure TPythonEngine.InitWinConsole; +begin +{$IFDEF MSWINDOWS} + FreeConsole; + AllocConsole; + SetConsoleTitle( 'Python console' ); +{$ENDIF} +end; + +procedure TPythonEngine.SetUseWindowsConsole( const Value : Boolean ); +begin + FUseWindowsConsole := Value; + if (csDesigning in ComponentState) then + RedirectIO := False; +end; + +// GlobalVars contains a dictionary object used by the Run_CommandAsObject method, if not nil. +// Warning ! SetGlobalVars increments the reference count of the dictionary object ! +procedure TPythonEngine.SetGlobalVars(const Value: PPyObject); +begin + Py_XDecRef(FGlobalVars); + if Assigned(Value) then + if PyDict_Check(Value) then + FGlobalVars := Value + else + begin + FGlobalVars := nil; + raise Exception.Create('You must set a Python dictionary in the GlobalVars property'); + end + else + FGlobalVars := nil; + Py_XIncRef(FGlobalVars); +end; + +// LocalVars contains a dictionary object used by the Run_CommandAsObject method, if not nil. +// Warning ! SetLocalVars increments the reference count of the dictionary object ! +procedure TPythonEngine.SetLocalVars(const Value: PPyObject); +begin + Py_XDecRef(FLocalVars); + if Assigned(Value) then + if PyDict_Check(Value) then + FLocalVars := Value + else + begin + FLocalVars := nil; + raise Exception.Create('You must set a Python dictionary in the LocalVars property'); + end + else + FLocalVars := nil; + Py_XIncRef(FLocalVars); +end; + +procedure TPythonEngine.SetPyFlags(const Value: TPythonFlags); +begin + if FPyFlags <> Value then + begin + if Initialized then + raise Exception.Create('You can''t modify Python flags after it has been initialized'); + FPyFlags := Value; + end; // of if +end; + +procedure TPythonEngine.SetPythonHome(const PythonHome: UnicodeString); +begin + FPythonHome := PythonHome; +end; + +procedure TPythonEngine.SetProgramName(const ProgramName: UnicodeString); +begin + FProgramName := ProgramName; +end; + +function TPythonEngine.IsType(ob: PPyObject; obt: PPyTypeObject): Boolean; +begin + result := ob^.ob_type = obt; +end; + +function TPythonEngine.EvalPyFunction(pyfunc, pyargs:PPyObject): Variant; +var presult :PPyObject; +begin + CheckPython; + Result := -1; + if pyfunc = nil then exit; + try + presult := PyEval_CallObjectWithKeywords(pyfunc,pyargs, nil); + CheckError(False); + if presult = nil then + // should not happen since an exception would have been raised + // in that case by CheckError + Result := Null + else + begin + try + if presult = Py_None then + Result := 0 + else + Result := PyObjectAsVariant( presult ); + finally + Py_DECREF(presult); + end; + end; + except + if PyErr_Occurred <> nil then + CheckError(False) + else + raise; + end; +end; + +function TPythonEngine.EvalFunction(pyfunc:PPyObject; const args: array of const): Variant; +var pargs: PPyObject; +begin + CheckPython; + pargs := ArrayToPyTuple(args); + try + Result := EvalPyFunction(pyfunc,pargs); + finally + Py_DECREF(pargs); + end; +end; + +function TPythonEngine.EvalFunctionNoArgs(pyfunc:PPyObject): Variant; +var pargs: PPyObject; +begin + CheckPython; + pargs := PyTuple_New(0); + try + Result := EvalPyFunction(pyfunc, pargs); + finally + Py_DECREF(pargs); + end; +end; + +function TPythonEngine.EvalStringAsStr(const command : AnsiString) : string; +begin + Result := Run_CommandAsString( command, eval_input ); +end; + +function TPythonEngine.EvalString(const command : AnsiString) : PPyObject; +begin + Result := Run_CommandAsObject( command, eval_input ); +end; + +procedure TPythonEngine.ExecString(const command : AnsiString); +begin + Py_XDecRef( Run_CommandAsObject( command, file_input ) ); +end; + +function TPythonEngine.Run_CommandAsString(const command : AnsiString; mode : Integer) : string; +var + v : PPyObject; +begin + Result := ''; + v := Run_CommandAsObject( command, mode ); + Result := PyObjectAsString( v ); + Py_XDECREF(v); +end; + +function TPythonEngine.Run_CommandAsObject(const command : AnsiString; mode : Integer) : PPyObject; +begin + Result := Run_CommandAsObjectWithDict(command, mode, nil, nil); +end; + +function TPythonEngine.Run_CommandAsObjectWithDict(const command : AnsiString; mode : Integer; locals, globals : PPyObject) : PPyObject; +var + m : PPyObject; + _locals, _globals : PPyObject; +begin + CheckPython; + Result := nil; + Traceback.Clear; + CheckError(False); + + m := GetMainModule; + if m = nil then + raise EPythonError.Create('Run_CommandAsObject: can''t create __main__'); + + if Assigned(locals) then + _locals := locals + else if Assigned(FLocalVars) then + _locals := LocalVars + else + _locals := PyModule_GetDict(m); + + if Assigned(globals) then + _globals := globals + else if Assigned(FGlobalVars) then + _globals := GlobalVars + else + _globals := _locals; + + try + Result := PyRun_String(PAnsiChar(CleanString(command)), mode, _globals, _locals); + //Result := PyRun_String(PAnsiChar((command)), mode, _globals, _locals); + if Result = nil then + CheckError(False); + except + if PyErr_Occurred <> nil then + CheckError(False) + else + raise; + end; +end; + +procedure TPythonEngine.ExecStrings( strings : TStrings ); +begin + Py_XDecRef( Run_CommandAsObject( EncodeString(strings.Text) , file_input ) ); +end; + +function TPythonEngine.EvalStrings( strings : TStrings ) : PPyObject; +begin + Result := Run_CommandAsObject( EncodeString(strings.Text) , eval_input ); +end; + +procedure TPythonEngine.ExecString(const command : AnsiString; locals, globals : PPyObject ); +begin + Py_XDecRef( Run_CommandAsObjectWithDict( command, file_input, locals, globals ) ); +end; + +procedure TPythonEngine.ExecStrings( strings : TStrings; locals, globals : PPyObject ); +begin + Py_XDecRef( Run_CommandAsObjectWithDict( EncodeString(strings.Text), file_input, locals, globals ) ); +end; + +function TPythonEngine.EvalString( const command : AnsiString; locals, globals : PPyObject ) : PPyObject; +begin + Result := Run_CommandAsObjectWithDict( command, eval_input, locals, globals ); +end; + +function TPythonEngine.EvalStrings( strings : TStrings; locals, globals : PPyObject ) : PPyObject; +begin + Result := Run_CommandAsObjectWithDict( EncodeString(strings.Text), eval_input, locals, globals ); +end; + +function TPythonEngine.EvalStringsAsStr( strings : TStrings ) : string; +begin + Result := Run_CommandAsString( EncodeString(strings.Text), eval_input ); + //Result := Run_CommandAsString( (strings.Text), eval_input ); +end; + +function TPythonEngine.CheckEvalSyntax( const str : AnsiString ) : Boolean; +begin + result := CheckSyntax( str, eval_input ); +end; + +function TPythonEngine.CheckExecSyntax( const str : AnsiString ) : Boolean; +begin + result := CheckSyntax( str, file_input ); +end; + +function TPythonEngine.CheckSyntax( const str : AnsiString; mode : Integer ) : Boolean; +var + n : PNode; + PyCode: PPyObject; +begin + if (FMajorVersion = 3) and (MinorVersion < 10) then + begin + n := PyParser_SimpleParseString( PAnsiChar(str), mode ); + result := Assigned(n); + if Assigned( n ) then + PyNode_Free(n); + end + else + begin + PyCode := Py_CompileString(PAnsiChar(str), '', mode); + Result := Assigned(PyCode); + Py_XDECREF(PyCode); + end; +end; + +procedure TPythonEngine.RaiseError; + + function Define( E : EPythonError; const sType, sValue : string ) : EPythonError; + begin + E.EName := sType; + E.EValue := sValue; + if sValue <> '' then + E.Message := Format('%s: %s',[sType,sValue]) + else + E.Message := sType; + Result := E; + end; + + function DefineSyntaxError( E : EPySyntaxError; const sType, sValue : UnicodeString; err_type, err_value : PPyObject ) : EPySyntaxError; + var + s_value : UnicodeString; + s_line : UnicodeString; + s_filename : UnicodeString; + i_line_number : Integer; + i_offset : Integer; + tmp : PPyObject; + begin + Result := E; + Result.EName := sType; + Result.EValue := sValue; + s_value := ''; + s_line := ''; + s_filename := ''; + i_line_number := 0; + i_offset := 0; + // Sometimes there's a tuple instead of instance... + if PyTuple_Check( err_value ) and (PyTuple_Size( err_value) >= 2) then + begin + s_value := PyObjectAsString(PyTuple_GetItem( err_value, 0)); + err_value := PyTuple_GetItem( err_value, 1); + if PyTuple_Check( err_value ) and (PyTuple_Size( err_value) >= 4) then + begin + i_line_number := PyLong_AsLong(PyTuple_GetItem( err_value, 1)); + i_offset := PyLong_AsLong(PyTuple_GetItem( err_value, 2)); + s_line := Trim(PyObjectAsString(PyTuple_GetItem( err_value, 3))); + end; + end else + // Is it an instance of the SyntaxError class ? + if (PyType_IsSubtype(PPyTypeObject(err_type), PPyTypeObject(PyExc_SyntaxError^)) = 1) + and IsType(err_value, PPyTypeObject(err_type)) + then + begin + // Get the filename + tmp := PyObject_GetAttrString(err_value, 'filename'); + if tmp <> nil then begin + if PyUnicode_Check(tmp) then + s_filename := PyUnicodeAsString(tmp) + else if tmp = Py_None then + s_filename := '???'; + Py_XDECREF(tmp); + end; + // Get the text containing the error, cut of carriage return + tmp := PyObject_GetAttrString(err_value, 'text'); + if Assigned(tmp) and PyUnicode_Check(tmp) then + s_line := Trim(PyUnicodeAsString(tmp)); + Py_XDECREF(tmp); + // Get the offset where the error should appear + tmp := PyObject_GetAttrString(err_value, 'offset' ); + if Assigned(tmp) and PyLong_Check(tmp) then + i_offset := PyLong_AsLong(tmp); + Py_XDECREF(tmp); + // Get the line number of the error + tmp := PyObject_GetAttrString(err_value, 'lineno' ); + if Assigned(tmp) and PyLong_Check(tmp) then + i_line_number := PyLong_AsLong(tmp); + Py_XDECREF(tmp); + // Get the message of the error + tmp := PyObject_GetAttrString(err_value, 'msg' ); + if Assigned(tmp) and PyUnicode_Check(tmp) then + s_value := PyUnicodeAsString(tmp); + Py_XDECREF(tmp); + end; + // If all is ok + if s_value <> '' then + begin + with Result do + begin + Message := Format('%s: %s (line %d, offset %d): ''%s''', [sType,s_value,i_line_number, i_offset,s_line]); + EName := sType; + EValue := s_value; + EFileName := s_filename; + ELineNumber := i_line_number; + EOffset := i_offset; + ELineStr := s_line; + end; + end + else + Result.Message := sType; + end; + + function GetTypeAsString( obj : PPyObject ) : string; + begin + if PyType_CheckExact( obj ) then + Result := string(PPyTypeObject(obj).tp_name) + else + Result := PyObjectAsString(obj); + end; + +var + err_type, err_value : PPyObject; + s_type : string; + s_value : string; +begin + s_value := ''; + + if PyErr_Occurred <> nil then + PyErr_Print; + err_type := PySys_GetObject('last_type'); + err_value := PySys_GetObject('last_value'); + if Assigned(err_type) then + begin + s_type := GetTypeAsString(err_type); + s_value := PyObjectAsString(err_value); + + if (PyErr_GivenExceptionMatches(err_type, PyExc_SystemExit^) <> 0) then + raise Define( EPySystemExit.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_StopIteration^) <> 0) then + raise Define( EPyStopIteration.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_KeyboardInterrupt^) <> 0) then + raise Define( EPyKeyboardInterrupt.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_ImportError^) <> 0) then + raise Define( EPyImportError.Create(''), s_type, s_value ) + {$IFDEF MSWINDOWS} + else if (PyErr_GivenExceptionMatches(err_type, PyExc_WindowsError^) <> 0) then + raise Define( EPyWindowsError.Create(''), s_type, s_value ) + {$ENDIF} + else if (PyErr_GivenExceptionMatches(err_type, PyExc_IOError^) <> 0) then + raise Define( EPyIOError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_OSError^) <> 0) then + raise Define( EPyOSError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_EnvironmentError^) <> 0) then + raise Define( EPyEnvironmentError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_EOFError^) <> 0) then + raise Define( EPyEOFError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_NotImplementedError^) <> 0) then + raise Define( EPyNotImplementedError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_RuntimeError^) <> 0) then + raise Define( EPyRuntimeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UnboundLocalError^) <> 0) then + raise Define( EPyUnboundLocalError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_NameError^) <> 0) then + raise Define( EPyNameError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_AttributeError^) <> 0) then + raise Define( EPyAttributeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_TabError^) <> 0) then + raise DefineSyntaxError( EPyTabError.Create(''), s_type, s_value, err_type, err_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_IndentationError^) <> 0) then + raise DefineSyntaxError( EPyIndentationError.Create(''), s_type, s_value, err_type, err_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_SyntaxError^) <> 0) then + raise DefineSyntaxError( EPySyntaxError.Create(''), s_type, s_value, err_type, err_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_TypeError^) <> 0) then + raise Define( EPyTypeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_AssertionError^) <> 0) then + raise Define( EPyAssertionError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_IndexError^) <> 0) then + raise Define( EPyIndexError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_KeyError^) <> 0) then + raise Define( EPyKeyError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_LookupError^) <> 0) then + raise Define( EPyLookupError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_OverflowError^) <> 0) then + raise Define( EPyOverflowError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_ZeroDivisionError^) <> 0) then + raise Define( EPyZeroDivisionError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_FloatingPointError^) <> 0) then + raise Define( EPyFloatingPointError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_ArithmeticError^) <> 0) then + raise Define( EPyArithmeticError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UnicodeEncodeError^) <> 0) then + raise Define( UnicodeEncodeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UnicodeDecodeError^) <> 0) then + raise Define( UnicodeDecodeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UnicodeTranslateError^) <> 0) then + raise Define( UnicodeTranslateError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UnicodeError^) <> 0) then + raise Define( EPyUnicodeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_ValueError^) <> 0) then + raise Define( EPyValueError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_ReferenceError^) <> 0) then + raise Define( EPyReferenceError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_SystemError^) <> 0) then + raise Define( EPySystemError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_MemoryError^) <> 0) then + raise Define( EPyMemoryError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UserWarning^) <> 0) then + raise Define( EPyUserWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_DeprecationWarning^) <> 0) then + raise Define( EPyDeprecationWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_SyntaxWarning^) <> 0) then + raise Define( EPySyntaxWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_RuntimeWarning^) <> 0) then + raise Define( EPyRuntimeWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_FutureWarning^) <> 0) then + raise Define( FutureWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_PendingDeprecationWarning^) <> 0) then + raise Define( PendingDeprecationWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_Warning^) <> 0) then + raise Define( EPyWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_Exception^) <> 0) then + raise Define( EPyException.Create(''), s_type, s_value ) + else // Else if no known exception was detected, + // then build an ExecError exception + raise Define( EPyExecError.Create(''), s_type, s_value ); + end + else + raise EPythonError.Create('RaiseError: couldn''t fetch last exception'); +end; + +function TPythonEngine.PyObjectAsString( obj : PPyObject ) : string; +var + S : PPyObject; + W : UnicodeString; +begin + Result := ''; + if not Assigned( obj ) then + Exit; + +{ if PyUnicode_Check(obj) then + begin + W := PyUnicodeAsString(obj); + Result := string(W); + Exit; + end; } + S := PyObject_Str( obj ); + //if Assigned(S) and PyUnicode_Check(S) then + if Assigned(S) then + begin + //W := PyUnicodeAsString(S); + //W:= PyUnicodeAsUTF8String(S) ; + //W:= PyBytes_AsString(S); + W:= PyUnicodeAsUTF8String(S); + result:= string(W); + //Result := string(W); + end; //} + //result:= S; + //result:= PyObjectAsString(S) + Py_XDECREF(S); +end; + +procedure TPythonEngine.DoRedirectIO; +const + code = 'import sys'+LF+ + 'class DebugOutput:'+LF+ + ' pyio = __import__("pyio")'+LF+ + ' softspace=0'+LF+ + ' encoding=None'+LF+ + ' def write(self,message):'+LF+ + ' self.pyio.write(message)'+LF+ + ' def readline(self, size=None):'+LF+ + ' return self.pyio.read(size)'+LF+ + ' def flush(self):' + LF + + ' pass' + LF + + ' def isatty(self):' + LF + + ' return True' + LF + + 'sys.old_stdin=sys.stdin'+LF+ + 'sys.old_stdout=sys.stdout'+LF+ + 'sys.old_stderr=sys.stderr'+LF+ + 'sys.stdin=sys.stderr=sys.stdout=DebugOutput()'+LF+#0; +begin + if csDesigning in ComponentState then + Exit; + CheckPython; + if not Assigned(FIOPythonModule) then + begin + // create a new module called pyio + FIOPythonModule := TPythonModule.Create( Self ); + with FIOPythonModule as TPythonModule do + begin + Engine := Self; + ModuleName := 'pyio'; + AddMethod( 'write', pyio_write, 'write(string) -> None' ); + AddMethod( 'read', pyio_read, 'read() -> string' ); + AddMethod( 'SetDelayWrites', pyio_SetDelayWrites, 'SetDelayWrites(Boolean) -> None' ); + AddMethod( 'SetMaxLines', pyio_SetMaxLines, 'SetMaxLines(Integer) -> None' ); + AddMethod( 'GetTypesStats', pyio_GetTypesStats, 'GetTypesStats( [type name] ) -> a list of tuple (TypeName, InstanceCount, CreateHits, DeleteHits)' ); + end; + end; + with FIOPythonModule as TPythonModule do + if not Initialized then + Initialize; + // execute the code + ExecString(code); + FIORedirected := True; +end; + +procedure TPythonEngine.AddClient( client : TEngineClient ); +begin + FClients.Add( client ); +end; + +procedure TPythonEngine.RemoveClient( client : TEngineClient ); +begin + // We finalize the PythonEngine, as soon as a client should + // be freed, because the destroy order of the components + // is not predictable and may cause some memory crashes ! + if (csDesigning in ComponentState) then + FClients.Remove( client ) + else if (Initialized) then begin + FClients.Remove( client ); + if (ClientCount = 0) then + Finalize; + end; +end; + +function TPythonEngine.FindClient( const aName : string ) : TEngineClient; +var + i : Integer; +begin + Result := nil; + for i := 0 to ClientCount - 1 do + with TPythonType( Clients[i] ) do + if Name = aName then + begin + Result := Clients[i]; + Break; + end; +end; + +function TPythonEngine.EncodeString(const str: UnicodeString): AnsiString; {$IFDEF FPC}overload;{$ENDIF} +begin + Result := UTF8Encode(str) +end; + +{$IFDEF FPC} +function TPythonEngine.EncodeString (const str: AnsiString): AnsiString; overload; +begin + Result := str; +end; +{$ENDIF} + +function TPythonEngine.EncodeWindowsFilePath(const str: string): AnsiString; +{PEP 529} +begin + if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >=6) )then + Result := UTF8Encode(str) + else + Result := AnsiString(str); +end; + +function TPythonEngine.TypeByName( const aTypeName : AnsiString ) : PPyTypeObject; +var + i : Integer; +begin + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonType then + with TPythonType( Clients[i] ) do + if TypeName = aTypeName then + begin + Result := TheTypePtr; + Exit; + end; + raise Exception.CreateFmt('Could not find type: %s', [aTypeName]); +end; + +function TPythonEngine.ModuleByName( const aModuleName : AnsiString ) : PPyObject; +var + i : Integer; +begin + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonModule then + with TPythonModule( Clients[i] ) do + if ModuleName = aModuleName then + begin + Result := Module; + Exit; + end; + raise Exception.CreateFmt('Could not find module: %s', [aModuleName]); +end; + +function TPythonEngine.MethodsByName( const aMethodsContainer: string ) : PPyMethodDef; +var + i : Integer; +begin + for i := 0 to ClientCount - 1 do + if Clients[i] is TMethodsContainer then + with TMethodsContainer( Clients[i] ) do + if Name = aMethodsContainer then + begin + Result := MethodsData; + Exit; + end; + raise Exception.CreateFmt('Could not find component: %s', [aMethodsContainer]); +end; + +function TPythonEngine.VariantAsPyObject( const V : Variant ) : PPyObject; +Var + DeRefV : Variant; + + function ArrayVarDim1 : PPyObject; + var + i, cpt : Integer; + begin + Result := PyList_New( VarArrayHighBound( DeRefV, 1 ) - VarArrayLowBound( DeRefV, 1 ) + 1 ); + cpt := 0; + for i := VarArrayLowBound( DeRefV, 1 ) to VarArrayHighBound( DeRefV, 1 ) do + begin + PyList_SetItem( Result, cpt, VariantAsPyObject(DeRefV[i]) ); + Inc(cpt); + end; + end; + + function ArrayVarDim2 : PPyObject; + var + i, j, cpt, cpt2 : Integer; + L : PPyObject; + begin + Result := PyList_New( VarArrayHighBound( DeRefV, 1 ) - VarArrayLowBound( DeRefV, 1 ) + 1 ); + cpt := 0; + for i := VarArrayLowBound( DeRefV, 1 ) to VarArrayHighBound( DeRefV, 1 ) do + begin + L := PyList_New( VarArrayHighBound( DeRefV, 2 ) - VarArrayLowBound( DeRefV, 2 ) + 1 ); + PyList_SetItem( Result, cpt, L ); + cpt2 := 0; + for j := VarArrayLowBound( DeRefV, 2 ) to VarArrayHighBound( DeRefV, 2 ) do + begin + PyList_SetItem( L, cpt2, VariantAsPyObject(DeRefV[i, j]) ); + Inc(cpt2); + end; + Inc(cpt); + end; + end; + + function ArrayVarDim3 : PPyObject; + var + i, j, k, cpt, cpt2, cpt3 : Integer; + L, L2 : PPyObject; + begin + Result := PyList_New( VarArrayHighBound( DeRefV, 1 ) - VarArrayLowBound( DeRefV, 1 ) + 1 ); + cpt := 0; + for i := VarArrayLowBound( DeRefV, 1 ) to VarArrayHighBound( DeRefV, 1 ) do + begin + L := PyList_New( VarArrayHighBound( DeRefV, 2 ) - VarArrayLowBound( DeRefV, 2 ) + 1 ); + PyList_SetItem( Result, cpt, L ); + cpt2 := 0; + for j := VarArrayLowBound( DeRefV, 2 ) to VarArrayHighBound( DeRefV, 2 ) do + begin + L2 := PyList_New( VarArrayHighBound( DeRefV, 3 ) - VarArrayLowBound( DeRefV, 3 ) + 1 ); + PyList_SetItem( L, cpt2, L2 ); + cpt3 := 0; + for k := VarArrayLowBound( DeRefV, 3 ) to VarArrayHighBound( DeRefV, 3 ) do + begin + PyList_SetItem( L2, cpt3, VariantAsPyObject(DeRefV[i, j, k]) ); + Inc(cpt3); + end; + Inc(cpt2); + end; + Inc(cpt); + end; + end; + +var + s : AnsiString; + y, m, d, h, mi, sec, ms, jd, wd : WORD; + dt : TDateTime; + dl : Integer; + wStr : UnicodeString; + args : PPyObject; +begin + //Dereference Variant + DerefV := V; + while VarType(DeRefV) = varByRef or varVariant do + DeRefV := Variant(PVarData(TVarData(DeRefV).VPointer)^); + + case VarType(DeRefV) and (VarTypeMask or VarArray) of + varBoolean: begin + if DeRefV = true then + Result := PPyObject(Py_True) + else + Result := PPyObject(Py_False); + Py_XIncRef(Result); + end; + varSmallint, + varByte, + varShortInt, + varWord, + varLongWord, + varInteger: Result := PyLong_FromLong( DeRefV ); + varInt64: Result := PyLong_FromLongLong( DeRefV ); + varSingle, + varDouble, + varCurrency: Result := PyFloat_FromDouble( DeRefV ); + varDate: + begin + dt := DeRefV; + DecodeDate( dt, y, m, d ); + DecodeTime( dt, h, mi, sec, ms ); + if (DatetimeConversionMode = dcmToTuple) then + begin + wd := (DayOfWeek( dt ) + 7 - 2) mod 7; // In Python, Monday is the first day (=0) + jd := Round(EncodeDate(y,m,d)-EncodeDate(y,1,1))+1; // This shoud be the Julian day, the day in a year (0-366) + dl := -1; // This is daylight save... ?Ώ?Ώ? I don't know what it is... + Result := ArrayToPyTuple( [y, m, d, h, mi, sec, wd, jd, dl] ); + end + else if (DatetimeConversionMode = dcmToDatetime) then + begin + if not Assigned(FPyDateTime_DateTimeType) then + raise EPythonError.Create('dcmToDatetime DatetimeConversionMode cannot be used with this version of python. Missing module datetime'); + args := ArrayToPyTuple([y, m, d, h, mi, sec, ms*1000]); + try + Result := PyEval_CallObjectWithKeywords(FPyDateTime_DateTimeType, args, nil); + CheckError(False); + finally + Py_DecRef(args); + end; + end + else + raise EPythonError.Create('Invalid DatetimeConversionMode'); + end; + varOleStr: + begin + if (TVarData(DeRefV).VOleStr = nil) or (TVarData(DeRefV).VOleStr^ = #0) then + wStr := '' + else + wStr := DeRefV; + Result := PyUnicodeFromString(wStr); + end; + varString: + begin + s := AnsiString(DeRefV); + Result := PyBytes_FromStringAndSize(PAnsiChar(s), Length(s)); + end; + {varUString: + begin + wStr := DeRefV; + Result := PyUnicodeFromString(wStr); + end; } + else + if VarType(DeRefV) and varArray <> 0 then + begin + case VarArrayDimCount(DeRefV) of + 1: Result := ArrayVarDim1; + 2: Result := ArrayVarDim2; + 3: Result := ArrayVarDim3; + else + raise Exception.Create('Can''t convert a variant array of more than 3 dimensions to a Python sequence'); + end; + end + else if VarIsNull(DeRefV) or VarIsEmpty(DeRefV) then + begin + Result := ReturnNone; + end + else + // if we cannot get something useful then + Result := ReturnNone; + end; // of case +end; + +function TPythonEngine.PyObjectAsVariant( obj : PPyObject ) : Variant; + + function ExtractDate( var date : Variant ) : Boolean; + + function GetStructMember( obj : PPyObject; const AMember : AnsiString ) : Integer; + var + member : PPyObject; + begin + member := PyObject_GetAttrString( obj, PAnsiChar(AMember) ); + CheckError(False); + if PyLong_Check(member) then + Result := PyLong_AsLong(member) + else + raise EPythonError.CreateFmt('Unexpected type found in member %s of a time_struct object', [AMember]); + Py_XDecRef(member); + end; + + var + i, wd, jd, dl : Integer; + dt : TDateTime; + y, m, d, h, mi, sec, msec : WORD; + delta : PPyDateTime_Delta; + begin + Result := False; + if PyTimeStruct_Check( obj ) then + begin + y := GetStructMember( obj, 'tm_year' ); + m := GetStructMember( obj, 'tm_mon' ); + d := GetStructMember( obj, 'tm_mday' ); + h := GetStructMember( obj, 'tm_hour' ); + mi := GetStructMember( obj, 'tm_min' ); + sec := GetStructMember( obj, 'tm_sec' ); + //wd := GetStructMember( obj, 'tm_wday' ); + //jd := GetStructMember( obj, 'tm_yday' ); + //dl := GetStructMember( obj, 'tm_isdst' ); + dt := EncodeDate( y, m, d ) + EncodeTime( h, mi, sec, 0 ); + Date := dt; + Result := True; + end + else if PyDateTime_Check( obj ) then + begin + y := GetStructMember(obj, 'year'); + m := GetStructMember(obj, 'month'); + d := GetStructMember(obj, 'day'); + h := GetStructMember(obj, 'hour'); + mi := GetStructMember(obj, 'minute'); + sec := GetStructMember(obj, 'second'); + msec := GetStructMember(obj, 'microsecond') div 1000; + dt := EncodeDate( y, m, d ) + EncodeTime( h, mi, sec, msec ); + Date := dt; + Result := True; + end + else if PyDate_Check( obj ) then + begin + y := GetStructMember(obj, 'year'); + m := GetStructMember(obj, 'month'); + d := GetStructMember(obj, 'day'); + dt := EncodeDate( y, m, d ); + Date := dt; + Result := True; + end + else if PyTime_Check( obj ) then + begin + h := GetStructMember(obj, 'hour'); + mi := GetStructMember(obj, 'minute'); + sec := GetStructMember(obj, 'second'); + msec := GetStructMember(obj, 'microsecond') div 1000; + dt := EncodeTime( h, mi, sec, msec ); + Date := dt; + Result := True; + end + else if PyDelta_Check( obj ) then + begin + delta := PPyDateTime_Delta(obj); + dt := delta^.days + (delta^.seconds / (24*60*60)) + ((delta^.microseconds div 1000) / (24*60*60*1000)); + Date := dt; + Result := True; + end + else if PyTuple_Check( obj ) and (PyTuple_Size(obj) = 9) then + begin + for i := 0 to 8 do + if not PyLong_Check(PyTuple_GetItem(obj, i)) then + Exit; + y := PyLong_AsLong( PyTuple_GetItem(obj, 0) ); + m := PyLong_AsLong( PyTuple_GetItem(obj, 1) ); + d := PyLong_AsLong( PyTuple_GetItem(obj, 2) ); + h := PyLong_AsLong( PyTuple_GetItem(obj, 3) ); + mi := PyLong_AsLong( PyTuple_GetItem(obj, 4) ); + sec := PyLong_AsLong( PyTuple_GetItem(obj, 5) ); + wd := PyLong_AsLong( PyTuple_GetItem(obj, 6) ); + jd := PyLong_AsLong( PyTuple_GetItem(obj, 7) ); + dl := PyLong_AsLong( PyTuple_GetItem(obj, 8) ); + if not (m in [1..12]) or + not (d in [1..31]) or + not (h in [0..23]) or + not (mi in [0..59]) or + not (sec in [0..59]) or + not (wd in [0..6]) or + not ((jd>=0) and (jd<=366)) or + not ((dl>=-1) and (dl<=1)) then + Exit; + try + dt := EncodeDate( y, m, d ); + dt := dt + EncodeTime( h, mi, sec, 0 ); + Date := dt; + Result := True; + except + end; + end; + end; + + function GetSequenceItem( sequence : PPyObject; idx : Integer ) : Variant; + var + val : PPyObject; + begin + val := PySequence_GetItem( sequence, idx ); + try + Result := PyObjectAsVariant( val ); + finally + Py_XDecRef( val ); + end; + end; + +var + i, seq_length : Integer; +begin + if PyFloat_Check(obj) then + Result := PyFloat_AsDouble(obj) + else if PyBool_Check(obj) then // we must check Bool before Int, as Boolean type inherits from Int. + Result := PyObject_IsTrue(obj) = 1 + else if PyLong_Check(obj) then + Result := PyLong_AsLongLong(obj) + //else if PyUnicode_Check(obj) then + //Result := PyUnicodeAsString(obj) + else if PyBytes_Check(obj) then + Result := AnsiString(PyBytes_AsString(obj)) + else if ExtractDate( Result ) then + begin + // Nothing to do + end + else if PySequence_Check( obj ) = 1 then + begin + seq_length := PySequence_Length( obj ); + // if we have at least one object in the sequence, + if seq_length > 0 then + // we try to get the first one, simply to test if the sequence API + // is really implemented. + Py_XDecRef( PySequence_GetItem( obj, 0 ) ); + // check if the Python object did really implement the sequence API + if PyErr_Occurred = nil then + begin + // Convert a Python sequence into an array of Variant + Result := VarArrayCreate( [0, seq_length-1], varVariant ); + for i := 0 to PySequence_Length( obj )-1 do + Result[i] := GetSequenceItem( obj, i ); + end + else // the object didn't implement the sequence API, so we return Null + begin + PyErr_Clear; + Result := Null; + end; + end + else + Result := Null; +end; + +function TPythonEngine.VarRecAsPyObject( const v : TVarRec ) : PPyObject; +begin + case v.VType of + vtInteger: Result := PyLong_FromLong( v.VInteger ); + vtBoolean: Result := PyLong_FromLong( Integer(v.VBoolean) ); + vtChar: Result := PyUnicodeFromString(AnsiString(v.VChar)); + vtExtended: Result := PyFloat_FromDouble( v.VExtended^ ); + vtString: + begin + if Assigned(v.VString) then + Result := PyUnicodeFromString(AnsiString(v.VString^)) + else + Result := PyUnicodeFromString(''); + end; + vtPChar: Result := PyUnicodeFromString(AnsiString(v.VPChar)); + vtAnsiString: + begin + if Assigned(v.VAnsiString) then + Result := PyUnicodeFromString(PAnsiChar(v.VAnsiString)) + else + Result := PyUnicodeFromString(''); + end; + vtCurrency: Result := PyFloat_FromDouble( v.VCurrency^ ); + vtVariant: Result := VariantAsPyObject( v.VVariant^ ); + vtPointer: Result := v.VPointer; + vtInt64: Result := PyLong_FromLongLong( v.VInt64^ ); + vtWideChar: Result := PyUnicodeFromString(UnicodeString(v.VWideChar)); + vtPWideChar: + begin + if Assigned(v.VPWideChar) then + Result := PyUnicodeFromString(UnicodeString(v.VPWideChar)) + else + Result := PyUnicodeFromString(''); + end; + vtWideString: + begin + if Assigned(v.VWideString) then + Result := PyUnicodeFromString(WideString(v.VWideString)) + else + Result := PyUnicodeFromString(''); + end; + {vtUnicodeString: + begin + if Assigned(v.VUnicodeString) then + Result := PyUnicodeFromString(UnicodeString(v.VUnicodeString)) + else + Result := PyUnicodeFromString(''); + end; } + else + Raise Exception.Create('Argument type not allowed'); + end; +end; + +// This function prevents Python from deleting the objects contained +// when the container will be freed, because we increment each +// object's refcount. +function TPythonEngine.MakePyTuple( const objects : array of PPyObject ) : PPyObject; +var + i : Integer; +begin + Result := PyTuple_New( High(objects)+1 ); + if not Assigned(Result) then + raise EPythonError.Create('Could not create a new tuple object'); + for i := Low(objects) to High(objects) do + begin + Py_XINCREF( objects[i] ); + PyTuple_SetItem( Result, i, objects[i] ); + end; +end; + +// This function prevents Python from deleting the objects contained +// when the container will be freed, because we increment each +// object's refcount. +function TPythonEngine.MakePyList( const objects : array of PPyObject ) : PPyObject; +var + i : Integer; +begin + Result := PyList_New( High(objects)+1 ); + if not Assigned(Result) then + raise EPythonError.Create('Could not create a new list object'); + for i := Low(objects) to High(objects) do + begin + Py_XIncRef( objects[i] ); + PyList_SetItem( Result, i, objects[i] ); + end; +end; + +function TPythonEngine.ArrayToPyTuple( const items : array of const) : PPyObject; +var + i : Integer; +begin + Result := PyTuple_New( High(items)+1 ); + if not Assigned(Result) then + raise EPythonError.Create('Could not create a new tuple object'); + for i := Low(items) to High(items) do + PyTuple_SetItem( Result, i, VarRecAsPyObject( items[i] ) ); +end; + +function TPythonEngine.ArrayToPyList( const items : array of const) : PPyObject; +var + i : Integer; +begin + Result := PyList_New( High(items)+1 ); + if not Assigned(Result) then + raise EPythonError.Create('Could not create a new list object'); + for i := Low(items) to High(items) do + PyList_SetItem( Result, i, VarRecAsPyObject( items[i] ) ); +end; + +// You must give each entry as a couple key(string)/value +function TPythonEngine.ArrayToPyDict( const items : array of const) : PPyObject; + + function VarRecAsString( const v : TVarRec ) : AnsiString; + begin + case v.VType of + vtChar: Result := v.VChar; + vtString: + begin + if Assigned(v.VString) then + Result := v.VString^ + else + Result := ''; + end; + vtPChar: + begin + Result := v.VPChar; + end; + vtWideChar: + begin + Result := AnsiString(v.VWideChar); + end; + vtAnsiString: + begin + if Assigned(v.VAnsiString) then + Result := Ansistring(v.VAnsiString) + else + Result := ''; + end; + vtVariant: + begin + if Assigned(v.VVariant) then + Result := AnsiString(v.VVariant^) + else + Result := ''; + end; + vtWideString : + begin + if Assigned(v.VWideString) then + Result := AnsiString(WideString(v.VWideString)) + else + Result := ''; + end; + {vtUnicodeString: + begin + if Assigned(v.VUnicodeString) then + Result := AnsiString(UnicodeString(v.VUnicodeString)) + else + Result := ''; + end; } + else + Raise Exception.Create('Argument type not allowed'); + end; + end; + +var + i : Integer; + s : AnsiString; + obj : PPyObject; +begin + if ((High(items)+1) mod 2) <> 0 then + raise Exception.Create('You must provide an even number of arguments'); + Result := PyDict_New; + if not Assigned(Result) then + raise EPythonError.Create('Could not create a new dict object'); + i := Low(items); + try + while i <= High(items) do + begin + s := VarRecAsString( items[i] ); + obj := VarRecAsPyObject( items[i+1] ); + if s = '' then + PyDict_SetItemString( Result, '', obj ) + else + PyDict_SetItemString( Result, PAnsiChar(s), obj ); + Py_XDecRef(obj); + Inc( i, 2 ); + end; + except + Py_XDECREF( Result ); + end; +end; + +function TPythonEngine.StringsToPyList( strings : TStrings ) : PPyObject; +var + i : Integer; +begin + Result := PyList_New( strings.Count ); + if not Assigned(Result) then + raise EPythonError.Create('Could not create a new list object'); + for i := 0 to strings.Count - 1 do + PyList_SetItem( Result, i, + PyUnicodeFromString(strings.Strings[i])); +end; + +function TPythonEngine.StringsToPyTuple( strings : TStrings ) : PPyObject; +var + i : Integer; +begin + Result := PyTuple_New( strings.Count ); + if not Assigned(Result) then + raise EPythonError.Create('Could not create a new tuple object'); + for i := 0 to strings.Count - 1 do + PyTuple_SetItem( Result, i, + PyUnicodeFromString(strings.Strings[i])); +end; + +procedure TPythonEngine.PyListToStrings( list : PPyObject; strings : TStrings ); +var + i : Integer; +begin + if not PyList_Check(list) then + raise EPythonError.Create('the python object is not a list'); + strings.Clear; + for i := 0 to PyList_Size( list ) - 1 do + strings.Add( PyObjectAsString( PyList_GetItem( list, i ) ) ); +end; + +procedure TPythonEngine.PyTupleToStrings( tuple: PPyObject; strings : TStrings ); +var + i : Integer; +begin + if not PyTuple_Check(tuple) then + raise EPythonError.Create('the python object is not a tuple'); + strings.Clear; + for i := 0 to PyTuple_Size( tuple ) - 1 do + strings.Add( PyObjectAsString( PyTuple_GetItem( tuple, i ) ) ); +end; + +function TPythonEngine.PyBytesAsAnsiString(obj: PPyObject): AnsiString; +var + buffer: PAnsiChar; + size: NativeInt; +begin +// if PyBytes_Check(obj) then fix + if assigned(obj) then + begin + PyBytes_AsStringAndSize(obj, buffer, size); + SetString(Result, buffer, size); + end + else + raise EPythonError.CreateFmt(SPyConvertionError, ['PyBytesAsAnsiString', 'Bytes']); +end; + +function TPythonEngine.PyUnicodeAsString( obj : PPyObject ) : UnicodeString; +var + _size : Integer; +{$IFDEF POSIX} + _ucs4Str : UCS4String; +{$ENDIF} +begin + if PyUnicode_Check(obj) then + begin + _size := PyUnicode_GetSize(obj); + if _size > 0 then + begin +{$IFDEF POSIX} + // Note that Linux uses UCS4 strings, whereas it declares using UCS2 strings!!! + SetLength(_ucs4Str, _size+1); + if PyUnicode_AsWideChar(obj, @_ucs4Str[0], _size) <> _size then + raise EPythonError.Create('Could not copy the whole Unicode string into its buffer'); + Result := UCS4StringToWideString(_ucs4Str); + // remove trailing zeros (needed by Kylix1) + while (Length(Result) > 0) and (Result[Length(Result)] = #0) do + Delete(Result, Length(Result), 1); +{$ELSE} + SetLength(Result, _size); + if PyUnicode_AsWideChar(obj, @Result[1], _size) <> _size then + raise EPythonError.Create('Could not copy the whole Unicode string into its buffer'); +{$ENDIF} + end + else + Result := ''; + end + else + raise EPythonError.CreateFmt(SPyConvertionError, ['PyUnicodeAsString', 'Unicode']); +end; + +//( + +function TPythonEngine.PyUnicodeAsUTF8String( obj : PPyObject ) : RawByteString; +var + buffer: PAnsiChar; + size: NativeInt; +begin + //if PyUnicode_Check(obj) then fix + if assigned(obj) then + begin + Result := ''; + buffer := PyUnicode_AsUTF8AndSize(obj, @size); + if Assigned(buffer) then + SetString(Result, buffer, size) + else + Result := ''; + //SetCodePage(Result, CP_UTF8, False); fix + end + else + raise EPythonError.CreateFmt(SPyConvertionError, ['PyUnicodeAsUTF8String', 'Unicode']); +end; + +//*) + + +function TPythonEngine.PyUnicodeFromString(const AString : UnicodeString) : PPyObject; +{$IFDEF POSIX} +var + _ucs4Str : UCS4String; +{$ENDIF} +begin +{$IFDEF POSIX} + // Note that Linux uses UCS4 strings, whereas it declares using UCS2 strings!!! + _ucs4Str := WideStringToUCS4String(AString); + Result := PyUnicode_FromWideChar( {PWideChar}(@_ucs4Str[0]), Length(_ucs4Str)-1 {trim trailing zero}); +{$ELSE} + Result := PyUnicode_FromWideChar( PWideChar(AString), Length(AString) ); +{$ENDIF} +end; + +function TPythonEngine.ReturnFalse : PPyObject; +begin + Result := Py_False; + Py_INCREF( Result ); +end; + +function TPythonEngine.ReturnNone : PPyObject; +begin + Result := Py_None; + Py_INCREF( Result ); +end; + +function TPythonEngine.ReturnTrue : PPyObject; +begin + Result := Py_True; + Py_INCREF( Result ); +end; + +function TPythonEngine.FindModule( const ModuleName : AnsiString ) : PPyObject; +var + modules, m : PPyObject; +begin + modules := PyImport_GetModuleDict; + m := PyDict_GetItemString(modules, PAnsiChar(ModuleName) ); + if (m <> nil) and (PyModule_Check(m)) then + Result := m + else + Result := nil; +end; + +function TPythonEngine.FindFunction(const ModuleName,FuncName: AnsiString): PPyObject; +var + module,func: PPyObject; +begin + module := FindModule(ModuleName); + if module = nil then result := nil + else begin + func := PyObject_GetAttrString(module, PAnsiChar(FuncName)); + if Assigned(func) then begin + if PyFunction_Check(func) then + Result := func + else + begin + Py_XDecRef(func); + Result := nil; + end; + end else begin + Result := nil; + PyErr_Clear; + end; + end; +end; + +function TPythonEngine.SetToList( data : Pointer; size : Integer ) : PPyObject; + + function GetBit( idx : Integer ) : Boolean; + var + tmp : PAnsiChar; + begin + if idx >= size*8 then + begin + Result := False; + Exit; + end; + tmp := PAnsiChar(data); + tmp := tmp + (idx div 8); + Result := (Ord(tmp^) and (1 shl (idx mod 8))) <> 0; + end; + +var + i, cpt : Integer; +begin + cpt := 0; + for i := 0 to size*8-1 do + if GetBit(i) then + Inc(cpt); + Result := PyList_New( cpt ); + cpt := 0; + for i := 0 to size*8-1 do + if GetBit(i) then + begin + PyList_SetItem( Result, cpt, PyLong_FromLong(i) ); + Inc(cpt); + end; +end; + +procedure TPythonEngine.ListToSet( List : PPyObject; data : Pointer; size : Integer ); + + procedure SetBit( idx : Integer ); + var + tmp : PAnsiChar; + begin + if idx >= size*8 then + Exit; + tmp := PAnsiChar(data); + tmp := tmp + (idx div 8); + tmp^ := AnsiChar(Chr((Ord(tmp^) or (1 shl (idx mod 8))))); + end; + +var + i : Integer; +begin + FillChar( PAnsiChar(data)^, size, #0 ); + for i := 0 to PyList_Size(list)-1 do + SetBit( PyObjectAsVariant( PyList_GetItem(list, i) ) ); +end; + +procedure TPythonEngine.CheckError(ACatchStopEx : Boolean = False); + procedure ProcessSystemExit; + var + errtype, errvalue, errtraceback: PPyObject; + SErrValue: string; + begin + PyErr_Fetch(errtype, errvalue, errtraceback); + Traceback.Refresh(errtraceback); + SErrValue := PyObjectAsString(errvalue); + PyErr_Clear; + raise EPySystemExit.CreateResFmt(@SPyExcSystemError, [SErrValue]); + end; + +var + PyException: PPyObject; +begin + PyException := PyErr_Occurred; + if PyException <> nil then + begin + if ACatchStopEx and (PyErr_GivenExceptionMatches(PyException, PyExc_StopIteration^) <> 0) then + begin + PyErr_Clear; + raise EPyStopIteration.CreateRes(@SPyExcStopIteration); + end + else if PyErr_GivenExceptionMatches(PyException, PyExc_SystemExit^) <> 0 then + // Special treatment for SystemExit. Calling PyErr_Print would terminate the process + ProcessSystemExit + else + begin + PyErr_Print; + Traceback.Refresh; + RaiseError; + end; + end; +end; + +function TPythonEngine.GetMainModule : PPyObject; +begin + Result := PyImport_AddModule(PAnsiChar(ExecModule)); +end; + +function TPythonEngine.PyTimeStruct_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FTimeStruct) and (Pointer(obj^.ob_type) = FTimeStruct); +end; + +function TPythonEngine.PyDate_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PPyTypeObject(FPyDateTime_DateType)); +end; + +function TPythonEngine.PyDate_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_DateType); +end; + +function TPythonEngine.PyDateTime_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PPyTypeObject(FPyDateTime_DateTimeType)); +end; + +function TPythonEngine.PyDateTime_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_DateTimeType); +end; + +function TPythonEngine.PyTime_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PPyTypeObject(FPyDateTime_TimeType)); +end; + +function TPythonEngine.PyTime_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_TimeType); +end; + +function TPythonEngine.PyDelta_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PPyTypeObject(FPyDateTime_DeltaType)); +end; + +function TPythonEngine.PyDelta_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_DeltaType); +end; + +function TPythonEngine.PyTZInfo_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PPyTypeObject(FPyDateTime_TZInfoType)); +end; + +function TPythonEngine.PyTZInfo_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_TZInfoType); +end; + +{ +function TPythonEngine.PyUnicodeFromString(const AString: AnsiString): PPyObject; +begin + Result := PyUnicodeFromString(UnicodeString(AString)); +end; } + + +(*******************************************************) +(** **) +(** class TEngineClient **) +(** **) +(*******************************************************) + +procedure TEngineClient.SetEngine( val : TPythonEngine ); +begin + if val <> FEngine then + begin + if Assigned(FEngine) {and not(csDesigning in ComponentState)} then + FEngine.RemoveClient( Self ); + FEngine := val; + if Assigned(FEngine) {and not(csDesigning in ComponentState)} then + FEngine.AddClient( Self ); + end; +end; + +procedure TEngineClient.ModuleReady(Sender : TObject); +begin +end; + +constructor TEngineClient.Create( AOwner : TComponent ); +var + i : Integer; +begin + inherited; + if (csDesigning in ComponentState) and Assigned(AOwner) then + with AOwner do + for i := 0 to ComponentCount - 1 do + if Components[i] is TPythonEngine then + begin + Self.Engine := TPythonEngine(Components[i]); + Break; + end; +end; + +destructor TEngineClient.Destroy; +begin + Engine := nil; // This detaches the client from the Engine. + if Assigned( FOnDestroy ) then + FOnDestroy( Self ); + inherited; +end; + +procedure TEngineClient.Loaded; +begin + inherited; + if Assigned( FOnCreate ) then + FOnCreate( Self ); +end; + +procedure TEngineClient.Notification( AComponent: TComponent; Operation: TOperation); +begin + inherited; + if Operation = opRemove then + if AComponent = FEngine then + FEngine := nil; +end; + +procedure TEngineClient.Initialize; +begin + if FInitialized then + Exit; + if Assigned( FOnInitialization ) then + FOnInitialization( Self ); + FInitialized := True; +end; + +procedure TEngineClient.Finalize; +begin + if not FInitialized then + Exit; + if Assigned( FOnFinalization ) then + FOnFinalization( Self ); + FInitialized := False; +end; + +procedure TEngineClient.ClearEngine; +begin + FEngine := nil; +end; + +procedure TEngineClient.CheckEngine; +begin + if not Assigned(FEngine) then + raise Exception.CreateFmt('No Engine defined for component "%s"', [Name]); +end; + + +(*******************************************************) +(** **) +(** class TMethodsContainer **) +(** **) +(*******************************************************) + +//////////////////////////////////////// +// class TEventDef + +constructor TEventDef.Create(ACollection: TCollection); +begin + inherited; + FDocString := TStringList.Create; + Name := Format('PythonEvent%d',[Collection.Count - 1]); +end; + +destructor TEventDef.Destroy; +begin + FDocString.Free; + inherited; +end; + +function TEventDef.GetDisplayName: string; +begin + Result := string(FName); +end; + +function TEventDef.GetDocString : AnsiString; +begin + Owner.Container.CheckEngine; + FTmpDocString := + Owner.Container.Engine.EncodeString(CleanString(FDocString.Text, False)); + Result := fTmpDocString; +end; + +function TEventDef.PythonEvent(pself, args: PPyObject): PPyObject; +begin + Owner.Container.CheckEngine; + with Owner.Container.Engine do + begin + if Assigned(fOnExecute) then + fOnExecute(Self, pself, args, Result); + end; +end; + +function TEventDef.Owner : TEventDefs; +begin + Result := Collection as TEventDefs; +end; + +procedure TEventDef.SetDisplayName(const Value: string); +begin + FName := AnsiString(Value); + inherited; +end; + +procedure TEventDef.Assign(Source: TPersistent); +begin + if Source is TEventDef then + begin + Name := TEventDef(Source).Name; + DocString := TEventDef(Source).DocString; + end + else + inherited Assign(Source); +end; + +procedure TEventDef.SetDocString(const Value: TStringList); +begin + FDocString.Assign(Value); +end; + +//////////////////////////////////////// +// class TEventDefs + +constructor TEventDefs.Create(AMethodsContainer : TMethodsContainer ); +begin + inherited Create(TEventDef); + FMethodsContainer := AMethodsContainer; +end; + +function TEventDefs.GetItems( idx : Integer ) : TEventDef; +begin + Result := TEventDef(inherited GetItem(idx)); +end; + +procedure TEventDefs.SetItems( idx : Integer; Value : TEventDef ); +begin + inherited SetItem( idx, Value ); +end; + +function TEventDefs.GetOwner: TPersistent; +begin + Result := FMethodsContainer; +end; + +function TEventDefs.Add : TEventDef; +begin + Result := TEventDef(inherited Add); +end; + +procedure TEventDefs.RegisterEvents; +var + i : Integer; +begin + for i := 0 to Count - 1 do + with Items[i] do + FMethodsContainer.AddDelphiMethod(PAnsiChar(FName), PythonEvent, PAnsiChar(GetDocString)); +end; + +//////////////////////////////////////// +// class TMethodsContainer + +procedure TMethodsContainer.AllocMethods; +begin + Assert(FMethods = nil); + FAllocatedMethodCount := PYT_METHOD_BUFFER_INCREASE; + FMethodCount := 0; + FMethods := PPyMethodDef(AllocMem(SizeOf(PyMethodDef)*(FAllocatedMethodCount+1))); +end; + +procedure TMethodsContainer.FreeMethods; +begin + if Assigned(FMethods) then + begin + FreeMem(FMethods); + FMethods := nil; + end; + FAllocatedMethodCount := 0; + FMethodCount := 0; +end; + +procedure TMethodsContainer.ReallocMethods; +begin + Inc( FAllocatedMethodCount, PYT_METHOD_BUFFER_INCREASE ); + ReAllocMem( FMethods, SizeOf(PyMethodDef)*(FAllocatedMethodCount+1)); + //FillChar( FMethods[MethodCount+1] ,SizeOf(PyMethodDef)*PYT_METHOD_BUFFER_INCREASE,0); fix +end; + +function TMethodsContainer.GetMethods( idx : Integer ) : PPyMethodDef; +begin + if (idx < 0) or (idx > MethodCount) then + raise Exception.CreateFmt('%s: Index %d out of range', [ClassName, idx]); + //Result := @( FMethods[idx])^; fix + //Result := @( FMethods^[idx]); +end; + +function TMethodsContainer.StoreEventDefs: Boolean; +begin + Result := (FEventDefs <> nil) and (FEventDefs.Count > 0); +end; + +constructor TMethodsContainer.Create( AOwner : TComponent ); +begin + inherited; + AllocMethods; + fEventDefs := TEventDefs.Create(Self); +end; + +destructor TMethodsContainer.Destroy; +begin + fEventDefs.Free; + fEventDefs := nil; + FreeMethods; + inherited; +end; + +procedure TMethodsContainer.Initialize; +begin + inherited; + Events.RegisterEvents; +end; + +procedure TMethodsContainer.Finalize; +begin + if not (csDestroying in ComponentState) then + ClearMethods; + inherited; +end; + +function TMethodsContainer.AddMethod( AMethodName : PAnsiChar; + AMethod : PyCFunction; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + if FMethodCount = FAllocatedMethodCount then + ReallocMethods; + Result := Methods[ MethodCount ]; + Result^.ml_name := AMethodName; + Result^.ml_meth := AMethod; + Result^.ml_flags := METH_VARARGS; + Result^.ml_doc := ADocString; + Inc( FMethodCount ); +end; + +function TMethodsContainer.AddMethodWithKeywords( AMethodName : PAnsiChar; + AMethod : PyCFunctionWithKW; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + Result := AddMethod( AMethodName, + PyCFunction(AMethod), + ADocString ); + Result^.ml_flags := Result^.ml_flags or METH_KEYWORDS; +end; + +function TMethodsContainer.AddDelphiMethod( AMethodName : PAnsiChar; + ADelphiMethod: TDelphiMethod; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + Result := AddMethod( AMethodName, + GetOfObjectCallBack( TCallBack(ADelphiMethod), 2, ctCDECL), + ADocString ); +end; + +function TMethodsContainer.AddDelphiMethodWithKeywords( AMethodName : PAnsiChar; + ADelphiMethod: TDelphiMethodWithKW; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + Result := AddMethod( AMethodName, + GetOfObjectCallBack( TCallBack(ADelphiMethod), 3, ctCDECL), + ADocString ); + Result^.ml_flags := Result^.ml_flags or METH_KEYWORDS; +end; + +procedure TMethodsContainer.ClearMethods; +begin + FMethodCount := 0; + FillChar(FMethods^, Sizeof(FMethods^)*FAllocatedMethodCount, 0); +end; + +//////////////////////////////////////// +// class TMembersContainer + +function TMembersContainer.GetMembersStartOffset : Integer; +begin + Result := 0; +end; + +procedure TMembersContainer.AddMember(MemberName: PAnsiChar; MemberType : TPyMemberType; + MemberOffset : NativeInt; MemberFlags: TPyMemberFlag; MemberDoc: PAnsiChar); +begin + if FMemberCount = FAllocatedMemberCount then + ReallocMembers; + with Members[ MemberCount ]^ do + begin + name := MemberName; + case MemberType of + mtShort: _type := T_Short; + mtInt: _type := T_Int; + mtLong: _type := T_Long; + mtFloat: _type := T_Float; + mtDouble: _type := T_Double; + mtString: _type := T_String; + mtObject: _type := T_Object; + mtChar: _type := T_Char; + mtByte: _type := T_Byte; + mtUByte: _type := T_UByte; + mtUShort: _type := T_UShort; + mtUInt: _type := T_UInt; + mtULong: _type := T_ULong; + mtStringInplace: _type := T_STRING_INPLACE; + mtObjectEx: _type := T_OBJECT_EX; + else + raise Exception.Create('Unknown member type'); + end; + offset := MemberOffset + GetMembersStartOffset; + case MemberFlags of + mfDefault: flags := 0; + mfReadOnly: flags := READONLY; + mfReadRestricted: flags := READ_RESTRICTED; + mfWriteRestricted: flags := PY_WRITE_RESTRICTED; + mfRestricted: flags := RESTRICTED; + else + raise Exception.Create('Unknown member flag'); + end; + doc := MemberDoc; + end; + Inc( FMemberCount ); +end; + +procedure TMembersContainer.AllocMembers; +begin + FAllocatedMemberCount := PYT_MEMBER_BUFFER_INCREASE; + Assert(not Assigned(FMembers)); + FMembers := PPyMemberDef(AllocMem(SizeOf(PyMemberDef)*(FAllocatedMemberCount+1))); +end; + +procedure TMembersContainer.ClearMembers; +begin + FMemberCount := 0; + FillChar(FMembers^, Sizeof(FMembers^)*FAllocatedMemberCount, 0); +end; + +constructor TMembersContainer.Create(AOwner: TComponent); +begin + inherited; + AllocMembers; +end; + +destructor TMembersContainer.Destroy; +begin + FreeMembers; + inherited; +end; + +procedure TMembersContainer.Finalize; +begin + if not (csDestroying in ComponentState) then + ClearMembers; + inherited; +end; + +procedure TMembersContainer.FreeMembers; +begin + if Assigned(FMembers) then + begin + FreeMem(FMembers); + FMembers := nil; + end; + FMemberCount := 0; + FAllocatedMemberCount := 0; +end; + +function TMembersContainer.GetMembers(idx: Integer): PPyMemberDef; +begin + if (idx < 0) or (idx > MemberCount) then + raise Exception.CreateFmt('%s: Index %d out of range', [ClassName, idx]); + // Result := @( FMembers[idx] ); fix +end; + +procedure TMembersContainer.ReallocMembers; +begin + Inc( FAllocatedMemberCount, PYT_MEMBER_BUFFER_INCREASE ); + ReAllocMem( FMembers, SizeOf(PyMemberDef)*(FAllocatedMemberCount+1)); + //FillChar( FMembers[MemberCount+1], SizeOf(PyMemberDef)*PYT_MEMBER_BUFFER_INCREASE,0); fix +end; + +//////////////////////////////////////// +// class TGetSetContainer + + +procedure TGetSetContainer.AddGetSet(AName: PAnsiChar; AGet: getter; + ASet: setter; ADoc: PAnsiChar; AClosure: Pointer); +begin + if FGetSetCount = FAllocatedGetSetCount then + ReallocGetSets; + with GetSet[ GetSetCount ]^ do + begin + name := AName; + get := AGet; + _set := ASet; + doc := ADoc; + closure := AClosure; + end; + Inc( FGetSetCount ); +end; + +procedure TGetSetContainer.AllocGetSets; +begin + FAllocatedGetSetCount := PYT_GETSET_BUFFER_INCREASE; + Assert(not Assigned(FGetSets)); + FGetSets := PPyGetSetDef(AllocMem(SizeOf(PyGetSetDef)*(FAllocatedGetSetCount+1))); +end; + +procedure TGetSetContainer.ClearGetSets; +begin + FGetSetCount := 0; + FillChar(FGetSets^, Sizeof(FGetSets^)*FAllocatedGetSetCount, 0); +end; + +constructor TGetSetContainer.Create(AOwner: TComponent); +begin + inherited; + AllocGetSets; +end; + +destructor TGetSetContainer.Destroy; +begin + FreeGetSets; + inherited; +end; + +procedure TGetSetContainer.Finalize; +begin + if not (csDestroying in ComponentState) then + ClearGetSets; + inherited; +end; + +procedure TGetSetContainer.FreeGetSets; +begin + if Assigned(FGetSets) then + begin + FreeMem(FGetSets); + FGetSets := nil; + end; + FGetSetCount := 0; + FAllocatedGetSetCount := 0; +end; + +function TGetSetContainer.GetGetSet(idx: Integer): PPyGetSetDef; +begin + if (idx < 0) or (idx > GetSetCount) then + raise Exception.CreateFmt('%s: Index %d out of range', [ClassName, idx]); + //Result := @( FGetSets[idx] ); fix +end; + +procedure TGetSetContainer.ReallocGetSets; +begin + Inc( FAllocatedGetSetCount, PYT_GETSET_BUFFER_INCREASE ); + ReAllocMem( FGetSets, SizeOf(PyGetSetDef)*(FAllocatedGetSetCount+1)); + //FillChar( FGetSets[GetSetCount+1], SizeOf(PyGetSetDef)*PYT_GETSET_BUFFER_INCREASE,0); fix +end; + +(*******************************************************) +(** **) +(** class TPythonModule **) +(** **) +(*******************************************************) + +//////////////////////////////////////// +// class TParentClassError + +procedure TParentClassError.AssignTo( Dest: TPersistent ); +begin + if Dest is TParentClassError then + with TParentClassError( Dest ) do + begin + FName := Self.FName; + FModule := Self.FModule; + end; + inherited; +end; + +//////////////////////////////////////// +// class TError + +function TError.GetDisplayName: string; +begin + Result := string(Name); + if Result = '' then Result := inherited GetDisplayName; +end; + +procedure TError.SetName( const Value : AnsiString ); + + procedure CheckName; + var + i : Integer; + m : TPythonModule; + begin + with Collection as TErrors do + begin + if GetOwner = nil then + Exit; + m := GetOwner as TPythonModule; + for i := 0 to Count - 1 do + with Items[i] do + if Name = Value then + raise Exception.CreateFmt( 'In module "%s", there''s already an error named "%s"', + [m.ModuleName, Value]); + end; + end; + + procedure UpdateDependencies; + var + i, j : Integer; + m : TPythonModule; + begin + if FName = '' then + Exit; + with Collection as TErrors do + with GetOwner as TPythonModule do + begin + if not Assigned(Engine) then + Exit; + m := TPythonModule( TErrors(Self.Collection).GetOwner ); + with Engine do + begin + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonModule then + with TPythonModule(Clients[i]) do + begin + for j := 0 to Errors.Count - 1 do + with Errors.Items[j] do + if (ParentClass.Module = m.ModuleName) and + (ParentClass.Name = Self.Name) then + ParentClass.Name := Value; + end; + end; + end; + end; + +begin + if (FName <> Value) and (Value <> '') then + begin + CheckName; + if ErrorType = etClass then + UpdateDependencies; + FName := Value; + Changed(False); + end; +end; + +procedure TError.SetText( const Value : AnsiString ); +begin + if FText <> Value then + begin + FText := Value; + Changed(False); + end; +end; + +procedure TError.SetErrorType( Value : TErrorType ); +begin + if FErrorType <> Value then + begin + FErrorType := Value; + if FErrorType = etString then + FParentClass.Name := ''; + Changed(False); + end; +end; + +procedure TError.SetParentClass( Value : TParentClassError ); +begin + FParentClass.Assign( Value ); + Changed(False); +end; + +constructor TError.Create(ACollection: TCollection); +begin + inherited; + FErrorType := etString; + FParentClass := TParentClassError.Create; +end; + +destructor TError.Destroy; +begin + FParentClass.Free; + inherited; +end; + +procedure TError.Assign(Source: TPersistent); +begin + if Source is TError then + begin + Name := TError(Source).Name; + Text := TError(Source).Text; + Exit; + end; + inherited Assign(Source); +end; + +procedure TError.BuildError( const ModuleName : AnsiString ); + + function FindParentClass : PPyObject; + var + m, d : PPyObject; + begin + Owner.Owner.CheckEngine; + with Owner.Owner.Engine do + begin + if ParentClass.Module <> '' then + //m := PyImport_ImportModule( PAnsiChar(ParentClass.Module) ) + m := PyImport_AddModule( PAnsiChar(ParentClass.Module) ) + else + m := FindModule( ModuleName ); + if not Assigned(m) then + raise Exception.CreateFmt('Could not find module containing the parent class of error "%s"', [Self.Name]); + d := PyModule_GetDict(m); + Result := PyDict_GetItemString( d, PAnsiChar(ParentClass.Name) ); + if not Assigned(Result) then + raise Exception.CreateFmt('Could not find the parent class "%s" of error "%s"', [ParentClass.Name, Self.Name]); + if not PyClass_Check( Result ) and not PyType_CheckExact( Result ) then + raise Exception.CreateFmt('The object "%s" in module "%s" is not a class', [ParentClass.Name, ParentClass.Module] ); + end; + end; + +var + parent : PPyObject; +begin + if Assigned(Error) then + Exit; + if Name = '' then + with GetOwner as TPythonModule do + raise Exception.CreateFmt( 'Error without name in module "%s"', [ModuleName] ); + if Text = '' then + Text := Name; + Owner.Owner.CheckEngine; + with Owner.Owner.Engine do + begin + if ErrorType = etString then + Error := PyUnicodeFromString(Text) + else if ErrorType = etClass then + begin + if FParentClass.Name <> '' then + parent := FindParentClass + else + parent := nil; + Error := PyErr_NewException( + PAnsiChar(AnsiString(Format('%s.%s', [ModuleName, Self.Name]))), + parent, nil ); + end; + end; + if not Assigned(Error) then + raise Exception.CreateFmt( 'Could not create error "%s"', [Name] ); +end; + +procedure TError.RaiseError( const msg : AnsiString ); +begin + Owner.Owner.CheckEngine; + with Owner.Owner.Engine do + PyErr_SetString( Error, PAnsiChar(msg) ); +end; + +procedure TError.RaiseErrorObj( const msg : AnsiString; obj : PPyObject ); +var + args, res, str : PPyObject; + i : Integer; + keys : PPyObject; + key : PPyObject; + val : PPyObject; +begin + Owner.Owner.CheckEngine; + with Owner.Owner.Engine do + // if we give a dictionary as argument, then we use it for the + // instance. + if PyDict_Check( obj ) then + begin + args := PyTuple_New(0); + if not Assigned(args) then + raise Exception.Create('TError.RaiseErrorObj: Could not create an empty tuple'); + res := PyEval_CallObjectWithKeywords(Error, args, nil); + Py_DECREF(args); + if not Assigned(res) then + raise Exception.CreateFmt('TError.RaiseErrorObj: Could not create an instance of "%s"', [Self.Name]); + if PyObject_TypeCheck(res, PPyTypeObject(PyExc_Exception^)) then + begin + args := PyTuple_New(1); + if not Assigned(args) then + raise Exception.Create('TError.RaiseErrorObj: Could not create an empty tuple'); + str := PyUnicodeFromString(msg); + PyTuple_SetItem(args, 0, str); + res := PyEval_CallObjectWithKeywords(Error, args, nil); + Py_DECREF(args); + if not Assigned(res) then + raise Exception.CreateFmt('TError.RaiseErrorObj: Could not create an instance of "%s"', [Self.Name]); + keys := PyDict_Keys(obj); + for i := 0 to PySequence_Length(keys)-1 do + begin + key := PySequence_GetItem(keys, i); + val := PyDict_GetItem(obj, key); + if Assigned(val) then + begin + PyObject_SetAttr(res, key, val); + Py_DECREF(val); + end; + Py_XDECREF(key); + end; + Py_XDECREF(keys); + end + else + raise Exception.Create('TError.RaiseErrorObj: I didn''t get an instance' ); + PyErr_SetObject( Error, res ); + end + else + PyErr_SetObject( Error, obj ); +end; + +function TError.Owner : TErrors; +begin + Result := GetOwner as TErrors; +end; + +//////////////////////////////////////// +// class TErrors + +function TErrors.GetError(Index: Integer): TError; +begin + Result := TError(inherited GetItem(Index)); +end; + +procedure TErrors.SetError(Index: Integer; Value: TError); +begin + inherited SetItem(Index, Value); +end; + +function TErrors.GetOwner: TPersistent; +begin + Result := FModule; +end; + +procedure TErrors.Update(Item: TCollectionItem); +begin + inherited; +end; + +constructor TErrors.Create(Module: TPythonModule ); +begin + inherited Create( TError ); + FModule := Module; +end; + +function TErrors.Add: TError; +begin + Result := TError(inherited Add); +end; + +function TErrors.Owner : TPythonModule; +begin + Result := GetOwner as TPythonModule; +end; + +//////////////////////////////////////// +// class TPythonModule + +function TPythonModule.GetClientCount : Integer; +begin + Result := FClients.Count; +end; + +function TPythonModule.GetClients( idx : Integer ) : TEngineClient; +begin + Result := TEngineClient(FClients.Items[idx]); +end; + +procedure TPythonModule.SetErrors( val : TErrors ); +begin + FErrors.Assign( val ); +end; + +procedure TPythonModule.SetModuleName( const val : AnsiString ); + + procedure UpdateDependencies; + var + i, j : Integer; + begin + if not Assigned(Engine) then + Exit; + if FModuleName = '' then + Exit; + with Engine do + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonModule then + with TPythonModule(Clients[i]) do + for j := 0 to Errors.Count - 1 do + with Errors.Items[j] do + if ParentClass.Module = Self.FModuleName then + ParentClass.Module := val; + end; + +begin + if (FModuleName <> val) and (val <> '') then + begin + UpdateDependencies; + FModuleName := val; + end; +end; + +constructor TPythonModule.Create( AOwner : TComponent ); +begin + inherited; + FClients := TList.Create; + FErrors := TErrors.Create(Self); + FDocString := TStringList.Create; +end; + +destructor TPythonModule.Destroy; +begin + FDocString.Free; + FClients.Free; + FErrors.Free; + inherited; +end; + + +procedure TPythonModule.SetDocString( value : TStringList ); +begin + FDocString.Assign( value ); +end; + +procedure TPythonModule.DefineDocString; +var + doc : PPyObject; +begin + with Engine do + begin + if DocString.Text <> '' then + begin + doc := + PyUnicodeFromString(CleanString(FDocString.Text, False)); + PyObject_SetAttrString( FModule, '__doc__', doc ); + Py_XDecRef(doc); + CheckError(False); + end; + end; +end; + +procedure TPythonModule.MakeModule; +begin + CheckEngine; + if Assigned(FModule) then + Exit; + with Engine do + begin + FillChar(FModuleDef, SizeOf(FModuleDef), 0); + FModuleDef.m_base.ob_refcnt := 1; + FModuleDef.m_name := PAnsiChar(ModuleName); + FModuleDef.m_methods := MethodsData; + FModuleDef.m_size := -1; + FModule := Py_InitModule( ModuleDef ); + DefineDocString; + end; +end; + +procedure TPythonModule.Initialize; +var + i : Integer; +begin + inherited; + FModule := nil; + MakeModule; + for i := 0 to ClientCount - 1 do + Clients[i].ModuleReady(Self); + BuildErrors; + if Assigned(FOnAfterInitialization) then + FOnAfterInitialization( Self ); +end; + +procedure TPythonModule.InitializeForNewInterpreter; +var + initialized : Boolean; + oldModule : PPyObject; +begin + initialized := FInitialized; + oldModule := FModule; + FModule := nil; + FInitialized := False; + try + Initialize; + finally + FInitialized := initialized; + FModule := oldModule; + end; +end; + +procedure TPythonModule.AddClient( client : TEngineClient ); +begin + FClients.Add( client ); +end; + +function TPythonModule.ErrorByName( const AName : AnsiString ) : TError; +var + i : Integer; +begin + for i := 0 to Errors.Count - 1 do + if CompareText( string(Errors.Items[i].Name), string(AName) ) = 0 then + begin + Result := Errors.Items[i]; + Exit; + end; + raise Exception.CreateFmt( 'Could not find error "%s"', [AName] ); +end; + +procedure TPythonModule.RaiseError( const error, msg : AnsiString ); +begin + ErrorByName( error ).RaiseError( msg ); +end; + +procedure TPythonModule.RaiseErrorFmt( const error, format : AnsiString; const Args : array of const ); +begin + RaiseError( error, AnsiString(SysUtils.Format( string(format), Args )) ); +end; + +procedure TPythonModule.RaiseErrorObj( const error, msg : AnsiString; obj : PPyObject ); +begin + ErrorByName( error ).RaiseErrorObj( msg, obj ); +end; + +procedure TPythonModule.BuildErrors; +var + i : Integer; + d : PPyObject; +begin + CheckEngine; + with Engine do + begin + d := PyModule_GetDict( Module ); + if not Assigned(d) then + Exit; + for i := 0 to Errors.Count - 1 do + with Errors.Items[i] do + begin + BuildError( ModuleName ); + PyDict_SetItemString( d, PAnsiChar(Name), Error ); + end; + end; +end; + +// warning, this function will increase the refcount of value, +// so, if you don't want to keep a link, don't forget to decrement +// the refcount after the SetVar method. +procedure TPythonModule.SetVar( const varName : AnsiString; value : PPyObject ); +begin + if Assigned(FEngine) and Assigned( FModule ) then + begin + if Engine.PyObject_SetAttrString(Module, PAnsiChar(varName), value ) <> 0 then + raise EPythonError.CreateFmt( 'Could not set var "%s" in module "%s"', [varName, ModuleName] ); + end + else + raise EPythonError.CreateFmt( 'Can''t set var "%s" in module "%s", because it is not yet initialized', [varName, ModuleName] ); +end; + +// warning, this function will increase the refcount of value, +// so, if you don't want to keep a link, don't forget to decrement +// the refcount after the GetVar method. +function TPythonModule.GetVar( const varName : AnsiString ) : PPyObject; +begin + if Assigned(FEngine) and Assigned( FModule ) then + begin + Result := Engine.PyObject_GetAttrString(Module, PAnsiChar(varName) ); + Engine.PyErr_Clear; + end + else + raise EPythonError.CreateFmt( 'Can''t get var "%s" in module "%s", because it is not yet initialized', [varName, ModuleName] ); +end; + +procedure TPythonModule.DeleteVar( const varName : AnsiString ); +var + dict : PPyObject; +begin + if Assigned(FEngine) and Assigned( FModule ) then + with Engine do + begin + dict := PyModule_GetDict( Module ); + if not Assigned(dict) then raise EPythonError.CreateFmt( 'Can''t get __dict__ of module "%s"', [ModuleName] ); + PyDict_DelItemString( dict, PAnsiChar(varName) ); + end + else + raise EPythonError.CreateFmt( 'Can''t delete var "%s" in module "%s", because it is not yet initialized', [varName, ModuleName] ); +end; + +procedure TPythonModule.ClearVars; +var + dict : PPyObject; +begin + if Assigned(FEngine) and Assigned( FModule ) then + with Engine do begin + dict := PyModule_GetDict( Module ); + PyDict_Clear(dict); + end; +end; + +procedure TPythonModule.SetVarFromVariant( const varName : AnsiString; const value : Variant ); +var + obj : PPyObject; +begin + CheckEngine; + with Engine do + begin + obj := VariantAsPyObject( value ); + try + SetVar( varName, obj ); + finally + Py_XDecRef(obj); + end; + end; +end; + +function TPythonModule.GetVarAsVariant( const varName : AnsiString ) : Variant; +var + obj : PPyObject; +begin + CheckEngine; + with Engine do + begin + obj := GetVar( varName ); + try + Result := PyObjectAsVariant( obj ); + finally + Py_XDecRef(obj); + end; + end; +end; + +(*******************************************************) +(** **) +(** class TPythonType **) +(** **) +(*******************************************************) + +////////////////////////////// +// TPyObject + +// Constructors & Destructors +constructor TPyObject.Create( APythonType : TPythonType ); +begin + inherited Create; + if Assigned(APythonType) then + begin + ob_refcnt := 1; + PythonType := APythonType; + with APythonType do + begin + Inc(FInstanceCount); + Inc(FCreateHits); + end; + end; +end; + +constructor TPyObject.CreateWith( APythonType : TPythonType; args : PPyObject ); +begin + Create( APythonType ); +end; + +destructor TPyObject.Destroy; +begin + if Assigned(PythonType) then + begin + Dec(PythonType.FInstanceCount); + Inc(PythonType.FDeleteHits); + end; + inherited; +end; + +class function TPyObject.NewInstance: TObject; +var + mem : PAnsiChar; +begin + GetMem(mem, InstanceSize + Sizeof(PyObject)); + PPyObject(mem)^.ob_refcnt := 1; + PPyObject(mem)^.ob_type := nil; + Result := InitInstance(Mem+Sizeof(PyObject)); +end; + +procedure TPyObject.FreeInstance; +begin + CleanupInstance; + if not PythonAlloc then + FreeMem(PAnsiChar(Self)-Sizeof(PyObject)); +end; + +// Misc +function TPyObject.GetSelf : PPyObject; +begin + Result := PPyObject( PAnsiChar(Self)-Sizeof(PyObject) ) +end; + +procedure TPyObject.IncRef; +begin + Inc(GetSelf^.ob_refcnt); +end; + +procedure TPyObject.Adjust(PyPointer: Pointer); +var + ptr : PNativeInt; +begin + ptr := PyPointer; + ptr^ := NativeInt(PythonToDelphi(PPyObject(ptr^))); +end; + +function TPyObject.GetModule : TPythonModule; +begin + if Assigned(PythonType) then + Result := PythonType.Module + else + Result := nil; +end; + +function TPyObject.Get_ob_refcnt: NativeInt; +begin + Result := GetSelf^.ob_refcnt; +end; + +function TPyObject.Get_ob_type: PPyTypeObject; +begin + Result := GetSelf^.ob_type; +end; + +procedure TPyObject.Set_ob_refcnt(const Value: NativeInt); +begin + GetSelf^.ob_refcnt := Value; +end; + +procedure TPyObject.Set_ob_type(const Value: PPyTypeObject); +begin + GetSelf^.ob_type := Value; +end; + +// Type services +//////////////// + +// Basic services +function TPyObject.Print( var f: file; i: integer) : Integer; +begin + Result := -1; +end; + +function TPyObject.GetAttr(key : PAnsiChar) : PPyObject; +var + PyKey : PPyObject; +begin + with GetPythonEngine do + begin + PyKey := PyUnicodeFromString(key); + try + Result := PyObject_GenericGetAttr(GetSelf, PyKey) + finally + Py_XDecRef(PyKey); + end; + end; +end; + +function TPyObject.SetAttr(key : PAnsiChar; value : PPyObject) : Integer; +begin + with GetPythonEngine do + begin + Result := -1; + PyErr_SetString (PyExc_AttributeError^, + PAnsiChar(AnsiString(Format('Unknown attribute "%s"',[key])))); + end; +end; + +function TPyObject.Repr : PPyObject; +begin + Result := + GetPythonEngine.PyUnicodeFromString(Format('<%s at %x>', + [PythonType.TypeName, NativeInt(self)])); +end; + +function TPyObject.Compare( obj: PPyObject) : Integer; +begin + Result := 0; +end; + +function TPyObject.Hash : NativeInt; +begin + Result := NativeInt(Self); +end; + +function TPyObject.Str: PPyObject; +begin + Result := Repr; +end; + +function TPyObject.GetAttrO( key: PPyObject) : PPyObject; +begin + Result := GetPythonEngine.PyObject_GenericGetAttr(GetSelf, key); +end; + +function TPyObject.SetAttrO( key, value: PPyObject) : Integer; +begin + Result := GetPythonEngine.PyObject_GenericSetAttr(GetSelf, key, value); +end; + +function TPyObject.Call( ob1, ob2 : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.Traverse( proc: visitproc; ptr: Pointer) : integer; +begin + Result := 0; +end; + +function TPyObject.Clear: integer; +begin + Result := 0; +end; + +function TPyObject.RichCompare( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject; +Var + Res : Boolean; +begin + Res := False; + case Op of + pyLT: Res := Compare(obj) < 0; + pyLE: Res := Compare(obj) <= 0; + pyEQ: Res := Compare(obj) = 0; + pyNE: Res := Compare(obj) <> 0; + pyGT: Res := Compare(obj) > 0; + pyGE: Res := Compare(obj) >= 0; + end; + if Res then + Result := PPyObject(GetPythonEngine.Py_True) + else + Result := PPyObject(GetPythonEngine.Py_False); + GetPythonEngine.Py_INCREF( Result ); +end; + +function TPyObject.Iter : PPyObject; +begin + Result := nil; +end; + +function TPyObject.IterNext : PPyObject; +begin + Result := nil; +end; + +{ Called when an instance of a subtype has been created. Same as __init__ in a class } +function TPyObject.Init( args, kwds : PPyObject ) : Integer; +begin + Result := 0; +end; + +// Number services +function TPyObject.NbAdd( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbSubtract( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbMultiply( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbFloorDivide( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbTrueDivide( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbMatrixMultiply( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbRemainder( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbDivmod( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbPower( ob1, ob2 : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbNegative : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbPositive : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbAbsolute : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbBool : Integer; +begin + Result := 0; +end; + +function TPyObject.NbInvert : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbLShift( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbRShift( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbAnd( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbXor( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbOr( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInt : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbFloat : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceAdd(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceAnd(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceDivide(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceFloorDivide( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceTrueDivide( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceLshift(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceMultiply(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceOr(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceMatrixMultiply(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplacePower(ob1, ob2: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceRemainder(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceRshift(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceSubtract(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceXor(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +// Sequence services +function TPyObject.SqLength : NativeInt; +begin + Result := 0; +end; + +function TPyObject.SqConcat( obj : PPyObject) : PPyObject; +begin + Result := GetPythonEngine.ReturnNone; +end; + +function TPyObject.SqRepeat( val : NativeInt ) : PPyObject; +begin + Result := GetPythonEngine.ReturnNone; +end; + +function TPyObject.SqItem( idx : NativeInt ) : PPyObject; +begin + Result := GetPythonEngine.ReturnNone; +end; + +function TPyObject.SqAssItem( idx : NativeInt; obj : PPyObject) : Integer; +begin + Result := -1; +end; + +function TPyObject.SqContains(obj: PPyObject): integer; +begin + Result := -1; +end; + +function TPyObject.SqInplaceConcat(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.SqInplaceRepeat(i: NativeInt): PPyObject; +begin + Result := nil; +end; + +// Mapping services +function TPyObject.MpLength : NativeInt; +begin + Result := 0; +end; + +function TPyObject.MpSubscript( obj : PPyObject) : PPyObject; +begin + Result := GetPythonEngine.ReturnNone; +end; + +function TPyObject.MpAssSubscript( obj1, obj2 : PPyObject) : Integer; +begin + Result := -1; +end; + + +// Class methods +class procedure TPyObject.RegisterMethods( APythonType : TPythonType ); +begin +end; + +class procedure TPyObject.RegisterMembers( APythonType : TPythonType ); +begin +end; + +class procedure TPyObject.RegisterGetSets( APythonType : TPythonType ); +begin +end; + +class procedure TPyObject.SetupType(APythonType: TPythonType); +begin + +end; + + +////////////////////////////// +// TTypeServices + +constructor TTypeServices.Create; +begin + inherited; + FBasic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr]; +end; + +procedure TTypeServices.AssignTo( Dest: TPersistent ); +begin + if Dest is TTypeServices then + with TTypeServices( Dest ) do + begin + FBasic := Self.FBasic; + FNumber := Self.FNumber; + FSequence := Self.FSequence; + FMapping := Self.FMapping; + FInplaceNumber := Self.FInplaceNumber; + end; + inherited; +end; + +////////////////////////////// +// TPythonType + +function PythonToDelphi( obj : PPyObject ) : TPyObject; +begin + if IsDelphiObject( obj ) then + Result := TPyObject(PAnsiChar(obj)+Sizeof(PyObject)) + else + raise EPythonError.CreateFmt( 'Python object "%s" is not a Delphi class', [GetPythonEngine.PyObjectAsString(obj)] ); +end; + +procedure PyObjectDestructor( pSelf : PPyObject); cdecl; +var + call_tp_free : Boolean; + obj : TPyObject; +begin + obj := PythonToDelphi(pSelf); + call_tp_free := obj.PythonAlloc; + if PythonOk then + obj.Free; + if call_tp_free and Assigned(pSelf.ob_type) and Assigned(pSelf.ob_type^.tp_free) then + pSelf.ob_type^.tp_free(pSelf); +end; + +procedure TPythonType.Notification( AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if Operation = opRemove then + if AComponent = FModule then + FModule := nil; +end; + +procedure TPythonType.SetPyObjectClass( val : TPyObjectClass ); +begin + if val <> FPyObjectClass then + begin + if Assigned(FPyObjectClass) then + begin + ClearMethods; + ClearMembers; + ClearGetSets; + end; + FPyObjectClass := val; + if Assigned(val) then + begin + FType.tp_basicsize := val.InstanceSize + Sizeof(PyObject); + val.SetupType( Self ); + val.RegisterMethods( Self ); + val.RegisterMembers( Self ); + val.RegisterGetSets( Self ); + end; + end; +end; + +procedure TPythonType.SetModule( val : TPythonModule ); +begin + if val <> FModule then + begin + FModule := val; + if Assigned(val) then + if Initialized and not (csLoading in ComponentState) then + if val.Initialized then + AddTypeVar + else + val.AddClient(Self); + end; +end; + +procedure TPythonType.ModuleReady(Sender : TObject); +begin + inherited; + AddTypeVar; +end; + +procedure TPythonType.SetServices( val : TTypeServices ); +begin + FServices.Assign( val ); +end; + +procedure TPythonType.SetTypeName( const val : AnsiString ); +begin + if (FTypeName <> val) and (val <> '') then + begin + FTypeName := val; + end; +end; + +function TPythonType.CreateMethod( pSelf, args : PPyObject ) : PPyObject; +begin + Result := CreateInstanceWith( args ); +end; + +procedure TPythonType.ReallocGetSets; +begin + inherited; + if tpfBaseType in TypeFlags then + FType.tp_getset := GetSetData; +end; + +procedure TPythonType.ReallocMembers; +begin + inherited; + if tpfBaseType in TypeFlags then + FType.tp_members := MembersData; +end; + +procedure TPythonType.ReallocMethods; +begin + inherited; + if tpfBaseType in TypeFlags then + FType.tp_methods := MethodsData; +end; + +procedure TPythonType.SetDocString( value : TStringList ); +begin + FDocString.Assign( value ); +end; + +function TPythonType.TypeFlagsAsInt : C_ULong; +begin + Result := 0; + if tpfHeapType in TypeFlags then + Result := Result or Py_TPFLAGS_HEAPTYPE; + if tpfBaseType in TypeFlags then + Result := Result or Py_TPFLAGS_BASETYPE; + if tpfReady in TypeFlags then + Result := Result or Py_TPFLAGS_READY; + if tpfReadying in TypeFlags then + Result := Result or Py_TPFLAGS_READYING; + if tpfHaveGC in TypeFlags then + Result := Result or Py_TPFLAGS_HAVE_GC; + if tpVectorCall in TypeFlags then + Result := Result or _Py_TPFLAGS_HAVE_VECTORCALL; + if tpMethodDescriptor in TypeFlags then + Result := Result or Py_TPFLAGS_METHOD_DESCRIPTOR; + if tpHaveVersionTag in TypeFlags then + Result := Result or Py_TPFLAGS_HAVE_VERSION_TAG; + if tpValidVersionTag in TypeFlags then + Result := Result or Py_TPFLAGS_VALID_VERSION_TAG; + if tpIsAbstract in TypeFlags then + Result := Result or Py_TPFLAGS_IS_ABSTRACT; + if tpLongSubclass in TypeFlags then + Result := Result or Py_TPFLAGS_LONG_SUBCLASS; + if tpListSubClass in TypeFlags then + Result := Result or Py_TPFLAGS_LIST_SUBCLASS; + if tpTupleSubclass in TypeFlags then + Result := Result or Py_TPFLAGS_TUPLE_SUBCLASS; + if tpBytesSubclass in TypeFlags then + Result := Result or Py_TPFLAGS_BYTES_SUBCLASS; + if tpBaseExcSubclass in TypeFlags then + Result := Result or Py_TPFLAGS_BASE_EXC_SUBCLASS; + if tpTypeSubclass in TypeFlags then + Result := Result or Py_TPFLAGS_TYPE_SUBCLASS; +end; + +// Type services +// They will be all forwarded to the Delphi class that +// implements the object through the use of virtual +// methods +/////////////////////////////////////// + +// Basic services + +function TPythonType_Print( pSelf : PPyObject; var f: file; i: integer) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).Print( f, i ); +end; + +function TPythonType_GetAttr( pSelf : PPyObject; key : PAnsiChar) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).GetAttr( key ); +end; + +function TPythonType_SetAttr( pSelf : PPyObject; key : PAnsiChar; value : PPyObject) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).SetAttr( key, value ); +end; + +function TPythonType_Repr( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).Repr; +end; + +function TPythonType_Compare( pSelf, obj : PPyObject ) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).Compare( obj ); +end; + +function TPythonType_Hash( pSelf : PPyObject) : NativeInt; cdecl; +begin + Result := PythonToDelphi(pSelf).Hash; +end; + +function TPythonType_Str( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).Str; +end; + +function TPythonType_GetAttrO( pSelf, key: PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).GetAttrO( key ); +end; + +function TPythonType_SetAttrO( pSelf, key, value: PPyObject) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).SetAttrO( key, value ); +end; + +function TPythonType_Call( pSelf, ob1, ob2 : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).Call( ob1, ob2 ); +end; + +function TPythonType_Traverse( pSelf: PPyObject; proc: visitproc; ptr: Pointer) : integer; cdecl; +begin + Result := PythonToDelphi(pSelf).Traverse( proc, ptr ); +end; + +function TPythonType_Clear( pSelf: PPyObject): integer; cdecl; +begin + Result := PythonToDelphi(pSelf).Clear; +end; + +function TPythonType_RichCmp( pSelf, obj : PPyObject; i : Integer) : PPyObject; cdecl; +begin + Assert(i >= Ord(Low(TRichComparisonOpcode))); + Assert(i <= Ord(High(TRichComparisonOpcode))); + Result := PythonToDelphi(pSelf).RichCompare( obj, TRichComparisonOpcode(i) ); +end; + +function TPythonType_Iter( pSelf: PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).Iter; +end; + +function TPythonType_IterNext( pSelf: PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).IterNext; +end; + +function TPythonType_InitSubtype( pSelf, args, kwds : PPyObject) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).Init(args, kwds); +end; + +function TPythonType.NewSubtypeInst( aType: PPyTypeObject; args, kwds : PPyObject) : PPyObject; +var + obj : TPyObject; +begin + Result := aType^.tp_alloc(aType, 0); + if Assigned(Result) then + begin + obj := PythonToDelphi(Result); + PyObjectClass.InitInstance(obj); + obj.ob_type := aType; + obj.IsSubtype := aType <> @FType; + obj.PythonAlloc := True; + obj.CreateWith(Self, args); + if Engine.PyErr_Occurred <> nil then + begin + Engine.Py_DECREF(Result); + Result := nil; + end; + end; +end; + +function TPythonType_AllocSubtypeInst( pSelf: PPyTypeObject; nitems : NativeInt) : PPyObject; cdecl; +begin + Result := GetPythonEngine.PyType_GenericAlloc(pSelf, nitems); +end; + +procedure FreeSubtypeInst(ob:PPyObject); +begin + GetPythonEngine.PyObject_Free(ob); +end; + + +// Number services + +function TPythonType_NbAdd( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbAdd( obj ); +end; + +function TPythonType_NbSubtract( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbSubtract( obj ); +end; + +function TPythonType_NbMultiply( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbMultiply( obj ); +end; + +function TPythonType_NbFloorDivide( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbFloorDivide( obj ); +end; + +function TPythonType_NbTrueDivide( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbTrueDivide( obj ); +end; + +function TPythonType_NbMatrixMultiply( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbMatrixMultiply( obj ); +end; + +function TPythonType_NbRemainder( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbRemainder( obj ); +end; + +function TPythonType_NbDivmod( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbDivmod( obj ); +end; + +function TPythonType_NbPower( pSelf, ob1, ob2 : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbPower( ob1, ob2 ); +end; + +function TPythonType_NbNegative( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbNegative; +end; + +function TPythonType_NbPositive( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbPositive; +end; + +function TPythonType_NbAbsolute( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbAbsolute; +end; + +function TPythonType_NbBool( pSelf : PPyObject ) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).NbBool; +end; + +function TPythonType_NbInvert( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInvert; +end; + +function TPythonType_NbLShift( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbLShift( obj ); +end; + +function TPythonType_NbRShift( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbRShift( obj ); +end; + +function TPythonType_NbAnd( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbAnd( obj ); +end; + +function TPythonType_NbXor( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbXor( obj ); +end; + +function TPythonType_NbOr( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbOr( obj ); +end; + +function TPythonType_NbInt( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInt; +end; + +function TPythonType_NbFloat( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbFloat; +end; + +function TPythonType_NbInplaceAdd(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceAdd( obj ); +end; + +function TPythonType_NbInplaceAnd(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceAnd( obj ); +end; + +function TPythonType_NbInplaceDivide(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceDivide( obj ); +end; + +function TPythonType_NbInplaceFloorDivide( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceFloorDivide( obj ); +end; + +function TPythonType_NbInplaceTrueDivide( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceTrueDivide( obj ); +end; + +function TPythonType_NbInplaceLshift(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceLshift( obj ); +end; + +function TPythonType_NbInplaceMultiply(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceMultiply( obj ); +end; + +function TPythonType_NbInplaceOr(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceOr( obj ); +end; + +function TPythonType_NbInplaceMatrixMultiply(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceMatrixMultiply( obj ); +end; + +function TPythonType_NbInplacePower(pSelf, ob1, ob2: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplacePower( ob1, ob2 ); +end; + +function TPythonType_NbInplaceRemainder(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceRemainder( obj ); +end; + +function TPythonType_NbInplaceRshift(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceRshift( obj ); +end; + +function TPythonType_NbInplaceSubtract(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceSubtract( obj ); +end; + +function TPythonType_NbInplaceXor(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceXor( obj ); +end; + +// Sequence services + +function TPythonType_SqLength( pSelf : PPyObject ) : NativeInt; cdecl; +begin + Result := PythonToDelphi(pSelf).SqLength; +end; + +function TPythonType_SqConcat( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).SqConcat( obj ); +end; + +function TPythonType_SqRepeat( pSelf : PPyObject; val : NativeInt ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).SqRepeat( val ); +end; + +function TPythonType_SqItem( pSelf : PPyObject; idx : NativeInt ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).SqItem( idx ); +end; + +function TPythonType_SqAssItem( pSelf : PPyObject; idx : NativeInt; obj : PPyObject) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).SqAssItem( idx, obj ); +end; + +// Mapping services + +function TPythonType_MpLength( pSelf : PPyObject ) : NativeInt; cdecl; +begin + Result := PythonToDelphi(pSelf).MpLength; +end; + +function TPythonType_MpSubscript( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).MpSubscript( obj ); +end; + +function TPythonType_MpAssSubscript( pSelf, obj1, obj2 : PPyObject) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).MpAssSubscript( obj1, obj2 ); +end; + +function TPythonType_SqContains(pSelf, obj : PPyObject): integer; cdecl; +begin + Result := PythonToDelphi(pSelf).SqContains( obj ); +end; + +function TPythonType_SqInplaceConcat(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).SqInplaceConcat( obj ); +end; + +function TPythonType_SqInplaceRepeat(pSelf : PPyObject; i: NativeInt): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).SqInplaceRepeat( i ); +end; + +procedure TPythonType.InitServices; +{ Called from TPythonType.Initialize which first calls CheckEngine - FEngine is alread assigned } +begin + with FType do + begin + // Basic services + if FDocString.Count > 0 then + with Engine do + begin + FCurrentDocString := EncodeString(CleanString(FDocString.Text, False)); + tp_doc := PAnsiChar(FCurrentDocString); + end; + tp_dealloc := @PyObjectDestructor; + if bsGetAttr in Services.Basic then + tp_getattr := TPythonType_GetAttr; + if bsSetAttr in Services.Basic then + tp_setattr := TPythonType_SetAttr; + if bsRepr in Services.Basic then + tp_repr := TPythonType_Repr; + if bsStr in Services.Basic then + tp_str := TPythonType_Str; + if bsHash in Services.Basic then + tp_hash := TPythonType_Hash; + if bsGetAttrO in Services.Basic then + tp_getattro := TPythonType_GetAttrO; + if bsSetAttrO in Services.Basic then + tp_setattro := TPythonType_SetAttrO; + if bsCall in Services.Basic then + tp_call := TPythonType_Call; + if bsTraverse in Services.Basic then + tp_traverse := TPythonType_Traverse; + if bsClear in Services.Basic then + tp_clear := TPythonType_Clear; + if bsRichCompare in Services.Basic then + tp_richcompare := TPythonType_RichCmp; + if bsIter in Services.Basic then + tp_iter := TPythonType_Iter; + if bsIterNext in Services.Basic then + tp_iternext := TPythonType_IterNext; + if tpfBaseType in TypeFlags then + begin + tp_init := TPythonType_InitSubtype; + tp_alloc := TPythonType_AllocSubtypeInst; + tp_new := GetCallBack( Self, @TPythonType.NewSubtypeInst, 3, ctCDECL); + tp_free := FreeSubtypeInst; + tp_methods := MethodsData; + tp_members := MembersData; + tp_getset := GetSetData; + end; + + // Number services + if Services.Number <> [] then + begin + tp_as_number := @FNumber; + + with FNumber do + begin + if nsAdd in Services.Number then nb_add := TPythonType_NbAdd; // #3.1 + if nsSubtract in Services.Number then nb_subtract := TPythonType_NbSubtract; // #3.2 + if nsMultiply in Services.Number then nb_multiply := TPythonType_NbMultiply; // #3.3 + if nsFloorDivide in Services.Number then nb_floor_divide := TPythonType_NbFloorDivide; // #3.30 + if nsTrueDivide in Services.Number then nb_true_divide := TPythonType_NbTrueDivide; // #3.31 + if (nsMatrixMultiply in Services.Number) and ((FEngine.MajorVersion > 3) + or ((FEngine.MajorVersion = 3) and (FEngine.MinorVersion >= 5))) + then + nb_matrix_multiply := TPythonType_NbMatrixMultiply; // #3.35 + if nsRemainder in Services.Number then nb_remainder := TPythonType_NbRemainder; // #3.4 + if nsDivmod in Services.Number then nb_divmod := TPythonType_NbDivmod; // #3.5 + if nsPower in Services.Number then nb_power := TPythonType_NbPower; // #3.6 + if nsNegative in Services.Number then nb_negative := TPythonType_NbNegative; // #3.7 + if nsPositive in Services.Number then nb_positive := TPythonType_NbPositive; // #3.8 + if nsAbsolute in Services.Number then nb_absolute := TPythonType_NbAbsolute; // #3.9 + if nsBool in Services.Number then nb_bool := TPythonType_NbBool; // #3.10 + if nsInvert in Services.Number then nb_invert := TPythonType_NbInvert; // #3.11 + if nsLShift in Services.Number then nb_lshift := TPythonType_NbLShift; // #3.12 + if nsRShift in Services.Number then nb_rshift := TPythonType_NbRShift; // #3.13 + if nsAnd in Services.Number then nb_and := TPythonType_NbAnd; // #3.14 + if nsXor in Services.Number then nb_xor := TPythonType_NbXor; // #3.15 + if nsOr in Services.Number then nb_or := TPythonType_NbOr; // #3.16 + if nsInt in Services.Number then nb_int := TPythonType_NbInt; // #3.17 + if nsFloat in Services.Number then nb_float := TPythonType_NbFloat; // #3.19 + if nsInplaceAdd in Services.InplaceNumber then nb_inplace_add := TPythonType_NbInplaceAdd; // #3.20 + if nsInplaceSubtract in Services.InplaceNumber then nb_inplace_subtract := TPythonType_NbInplaceSubtract; // #3.21 + if nsInplaceMultiply in Services.InplaceNumber then nb_inplace_multiply := TPythonType_NbInplaceMultiply; // #3.22 + if nsInplaceFloorDivide in Services.InplaceNumber then nb_inplace_floor_divide := TPythonType_NbInplaceFloorDivide; // #3.32 + if nsInplaceTrueDivide in Services.InplaceNumber then nb_inplace_true_divide := TPythonType_NbInplaceTrueDivide; // #3.33 + if nsInplaceRemainder in Services.InplaceNumber then nb_inplace_remainder := TPythonType_NbInplaceRemainder; // #3.23 + if nsInplacePower in Services.InplaceNumber then nb_inplace_power := TPythonType_NbInplacePower; // #3.24 + if nsInplaceLShift in Services.InplaceNumber then nb_inplace_lshift := TPythonType_NbInplaceLShift; // #3.25 + if nsInplaceRShift in Services.InplaceNumber then nb_inplace_rshift := TPythonType_NbInplaceRShift; // #3.26 + if nsInplaceAnd in Services.InplaceNumber then nb_inplace_and := TPythonType_NbInplaceAnd; // #3.27 + if nsInplaceXor in Services.InplaceNumber then nb_inplace_xor := TPythonType_NbInplaceXor; // #3.28 + if nsInplaceOr in Services.InplaceNumber then nb_inplace_or := TPythonType_NbInplaceOr; // #3.29 + if (nsInplaceMatrixMultiply in Services.InplaceNumber) and + ((FEngine.MajorVersion > 3) or ((FEngine.MajorVersion = 3) + and (FEngine.MinorVersion >= 5))) + then + nb_inplace_matrix_multiply := TPythonType_NbInplaceMatrixMultiply; // #3.36 + end; + end; + + // Sequence services + if Services.Sequence <> [] then + begin + tp_as_sequence := @FSequence; + + with FSequence do + begin + if ssLength in Services.Sequence then + sq_length := TPythonType_SqLength; + if ssConcat in Services.Sequence then + sq_concat := TPythonType_SqConcat; + if ssRepeat in Services.Sequence then + sq_repeat := TPythonType_SqRepeat; + if ssItem in Services.Sequence then + sq_item := TPythonType_SqItem; + if ssAssItem in Services.Sequence then + sq_ass_item := TPythonType_SqAssItem; + if ssContains in Services.Sequence then + sq_contains := TPythonType_SqContains; + if ssInplaceConcat in Services.Sequence then + sq_inplace_concat := TPythonType_SqInplaceConcat; + if ssInplaceRepeat in Services.Sequence then + sq_inplace_repeat := TPythonType_SqInplaceRepeat; + end; + end; + + // Mapping services + if Services.Mapping <> [] then + begin + tp_as_mapping := @FMapping; + + with FMapping do + begin + if msLength in Services.Mapping then + mp_length := TPythonType_MpLength; + if msSubScript in Services.Mapping then + mp_subscript := TPythonType_MpSubscript; + if msAssSubscript in Services.Mapping then + mp_ass_subscript := TPythonType_MpAssSubscript; + end; + end; + end; +end; + +// Public methods + +constructor TPythonType.Create( AOwner : TComponent ); +begin + inherited; + FPrefix := 'Create'; + FServices := TTypeServices.Create; + FDocString := TStringList.Create; + FTypeFlags := TPFLAGS_DEFAULT; + FGenerateCreateFunction := True; +end; + +destructor TPythonType.Destroy; +begin + if gVarType = Self then + gVarType := nil; + FDocString.Free; + FServices.Free; + inherited; +end; + +function TPythonType.GetTypePtr : PPyTypeObject; +begin + Result := PPyTypeObject(@FType); +end; + +procedure TPythonType.Initialize; +begin + CheckEngine; + with Engine, FType do + begin + ob_type := PPyTypeObject(PyType_Type); + ob_refcnt := 1; + tp_name := PAnsiChar(FTypeName); + tp_flags := TypeFlagsAsInt; + end; + if Assigned(FModule) then + begin + if Module.Initialized then + AddTypeVar + else + Module.AddClient( Self ); + end; + InitServices; + inherited; +end; + +procedure TPythonType.Finalize; +begin + Engine.Py_XDECREF(FCreateFunc); + FCreateFunc := nil; + inherited; +end; + +function TPythonType.CreateInstance : PPyObject; +var + obj : TPyObject; +begin + CheckEngine; + with Engine do + begin + obj := PyObjectClass.Create( Self ); + obj.ob_type := @FType; + if PyErr_Occurred <> nil then + begin + obj.Free; + Result := nil; + end + else + Result := obj.GetSelf; + end; +end; + +function TPythonType.CreateInstanceWith( args : PPyObject ) : PPyObject; +var + obj : TPyObject; +begin + CheckEngine; + with Engine do + begin + obj := PyObjectClass.CreateWith( Self, args ); + obj.ob_type := @FType; + if PyErr_Occurred <> nil then + begin + obj.Free; + Result := nil; + end + else + Result := obj.GetSelf; + end; +end; + +procedure TPythonType.AddTypeVar; +var + d : PPyObject; + meth : TDelphiMethod; +begin + CheckEngine; + Assert(Module <> nil); + Assert(Module.Module <> nil); + if FGenerateCreateFunction then + begin + FCreateFuncName := FPrefix+FTypeName; + FCreateFuncDoc := AnsiString(Format('Creates a new instance of type %s', [TypeName])); + if not Assigned(FCreateFunc) then + begin + meth := CreateMethod; + FCreateFuncDef.ml_name := PAnsiChar(FCreateFuncName); + FCreateFuncDef.ml_meth := GetOfObjectCallBack( TCallBack(meth), 2, ctCDECL); + FCreateFuncDef.ml_flags := METH_VARARGS; + FCreateFuncDef.ml_doc := PAnsiChar(FCreateFuncDoc); + FCreateFunc := Engine.PyCFunction_NewEx(@FCreateFuncDef, nil, nil) + end; + Assert(Assigned(FCreateFunc)); + end; + with Engine do + begin + d := PyModule_GetDict( Module.Module ); + Assert(Assigned(d)); + PyDict_SetItemString( d, PAnsiChar(TypeName), PPyObject(TheTypePtr) ); + if FGenerateCreateFunction then + PyDict_SetItemString( d, PAnsiChar(FCreateFuncName), FCreateFunc ); + end; +end; + +function TPythonType.GetMembersStartOffset : Integer; +begin + Result := Sizeof(PyObject); +end; + +(*******************************************************) +(** **) +(** class TPythonDelphiVar **) +(** **) +(*******************************************************) + +procedure TPythonDelphiVar.CreateVarType; +begin + if not Assigned(gVarType) then + begin + gVarType := TPythonType.Create( Self.Engine ); + with gVarType do + begin + TypeName := 'PythonDelphiVar'; + Engine := Self.Engine; + PyObjectClass := TPyVar; + Initialize; + end; + end; +end; + +procedure TPythonDelphiVar.CreateVar; +var + v : TPyVar; + m, d : PPyObject; +begin + if not Assigned(Engine) then + Exit; + Assert(Assigned(gVarType), 'missing TPythonType for TPythonDelphiVar'); + with Engine do + begin + // Create an instance of PythonDelphiVar + FVarObject := gVarType.CreateInstance; + CheckError(False); + v := TPyVar(PythonToDelphi(FVarObject)); + v.dv_component := Self; + // Add a reference to this var in the module + m := PyImport_AddModule(PAnsiChar(Module)); + if m = nil then + raise EPythonError.CreateFmt('CreateVar: can''t create module "%s"', [Module]); + d := PyModule_GetDict(m); + if @PyDict_SetItemString = nil then + raise Exception.Create('nil'); + PyDict_SetItemString( d, PAnsiChar(VarName), FVarObject ); + end; +end; + +function TPythonDelphiVar.GetValue : Variant; +begin + if Assigned( FVarObject ) then + with TPyVar(PythonToDelphi(FVarObject)) do + Result := GetValueAsVariant + else + raise Exception.Create('No variable was created' ); +end; + +procedure TPythonDelphiVar.SetValue( const val : Variant ); +begin + if Assigned( FVarObject ) then + with TPyVar(PythonToDelphi(FVarObject)) do + SetValueFromVariant(val) + else + raise Exception.Create('No variable was created' ); +end; + +// Warning: GetValueAsPyObject returns a preincremented object ! +function TPythonDelphiVar.GetValueAsPyObject : PPyObject; +begin + if Assigned( FVarObject ) then + with TPyVar(PythonToDelphi(FVarObject)) do + Result := GetValue + else + raise Exception.Create('No variable was created' ); +end; + +procedure TPythonDelphiVar.SetValueFromPyObject( val : PPyObject ); +begin + if Assigned( FVarObject ) then + with TPyVar(PythonToDelphi(FVarObject)) do + SetValue(val) + else + raise Exception.Create('No variable was created' ); +end; + +function TPythonDelphiVar.IsVariantOk( const v : Variant ) : Boolean; +var + t : Integer; +begin + t := VarType(v) and VarTypeMask; + Result := (t = varSmallint) or + (t = varInteger) or + (t = varSingle) or + (t = varDouble) or + (t = varCurrency) or + (t = varDate) or + (t = varOleStr) or + (t = varBoolean) or + (t = varByte) or + //(t = varUString) or + (t = varString); +end; + +function TPythonDelphiVar.GetValueAsString : string; +var + v : Variant; + obj : PPyObject; +begin + v := Value; + if IsVariantOk( v ) then + Result := v + else + begin + CheckEngine; + obj := GetValueAsPyObject; + try + Result := Engine.PyObjectAsString( obj ); + finally + Engine.Py_XDecRef(obj); + end; + end; +end; + +procedure TPythonDelphiVar.SetVarName( const val : AnsiString ); + + procedure CheckVarName; + var + i : Integer; + begin + if Owner = nil then Exit; + if (val = FVarName) or (val = '') then Exit; + for i := 0 to Owner.ComponentCount - 1 do + if Owner.Components[i] is TPythonDelphiVar then + with TPythonDelphiVar(Owner.Components[i]) do + if (VarName = val) and (Module = Self.Module) then + raise Exception.CreateFmt('A variable "%s" already exists in the module "%s"',[val, Module]); + end; + +begin + if val <> FVarName then + begin + CheckVarName; + FVarName := val; + end; +end; + +constructor TPythonDelphiVar.Create( AOwner : TComponent ); + + procedure AdjustName; + var + i, cpt : Integer; + done : Boolean; + begin + if AOwner = nil then Exit; + cpt := 1; + done := False; + while not done do + begin + done := True; + for i := 0 to AOwner.ComponentCount - 1 do + if AOwner.Components[i] is TPythonDelphiVar then + with TPythonDelphiVar(AOwner.Components[i]) do + if (VarName = Self.FVarName+AnsiString(IntToStr(cpt))) and + (Module = Self.Module) then + begin + Inc(cpt); + done := False; + Break; + end; + end; + FVarName := FVarName + AnsiString(IntToStr(cpt)); + end; + +begin + inherited; + FModule := '__main__'; + FVarName := 'varname'; + if csDesigning in ComponentState then + AdjustName; +end; + +procedure TPythonDelphiVar.Initialize; +begin + if csDesigning in ComponentState then + Exit; + CheckEngine; + CreateVarType; + CreateVar; + inherited; +end; + +procedure TPythonDelphiVar.Finalize; +begin + inherited; + if not PythonOK then + Exit; + if Assigned(FVarObject) then + with TPyVar(PythonToDelphi(FVarObject)) do + begin + dv_component := nil; + SetValue( nil ); + end; + with Engine do + Py_XDECREF( FVarObject ); + FVarObject := nil; +end; + + +constructor TPyVar.Create( APythonType : TPythonType ); +begin + inherited; +end; + +// Don't call the Create constructor of TPyVar, because +// we call the inherited constructor CreateWith that calls +// the Create constructor first, and because the constructors +// are virtual, TPyVar.Create will be automatically be called. + +constructor TPyVar.CreateWith( APythonType : TPythonType; args : PPyObject ); +begin + inherited; + with GetPythonEngine do + begin + if PyArg_ParseTuple( args, 'O:CreateVar',@dv_object ) = 0 then + exit; + end; +end; + +destructor TPyVar.Destroy; +begin + with GetPythonEngine do + begin + if Assigned(dv_object) then + begin + Py_DecRef(dv_object); + dv_object := nil; + end; + end; + inherited; +end; + +// Then we override the needed services + +function TPyVar.GetAttrO( key: PPyObject) : PPyObject; +begin + with GetPythonEngine do + begin + if CompareText( PyObjectAsString(key), 'Value') = 0 then + Result := GetValue + else + Result := inherited GetAttrO(key); + end; +end; + +function TPyVar.SetAttrO( key, value: PPyObject) : Integer; +begin + Result := 0; + with GetPythonEngine do + begin + if CompareText( PyObjectAsString(key), 'Value' ) = 0 then + SetValue( value ) + else + Result := inherited SetAttrO(key, value); + end; +end; + +function TPyVar.Repr : PPyObject; +var + obj : PPyObject; +begin + with GetPythonEngine do + begin + obj := GetValue; + try + Result := + PyUnicodeFromString(Format('<%s: %s>', + [PythonType.TypeName, PyObjectAsString(obj)])); + finally + Py_XDecRef(obj); + end; + end; +end; + +// Class methods +// We register the methods of our type + +class procedure TPyVar.RegisterMethods( APythonType : TPythonType ); +begin + inherited; + with APythonType do + begin + //AddMethod( 'OffsetBy', @TPyPoint.DoOffsetBy, 'Point.OffsetBy( dx, dy )' ); + end; +end; + +// Methods of TPyVar + + +// Warning: GetValue returns a preincremented object ! +function TPyVar.GetValue : PPyObject; +var + v : Variant; +begin + Result := nil; + with GetPythonEngine do + begin + if Assigned( dv_component ) and + (@dv_component.OnExtGetData <> nil) then + begin + dv_component.OnExtGetData( dv_component, Result ); + end + else if Assigned( dv_component ) and + (@dv_component.OnGetData <> nil) then + begin + dv_component.OnGetData( dv_component, v ); + Result := VariantAsPyObject(v); + end + else if Assigned(dv_object) then + begin + Result := dv_object; + Py_XIncRef(Result); + end; + if Result = nil then + Result := ReturnNone; + end; +end; + +function TPyVar.GetValueAsVariant : Variant; +var + obj : PPyObject; +begin + with GetPythonEngine do + begin + obj := GetValue; + try + try + Result := PyObjectAsVariant( obj ); + except + Result := PyObjectAsString(obj); + end; + finally + Py_XDecRef(obj); + end; + end; +end; + +procedure TPyVar.SetValue( value : PPyObject ); +begin + with GetPythonEngine do + begin + if Assigned( dv_component ) and + (@dv_component.OnExtSetData <> nil) then + begin + dv_component.OnExtSetData( dv_component, value); + end + else if Assigned( dv_component ) and + (@dv_component.OnSetData <> nil) then + begin + dv_component.OnSetData( dv_component, PyObjectAsVariant(value) ); + end; + Py_XDecRef(dv_object); + dv_object := value; + Py_XIncRef(dv_object); + if Assigned( dv_component ) and + (@dv_component.OnChange <> nil) then + dv_component.OnChange( dv_component ); + end; +end; + +procedure TPyVar.SetValueFromVariant( const value : Variant ); +var + obj : PPyObject; +begin + with GetPythonEngine do + begin + obj := VariantAsPyObject( value ); + SetValue(obj); + Py_XDecRef(obj); + end; +end; + +(*******************************************************) +(** **) +(** class TPythonThread **) +(** **) +(*******************************************************) + +procedure TPythonThread.Execute; +var + global_state : PPyThreadState; + gilstate : PyGILState_STATE; +begin + with GetPythonEngine do + begin + if fThreadExecMode = emNewState then + begin + gilstate := PyGILState_Ensure(); + try + fThreadState := GetThreadState; + ExecuteWithPython; + finally + PyGILState_Release(gilstate); + end; + end else {fThreadExecMode} + begin + gilstate := PyGILState_Ensure(); + global_state := PyThreadState_Get; + PyThreadState_Swap(nil); + fThreadState := Py_NewInterpreter; + + if Assigned( fThreadState) then + begin + PyThreadState_Swap(fThreadState); + ExecuteWithPython; + Py_EndInterpreter( fThreadState); + PyThreadState_Swap(global_state); + PyGILState_Release(gilstate); + end else + raise EPythonError.Create( 'Could not create a new thread state'); + end; {withinterp} + end; +end; + + +class procedure TPythonThread.Py_Begin_Allow_Threads; +begin + with GetPythonEngine do + // f_savethreadstate := PyEval_SaveThread; +end; + +class procedure TPythonThread.Py_End_Allow_Threads; +begin + with GetPythonEngine do + //PyEval_RestoreThread(f_savethreadstate); +end; + +class procedure TPythonThread.Py_Begin_Block_Threads; +begin + Py_End_Allow_Threads; +end; + +class procedure TPythonThread.Py_Begin_Unblock_Threads; +begin + Py_Begin_Allow_Threads; +end; + +(*******************************************************) +(** **) +(** Methods for new Python objects or modules **) +(** **) +(*******************************************************) + +///////////////////////////////////////////////////////// +// Module pyio for Python Input/Outputs +// + +function pyio_write(self, args : PPyObject) : PPyObject; +var + a1 : PPyObject; +begin + // Forbid printing for any other thread than the main one + {$IFNDEF FPC} + if GetCurrentThreadId <> MainThreadId then + with GetPythonEngine do + begin + if RedirectIO and (IO <> nil) and (IO.ClassName <> 'TPythonInputOutput') and not IO.DelayWrites then + begin + Result := GetPythonEngine.ReturnNone; + Exit; + end; + end; + {$ENDIF} + with GetPythonEngine do + begin + if Assigned(args) and (PyTuple_Size(args) > 0) then + begin + a1 := PyTuple_GetItem(args, 0); + if RedirectIO and (IO <> nil) and Assigned(a1) then + begin + {if PyUnicode_Check(a1) then fix for IO fix + IO.Write(PyUnicodeAsString(a1)) + else } + IO.Write(IOString(PyObjectAsString(a1))); + end; + Result := ReturnNone; + end + else + begin + PyErr_BadArgument; + Result := nil; + end; + end; +end; + +function pyio_read(self, args : PPyObject) : PPyObject; +var + txt : AnsiString; + Widetxt : UnicodeString; +begin + with GetPythonEngine do + begin + if RedirectIO then + begin + txt := ''; + if Assigned(IO) then + if IO.UnicodeIO then begin + Widetxt := IO.ReceiveUniData; + if PyErr_Occurred <> nil then + Result := nil + else + Result := PyUnicodeFromString(Widetxt); + end else begin + txt := IO.ReceiveData; + if PyErr_Occurred <> nil then + Result := nil + else + Result := PyUnicodeFromString(txt); + end + else + Result := PyUnicodeFromString(txt); + end + else + Result := ReturnNone; + end; +end; + +function pyio_SetDelayWrites(self, args : PPyObject) : PPyObject; +var + val : Integer; +begin + with GetPythonEngine do + begin + if PyArg_ParseTuple( args, 'i:SetDelayWrites',@val ) <> 0 then + begin + if IO <> nil then + IO.DelayWrites := val <> 0; + Result := ReturnNone; + end + else + Result := nil; + end; +end; + +function pyio_SetMaxLines(self, args : PPyObject) : PPyObject; +var + val : Integer; +begin + with GetPythonEngine do + begin + if PyArg_ParseTuple( args, 'i:SetMaxLines',@val ) <> 0 then + begin + if IO <> nil then + IO .MaxLines := val; + Result := ReturnNone; + end + else + Result := nil; + end; +end; + +// With no args, it will look at all types +// With args, it will look only at the types listed in the args. + +// It returns a list of tuples. Each tuple contains: +// the Type name, the InstanceCount, the CreateHits and the DeleteHits + +function pyio_GetTypesStats(self, args : PPyObject) : PPyObject; + + function HandleType( T : TPythonType ) : PPyObject; + begin + with GetPythonEngine do + begin + Result := PyTuple_New(4); + PyTuple_SetItem( Result, 0, PyUnicodeFromString(T.TypeName)); + PyTuple_SetItem( Result, 1, PyLong_FromLong(T.InstanceCount) ); + PyTuple_SetItem( Result, 2, PyLong_FromLong(T.CreateHits) ); + PyTuple_SetItem( Result, 3, PyLong_FromLong(T.DeleteHits) ); + end; + end; + + function FindType( const TName : AnsiString ) : TPythonType; + var + i : Integer; + begin + Result := nil; + with GetPythonEngine do + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonType then + with TPythonType(Clients[i]) do + if TypeName = TName then + begin + Result := TPythonType(Clients[i]); + Break; + end; + end; + +var + i : Integer; + T : TPythonType; + obj : PPyObject; + str : AnsiString; +begin + with GetPythonEngine do + begin + Result := PyList_New(0); + if PyTuple_Size(args) > 0 then + for i := 0 to PyTuple_Size(args)-1 do + begin + str := AnsiString(PyObjectAsString( PyTuple_GetItem(args, i) )); + T := FindType( str ); + if Assigned(T) then + begin + obj := HandleType( T ); + PyList_Append( Result, obj ); + Py_XDecRef(obj); + end; + end + else + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonType then + begin + obj := HandleType( TPythonType(Clients[i]) ); + PyList_Append( Result, obj ); + Py_XDecRef(obj); + end; + end; +end; + + +(*******************************************************) +(** **) +(** Global procedures **) +(** **) +(*******************************************************) + +function GetPythonEngine : TPythonEngine; +begin + if not Assigned( gPythonEngine ) then + raise Exception.Create( 'No Python engine was created' ); + if not gPythonEngine.Finalizing and not gPythonEngine.Initialized then + raise Exception.Create( 'The Python engine is not properly initialized' ); + Result := gPythonEngine; +end; + +function PythonOK : Boolean; +begin + Result := Assigned( gPythonEngine ) and + (gPythonEngine.Initialized or gPythonEngine.Finalizing); +end; + +function IsDelphiObject( obj : PPyObject ) : Boolean; +var + t : PPyTypeObject; +begin + Result := False; + // Here's a simple trick: we compare the object destructor to + // our special destructor for Delphi objects, or + // we check if one of the parent types of obj has a Delphi destructor. + if Assigned(obj) then + begin + t := obj^.ob_type; + while Assigned(t) do + begin + if @t^.tp_dealloc = @PyObjectDestructor then + begin + Result := True; + Break; + end; + t := t^.tp_base; + end; + end; +end; + +procedure Register; +begin + RegisterComponents('Python',[ TPythonEngine, TPythonInputOutput, + TPythonType, TPythonModule, TPythonDelphiVar]); +end; + +function SysVersionFromDLLName(const DLLFileName : string): string; +var + Minor, Major: integer; +begin + PythonVersionFromDLLName(DLLFileName, Major, Minor); + Result := Format('%d.%d', [Major, Minor]); +end; + +function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean; +begin + //(((t)->tp_flags & (f)) != 0) + Result := (((AType)^.tp_flags and (AFlag)) <> 0); +end; + +procedure MaskFPUExceptions(ExceptionsMasked : boolean; + MatchPythonPrecision : Boolean); +begin + {$IF Defined(CPUX86) or Defined(CPUX64)} + if ExceptionsMasked then + SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, + exOverflow, exUnderflow, exPrecision]) + else + SetExceptionMask([exDenormalized, exUnderflow, exPrecision]); + {$WARN SYMBOL_PLATFORM OFF} + {$IF Defined(FPC) or Defined(MSWINDOWS)} + if MatchPythonPrecision then + SetPrecisionMode(pmDouble) + else + SetPrecisionMode(pmExtended); + {$WARN SYMBOL_PLATFORM ON} + {$IFEND} + {$IFEND} +end; + +function CleanString(const s : AnsiString; AppendLF : Boolean) : AnsiString; +var + i : Integer; +begin + result := s; + if s = '' then + Exit; + i := Pos(AnsiString(CR),s); + while i > 0 do + begin + Delete( result, i, 1 ); + i := PosEx(AnsiString(CR),result, i); //fix + end; + if AppendLF and (result[length(result)] <> LF) then + Result := Result + LF; +end; + +(* +function CleanString(const s : UnicodeString; AppendLF : Boolean) : UnicodeString; +begin + {$IFDEF FPC} + Result := UnicodeString(AdjustLineBreaks(AnsiString(s), tlbsLF)); + {$ELSE} + Result := AdjustLineBreaks(s, tlbsLF); + {$ENDIF} + if AppendLF and (result[length(result)] <> LF) then + Result := Result + LF; +end; *) + +{$IFDEF MSWINDOWS} +function IsPythonVersionRegistered(PythonVersion : string; + out InstallPath: string; out AllUserInstall: Boolean) : Boolean; + // Python provides for All user and Current user installations + // All User installations place the Python DLL in the Windows System directory + // and write registry info to HKEY_LOCAL_MACHINE + // Current User installations place the DLL in the install path and + // the registry info in HKEY_CURRENT_USER. + // Hence, for Current user installations we need to try and find the install path + // since it may not be on the system path. + + // The above convension was changed in Python 3.5. Now even for all user + // installations the dll is located at the InstallPath. + // Also from version 3.5 onwards 32 bit version have a suffix -32 e.g. "3.6-32" + // See also PEP 514 + +var + key: string; + VersionSuffix: string; + MajorVersion : integer; + MinorVersion : integer; +begin + Result := False; + InstallPath := ''; + AllUserInstall := False; + MajorVersion := StrToInt(PythonVersion[1]); + MinorVersion := StrToInt(PythonVersion[3]); + VersionSuffix := ''; +{$IFDEF CPUX86} + if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 5)) then + VersionSuffix := '-32'; +{$ENDIF} + key := Format('\Software\Python\PythonCore\%s%s\InstallPath', [PythonVersion, VersionSuffix]); + + // First try HKEY_CURRENT_USER as per PEP514 + try + with TRegistry.Create(KEY_READ and not KEY_NOTIFY) do + try + RootKey := HKEY_CURRENT_USER; + if OpenKey(Key, False) then begin + InstallPath := ReadString(''); + Result := True; + Exit; + end; + finally + Free; + end; + except + end; + + //Then try for an all user installation + try + with TRegistry.Create(KEY_READ and not KEY_NOTIFY) do + try + RootKey := HKEY_LOCAL_MACHINE; + if OpenKey(Key, False) then begin + AllUserInstall := True; + if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 5)) then + InstallPath := ReadString(''); + Result := True; + end; + finally + Free; + end; + except + end; +end; +{$ENDIF} + +procedure PythonVersionFromDLLName(LibName: string; out MajorVersion, MinorVersion: integer); +//Windows: 'c:\some\path\python310.dll' +//Linux: '/some/path/libpython3.10m.so' +const + cPython = 'python'; + DefaultMajor = 3; + DefaultMinor = 4; +var + NPos: integer; + ch: char; +begin + MajorVersion:= DefaultMajor; + MinorVersion:= DefaultMinor; + LibName:= LowerCase(ExtractFileName(LibName)); //strip path + NPos:= Pos(cPython, LibName); + if NPos=0 then exit; + Inc(NPos, Length(cPython)); + if NPos>Length(LibName) then exit; + ch:= LibName[NPos]; + case ch of + '2'..'5': //support major versions 2...5 + MajorVersion:= StrToIntDef(ch, DefaultMajor); + else + exit; + end; + Delete(LibName, 1, NPos); + if LibName='' then exit; + case LibName[1] of + '.': //Unix name with dot + Delete(LibName, 1, 1); + '0'..'9': //Windows name w/o dot + begin end; + else //unknown char after major version + exit; + end; + //strip file extension and handle 'libpython3.10m.so' + for NPos:= 1 to Length(LibName) do + begin + case LibName[NPos] of + '.', 'a'..'z': + begin + SetLength(LibName, NPos-1); + Break + end; + end; + end; + //the rest is minor version number '0'...'999' + MinorVersion:= StrToIntDef(LibName, DefaultMinor); +end; + + +end. + diff --git a/Source/PythonEngine_mX5.pas b/Source/PythonEngine_mX5.pas new file mode 100644 index 00000000..494d2aae --- /dev/null +++ b/Source/PythonEngine_mX5.pas @@ -0,0 +1,10384 @@ +(**************************************************************************) +(* This unit is part of the Python for Delphi (P4D) library *) +(* Project home: https://github.com/pyscripter/python4delphi *) +(* *) +(* Project Maintainer: PyScripter (pyscripter@gmail.com) *) +(* Original Authors: Dr. Dietmar Budelsky (dbudelsky@web.de) *) +(* Morgan Martinet (https://github.com/mmm-experts) *) +(* Core developer: Lucas Belo (lucas.belo@live.com) *) +(* Contributors: See contributors.md at project home *) +(* *) +(* LICENCE and Copyright: MIT (see project home) *) +(**************************************************************************) + +{$I Definition.Inc} +{$POINTERMATH ON} + +unit PythonEngine; + +{ TODO -oMMM : implement Attribute descriptor and subclassing stuff } + +{$IFNDEF FPC} + {$IFNDEF DELPHIXE2_OR_HIGHER} + Error! Delphi XE2 or higher is required! + {$ENDIF} +{$ENDIF} + +{$IF defined(LINUX) or (defined(BSD) and not defined(DARWIN)) or defined(SOLARIS) or defined(HAIKU)} + {$define _so_files} +{$IFEND} + +interface + +uses + Types, +{$IFDEF MSWINDOWS} + Windows, +{$ELSE} +{$IFDEF FPC} + Dl, + DynLibs, +{$ELSE} + Posix.DLfcn, + Posix.Pthread, +{$ENDIF} +{$ENDIF} + Classes, + SysUtils, + SyncObjs, + Variants, + MethodCallBack; + +{$IF not Defined(FPC) and (CompilerVersion >= 23)} +const + {$IF CompilerVersion >= 33} + pidSupportedPlatforms = pidAllPlatforms; + {$ELSE} + pidSupportedPlatforms = pidWin32 or pidWin64 or pidOSX32; + {$IFEND} +{$IFEND} + + +//####################################################### +//## ## +//## PYTHON specific constants ## +//## ## +//####################################################### + +type + TPythonVersionProp = record + DllName : string; + RegVersion : string; + APIVersion : Integer; + end; +const +{$IFDEF MSWINDOWS} + PYTHON_KNOWN_VERSIONS: array[1..7] of TPythonVersionProp = + ( + (DllName: 'python38.dll'; RegVersion: '3.8'; APIVersion: 1013), + (DllName: 'python39.dll'; RegVersion: '3.9'; APIVersion: 1013), + (DllName: 'python310.dll'; RegVersion: '3.10'; APIVersion: 1013), + (DllName: 'python311.dll'; RegVersion: '3.11'; APIVersion: 1013), + (DllName: 'python312.dll'; RegVersion: '3.12'; APIVersion: 1013), + (DllName: 'python313.dll'; RegVersion: '3.13'; APIVersion: 1013), + (DllName: 'python314.dll'; RegVersion: '3.14'; APIVersion: 1013) + ); +{$ENDIF} +{$IFDEF _so_files} + PYTHON_KNOWN_VERSIONS: array[1..7] of TPythonVersionProp = + ( + (DllName: 'libpython3.8.so'; RegVersion: '3.8'; APIVersion: 1013), + (DllName: 'libpython3.9.so'; RegVersion: '3.9'; APIVersion: 1013), + (DllName: 'libpython3.10.so'; RegVersion: '3.10'; APIVersion: 1013), + (DllName: 'libpython3.11.so'; RegVersion: '3.11'; APIVersion: 1013), + (DllName: 'libpython3.12.so'; RegVersion: '3.12'; APIVersion: 1013), + (DllName: 'libpython3.13.so'; RegVersion: '3.13'; APIVersion: 1013), + (DllName: 'libpython3.14.so'; RegVersion: '3.14'; APIVersion: 1013) + ); +{$ENDIF} +{$IFDEF DARWIN} + PYTHON_KNOWN_VERSIONS: array[1..7] of TPythonVersionProp = + ( + (DllName: 'libpython3.8.dylib'; RegVersion: '3.8'; APIVersion: 1013), + (DllName: 'libpython3.9.dylib'; RegVersion: '3.9'; APIVersion: 1013), + (DllName: 'libpython3.10.dylib'; RegVersion: '3.10'; APIVersion: 1013), + (DllName: 'libpython3.11.dylib'; RegVersion: '3.11'; APIVersion: 1013), + (DllName: 'libpython3.12.dylib'; RegVersion: '3.12'; APIVersion: 1013), + (DllName: 'libpython3.13.dylib'; RegVersion: '3.13'; APIVersion: 1013), + (DllName: 'libpython3.14.dylib'; RegVersion: '3.14'; APIVersion: 1013) + ); +{$ENDIF} +{$IFDEF ANDROID} + PYTHON_KNOWN_VERSIONS: array[1..7] of TPythonVersionProp = + ( + (DllName: 'libpython3.8.so'; RegVersion: '3.8'; APIVersion: 1013), + (DllName: 'libpython3.9.so'; RegVersion: '3.9'; APIVersion: 1013), + (DllName: 'libpython3.10.so'; RegVersion: '3.10'; APIVersion: 1013), + (DllName: 'libpython3.11.so'; RegVersion: '3.11'; APIVersion: 1013), + (DllName: 'libpython3.12.so'; RegVersion: '3.12'; APIVersion: 1013), + (DllName: 'libpython3.13.so'; RegVersion: '3.13'; APIVersion: 1013), + (DllName: 'libpython3.14.so'; RegVersion: '3.14'; APIVersion: 1013) + ); +{$ENDIF} + + COMPILED_FOR_PYTHON_VERSION_INDEX = High(PYTHON_KNOWN_VERSIONS); + + PYT_METHOD_BUFFER_INCREASE = 10; + PYT_MEMBER_BUFFER_INCREASE = 10; + PYT_GETSET_BUFFER_INCREASE = 10; + + METH_VARARGS = $0001; + METH_KEYWORDS = $0002; + METH_CLASS = $0010; + METH_STATIC = $0020; + METH_COEXIST = $0040; + + // Masks for the co_flags field of PyCodeObject + CO_OPTIMIZED = $0001; + CO_NEWLOCALS = $0002; + CO_VARARGS = $0004; + CO_VARKEYWORDS = $0008; + + // Rich comparison opcodes introduced in version 2.1 + Py_LT = 0; + Py_LE = 1; + Py_EQ = 2; + Py_NE = 3; + Py_GT = 4; + Py_GE = 5; + + {$IFDEF CPUARM} + DEFAULT_CALLBACK_TYPE: TCallType = TCallType.ctARMSTD; + {$ELSE} + DEFAULT_CALLBACK_TYPE: TCallType = TCallType.ctCDECL; + {$ENDIF CPUARM} + +type + // Delphi equivalent used by TPyObject + TRichComparisonOpcode = (pyLT, pyLE, pyEQ, pyNE, pyGT, pyGE); + + +// C long is 8 bytes in non-Windows 64-bit operating systems +// Same Delphi's LongInt but not fpc LongInt which is always 4 bytes +// Hence the following +{$IFDEF MSWINDOWS} + C_Long = Integer; + C_ULong = Cardinal; +{$ELSE} + C_Long = NativeInt; + C_ULong = NativeUInt; +{$ENDIF} + +// wchar_t is 4 bytes on Linux/OS X/Android but 2 bytes on Windows +{$IFDEF POSIX} + PWCharT = PUCS4Char; + PPWCharT = ^PUCS4Char; + WCharTString = UCS4String; +{$ELSE} + PWCharT = PWideChar; + PPWCharT = PPWideChar; + WCharTString = UnicodeString; +{$ENDIF} + + PPy_ssize_t = PNativeUInt; + Py_ssize_t = NativeUInt; + + const +{ +Type flags (tp_flags) + +These flags are used to change expected features and behavior for a +particular type. + +Arbitration of the flag bit positions will need to be coordinated among +all extension writers who publicly release their extensions (this will +be fewer than you might expect!). + +Most flags were removed as of Python 3.0 to make room for new flags. (Some +flags are not for backwards compatibility but to indicate the presence of an +optional feature; these flags remain of course.) + +Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value. + +Code can use PyType_HasFeature(type_ob, flag_value) to test whether the +given type object has a specified feature. +} + +// Set if the type object is dynamically allocated + Py_TPFLAGS_HEAPTYPE = (C_ULong(1) shl 9); + +// Set if the type allows subclassing + Py_TPFLAGS_BASETYPE = (C_ULong(1) shl 10); + +// Set if the type is 'ready' -- fully initialized + Py_TPFLAGS_READY = (C_ULong(1) shl 12); + +// Set while the type is being 'readied', to prevent recursive ready calls + Py_TPFLAGS_READYING = (C_ULong(1) shl 13); + +// Objects support garbage collection (see objimp.h) + Py_TPFLAGS_HAVE_GC = (C_ULong(1) shl 14); + +// Set if the type implements the vectorcall protocol (PEP 590) */ + _Py_TPFLAGS_HAVE_VECTORCALL = (C_ULong(1) shl 11); + +// Objects behave like an unbound method + Py_TPFLAGS_METHOD_DESCRIPTOR = (C_ULong(1) shl 17); + +// Objects support type attribute cache + Py_TPFLAGS_HAVE_VERSION_TAG = (C_ULong(1) shl 18); + Py_TPFLAGS_VALID_VERSION_TAG = (C_ULong(1) shl 19); + +// Type is abstract and cannot be instantiated + Py_TPFLAGS_IS_ABSTRACT = (C_ULong(1) shl 20); + +// These flags are used to determine if a type is a subclass. + Py_TPFLAGS_LONG_SUBCLASS = (C_ULong(1) shl 24); + Py_TPFLAGS_LIST_SUBCLASS = (C_ULong(1) shl 25); + Py_TPFLAGS_TUPLE_SUBCLASS = (C_ULong(1) shl 26); + Py_TPFLAGS_BYTES_SUBCLASS = (C_ULong(1) shl 27); + Py_TPFLAGS_UNICODE_SUBCLASS = (C_ULong(1) shl 28); + Py_TPFLAGS_DICT_SUBCLASS = (C_ULong(1) shl 29); + Py_TPFLAGS_BASE_EXC_SUBCLASS = (C_ULong(1) shl 30); + Py_TPFLAGS_TYPE_SUBCLASS = (C_ULong(1) shl 31); + + Py_TPFLAGS_DEFAULT = Py_TPFLAGS_BASETYPE or Py_TPFLAGS_HAVE_VERSION_TAG; + +// See function PyType_HasFeature below for testing the flags. + +// Delphi equivalent used by TPythonType +type + TPFlag = (tpfHeapType, tpfBaseType, tpfReady, tpfReadying, tpfHaveGC, + tpVectorCall, tpMethodDescriptor, tpHaveVersionTag, + tpValidVersionTag, tpIsAbstract, tpLongSubclass, + tpListSubClass, tpTupleSubclass, tpBytesSubclass, + tpBaseExcSubclass, tpTypeSubclass); + TPFlags = set of TPFlag; + +const + TPFLAGS_DEFAULT = [tpfBaseType, tpHaveVersionTag]; + +//------- Python opcodes ----------// +const + single_input = 256; + file_input = 257; + eval_input = 258; + + // UnicodeObject.h +const + // Return values of the PyUnicode_KIND() macro + + { + PyUnicode_WCHAR_KIND is deprecated. Will be removed in Python 12. + String contains only wstr byte characters. This is only possible + when the string was created with a legacy API and _PyUnicode_Ready() + has not been called yet. + } + PyUnicode_WCHAR_KIND = 0; + + PyUnicode_1BYTE_KIND = 1; + PyUnicode_2BYTE_KIND = 2; + PyUnicode_4BYTE_KIND = 4; + + // structmember.h +const +//* Types */ + T_SHORT = 0; + T_INT = 1; + T_LONG = 2; + T_FLOAT = 3; + T_DOUBLE = 4; + T_STRING = 5; + T_OBJECT = 6; +//* XXX the ordering here is weird for binary compatibility */ + T_CHAR = 7; //* 1-character string */ + T_BYTE = 8; //* 8-bit signed int */ +//* unsigned variants: */ + T_UBYTE = 9; + T_USHORT = 10; + T_UINT = 11; + T_ULONG = 12; + +//* strings contained in the structure */ + T_STRING_INPLACE= 13; + + T_OBJECT_EX = 16;{* Like T_OBJECT, but raises AttributeError + when the value is NULL, instead of + converting to None. *} + +//* Flags */ + READONLY = 1; + RO = READONLY; //* Shorthand */ + READ_RESTRICTED = 2; + PY_WRITE_RESTRICTED = 4; + RESTRICTED = (READ_RESTRICTED or PY_WRITE_RESTRICTED); +type + TPyMemberType = (mtShort, mtInt, mtLong, mtFloat, mtDouble, mtString, mtObject, + mtChar, mtByte, mtUByte, mtUShort, mtUInt, mtULong, + mtStringInplace, mtObjectEx); + TPyMemberFlag = (mfDefault, mfReadOnly, mfReadRestricted, mfWriteRestricted, mfRestricted); + +// Constants from pybuffer.h +const + PyBUF_MAX_NDIM = 64; // Maximum number of dimensions + // Flags for getting buffers. Keep these in sync with inspect.BufferFlags. + PyBUF_SIMPLE = 0; + PyBUF_WRITABLE = 1; + + PyBUF_FORMAT = $0004; + PyBUF_ND = $0008; + PyBUF_STRIDES = $0010 or PyBUF_ND; + PyBUF_C_CONTIGUOUS = $0020 or PyBUF_STRIDES; + PyBUF_F_CONTIGUOUS = $0040 or PyBUF_STRIDES; + PyBUF_ANY_CONTIGUOUS = $0080 or PyBUF_STRIDES; + PyBUF_INDIRECT = $0100 or PyBUF_STRIDES; + PyBUF_CONTIG = PyBUF_ND or PyBUF_WRITABLE; + PyBUF_CONTIG_RO = PyBUF_ND; + PyBUF_STRIDED = PyBUF_STRIDES or PyBUF_WRITABLE; + PyBUF_STRIDED_RO = PyBUF_STRIDES; + PyBUF_RECORDS = PyBUF_STRIDES or PyBUF_WRITABLE or PyBUF_FORMAT; + PyBUF_RECORDS_RO = PyBUF_STRIDES or PyBUF_FORMAT; + PyBUF_FULL = PyBUF_INDIRECT or PyBUF_WRITABLE or PyBUF_FORMAT; + PyBUF_FULL_RO = PyBUF_INDIRECT or PyBUF_FORMAT; + + PyBUF_READ = $100; + PyBUF_WRITE = $200; + +//####################################################### +//## ## +//## Non-Python specific constants ## +//## ## +//####################################################### + +const + CR = #13; + LF = #10; + TAB = #09; + CRLF = CR+LF; + +//####################################################### +//## ## +//## Python specific interface ## +//## ## +//####################################################### + +type + PP_frozen = ^P_frozen; + P_frozen = ^_frozen; + PPyObject = ^PyObject; + PPPyObject = ^PPyObject; + PPPPyObject = ^PPPyObject; + PPyTypeObject = ^PyTypeObject; + PPySliceObject = ^PySliceObject; + + AtExitProc = procedure; + PyCFunction = function( self, args:PPyObject): PPyObject; cdecl; + PyCFunctionWithKW = function( self, args, keywords:PPyObject): PPyObject; cdecl; + + unaryfunc = function( ob1 : PPyObject): PPyObject; cdecl; + binaryfunc = function( ob1,ob2 : PPyObject): PPyObject; cdecl; + ternaryfunc = function( ob1,ob2,ob3 : PPyObject): PPyObject; cdecl; + inquiry = function( ob1 : PPyObject): integer; cdecl; + lenfunc = function( ob1 : PPyObject): NativeInt; cdecl; + coercion = function( ob1,ob2 : PPPyObject): integer; cdecl; + ssizeargfunc = function( ob1 : PPyObject; i: NativeInt): PPyObject; cdecl; + ssizeobjargproc = function( ob1 : PPyObject; i: NativeInt; ob2 : PPyObject): + integer; cdecl; + objobjargproc = function( ob1,ob2,ob3 : PPyObject): integer; cdecl; + + pydestructor = procedure(ob: PPyObject); cdecl; + getattrfunc = function( ob1: PPyObject; name: PAnsiChar): PPyObject; cdecl; + setattrfunc = function( ob1: PPyObject; name: PAnsiChar; ob2: PPyObject): integer; cdecl; + reprfunc = function( ob: PPyObject): PPyObject; cdecl; + hashfunc = function( ob: PPyObject): NativeInt; cdecl; // !! in 2.x it is still a LongInt + getattrofunc = function( ob1,ob2: PPyObject): PPyObject; cdecl; + setattrofunc = function( ob1,ob2,ob3: PPyObject): integer; cdecl; + + objobjproc = function ( ob1, ob2: PPyObject): integer; cdecl; + visitproc = function ( ob1: PPyObject; ptr: Pointer): integer; cdecl; + traverseproc = function ( ob1: PPyObject; proc: visitproc; ptr: Pointer): integer; cdecl; + + richcmpfunc = function ( ob1, ob2 : PPyObject; i : Integer) : PPyObject; cdecl; + getiterfunc = function ( ob1 : PPyObject) : PPyObject; cdecl; + iternextfunc = function ( ob1 : PPyObject) : PPyObject; cdecl; + descrgetfunc = function ( ob1, ob2, ob3 : PPyObject) : PPyObject; cdecl; + descrsetfunc = function ( ob1, ob2, ob3 : PPyObject) : Integer; cdecl; + initproc = function ( self, args, kwds : PPyObject) : Integer; cdecl; + newfunc = function ( subtype: PPyTypeObject; args, kwds : PPyObject) : PPyObject; cdecl; + allocfunc = function ( self: PPyTypeObject; nitems : NativeInt) : PPyObject; cdecl; + + PyNumberMethods = {$IFDEF CPUX86}packed{$ENDIF} record + nb_add : binaryfunc; + nb_subtract : binaryfunc; + nb_multiply : binaryfunc; + nb_remainder : binaryfunc; + nb_divmod : binaryfunc; + nb_power : ternaryfunc; + nb_negative : unaryfunc; + nb_positive : unaryfunc; + nb_absolute : unaryfunc; + nb_bool : inquiry; + nb_invert : unaryfunc; + nb_lshift : binaryfunc; + nb_rshift : binaryfunc; + nb_and : binaryfunc; + nb_xor : binaryfunc; + nb_or : binaryfunc; + nb_int : unaryfunc; + nb_reserved : Pointer; // not used + nb_float : unaryfunc; + nb_inplace_add : binaryfunc; + nb_inplace_subtract : binaryfunc; + nb_inplace_multiply : binaryfunc; + nb_inplace_remainder : binaryfunc; + nb_inplace_power : ternaryfunc; + nb_inplace_lshift : binaryfunc; + nb_inplace_rshift : binaryfunc; + nb_inplace_and : binaryfunc; + nb_inplace_xor : binaryfunc; + nb_inplace_or : binaryfunc; + nb_floor_divide : binaryfunc; + nb_true_divide : binaryfunc; + nb_inplace_floor_divide : binaryfunc; + nb_inplace_true_divide : binaryfunc; + nb_index : unaryfunc; + nb_matrix_multiply : binaryfunc; // new in python 3.5 + nb_inplace_matrix_multiply : binaryfunc; // new in python 3.5 + end; + PPyNumberMethods = ^PyNumberMethods; + + PySequenceMethods = {$IFDEF CPUX86}packed{$ENDIF} record + sq_length : lenfunc; + sq_concat : binaryfunc; + sq_repeat : ssizeargfunc; + sq_item : ssizeargfunc; + was_sq_slice : Pointer; // empty slot in python 3.x + sq_ass_item : ssizeobjargproc; + was_sq_ass_slice : Pointer; // empty slot in python 3.x + sq_contains : objobjproc; + sq_inplace_concat : binaryfunc; + sq_inplace_repeat : ssizeargfunc; + end; + PPySequenceMethods = ^PySequenceMethods; + + PyMappingMethods = {$IFDEF CPUX86}packed{$ENDIF} record + mp_length : lenfunc; + mp_subscript : binaryfunc; + mp_ass_subscript : objobjargproc; + end; + PPyMappingMethods = ^PyMappingMethods; + + Py_complex = {$IFDEF CPUX86}packed{$ENDIF} record + real : double; + imag : double; + end; + + PyObject = {$IFDEF CPUX86}packed{$ENDIF} record + ob_refcnt: NativeUInt; + ob_type: PPyTypeObject; + end; + + _frozen = {$IFDEF CPUX86}packed{$ENDIF} record + name : PAnsiChar; + code : PByte; + size : Integer; + end; + + PySliceObject = {$IFDEF CPUX86}packed{$ENDIF} record + ob_refcnt: NativeUInt; + ob_type: PPyTypeObject; + start, stop, step: PPyObject; + end; + + PPyMethodDef = ^PyMethodDef; + PyMethodDef = {$IFDEF CPUX86}packed{$ENDIF} record + ml_name: PAnsiChar; + ml_meth: PyCFunction; + ml_flags: Integer; + ml_doc: PAnsiChar; + end; + + // structmember.h + PPyMemberDef = ^PyMemberDef; + PyMemberDef = {$IFDEF CPUX86}packed{$ENDIF} record + name : PAnsiChar; + _type : integer; + offset : NativeInt; + flags : Integer; + doc : PAnsiChar; + end; + + // descrobject.h + + // Descriptors + + getter = function ( obj : PPyObject; context : Pointer) : PPyObject; cdecl; + setter = function ( obj, value : PPyObject; context : Pointer) : integer; cdecl; + + PPyGetSetDef = ^PyGetSetDef; + PyGetSetDef = {$IFDEF CPUX86}packed{$ENDIF} record + name : PAnsiChar; + get : getter; + _set : setter; + doc : PAnsiChar; + closure : Pointer; + end; + + wrapperfunc = function (self, args: PPyObject; wrapped : Pointer) : PPyObject; cdecl; + + pwrapperbase = ^wrapperbase; + wrapperbase = {$IFDEF CPUX86}packed{$ENDIF} record + name : PAnsiChar; + wrapper : wrapperfunc; + doc : PAnsiChar; + end; + + // Various kinds of descriptor objects + + {#define PyDescr_COMMON \ + PyObject_HEAD \ + PyTypeObject *d_type; \ + PyObject *d_name \ + PyObject *d_qualname + } + + PPyDescrObject = ^PyDescrObject; + PyDescrObject = {$IFDEF CPUX86}packed{$ENDIF} record + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + d_type : PPyTypeObject; + d_name : PPyObject; + d_qualname : PPyObject; + end; + + PPyMethodDescrObject = ^PyMethodDescrObject; + PyMethodDescrObject = {$IFDEF CPUX86}packed{$ENDIF} record + // Start of PyDescr_COMMON + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + d_type : PPyTypeObject; + d_name : PPyObject; + d_qualname : PPyObject; + // End of PyDescr_COMMON + d_method : PPyMethodDef; + end; + + PPyMemberDescrObject = ^PyMemberDescrObject; + PyMemberDescrObject = {$IFDEF CPUX86}packed{$ENDIF} record + // Start of PyDescr_COMMON + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + d_type : PPyTypeObject; + d_name : PPyObject; + d_qualname : PPyObject; + // End of PyDescr_COMMON + d_member : PPyMemberDef; + end; + + PPyGetSetDescrObject = ^PyGetSetDescrObject; + PyGetSetDescrObject = {$IFDEF CPUX86}packed{$ENDIF} record + // Start of PyDescr_COMMON + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + d_type : PPyTypeObject; + d_name : PPyObject; + d_qualname : PPyObject; + // End of PyDescr_COMMON + d_getset : PPyGetSetDef; + end; + + PPyWrapperDescrObject = ^PyWrapperDescrObject; + PyWrapperDescrObject = {$IFDEF CPUX86}packed{$ENDIF} record + // Start of PyDescr_COMMON + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + d_type : PPyTypeObject; + d_name : PPyObject; + d_qualname : PPyObject; + // End of PyDescr_COMMON + d_base : pwrapperbase; + d_wrapped : Pointer; // This can be any function pointer + end; + + PPyModuleDef_Base = ^PyModuleDef_Base; + PyModuleDef_Base = {$IFDEF CPUX86}packed{$ENDIF} record + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + m_init : function( ) : PPyObject; cdecl; + m_index : NativeInt; + m_copy : PPyObject; + end; + + // Slots are used for two phase module initialization + // which is not yet implemented + + PPyModuleDef_Slot = ^PyModuleDef_Slot; + PyModuleDef_Slot = {$IFDEF CPUX86}packed{$ENDIF} record + slot: integer; + value: Pointer; + end; + + PPyModuleDef = ^PyModuleDef; + PyModuleDef = {$IFDEF CPUX86}packed{$ENDIF} record + m_base : PyModuleDef_Base; + m_name : PAnsiChar; + m_doc : PAnsiChar; + m_size : NativeInt; + m_methods : PPyMethodDef; + m_slots : PPyModuleDef_Slot; + m_traverse : traverseproc; + m_clear : inquiry; + m_free : inquiry; + end; + + // pybuffer.h + + PPy_buffer = ^Py_Buffer; + Py_buffer = record + buf: Pointer; + obj: PPyObject; (* owned reference *) + len: Py_ssize_t; + itemsize: Py_ssize_t; (* This is Py_ssize_t so it can be + pointed to by strides in simple case.*) + readonly: Integer; + ndim: Integer; + format: PAnsiChar; + shape: PPy_ssize_t ; + strides: PPy_ssize_t; + suboffsets: PPy_ssize_t; + internal: Pointer; + end; + + getbufferproc = function(exporter: PPyObject; view: PPy_buffer; flags: Integer): Integer; cdecl; + releasebufferproc = procedure(exporter: PPyObject; view: PPy_buffer); cdecl; + + PPyBufferProcs = ^PyBufferProcs; + PyBufferProcs = record + bf_getbuffer: getbufferproc; + bf_releasebuffer: releasebufferproc; + end; + + // object.h + + PyTypeObject = {$IFDEF CPUX86}packed{$ENDIF} record + ob_refcnt: NativeUInt; + ob_type: PPyTypeObject; + ob_size: NativeInt; // Number of items in variable part + tp_name: PAnsiChar; // For printing + tp_basicsize, + tp_itemsize: NativeInt; // For allocation + + // Methods to implement standard operations + + tp_dealloc: pydestructor; + tp_vectorcall_offset: NativeInt; + tp_getattr: getattrfunc; + tp_setattr: setattrfunc; + tp_as_async: Pointer; // not implemented + tp_repr: reprfunc; + + // Method suites for standard classes + + tp_as_number: PPyNumberMethods; + tp_as_sequence: PPySequenceMethods; + tp_as_mapping: PPyMappingMethods; + + // More standard operations (here for binary compatibility) + + tp_hash: hashfunc; + tp_call: ternaryfunc; + tp_str: reprfunc; + tp_getattro: getattrofunc; + tp_setattro: setattrofunc; + + // Functions to access object as input/output buffer + tp_as_buffer: PPyBufferProcs; + // Flags to define presence of optional/expanded features + tp_flags: C_ULong; + + tp_doc: PAnsiChar; // Documentation string + + // call function for all accessible objects + tp_traverse: traverseproc; + + // delete references to contained objects + tp_clear: inquiry; + + // rich comparisons + tp_richcompare: richcmpfunc; + + // weak reference enabler + tp_weaklistoffset: NativeInt; + // Iterators + tp_iter : getiterfunc; + tp_iternext : iternextfunc; + + // Attribute descriptor and subclassing stuff + tp_methods : PPyMethodDef; + tp_members : PPyMemberDef; + tp_getset : PPyGetSetDef; + tp_base : PPyTypeObject; + tp_dict : PPyObject; + tp_descr_get : descrgetfunc; + tp_descr_set : descrsetfunc; + tp_dictoffset : NativeInt; + tp_init : initproc; + tp_alloc : allocfunc; + tp_new : newfunc; + tp_free : pydestructor; // Low-level free-memory routine + tp_is_gc : inquiry; // For PyObject_IS_GC + tp_bases : PPyObject; + tp_mro : PPyObject; // method resolution order + tp_cache : PPyObject; + tp_subclasses : PPyObject; + tp_weaklist : PPyObject; + tp_del : PyDestructor; + tp_version_tag : Cardinal; // Type attribute cache version tag. Added in version 2.6 + tp_finalize : PyDestructor; + tp_vectorcall : Pointer; // not implemented + //More spares + tp_xxx1 : NativeInt; + tp_xxx2 : NativeInt; + tp_xxx3 : NativeInt; + tp_xxx4 : NativeInt; + tp_xxx5 : NativeInt; + tp_xxx6 : NativeInt; + tp_xxx7 : NativeInt; + tp_xxx8 : NativeInt; + tp_xxx9 : NativeInt; + tp_xxx10 : NativeInt; + tp_pythontype : Pointer; // Introduced for FindPythonType optimization + end; + + // from pystate.h + // the structure of PyInterpreterState and PyThreadState is considered + // an implementation detail. It has been changing between python versions + // and there is no real use of accessing these structures directly. + PPyInterpreterState = Pointer; + PPyThreadState = Pointer; + + // Parse tree node interface + + PNode = ^node; + node = {$IFDEF CPUX86}packed{$ENDIF} record + n_type : smallint; + n_str : PAnsiChar; + n_lineno : integer; + n_col_offset: integer; + n_nchildren : integer; + n_child : PNode; + end; + + PPyCompilerFlags = ^PyCompilerFlags; + PyCompilerFlags = {$IFDEF CPUX86}packed{$ENDIF} record + flags : integer; + cf_feature_version : integer; //added in Python 3.8 + end; + + const + PyCF_ONLY_AST = $0400; + + // from datetime.h + + +{* Fields are packed into successive bytes, each viewed as unsigned and + * big-endian, unless otherwise noted: + * + * byte offset + * 0 year 2 bytes, 1-9999 + * 2 month 1 byte, 1-12 + * 3 day 1 byte, 1-31 + * 4 hour 1 byte, 0-23 + * 5 minute 1 byte, 0-59 + * 6 second 1 byte, 0-59 + * 7 usecond 3 bytes, 0-999999 + * 10 + *} + +const + { # of bytes for year, month, and day. } + _PyDateTime_DATE_DATASIZE = 4; + + { # of bytes for hour, minute, second, and usecond. } + _PyDateTime_TIME_DATASIZE = 6; + + { # of bytes for year, month, day, hour, minute, second, and usecond. } + _PyDateTime_DATETIME_DATASIZE = 10; + +type + PyDateTime_Delta = {$IFDEF CPUX86}packed{$ENDIF} record + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : NativeInt; // -1 when unknown + days : Integer; // -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS + seconds : Integer; // 0 <= seconds < 24*3600 is invariant + microseconds: Integer; // 0 <= microseconds < 1000000 is invariant + end; + PPyDateTime_Delta = ^PyDateTime_Delta; + + PyDateTime_TZInfo = {$IFDEF CPUX86}packed{$ENDIF} record // a pure abstract base clase + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + end; + PPyDateTime_TZInfo = ^PyDateTime_TZInfo; + +{ +/* The datetime and time types have hashcodes, and an optional tzinfo member, + * present if and only if hastzinfo is true. + */ +#define _PyTZINFO_HEAD \ + PyObject_HEAD \ + long hashcode; \ + char hastzinfo; /* boolean flag */ +} + +{* No _PyDateTime_BaseTZInfo is allocated; it's just to have something + * convenient to cast to, when getting at the hastzinfo member of objects + * starting with _PyTZINFO_HEAD. + *} + _PyDateTime_BaseTZInfo = {$IFDEF CPUX86}packed{$ENDIF} record + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + end; + _PPyDateTime_BaseTZInfo = ^_PyDateTime_BaseTZInfo; + +{* All time objects are of PyDateTime_TimeType, but that can be allocated + * in two ways, with or without a tzinfo member. Without is the same as + * tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an + * internal struct used to allocate the right amount of space for the + * "without" case. + *} +{#define _PyDateTime_TIMEHEAD \ + _PyTZINFO_HEAD \ + unsigned char data[_PyDateTime_TIME_DATASIZE]; +} + + _PyDateTime_BaseTime = {$IFDEF CPUX86}packed{$ENDIF} record // hastzinfo false + // Start of _PyDateTime_TIMEHEAD + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + data : array[0..Pred(_PyDateTime_TIME_DATASIZE)] of Byte; + // End of _PyDateTime_TIMEHEAD + end; + _PPyDateTime_BaseTime = ^_PyDateTime_BaseTime; + + PyDateTime_Time = {$IFDEF CPUX86}packed{$ENDIF} record // hastzinfo true + // Start of _PyDateTime_TIMEHEAD + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + data : array[0..Pred(_PyDateTime_TIME_DATASIZE)] of Byte; + // End of _PyDateTime_TIMEHEAD + tzinfo : PPyObject; + end; + PPyDateTime_Time = ^PyDateTime_Time; + + + +{* All datetime objects are of PyDateTime_DateTimeType, but that can be + * allocated in two ways too, just like for time objects above. In addition, + * the plain date type is a base class for datetime, so it must also have + * a hastzinfo member (although it's unused there). + *} + PyDateTime_Date = {$IFDEF CPUX86}packed{$ENDIF} record + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + data : array[0..Pred(_PyDateTime_DATE_DATASIZE)] of Byte; + end; + PPyDateTime_Date = ^PyDateTime_Date; + + { +#define _PyDateTime_DATETIMEHEAD \ + _PyTZINFO_HEAD \ + unsigned char data[_PyDateTime_DATETIME_DATASIZE]; +} + + _PyDateTime_BaseDateTime = {$IFDEF CPUX86}packed{$ENDIF} record // hastzinfo false + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + data : array[0..Pred(_PyDateTime_DATETIME_DATASIZE)] of Byte; + end; + _PPyDateTime_BaseDateTime = ^_PyDateTime_BaseDateTime; + + PyDateTime_DateTime = {$IFDEF CPUX86}packed{$ENDIF} record // hastzinfo true + // Start of _PyDateTime_DATETIMEHEAD + // Start of _PyTZINFO_HEAD + // Start of the Head of an object + ob_refcnt : NativeUInt; + ob_type : PPyTypeObject; + // End of the Head of an object + hashcode : Integer; + hastzinfo : Char; // boolean flag + // End of _PyTZINFO_HEAD + data : array[0..Pred(_PyDateTime_DATETIME_DATASIZE)] of Byte; + // End of _PyDateTime_DATETIMEHEAD + tzinfo : PPyObject; + end; + PPyDateTime_DateTime = ^PyDateTime_DateTime; + + //bytearrayobject.h + + PyByteArrayObject = {$IFDEF CPUX86}packed{$ENDIF} record + ob_refcnt: NativeUInt; + ob_type: PPyTypeObject; + ob_alloc: Py_ssize_t; + ob_bytes: PAnsiChar; + ob_start: PAnsiChar; + ob_exports: Py_ssize_t; + end; + + //initconfig.h + //See https://docs.python.org/3/c-api/init_config.html + +const + _PyStatus_TYPE_OK = 0; + _PyStatus_TYPE_ERROR = 1; + _PyStatus_TYPE_EXIT = 2; + +type + TPyStatus_Type = Integer; + + PyStatus = {$IFDEF CPUX86}packed{$ENDIF} record + _type: TPyStatus_Type; + func: PAnsiChar; + err_msg: PAnsiChar; + exitcode: Integer; + end; + + PPyWideStringList = ^PyWideStringList; + PyWideStringList = {$IFDEF CPUX86}packed{$ENDIF} record + length: Py_ssize_t; + items: PPWCharT; + end; + + PPyConfig = ^PyConfig; + PyConfig = record + // The definition of PyConfig has been changing in every python version + // So we make this structure opaque and we access its fields through + // the ConfigOffsets below + Filler: array [0..1000] of Byte; + end; + + // Opaque structure PEP 741 + PPyInitConfig = Pointer; + +{$SCOPEDENUMS ON} + TConfigFields = ( + use_environment, + parse_argv, + argv, + site_import, + interactive, + optimization_level, + parser_debug, + verbose, + pathconfig_warnings, + program_name, + home, + module_search_paths_set, + module_search_paths, + executable); +{$SCOPEDENUMS OFF} + + TConfigOffsets = array [8..13] of array [TConfigFields] of Integer; + + // The followng needs updating when new versions are added + const + ConfigOffests: TConfigOffsets = + {$IFDEF MSWINDOWS} + {$IFDEF CPU64BITS} + ((8, 80, 88, 144, 156, 160, 164, 172, 224, 104, 240, 248, 256, 272), + (8, 80, 88, 144, 156, 160, 164, 172, 224, 104, 240, 248, 256, 272), + (8, 80, 104, 152, 168, 172, 176, 184, 240, 248, 264, 280, 288, 304), + (8, 96, 120, 168, 184, 188, 192, 200, 264, 272, 288, 304, 312, 336), + (8, 96, 120, 168, 184, 188, 192, 200, 268, 272, 288, 304, 312, 336), + (8, 96, 120, 168, 184, 188, 192, 200, 272, 280, 296, 312, 320, 344)); + {$ELSE} + ((8, 68, 72, 100, 112, 116, 120, 128, 164, 80, 172, 176, 180, 188), + (8, 68, 72, 100, 112, 116, 120, 128, 164, 80, 172, 176, 180, 188), + (8, 64, 76, 100, 116, 120, 124, 132, 168, 172, 180, 188, 192, 200), + (8, 72, 84, 108, 124, 128, 132, 140, 184, 188, 196, 204, 208, 220), + (8, 76, 88, 112, 128, 132, 136, 144, 192, 196, 204, 212, 216, 228), + (8, 76, 88, 112, 128, 132, 136, 144, 196, 200, 208, 216, 220, 232)); + {$ENDIF} + {$ELSE} + {$IFDEF CPU64BITS} + ((8, 88, 96, 152, 164, 168, 172, 180, 224, 112, 240, 248, 256, 272), + (8, 88, 96, 152, 164, 168, 172, 180, 224, 112, 240, 248, 256, 272), + (8, 80, 104, 152, 168, 172, 176, 184, 232, 240, 256, 272, 280, 296), + (8, 96, 120, 168, 184, 188, 192, 200, 256, 264, 280, 296, 304, 328), + (8, 104, 128, 176, 192, 196, 200, 208, 268, 272, 288, 304, 312, 336), + (8, 104, 128, 176, 192, 196, 200, 208, 272, 280, 296, 312, 320, 344)); + {$ELSE} + ((8, 68, 72, 100, 112, 116, 120, 128, 160, 80, 168, 172, 176, 184), + (8, 68, 72, 100, 112, 116, 120, 128, 160, 80, 168, 172, 176, 184), + (8, 64, 76, 100, 116, 120, 124, 132, 164, 168, 176, 184, 188, 196), + (8, 72, 84, 108, 124, 128, 132, 140, 180, 184, 192, 200, 204, 216), + (8, 76, 88, 112, 128, 132, 136, 144, 188, 192, 200, 208, 212, 224), + (8, 76, 88, 112, 128, 132, 136, 144, 192, 196, 204, 212, 216, 228)); + {$ENDIF} + {$ENDIF} + +//####################################################### +//## ## +//## GIL related ## +//## ## +//####################################################### +const + PyGILState_LOCKED = 0; + PyGILState_UNLOCKED = 1; +type + PyGILState_STATE = type Integer; // (PyGILState_LOCKED, PyGILState_UNLOCKED); + + // Introduced in Python 12 +const + PyInterpreterConfig_DEFAULT_GIL = 0; + PyInterpreterConfig_SHARED_GIL = 1; + PyInterpreterConfig_OWN_GIL = 2; + +type + PPyInterpreterConfig = ^PyInterpreterConfig; + PyInterpreterConfig = {$IFDEF CPUX86}packed{$ENDIF} record + use_main_obmalloc: Integer; + allow_fork: Integer; + allow_exec: Integer; + allow_threads: Integer; + allow_daemon_threads: Integer; + check_multi_interp_extensions: Integer; + gil: Integer; + end; + +var + _PyInterpreterConfig_INIT: PyInterpreterConfig = + ( use_main_obmalloc: 0; + allow_fork: 0; + allow_exec: 0; + allow_threads: 1; + allow_daemon_threads: 0; + check_multi_interp_extensions: 1; + gil: PyInterpreterConfig_OWN_GIL); + +//####################################################### +//## ## +//## New exception classes ## +//## ## +//####################################################### +type + // Components' exceptions + EDLLLoadError = class(Exception); + EDLLImportError = class(Exception) + public + WrongFunc : AnsiString; + ErrorCode : Integer; + end; + + // Python's exceptions + EPythonError = class(Exception) + public + EName : string; + EValue : string; + end; + EPyExecError = class(EPythonError); + + + // Standard exception classes of Python + +{ Hierarchy of Python exceptions, Python 2.3, copied from \Python\exceptions.c + +Exception\n\ + |\n\ + +-- SystemExit\n\ + +-- StopIteration\n\ + +-- StandardError\n\ + | |\n\ + | +-- KeyboardInterrupt\n\ + | +-- ImportError\n\ + | +-- EnvironmentError\n\ + | | |\n\ + | | +-- IOError\n\ + | | +-- OSError\n\ + | | |\n\ + | | +-- WindowsError\n\ + | | +-- VMSError\n\ + | |\n\ + | +-- EOFError\n\ + | +-- RuntimeError\n\ + | | |\n\ + | | +-- NotImplementedError\n\ + | |\n\ + | +-- NameError\n\ + | | |\n\ + | | +-- UnboundLocalError\n\ + | |\n\ + | +-- AttributeError\n\ + | +-- SyntaxError\n\ + | | |\n\ + | | +-- IndentationError\n\ + | | |\n\ + | | +-- TabError\n\ + | |\n\ + | +-- TypeError\n\ + | +-- AssertionError\n\ + | +-- LookupError\n\ + | | |\n\ + | | +-- IndexError\n\ + | | +-- KeyError\n\ + | |\n\ + | +-- ArithmeticError\n\ + | | |\n\ + | | +-- OverflowError\n\ + | | +-- ZeroDivisionError\n\ + | | +-- FloatingPointError\n\ + | |\n\ + | +-- ValueError\n\ + | | |\n\ + | | +-- UnicodeError\n\ + | | |\n\ + | | +-- UnicodeEncodeError\n\ + | | +-- UnicodeDecodeError\n\ + | | +-- UnicodeTranslateError\n\ + | |\n\ + | +-- ReferenceError\n\ + | +-- SystemError\n\ + | +-- MemoryError\n\ + |\n\ + +---Warning\n\ + |\n\ + +-- UserWarning\n\ + +-- DeprecationWarning\n\ + +-- PendingDeprecationWarning\n\ + +-- SyntaxWarning\n\ + +-- RuntimeWarning\n\ + +-- FutureWarning" +} + EPyException = class (EPythonError); + EPyStandardError = class (EPyException); + EPyArithmeticError = class (EPyStandardError); + EPyLookupError = class (EPyStandardError); + EPyAssertionError = class (EPyStandardError); + EPyAttributeError = class (EPyStandardError); + EPyEOFError = class (EPyStandardError); + EPyFloatingPointError = class (EPyArithmeticError); + EPyEnvironmentError = class (EPyStandardError); + EPyIOError = class (EPyEnvironmentError); + EPyOSError = class (EPyEnvironmentError); + EPyImportError = class (EPyStandardError); + EPyIndexError = class (EPyLookupError); + EPyKeyError = class (EPyLookupError); + EPyKeyboardInterrupt = class (EPyStandardError); + EPyMemoryError = class (EPyStandardError); + EPyNameError = class (EPyStandardError); + EPyOverflowError = class (EPyArithmeticError); + EPyRuntimeError = class (EPyStandardError); + EPyNotImplementedError = class (EPyRuntimeError); + EPySyntaxError = class (EPyStandardError) + public + EFileName: UnicodeString; + ELineStr: UnicodeString; + ELineNumber: Integer; + EOffset: Integer; + EEndLineNumber: Integer; + EEndOffset: Integer; + end; + EPyIndentationError = class (EPySyntaxError); + EPyTabError = class (EPyIndentationError); + EPySystemError = class (EPyStandardError); + EPySystemExit = class (EPyException); + EPyTypeError = class (EPyStandardError); + EPyUnboundLocalError = class (EPyNameError); + EPyValueError = class (EPyStandardError); + EPyUnicodeError = class (EPyValueError); + UnicodeEncodeError = class (EPyUnicodeError); + UnicodeDecodeError = class (EPyUnicodeError); + UnicodeTranslateError = class (EPyUnicodeError); + EPyZeroDivisionError = class (EPyArithmeticError); + EPyStopIteration = class(EPyException); + EPyWarning = class (EPyException); + EPyUserWarning = class (EPyWarning); + EPyDeprecationWarning = class (EPyWarning); + PendingDeprecationWarning = class (EPyWarning); + FutureWarning = class (EPyWarning); + EPySyntaxWarning = class (EPyWarning); + EPyRuntimeWarning = class (EPyWarning); + EPyReferenceError = class (EPyStandardError); + EPyBufferError = class (EPyException); + {$IFDEF MSWINDOWS} + EPyWindowsError = class (EPyOSError); + {$ENDIF} + +//####################################################### +//## ## +//## Components ## +//## ## +//####################################################### + +//------------------------------------------------------- +//-- -- +//-- class: TPythonInputOutput -- +//-- Works as a console for Python outputs -- +//-- It's a virtual Base class -- +//------------------------------------------------------- + +const + kMaxLines = 1000; + kMaxLineLength = 256; + +type + TSendDataEvent = procedure (Sender: TObject; const Data : AnsiString ) of object; + TReceiveDataEvent = procedure (Sender: TObject; var Data : AnsiString ) of object; + TSendUniDataEvent = procedure (Sender: TObject; const Data : UnicodeString ) of object; + TReceiveUniDataEvent = procedure (Sender: TObject; var Data : UnicodeString ) of object; + IOChar = WideChar; + IOString = UnicodeString; + TIOStringList = TStringList; + + {$IF not Defined(FPC) and (CompilerVersion >= 23)} + [ComponentPlatformsAttribute(pidSupportedPlatforms)] + {$IFEND} + TPythonInputOutput = class(TComponent) + protected + FMaxLines : Integer; + FLine_Buffer : IOString; + FLinesPerThread : TIOStringList; + FLock : TCriticalSection; + FQueue : TIOStringList; + FDelayWrites : Boolean; + FMaxLineLength : Integer; + FOnSendData : TSendDataEvent; + FOnReceiveData : TReceiveDataEvent; + FOnSendUniData : TSendUniDataEvent; + FOnReceiveUniData: TReceiveUniDataEvent; + FUnicodeIO : Boolean; + FRawOutput : Boolean; + + procedure Lock; + procedure Unlock; + procedure AddWrite( const str : IOString ); + // Virtual methods for handling the input/output of text + procedure SendData( const Data : AnsiString ); virtual; + function ReceiveData : AnsiString; virtual; + procedure SendUniData( const Data : UnicodeString ); virtual; + function ReceiveUniData : UnicodeString; virtual; + procedure AddPendingWrite; virtual; + function GetCurrentThreadSlotIdx : Integer; + function GetCurrentThreadLine : IOString; + procedure UpdateCurrentThreadLine; + + public + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + procedure Write( const str : IOString ); + procedure WriteLine( const str : IOString ); + + published + property MaxLines : Integer read FMaxLines write FMaxLines default kMaxLines; + property MaxLineLength : Integer read FMaxLineLength write FMaxLineLength default kMaxLineLength; + property DelayWrites : Boolean read FDelayWrites write FDelayWrites default False; + property OnSendData : TSendDataEvent read FOnSendData write FOnSendData; + property OnReceiveData : TReceiveDataEvent read FOnReceiveData write FOnReceiveData; + property OnSendUniData : TSendUniDataEvent read FOnSendUniData write FOnSendUniData; + property OnReceiveUniData : TReceiveUniDataEvent read FOnReceiveUniData write FOnReceiveUniData; + property UnicodeIO: Boolean read FUnicodeIO write FUnicodeIO; + property RawOutput: Boolean read FRawOutput write FRawOutput; + end; + +//------------------------------------------------------- +//-- -- +//-- Base class: TDynamicDll -- +//-- -- +//------------------------------------------------------- + +type + TDynamicDll = class(TComponent) + private + function IsAPIVersionStored: Boolean; + function IsDllNameStored: Boolean; + function IsRegVersionStored: Boolean; + procedure SetDllName(const Value: string); + protected + FDllName : string; + FDllPath : string; + FAPIVersion : Integer; + FRegVersion : string; + FAutoLoad : Boolean; + FAutoUnload : Boolean; + FFatalMsgDlg : Boolean; + FFatalAbort : Boolean; + FDLLHandle : THandle; + FUseLastKnownVersion: Boolean; + FOnBeforeLoad : TNotifyEvent; + FOnAfterLoad : TNotifyEvent; + FOnBeforeUnload : TNotifyEvent; + FInExtensionModule : Boolean; + + function Import(const funcname: AnsiString; canFail : Boolean = True): Pointer; + procedure Loaded; override; + procedure BeforeLoad; virtual; + procedure AfterLoad; virtual; + procedure BeforeUnload; virtual; + function GetQuitMessage : string; virtual; + procedure DoOpenDll(const aDllName : string); virtual; + function GetDllPath : string; + + procedure LoadPythonInfoFromModule; + function GetPythonModuleFromProcess(): NativeUInt; + // Check for Python symbols in the current loaded library (FDLLHandle) + function HasPythonSymbolsInLibrary(): boolean; + procedure LoadFromHostSymbols(); + //Loading strategies + function TryLoadFromHostSymbols(): boolean; + function TryLoadFromCurrentProcess(): boolean; + public + // Constructors & Destructors + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + // Public methods + procedure OpenDll(const aDllName : string); + function IsHandleValid : Boolean; + procedure LoadDll; + procedure LoadDllInExtensionModule; + procedure UnloadDll; + procedure Quit; + + // Public properties + published + property AutoLoad : Boolean read FAutoLoad write FAutoLoad default True; + property AutoUnload : Boolean read FAutoUnload write FAutoUnload default True; + property DllName : string read FDllName write SetDllName stored IsDllNameStored; + property DllPath : string read FDllPath write FDllPath; + property APIVersion : Integer read FAPIVersion write FAPIVersion stored IsAPIVersionStored; + property RegVersion : string read FRegVersion write FRegVersion stored IsRegVersionStored; + property FatalAbort : Boolean read FFatalAbort write FFatalAbort default True; + property FatalMsgDlg : Boolean read FFatalMsgDlg write FFatalMsgDlg default True; + property UseLastKnownVersion: Boolean read FUseLastKnownVersion write FUseLastKnownVersion default True; + property OnAfterLoad : TNotifyEvent read FOnAfterLoad write FOnAfterLoad; + property OnBeforeLoad : TNotifyEvent read FOnBeforeLoad write FOnBeforeLoad; + property OnBeforeUnload : TNotifyEvent read FOnBeforeUnload write FOnBeforeUnload; + end; + +//------------------------------------------------------- +//-- -- +//-- class: TPythonInterface derived from TDynamicDll-- +//-- This class maps the functions imported -- +//-- from the Python Dll, and adds some -- +//-- Delphi implementations. -- +//------------------------------------------------------- + +type + (*$HPPEMIT 'typedef int __cdecl (*TPyArg_Parse)(void * args, char * format, ...);' *) + TPyArg_Parse = function( args: PPyObject; format: PAnsiChar {;....}) : Integer; cdecl varargs; + {$EXTERNALSYM TPyArg_Parse} + + (*$HPPEMIT 'typedef int __cdecl (*TPyArg_ParseTupleAndKeywords)(void * args, void * kw, char * format, char** kwargs, ...);' *) + TPyArg_ParseTupleAndKeywords = function( args: PPyObject; kw: PPyObject; format: PAnsiChar; kwargs: PPAnsiChar {;...}): Integer; cdecl varargs; + {$EXTERNALSYM TPyArg_ParseTupleAndKeywords} + + (*$HPPEMIT 'typedef int __cdecl (*TPy_BuildValue)(char * format, ...);' *) + TPy_BuildValue = function( format: PAnsiChar {;...}): Pointer; cdecl varargs; + {$EXTERNALSYM TPy_BuildValue} + + TPythonInterface=class(TDynamicDll) + protected + FInitialized: Boolean; + FFinalizing: Boolean; + FMajorVersion: integer; + FMinorVersion: integer; + FBuiltInModuleName: string; + + procedure AfterLoad; override; + function GetQuitMessage : string; override; + procedure CheckPython; + + public + PyImport_FrozenModules: PP_frozen; + + Py_None: PPyObject; + Py_Ellipsis: PPyObject; + Py_False: PPyObject; + Py_True: PPyObject; + Py_NotImplemented: PPyObject; + + PyExc_AttributeError: PPPyObject; + PyExc_EOFError: PPPyObject; + PyExc_IOError: PPPyObject; + PyExc_ImportError: PPPyObject; + PyExc_IndexError: PPPyObject; + PyExc_KeyError: PPPyObject; + PyExc_KeyboardInterrupt: PPPyObject; + PyExc_MemoryError: PPPyObject; + PyExc_NameError: PPPyObject; + PyExc_OverflowError: PPPyObject; + PyExc_RuntimeError: PPPyObject; + PyExc_SyntaxError: PPPyObject; + PyExc_SystemError: PPPyObject; + PyExc_SystemExit: PPPyObject; + PyExc_TypeError: PPPyObject; + PyExc_ValueError: PPPyObject; + PyExc_ZeroDivisionError: PPPyObject; + PyExc_ArithmeticError: PPPyObject; + PyExc_Exception: PPPyObject; + PyExc_FloatingPointError: PPPyObject; + PyExc_LookupError: PPPyObject; + PyExc_AssertionError: PPPyObject; + PyExc_EnvironmentError: PPPyObject; + PyExc_IndentationError: PPPyObject; + PyExc_NotImplementedError: PPPyObject; + PyExc_OSError: PPPyObject; + PyExc_TabError: PPPyObject; + PyExc_UnboundLocalError: PPPyObject; + PyExc_UnicodeError: PPPyObject; + {$IFDEF MSWINDOWS} + PyExc_WindowsError: PPPyObject; + {$ENDIF} + PyExc_Warning: PPPyObject; + PyExc_DeprecationWarning: PPPyObject; + PyExc_RuntimeWarning: PPPyObject; + PyExc_SyntaxWarning: PPPyObject; + PyExc_UserWarning: PPPyObject; + PyExc_ReferenceError: PPPyObject; + PyExc_StopIteration: PPPyObject; + PyExc_FutureWarning: PPPyObject; + PyExc_PendingDeprecationWarning: PPPyObject; + PyExc_UnicodeDecodeError: PPPyObject; + PyExc_UnicodeEncodeError: PPPyObject; + PyExc_UnicodeTranslateError: PPPyObject; + PyExc_BufferError: PPPyObject; + + PyCode_Type: PPyTypeObject; + PyType_Type: PPyTypeObject; + PyCFunction_Type: PPyTypeObject; + PyComplex_Type: PPyTypeObject; + PyDict_Type: PPyTypeObject; + PyFloat_Type: PPyTypeObject; + PyFrame_Type: PPyTypeObject; + PyFunction_Type: PPyTypeObject; + PyList_Type: PPyTypeObject; + PyLong_Type: PPyTypeObject; + PyMethod_Type: PPyTypeObject; + PyModule_Type: PPyTypeObject; + PyObject_Type: PPyTypeObject; + PyRange_Type: PPyTypeObject; + PySlice_Type: PPyTypeObject; + PyBytes_Type: PPyTypeObject; + PyByteArray_Type: PPyTypeObject; + PyTuple_Type: PPyTypeObject; + PyBaseObject_Type: PPyTypeObject; + PyCallIter_Type: PPyTypeObject; + PyCell_Type: PPyTypeObject; + PyClassMethod_Type: PPyTypeObject; + PyProperty_Type: PPyTypeObject; + PySeqIter_Type: PPyTypeObject; + PyStaticMethod_Type: PPyTypeObject; + PySuper_Type: PPyTypeObject; + PyTraceBack_Type: PPyTypeObject; + PyUnicode_Type: PPyTypeObject; + PyGetSetDescr_Type: PPyTypeObject; + PyWrapperDescr_Type: PPyTypeObject; + _PyWeakref_RefType: PPyTypeObject; + _PyWeakref_ProxyType: PPyTypeObject; + _PyWeakref_CallableProxyType: PPyTypeObject; + PyBool_Type: PPyTypeObject; + PyEnum_Type: PPyTypeObject; + PySet_Type: PPyTypeObject; + PyFrozenSet_Type: PPyTypeObject; + + Py_GetBuildInfo: function : PAnsiChar; cdecl; + PyImport_ExecCodeModule: function ( const name : AnsiString; codeobject : PPyObject) : PPyObject; cdecl; + PyComplex_FromCComplex: function(c: Py_complex):PPyObject; cdecl; + PyComplex_FromDoubles: function(realv,imag : double):PPyObject; cdecl; + PyComplex_RealAsDouble: function(op : PPyObject ): double; cdecl; + PyComplex_ImagAsDouble: function(op : PPyObject ): double; cdecl; + PyComplex_AsCComplex: function(op : PPyObject ): Py_complex; cdecl; + PyCFunction_GetFunction: function(ob : PPyObject): Pointer; cdecl; + PyCFunction_GetSelf: function(ob : PPyObject): PPyObject; cdecl; + PyCallable_Check: function(ob : PPyObject): integer; cdecl; + + PyModule_Create2: function(moduledef: PPyModuleDef; Api_Version: Integer):PPyObject; cdecl; + PyErr_BadArgument: function: integer; cdecl; + PyErr_BadInternalCall: procedure; cdecl; + PyErr_CheckSignals: function: integer; cdecl; + PyErr_Clear: procedure; cdecl; + PyErr_Fetch: procedure(out errtype, errvalue, errtraceback: PPyObject); cdecl; + PyErr_NoMemory: function: PPyObject; cdecl; + PyErr_Occurred: function: PPyObject; cdecl; + PyErr_Print: procedure; cdecl; + PyErr_Restore: procedure (errtype, errvalue, errtraceback: PPyObject); cdecl; + PyErr_SetFromErrno: function (ob : PPyObject):PPyObject; cdecl; + PyErr_SetNone: procedure(value: PPyObject); cdecl; + PyErr_SetObject: procedure (ob1, ob2 : PPyObject); cdecl; + PyErr_SetString: procedure( ErrorObject: PPyObject; text: PAnsiChar); cdecl; + PyErr_WarnEx: function (ob: PPyObject; text: PAnsiChar; stack_level: NativeInt): integer; cdecl; + PyErr_WarnExplicit: function (ob: PPyObject; text: PAnsiChar; filename: PAnsiChar; lineno: integer; module: PAnsiChar; registry: PPyObject): integer; cdecl; + PyImport_GetModuleDict: function: PPyObject; cdecl; + + PyArg_Parse: TPyArg_Parse; + PyArg_ParseTuple: TPyArg_Parse; + PyArg_ParseTupleAndKeywords: TPyArg_ParseTupleAndKeywords; + Py_BuildValue: TPy_BuildValue; + + Py_Initialize: procedure; cdecl; + Py_Exit: procedure( RetVal: Integer); cdecl; + PyEval_GetBuiltins: function: PPyObject; cdecl; + PyDict_Copy: function(mp: PPyObject):PPyObject; cdecl; + PyDict_GetItem: function(mp, key : PPyObject):PPyObject; cdecl; + PyDict_SetItem: function(mp, key, item :PPyObject ):integer; cdecl; + PyDict_DelItem: function(mp, key : PPyObject ):integer; cdecl; + PyDict_Clear: procedure(mp : PPyObject); cdecl; + PyDict_Next: function(mp : PPyObject; pos: PNativeInt; key, value: PPPyObject):integer; cdecl; + PyDict_Keys: function(mp: PPyObject):PPyObject; cdecl; + PyDict_Values: function(mp: PPyObject):PPyObject; cdecl; + PyDict_Items: function(mp: PPyObject):PPyObject; cdecl; + PyDict_Size: function(mp: PPyObject):NativeInt; cdecl; + PyDict_Update: function (a: PPyObject; b: PPyObject):Integer; cdecl; + PyDict_DelItemString: function(dp : PPyObject;key : PAnsiChar ):integer; cdecl; + PyDict_New: function: PPyObject; cdecl; + PyDict_GetItemString: function( dp: PPyObject; key: PAnsiChar): PPyObject; cdecl; + PyDict_SetItemString: function( dp: PPyObject; key: PAnsiChar; item: PPyObject): + Integer; cdecl; + PyDictProxy_New: function (obj : PPyObject) : PPyObject; cdecl; + PyModule_GetDict: function( module:PPyObject): PPyObject; cdecl; + PyObject_Str: function( v: PPyObject): PPyObject; cdecl; + PyRun_String: function( str: PAnsiChar; start: Integer; globals: PPyObject; + locals: PPyObject): PPyObject; cdecl; + PyRun_SimpleString: function( str: PAnsiChar): Integer; cdecl; + PyBytes_AsString: function( ob: PPyObject): PAnsiChar; cdecl; + PyBytes_AsStringAndSize: function( ob: PPyObject; var buffer: PAnsiChar; var size: NativeInt): integer; cdecl; + PyByteArray_AsString: function(ob: PPyObject): PAnsiChar; cdecl; + + PyCFunction_NewEx: function(md:PPyMethodDef;self, ob:PPyObject):PPyObject; cdecl; + + PyBuffer_GetPointer: function(view: PPy_buffer; indices: PPy_ssize_t): Pointer; cdecl; + PyBuffer_SizeFromFormat: function(format: PAnsiChar): Py_ssize_t; cdecl; // New in Python 3.9 + PyBuffer_ToContiguous: function(buf: Pointer; view: PPy_buffer; len: Py_ssize_t; order: AnsiChar): Integer; cdecl; + PyBuffer_FromContiguous: function(view: PPy_buffer; buf: Pointer; len: Py_ssize_t; order: AnsiChar): Integer; cdecl; + PyBuffer_IsContiguous: function(view: PPy_buffer; fort: AnsiChar): Integer; cdecl; + PyBuffer_FillContiguousStrides: procedure(ndims: Integer; shape: Py_ssize_t; + strides: PPy_ssize_t; itemsize: Integer; fort: AnsiChar); cdecl; + PyBuffer_FillInfo: function(view: PPy_buffer; o: PPyObject; buf: Pointer; + len: Py_ssize_t; readonly: Integer; flags: Integer): Integer; cdecl; + PyBuffer_Release: procedure(view: PPy_buffer); cdecl; + + PyEval_GetFrame:function :PPyObject; cdecl; + PyEval_GetGlobals:function :PPyObject; cdecl; + PyEval_GetLocals:function :PPyObject; cdecl; + + PyEval_RestoreThread:procedure( tstate: PPyThreadState); cdecl; + PyEval_SaveThread:function :PPyThreadState; cdecl; + + PyFile_GetLine:function (ob:PPyObject;i:integer):PPyObject; cdecl; + PyFile_WriteObject:function (ob1,ob2:PPyObject;i:integer):integer; cdecl; + PyFile_WriteString:procedure(s:PAnsiChar;ob:PPyObject); cdecl; + PyFloat_AsDouble:function (ob:PPyObject):DOUBLE; cdecl; + PyFloat_FromDouble:function (db:double):PPyObject; cdecl; + PyFloat_FromString:function (str:PPyObject):PPyObject; cdecl; + PyFunction_GetCode:function (ob:PPyObject):PPyObject; cdecl; + PyFunction_GetGlobals:function (ob:PPyObject):PPyObject; cdecl; + PyFunction_New:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyImport_AddModule:function (name:PAnsiChar):PPyObject; cdecl; + PyImport_GetMagicNumber:function :C_Long; cdecl; + PyImport_ImportFrozenModule:function (key:PAnsiChar):integer; cdecl; + PyImport_ImportModule:function (name:PAnsiChar):PPyObject; cdecl; + PyImport_Import:function (name:PPyObject):PPyObject; cdecl; + PyImport_ReloadModule:function (ob:PPyObject):PPyObject; cdecl; + PyList_Append:function (ob1,ob2:PPyObject):integer; cdecl; + PyList_AsTuple:function (ob:PPyObject):PPyObject; cdecl; + PyList_GetItem:function (ob:PPyObject;i:NativeInt):PPyObject; cdecl; + PyList_GetSlice:function (ob:PPyObject;i1,i2:NativeInt):PPyObject; cdecl; + PyList_Insert:function (dp:PPyObject;idx:NativeInt;item:PPyObject):integer; cdecl; + PyList_New:function (size:NativeInt):PPyObject; cdecl; + PyList_Reverse:function (ob:PPyObject):integer; cdecl; + PyList_SetItem:function (dp:PPyObject;idx:NativeInt;item:PPyObject):integer; cdecl; + PyList_SetSlice:function (ob:PPyObject;i1,i2:NativeInt;ob2:PPyObject):integer; cdecl; + PyList_Size:function (ob:PPyObject):NativeInt; cdecl; + PyList_Sort:function (ob:PPyObject):integer; cdecl; + PyLong_AsDouble:function (ob:PPyObject):DOUBLE; cdecl; + PyLong_AsLong:function (ob:PPyObject):C_Long; cdecl; + PyLong_FromDouble:function (db:double):PPyObject; cdecl; + PyLong_FromLong:function (l:C_Long):PPyObject; cdecl; + PyLong_FromString:function (pc:PAnsiChar;var ppc:PAnsiChar;i:integer):PPyObject; cdecl; + PyLong_FromUnsignedLong:function(val:C_ULong): PPyObject; cdecl; + PyLong_AsUnsignedLong:function(ob:PPyObject): C_ULong; cdecl; + PyLong_FromUnicodeObject:function(ob:PPyObject; base : integer): PPyObject; cdecl; + PyLong_FromLongLong:function(val:Int64): PPyObject; cdecl; + PyLong_FromUnsignedLongLong:function(val:UInt64) : PPyObject; cdecl; + PyLong_AsLongLong:function(ob:PPyObject): Int64; cdecl; + PyLong_AsVoidPtr:function(ob:PPyObject): Pointer; cdecl; + PyLong_FromVoidPtr:function(p: Pointer): PPyObject; cdecl; + PyMapping_Check:function (ob:PPyObject):integer; cdecl; + PyMapping_GetItemString:function (ob:PPyObject;key:PAnsiChar):PPyObject; cdecl; + PyMapping_HasKey:function (ob,key:PPyObject):integer; cdecl; + PyMapping_HasKeyString:function (ob:PPyObject;key:PAnsiChar):integer; cdecl; + PyMapping_Length:function (ob:PPyObject):NativeInt; cdecl; + PyMapping_SetItemString:function (ob:PPyObject; key:PAnsiChar; value:PPyObject):integer; cdecl; + PyMapping_Keys:function(mp: PPyObject):PPyObject; cdecl; + PyMapping_Values:function(mp: PPyObject):PPyObject; cdecl; + PyMethod_Function:function (ob:PPyObject):PPyObject; cdecl; + PyMethod_New:function (ob1,ob2,ob3:PPyObject):PPyObject; cdecl; + PyMethod_Self:function (ob:PPyObject):PPyObject; cdecl; + PyModule_GetName:function (ob:PPyObject):PAnsiChar; cdecl; + PyModule_New:function (key:PAnsiChar):PPyObject; cdecl; + PyNumber_Absolute:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Add:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_And:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Check:function (ob:PPyObject):integer; cdecl; + PyNumber_FloorDivide:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_TrueDivide:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Divmod:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Float:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Invert:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Long:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Lshift:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Multiply:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Negative:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Or:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Positive:function (ob:PPyObject):PPyObject; cdecl; + PyNumber_Power:function (ob1,ob2,ob3:PPyObject):PPyObject; cdecl; + PyNumber_Remainder:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Rshift:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Subtract:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyNumber_Xor:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyOS_InterruptOccurred:function :integer; cdecl; + PyObject_CallObject:function (ob,args:PPyObject):PPyObject; cdecl; + PyObject_CallMethod : function ( obj : PPyObject; method, format : PAnsiChar {...}) : PPyObject; cdecl varargs; + PyObject_RichCompare:function (ob1,ob2:PPyObject;opid:integer):PPyObject; cdecl; + PyObject_RichCompareBool:function (ob1,ob2:PPyObject;opid:integer):Integer; cdecl; + PyObject_GetAttr:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PyObject_GetAttrString:function (ob:PPyObject;c:PAnsiChar):PPyObject; cdecl; + PyObject_GetItem:function (ob,key:PPyObject):PPyObject; cdecl; + PyObject_DelItem:function (ob,key:PPyObject):PPyObject; cdecl; + PyObject_HasAttr:function (ob, attr_name:PPyObject):integer; cdecl; + PyObject_HasAttrString:function (ob:PPyObject;key:PAnsiChar):integer; cdecl; + PyObject_Hash:function (ob:PPyObject):NativeInt; cdecl; + PyObject_IsTrue:function (ob:PPyObject):integer; cdecl; + PyObject_Length:function (ob:PPyObject):NativeInt; cdecl; + PyObject_Repr:function (ob:PPyObject):PPyObject; cdecl; + PyObject_SetAttr:function (ob1,ob2,ob3:PPyObject):integer; cdecl; + PyObject_SetAttrString:function (ob:PPyObject;key:PAnsiChar;value:PPyObject):integer; cdecl; + PyObject_SetItem:function (ob1,ob2,ob3:PPyObject):integer; cdecl; + PyObject_Init:function (ob:PPyObject; t:PPyTypeObject):PPyObject; cdecl; + PyObject_InitVar:function (ob:PPyObject; t:PPyTypeObject; size:NativeInt):PPyObject; cdecl; + PyObject_New:function (t:PPyTypeObject):PPyObject; cdecl; + PyObject_NewVar:function (t:PPyTypeObject; size:NativeInt):PPyObject; cdecl; + PyObject_Free:procedure (ob:PPyObject); cdecl; + PyObject_GetIter: function (obj: PPyObject) : PPyObject; cdecl; + PyIter_Next: function (obj: PPyObject) : PPyObject; cdecl; + PyObject_IsInstance:function (inst, cls:PPyObject):integer; cdecl; + PyObject_IsSubclass:function (derived, cls:PPyObject):integer; cdecl; + PyObject_Call:function (ob, args, kw:PPyObject):PPyObject; cdecl; + PyObject_GenericGetAttr:function (obj, name : PPyObject) : PPyObject; cdecl; + PyObject_GenericSetAttr:function (obj, name, value : PPyObject) : Integer; cdecl; + PyObject_Malloc:function (size:NativeUInt):PPyObject; cdecl; + PyObject_GC_New:function (t:PPyTypeObject):PPyObject; cdecl; + PyObject_GC_NewVar:function (t:PPyTypeObject; size:NativeInt):PPyObject; cdecl; + PyObject_GC_Resize:function (t:PPyObject; newsize:NativeInt):PPyObject; cdecl; + PyObject_GC_Del:procedure (ob:PPyObject); cdecl; + PyObject_GC_Track:procedure (ob:PPyObject); cdecl; + PyObject_GC_UnTrack:procedure (ob:PPyObject); cdecl; + PyObject_GetBuffer: function(obj: PPyObject; view: PPy_buffer; flags: Integer): Integer; cdecl; + PyObject_CopyData: function (dest: PPyObject; src: PPyObject): Integer; cdecl; + PySequence_Check:function (ob:PPyObject):integer; cdecl; + PySequence_Concat:function (ob1,ob2:PPyObject):PPyObject; cdecl; + PySequence_Count:function (ob1,ob2:PPyObject):integer; cdecl; + PySequence_GetItem:function (ob:PPyObject;i:NativeInt):PPyObject; cdecl; + PySequence_GetSlice:function (ob:PPyObject;i1,i2:NativeInt):PPyObject; cdecl; + PySequence_In:function (ob1,ob2:PPyObject):integer; cdecl; + PySequence_Index:function (ob1,ob2:PPyObject):NativeInt; cdecl; + PySequence_Length:function (ob:PPyObject):NativeInt; cdecl; + PySequence_Repeat:function (ob:PPyObject;count:NativeInt):PPyObject; cdecl; + PySequence_SetItem:function (ob:PPyObject;i:NativeInt;value:PPyObject):integer; cdecl; + PySequence_SetSlice:function (ob:PPyObject;i1,i2:NativeInt;value:PPyObject):integer; cdecl; + PySequence_DelSlice:function (ob:PPyObject;i1,i2:NativeInt):integer; cdecl; + PySequence_Tuple:function (ob:PPyObject):PPyObject; cdecl; + PySequence_Contains:function (ob, value:PPyObject):integer; cdecl; + PySequence_List:function (o:PPyObject):PPyObject; cdecl; + PySeqIter_New: function(obj : PPyObject) : PPyObject; cdecl; + PySlice_GetIndices:function (ob:PPySliceObject;length:NativeInt;var start,stop,step:NativeInt):integer; cdecl; + PySlice_GetIndicesEx:function (ob:PPySliceObject;length:NativeInt;var start,stop,step,slicelength:NativeInt):integer; cdecl; + PySlice_New:function (start,stop,step:PPyObject):PPyObject; cdecl; + PyBytes_Concat:procedure(var ob1:PPyObject;ob2:PPyObject); cdecl; + PyBytes_ConcatAndDel:procedure(var ob1:PPyObject;ob2:PPyObject); cdecl; + PyBytes_FromString:function (s:PAnsiChar):PPyObject; cdecl; + PyBytes_FromStringAndSize:function (s:PAnsiChar;i:NativeInt):PPyObject; cdecl; + PyBytes_Size:function (ob:PPyObject):NativeInt; cdecl; + PyBytes_DecodeEscape:function(s:PAnsiChar; len:NativeInt; errors:PAnsiChar; unicode:NativeInt; recode_encoding:PAnsiChar):PPyObject; cdecl; + PyBytes_Repr:function(ob:PPyObject; smartquotes:integer):PPyObject; cdecl; + PyBytes_FromObject: function(ob:PPyObject): PPyObject; cdecl; + PyByteArray_Concat: procedure(var ob1: PPyObject; ob2: PPyObject); cdecl; + PyByteArray_Resize: procedure(var ob1: PPyObject; len: Py_ssize_t); cdecl; + PyByteArray_FromObject: function(ob:PPyObject): PPyObject; cdecl; + PyByteArray_FromStringAndSize: function(s: PAnsiChar; i: Py_ssize_t): PPyObject; cdecl; + PyByteArray_Size: function(ob: PPyObject): Py_ssize_t; cdecl; + PyFrozenSet_New: function(iterable: PPyObject): PPyObject; cdecl; + PySet_New: function(iterable: PPyObject): PPyObject; cdecl; + PySet_Add: function(aset, key: PPyObject): Integer; cdecl; + PySet_Clear: function(aset: PPyObject): Integer; cdecl; + PySet_Contains: function(anyset, key: PPyObject): Integer; cdecl; + PySet_Discard: function(aset, key: PPyObject): Integer; cdecl; + PySet_Pop: function(aset: PPyObject): PPyObject; cdecl; + PySet_Size: function(anyset: PPyObject): Py_ssize_t; cdecl; + PySys_GetObject:function (s:PAnsiChar):PPyObject; cdecl; + PySys_SetObject:function (s:PAnsiChar;ob:PPyObject):integer; cdecl; + PyTraceBack_Here:function (p:pointer):integer; cdecl; + PyTraceBack_Print:function (ob1,ob2:PPyObject):integer; cdecl; + PyTuple_GetItem:function (ob:PPyObject;i:NativeInt):PPyObject; cdecl; + PyTuple_GetSlice:function (ob:PPyObject;i1,i2:NativeInt):PPyObject; cdecl; + PyTuple_New:function (size:NativeInt):PPyObject; cdecl; + PyTuple_SetItem:function (ob:PPyObject;key:NativeInt;value:PPyObject):integer; cdecl; + PyTuple_Size:function (ob:PPyObject):NativeInt; cdecl; + PyType_IsSubtype:function (a, b : PPyTypeObject):integer; cdecl; + PyType_GenericAlloc:function(atype: PPyTypeObject; nitems:NativeInt) : PPyObject; cdecl; + PyType_GenericNew:function(atype: PPyTypeObject; args, kwds : PPyObject) : PPyObject; cdecl; + PyType_Ready:function(atype: PPyTypeObject) : integer; cdecl; + PyUnicode_FromWideChar:function (const w:PWCharT; size:NativeInt):PPyObject; cdecl; + PyUnicode_FromString:function (s:PAnsiChar):PPyObject; cdecl; + PyUnicode_FromStringAndSize:function (s:PAnsiChar;i:NativeInt):PPyObject; cdecl; + PyUnicode_FromKindAndData:function (kind:integer;const buffer:pointer;size:NativeInt):PPyObject; cdecl; + PyUnicode_AsWideChar:function (unicode: PPyObject; w:PWCharT; size:NativeInt):integer; cdecl; + PyUnicode_AsUTF8:function (unicode: PPyObject):PAnsiChar; cdecl; + PyUnicode_AsUTF8AndSize:function (unicode: PPyObject; size: PNativeInt):PAnsiChar; cdecl; + PyUnicode_Decode:function (const s:PAnsiChar; size: NativeInt; const encoding : PAnsiChar; const errors: PAnsiChar):PPyObject; cdecl; + PyUnicode_DecodeUTF16:function (const s:PAnsiChar; size: NativeInt; const errors: PAnsiChar; byteoder: PInteger):PPyObject; cdecl; + PyUnicode_AsEncodedString:function (unicode:PPyObject; const encoding:PAnsiChar; const errors:PAnsiChar):PPyObject; cdecl; + PyUnicode_FromOrdinal:function (ordinal:integer):PPyObject; cdecl; + PyUnicode_GetLength:function (unicode:PPyObject):NativeInt; cdecl; + PyWeakref_GetObject: function ( ref : PPyObject) : PPyObject; cdecl; + PyWeakref_NewProxy: function ( ob, callback : PPyObject) : PPyObject; cdecl; + PyWeakref_NewRef: function ( ob, callback : PPyObject) : PPyObject; cdecl; + PyWrapper_New: function ( ob1, ob2 : PPyObject) : PPyObject; cdecl; + PyBool_FromLong: function ( ok : Integer) : PPyObject; cdecl; + PyThreadState_SetAsyncExc: function(t_id:C_ULong; exc:PPyObject) : Integer; cdecl; + Py_AtExit:function (proc: AtExitProc):integer; cdecl; + Py_CompileStringExFlags:function (str,filename:PAnsiChar;start:integer;flags:PPyCompilerFlags;optimize:integer):PPyObject; cdecl; + Py_FatalError:procedure(s:PAnsiChar); cdecl; + _PyObject_New:function (obt:PPyTypeObject;ob:PPyObject):PPyObject; cdecl; + _PyBytes_Resize:function (var ob:PPyObject;i:NativeInt):integer; cdecl; + Py_Finalize : procedure; cdecl; + PyErr_ExceptionMatches : function ( exc : PPyObject) : Integer; cdecl; + PyErr_GivenExceptionMatches : function ( raised_exc, exc : PPyObject) : Integer; cdecl; + PyEval_EvalCode : function ( co : PPyObject; globals, locals : PPyObject) : PPyObject; cdecl; + Py_GetVersion : function : PAnsiChar; cdecl; + Py_GetCopyright : function : PAnsiChar; cdecl; + Py_GetExecPrefix : function : PWCharT; cdecl; + Py_GetPath : function : PWCharT; cdecl; + Py_GetPythonHome : function : PWCharT; cdecl; + Py_GetPrefix : function : PWCharT; cdecl; + Py_GetProgramName : function : PWCharT; cdecl; + + PyErr_NewException : function (name : PAnsiChar; base, dict : PPyObject): PPyObject; cdecl; + PyMem_Malloc : function (size: NativeUInt): Pointer; cdecl; + PyMem_Free : procedure (P: Pointer); cdecl; + + Py_IsInitialized : function : integer; cdecl; + Py_GetProgramFullPath : function : PAnsiChar; cdecl; + Py_NewInterpreter : function : PPyThreadState; cdecl; + Py_NewInterpreterFromConfig : function( tstate: PPyThreadState; config: PPyInterpreterConfig): PyStatus; cdecl; + Py_EndInterpreter : procedure( tstate: PPyThreadState); cdecl; + PyEval_AcquireThread : procedure( tstate: PPyThreadState); cdecl; + PyEval_ReleaseThread : procedure( tstate: PPyThreadState); cdecl; + PyInterpreterState_New : function : PPyInterpreterState; cdecl; + PyInterpreterState_Clear : procedure( interp: PPyInterpreterState); cdecl; + PyInterpreterState_Delete : procedure( interp: PPyInterpreterState); cdecl; + PyThreadState_New : function ( interp: PPyInterpreterState): PPyThreadState; cdecl; + PyThreadState_Clear : procedure( tstate: PPyThreadState); cdecl; + PyThreadState_Delete : procedure( tstate: PPyThreadState); cdecl; + PyThreadState_Get : function : PPyThreadState; cdecl; + PyThreadState_Swap : function ( tstate: PPyThreadState): PPyThreadState; cdecl; + PyErr_SetInterrupt : procedure; cdecl; + PyGILState_Ensure : function() : PyGILstate_STATE; cdecl; + PyGILState_Release : procedure(gilstate : PyGILState_STATE); cdecl; + + // PEP 587 Initialization functions + PyWideStringList_Append : function(list: PPyWideStringList; item: PWCharT): PyStatus; cdecl; + PyWideStringList_Insert : function(list: PPyWideStringList; index: Py_ssize_t; item: PWCharT): PyStatus; cdecl; + PyConfig_InitPythonConfig : procedure(var config: PyConfig); cdecl; + PyConfig_InitIsolatedConfig : procedure(var config: PyConfig); cdecl; + PyConfig_Clear : procedure(var config: PyConfig); cdecl; + PyConfig_SetString : function(var config: PyConfig; config_str: PPWCharT; str: PWCharT): PyStatus; cdecl; + PyConfig_Read : function(var config: PyConfig): PyStatus; cdecl; + PyConfig_SetArgv : function(var config: PyConfig; argc: Py_ssize_t; argv: PPWCharT): PyStatus; cdecl; + PyConfig_SetWideStringList : function(var config: PyConfig; list: PPyWideStringList; length: Py_ssize_t; items: PPWCharT): PyStatus; cdecl; + Py_InitializeFromConfig : function({$IFDEF FPC}constref{$ELSE}[Ref] const{$ENDIF} config: PyConfig): PyStatus; cdecl; + + // PEP 741 Initialization functions - python 3.14+ + PyInitConfig_Create : function(): PPyInitConfig; cdecl; + PyInitConfig_Free : procedure(config: PPyInitConfig); cdecl; + Py_InitializeFromInitConfig : function(config: PPyInitConfig): Integer; cdecl; + PyInitConfig_SetInt : function(config: PPyInitConfig; name: PAnsiChar; value: Int64): Integer; cdecl; + PyInitConfig_SetStr : function(config: PPyInitConfig; name: PAnsiChar; value: PAnsiChar): Integer; cdecl; + PyInitConfig_SetStrList : function(config: PPyInitConfig; name: PAnsiChar; Lenght: Py_ssize_t; value: PPAnsiChar): Integer; cdecl; + PyInitConfig_GetError : function(config: PPyInitConfig; err_msg: PPAnsiChar): integer; cdecl; + PyConfig_Get : function(name: PAnsiChar): PPyObject; cdecl; + PyConfig_Set : function(name: PAnsiChar; value: PPyObject): Integer; cdecl; + + function Py_CompileString(str,filename:PAnsiChar;start:integer) : PPyObject; cdecl; + + // functions redefined in Delphi + class procedure Py_INCREF(op: PPyObject); static; inline; + class procedure Py_DECREF(op: PPyObject); static; inline; + class procedure Py_XINCREF(op: PPyObject); static; inline; + class procedure Py_XDECREF(op: PPyObject); static; inline; + (* Safely decref `op` and set `op` to NULL, especially useful in tp_clear + * and tp_dealloc implementations. + * + * Note that "the obvious" code can be deadly: + * + * Py_XDECREF(op); + * op = NULL; + * + * Typically, `op` is something like self->containee, and `self` is done + * using its `containee` member. In the code sequence above, suppose + * `containee` is non-NULL with a refcount of 1. Its refcount falls to + * 0 on the first line, which can trigger an arbitrary amount of code, + * possibly including finalizers (like __del__ methods or weakref callbacks) + * coded in Python, which in turn can release the GIL and allow other threads + * to run, etc. Such code may even invoke methods of `self` again, or cause + * cyclic gc to trigger, but-- oops! --self->containee still points to the + * object being torn down, and it may be in an insane state while being torn + * down. This has in fact been a rich historic source of miserable (rare & + * hard-to-diagnose) segfaulting (and other) bugs. + * + * The safe way is: + * + * Py_CLEAR(op); + * + * That arranges to set `op` to NULL _before_ decref'ing, so that any code + * triggered as a side-effect of `op` getting torn down no longer believes + * `op` points to a valid object. + * + * There are cases where it's safe to use the naive code, but they're brittle. + * For example, if `op` points to a Python integer, you know that destroying + * one of those can't cause problems -- but in part that relies on that + * Python integers aren't currently weakly referencable. Best practice is + * to use Py_CLEAR() even if you can't think of a reason for why you need to. + *) + class procedure Py_CLEAR(var op: PPyObject); static; inline; + + function PyBytes_Check( obj : PPyObject ) : Boolean; + function PyBytes_CheckExact( obj : PPyObject ) : Boolean; + function PyByteArray_Check(obj: PPyObject): Boolean; + function PyByteArray_CheckExact(obj: PPyObject): Boolean; + function PyFloat_Check( obj : PPyObject ) : Boolean; + function PyFloat_CheckExact( obj : PPyObject ) : Boolean; + function PyLong_Check( obj : PPyObject ) : Boolean; + function PyLong_CheckExact( obj : PPyObject ) : Boolean; + function PyTuple_Check( obj : PPyObject ) : Boolean; + function PyTuple_CheckExact( obj : PPyObject ) : Boolean; + function PyClass_Check( obj : PPyObject ) : Boolean; + function PyType_CheckExact( obj : PPyObject ) : Boolean; + function PyMethod_Check( obj : PPyObject ) : Boolean; + function PyList_Check( obj : PPyObject ) : Boolean; + function PyList_CheckExact( obj : PPyObject ) : Boolean; + function PyDict_Check( obj : PPyObject ) : Boolean; + function PyDict_CheckExact( obj : PPyObject ) : Boolean; + function PyModule_Check( obj : PPyObject ) : Boolean; + function PyModule_CheckExact( obj : PPyObject ) : Boolean; + function PySlice_Check( obj : PPyObject ) : Boolean; + function PyFunction_Check( obj : PPyObject ) : Boolean; + function PyIter_Check( obj : PPyObject ) : Boolean; + function PyUnicode_Check( obj : PPyObject ) : Boolean; + function PyUnicode_CheckExact( obj : PPyObject ) : Boolean; + function PyType_IS_GC(t : PPyTypeObject ) : Boolean; + function PyObject_IS_GC( obj : PPyObject ) : Boolean; + function PyObject_CheckBuffer(obj: PPyObject): Boolean; + function PyWeakref_Check( obj : PPyObject ) : Boolean; + function PyWeakref_CheckRef( obj : PPyObject ) : Boolean; + function PyWeakref_CheckProxy( obj : PPyObject ) : Boolean; + function PyBool_Check( obj : PPyObject ) : Boolean; + function PyEnum_Check( obj : PPyObject ) : Boolean; + function Py_InitModule( const md : PyModuleDef) : PPyObject; + + // The following are defined as non-exported inline functions in object.h + function Py_Type(ob: PPyObject): PPyTypeObject; inline; + function IsType(ob: PPyObject; obt: PPyTypeObject): Boolean; inline; + function PyObject_TypeCheck(obj:PPyObject; t:PPyTypeObject) : Boolean; inline; + + // Constructors & Destructors + constructor Create(AOwner: TComponent); override; + + // Public methods + procedure MapDll; + + // Public properties + property Initialized : Boolean read FInitialized; + property Finalizing : Boolean read FFinalizing; + property MajorVersion : integer read FMajorVersion; + property MinorVersion : integer read FMinorVersion; + property BuiltInModuleName: string read FBuiltInModuleName write FBuiltInModuleName; +end; + +//-------------------------------------------------------- +//-- -- +//-- class: TPythonEngine derived from TPythonInterface-- +//-- Pytrunobject providing interface for -- +//-- running Python into Delphi -- +//-------------------------------------------------------- +type + TDatetimeConversionMode = (dcmToTuple, dcmToDatetime); + TPythonFlag = (pfDebug, pfInteractive, pfNoSite, pfOptimize, pfVerbose, + pfFrozen, pfIgnoreEnvironment, pfNoUserSiteDirectory, + pfDontWriteBytecode, pfIsolated); + TPythonFlags = set of TPythonFlag; + +const + DEFAULT_DATETIME_CONVERSION_MODE = dcmToTuple; + DEFAULT_FLAGS = + {$IFDEF IOS} + [pfIsolated, pfNoUserSiteDirectory, pfIgnoreEnvironment, + pfDontWriteBytecodeFlag] + {$ELSE} + [] + {$ENDIF IOS}; + +type + TEngineClient = class; + TPathInitializationEvent = procedure ( Sender : TObject; var Path : string ) of Object; + TSysPathInitEvent = procedure(Sender: TObject; PathList: PPyObject) of object; + // Config will be either PPyConfig if version < 3.14 or PPyInitConfig + TConfigInitEvent = procedure(Sender: TObject; Config: Pointer) of object; + + + TTracebackItem = class + public + FileName : string; + LineNo : Integer; + Context : string; + end; + + TPythonTraceback = class + protected + FItems : TList; + FLimit : Integer; + + function GetItemCount : Integer; + function GetItem( idx : Integer ) : TTracebackItem; + public + constructor Create; + destructor Destroy; override; + + procedure Clear; + procedure Refresh(pytraceback: PPyObject = nil); + procedure AddItem(const Context, FileName: string; LineNo: Integer); + + property ItemCount : Integer read GetItemCount; + property Items[ idx : Integer ] : TTracebackItem read GetItem; + property Limit : Integer read FLimit write FLimit; + end; + + TPythonType = class; //forward declaration + + {$IF not Defined(FPC) and (CompilerVersion >= 23)} + [ComponentPlatformsAttribute(pidSupportedPlatforms)] + {$IFEND} + TPythonEngine = class(TPythonInterface) + private + FPythonExecutable: string; + FInitScript: TStrings; + FIO: TPythonInputOutput; + FRedirectIO: Boolean; + FOnAfterInit: TNotifyEvent; + FClients: TList; + FExecModule: AnsiString; + FAutoFinalize: Boolean; + FProgramName: UnicodeString; + FPythonHome: UnicodeString; + FPythonPath: UnicodeString; + FOnSysPathInit: TSysPathInitEvent; + FOnConfigInit: TConfigInitEvent; + FOnPathInitialization: TPathInitializationEvent; + FTraceback: TPythonTraceback; + FUseWindowsConsole: Boolean; + FGlobalVars: PPyObject; + FLocalVars: PPyObject; + FPyFlags: TPythonFlags; + FIORedirected: Boolean; + FIOPythonModule: TObject; + FDatetimeConversionMode: TDatetimeConversionMode; + FTimeStruct: PPyObject; + FPyDateTime_DateType: PPyObject; + FPyDateTime_DateTimeType: PPyObject; + FPyDateTime_DeltaType: PPyObject; + FPyDateTime_TimeType: PPyObject; + FPyDateTime_TZInfoType: PPyObject; + FPyDateTime_TimeTZType: PPyObject; + FPyDateTime_DateTimeTZType: PPyObject; + + protected + procedure Initialize; + procedure Finalize; + procedure AfterLoad; override; + procedure BeforeLoad; override; + procedure DoOpenDll(const aDllName : string); override; + procedure SetInitScript(Value: TStrings); + function GetThreadState: PPyThreadState; + function GetClientCount : Integer; + function GetClients( idx : Integer ) : TEngineClient; + procedure Notification(AComponent: TComponent; + Operation: TOperation); override; + // procedure CheckRegistry; + procedure InitWinConsole; + procedure SetUseWindowsConsole( const Value : Boolean ); + procedure SetGlobalVars(const Value: PPyObject); + procedure SetLocalVars(const Value: PPyObject); + procedure SetPyFlags(const Value: TPythonFlags); + procedure SetIO(InputOutput: TPythonInputOutput); + + public + // Constructors & Destructors + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + procedure DoOpenDll2(const aDllName : string); //override; + procedure SetProgramArgs2; + procedure Initialize2; + + // Public methods + procedure SetPythonHome(const PythonHome: UnicodeString); + procedure SetProgramName(const ProgramName: UnicodeString); + function Run_CommandAsString(const command: AnsiString; mode: Integer; const FileName: string = ''): string; + function Run_CommandAsObject(const command: AnsiString; mode: Integer; const FileName: string = ''): PPyObject; + function Run_CommandAsObjectWithDict(const command: AnsiString; mode: Integer; locals, globals: PPyObject; const FileName: string = ''): PPyObject; + function EncodeString(const str: UnicodeString): AnsiString; overload; + function EncodeString(const str: AnsiString): AnsiString; overload; + function EncodeWindowsFilePath(const str: string): AnsiString; + procedure ExecString(const command: AnsiString; const FileName: string = ''); overload; + procedure ExecStrings(strings: TStrings; const FileName: string = ''); overload; + procedure ExecString(const command: AnsiString; locals, globals: PPyObject; const FileName: string = ''); overload; + procedure ExecFile(const FileName: string; locals: PPyObject = nil; globals: PPyObject = nil); overload; + procedure ExecStrings(strings: TStrings; locals, globals: PPyObject; const FileName: string = ''); overload; + function EvalString(const command: AnsiString; const FileName: string = ''): PPyObject; overload; + function EvalStringAsStr(const command: AnsiString; const FileName: string = ''): string; + function EvalStrings(strings: TStrings; const FileName: string = ''): PPyObject; overload; + function EvalString(const command: AnsiString; locals, globals: PPyObject; const FileName: string = ''): PPyObject; overload; + function EvalStrings(strings: TStrings; locals, globals: PPyObject; const FileName: string = ''): PPyObject; overload; + function EvalStringsAsStr(strings: TStrings; const FileName: string = ''): string; + function EvalPyFunction(pyfunc, pyargs:PPyObject): Variant; + function EvalFunction(pyfunc:PPyObject; const args: array of const): Variant; + function EvalFunctionNoArgs(pyfunc:PPyObject): Variant; + function CheckEvalSyntax( const str : AnsiString ) : Boolean; + function CheckExecSyntax( const str : AnsiString ) : Boolean; + function CheckSyntax( const str : AnsiString; mode : Integer ) : Boolean; + procedure RaiseError; + function PyObjectAsString( obj : PPyObject ) : string; + procedure DoRedirectIO; + procedure CheckRegistry; //get from mX4 version to on OnPathInitialization + + procedure AddClient( client : TEngineClient ); + procedure RemoveClient( client : TEngineClient ); + function FindClient( const aName : string ) : TEngineClient; + function FindPythonType(const TypeName : AnsiString): TPythonType; + function TypeByName( const aTypeName : AnsiString ) : PPyTypeObject; + function ModuleByName( const aModuleName : AnsiString ) : PPyObject; + function MethodsByName( const aMethodsContainer: string ) : PPyMethodDef; + function VariantAsPyObject( const V : Variant ) : PPyObject; virtual; + function PyObjectAsVariant( obj : PPyObject ) : Variant; virtual; + function VarRecAsPyObject( const v : TVarRec ) : PPyObject; + function MakePyTuple( const objects : array of PPyObject ) : PPyObject; + function MakePyList( const objects : array of PPyObject ) : PPyObject; + function ArrayToPyTuple( const items : array of const) : PPyObject; + function ArrayToPyList( const items : array of const) : PPyObject; + function ArrayToPyDict( const items : array of const) : PPyObject; + function StringsToPyList( strings : TStrings ) : PPyObject; + function StringsToPyTuple( strings : TStrings ) : PPyObject; + procedure PyListToStrings(list: PPyObject; Strings: TStrings; ClearStrings: Boolean = True); + procedure PyTupleToStrings( tuple: PPyObject; strings : TStrings ); + function GetSequenceItem( sequence : PPyObject; idx : Integer ) : Variant; + function ReturnNone : PPyObject; + function ReturnTrue : PPyObject; + function ReturnFalse : PPyObject; + function FindModule( const ModuleName : AnsiString ) : PPyObject; + function FindFunction(const ModuleName,FuncName: AnsiString): PPyObject; + function SetToList( data : Pointer; size : Integer ) : PPyObject; + procedure ListToSet( List : PPyObject; data : Pointer; size : Integer ); + procedure CheckError(ACatchStopEx : Boolean = False); + function GetMainModule : PPyObject; + function PyTimeStruct_Check( obj : PPyObject ) : Boolean; + { Date, Time, DateTime and related objects check functions } + function PyDate_Check( obj : PPyObject ) : Boolean; + function PyDate_CheckExact( obj : PPyObject ) : Boolean; + function PyDateTime_Check( obj : PPyObject ) : Boolean; + function PyDateTime_CheckExact( obj : PPyObject ) : Boolean; + function PyTime_Check( obj : PPyObject ) : Boolean; + function PyTime_CheckExact( obj : PPyObject ) : Boolean; + function PyDelta_Check( obj : PPyObject ) : Boolean; + function PyDelta_CheckExact( obj : PPyObject ) : Boolean; + function PyTZInfo_Check( obj : PPyObject ) : Boolean; + function PyTZInfo_CheckExact( obj : PPyObject ) : Boolean; + + { String conversion } + function PyUnicodeFromString(const AString : UnicodeString) : PPyObject; overload; + function PyUnicodeFromString(const AString: AnsiString): PPyObject; overload; + function PyUnicodeAsString( obj : PPyObject ) : UnicodeString; + function PyUnicodeAsUTF8String( obj : PPyObject ) : RawByteString; + function PyBytesAsAnsiString( obj : PPyObject ) : AnsiString; + function PyByteArrayAsAnsiString( obj : PPyObject ) : AnsiString; + + // Public Properties + property ClientCount : Integer read GetClientCount; + property Clients[ idx : Integer ] : TEngineClient read GetClients; + property ExecModule : AnsiString read FExecModule write FExecModule; + property ThreadState: PPyThreadState read GetThreadState; + property Traceback : TPythonTraceback read FTraceback; + property LocalVars : PPyObject read FLocalVars Write SetLocalVars; + property GlobalVars : PPyObject read FGlobalVars Write SetGlobalVars; + property IOPythonModule: TObject read FIOPythonModule; {TPythonModule} + property PythonHome: UnicodeString read FPythonHome write SetPythonHome; + property ProgramName: UnicodeString read FProgramName write SetProgramName; + // List of paths separated with the path delimiter + // If used with pfNoSite, it completely overwrites the pyhon path on initialization! + // For adding directories to sys.path use the OnSysPathInit event instead. + property PythonPath: UnicodeString read FPythonPath write FPythonPath; + published + property AutoFinalize: Boolean read FAutoFinalize write FAutoFinalize default True; + property PythonExecutable: string read FPythonExecutable write FPythonExecutable; + property DatetimeConversionMode: TDatetimeConversionMode read FDatetimeConversionMode write FDatetimeConversionMode default DEFAULT_DATETIME_CONVERSION_MODE; + property InitScript: TStrings read FInitScript write SetInitScript; + property IO: TPythonInputOutput read FIO write SetIO; + property PyFlags: TPythonFlags read FPyFlags write SetPyFlags default DEFAULT_FLAGS; + property RedirectIO: Boolean read FRedirectIO write FRedirectIO default True; + property UseWindowsConsole: Boolean read FUseWindowsConsole write FUseWindowsConsole default False; + property OnAfterInit: TNotifyEvent read FOnAfterInit write FOnAfterInit; + property OnSysPathInit: TSysPathInitEvent read FOnSysPathInit write FOnSysPathInit; + property OnConfigInit: TConfigInitEvent read FOnConfigInit write FOnConfigInit; + property OnPathInitialization: TPathInitializationEvent read FOnPathInitialization write FOnPathInitialization; + end; + + +//------------------------------------------------------- +//-- -- +//-- Base class: TEngineClient -- +//-- -- +//------------------------------------------------------- + + TEngineClient = class(TComponent) + protected + FEngine : TPythonEngine; + FOnInitialization : TNotifyEvent; + FOnFinalization : TNotifyEvent; + FOnCreate : TNotifyEvent; + FOnDestroy : TNotifyEvent; + FInitialized : Boolean; + + procedure SetEngine( val : TPythonEngine ); virtual; + procedure Loaded; override; + procedure ModuleReady(Sender : TObject); virtual; + public + // Constructors & destructors + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + // Public Methods + procedure Initialize; virtual; + procedure Finalize; virtual; + procedure ClearEngine; + procedure CheckEngine; + + // Public Properties + property Initialized: Boolean read FInitialized; + + published + property Engine : TPythonEngine read FEngine write SetEngine; + property OnCreate : TNotifyEvent read FOnCreate write FOnCreate; + property OnDestroy : TNotifyEvent read FOnDestroy write FOnDestroy; + property OnFinalization : TNotifyEvent read FOnFinalization write FOnFinalization; + property OnInitialization : TNotifyEvent read FOnInitialization write FOnInitialization; + end; + +//------------------------------------------------------- +//-- -- +//--class: TMethodsContainer derived from TEngineClient-- +//-- -- +//------------------------------------------------------- + + TDelphiMethod = function ( self, args : PPyObject ) : PPyObject of object; cdecl; + TDelphiMethodWithKW = function ( self, args, keywords : PPyObject ) : PPyObject of object; cdecl; + TPythonEvent = procedure(Sender: TObject; PSelf, Args: PPyObject; var Result: PPyObject) of object; + TMethodsContainer = class; // forward declaration + TEventDefs = class; // forward declaration + + // Event Collection Item + TEventDef = class(TCollectionItem) + private + FName: AnsiString; + FTmpDocString: AnsiString; + FOnExecute: TPythonEvent; + FDocString: TStringList; + procedure SetDocString(const Value: TStringList); + protected + function GetDisplayName: string; override; + procedure SetDisplayName(const Value: string); override; + public + constructor Create(ACollection: TCollection); override; + destructor Destroy; override; + + procedure Assign(Source: TPersistent); override; + function GetDocString : AnsiString; + function PythonEvent(pself, args: PPyObject): PPyObject; cdecl; + function Owner : TEventDefs; + published + property Name: string read GetDisplayName write SetDisplayName; + property OnExecute: TPythonEvent read FOnExecute write FOnExecute; + property DocString: TStringList read FDocString write SetDocString; + end; + + // Event Collection + TEventDefs = class(TCollection) + protected + FMethodsContainer : TMethodsContainer; + + function GetItems( idx : Integer ) : TEventDef; + procedure SetItems( idx : Integer; Value : TEventDef ); + function GetOwner: TPersistent; override; + public + constructor Create( AMethodsContainer : TMethodsContainer ); + + function Add : TEventDef; + procedure RegisterEvents; + + property Items[ idx : Integer ] : TEventDef read GetItems; + property Container : TMethodsContainer read FMethodsContainer; + end; + + // class TMethodsContainer + TMethodsContainer = class(TEngineClient) + private + FMethodCount : Integer; + FAllocatedMethodCount : Integer; + FMethods : PPyMethodDef; + FModuleDef : PyModuleDef; + FEventDefs: TEventDefs; + + procedure AllocMethods; + procedure FreeMethods; + function GetMethods( idx : Integer ) : PPyMethodDef; + function StoreEventDefs: Boolean; + + protected + procedure ReallocMethods; virtual; + + public + // Constructors & destructors + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + // public methods + procedure Initialize; override; + procedure Finalize; override; + + function AddMethod( AMethodName : PAnsiChar; + AMethod : PyCFunction; + ADocString : PAnsiChar ) : PPyMethodDef; + function AddMethodWithKeywords( AMethodName : PAnsiChar; + AMethod : PyCFunctionWithKW; + ADocString : PAnsiChar ) : PPyMethodDef; + function AddClassMethodWithKeywords( AMethodName : PAnsiChar; + AMethod : PyCFunctionWithKW; + ADocString : PAnsiChar ) : PPyMethodDef; + function AddStaticMethodWithKeywords( AMethodName : PAnsiChar; + AMethod : PyCFunctionWithKW; + ADocString : PAnsiChar ) : PPyMethodDef; + function AddDelphiMethod( AMethodName : PAnsiChar; + ADelphiMethod: TDelphiMethod; + ADocString : PAnsiChar ) : PPyMethodDef; + function AddDelphiMethodWithKeywords( AMethodName : PAnsiChar; + ADelphiMethod: TDelphiMethodWithKW; + ADocString : PAnsiChar ) : PPyMethodDef; + procedure ClearMethods; + + // properties + property MethodCount : Integer read FMethodCount; + property Methods[ idx : Integer ] : PPyMethodDef read GetMethods; + property MethodsData : PPyMethodDef read FMethods; + property ModuleDef : PyModuleDef read FModuleDef; + + published + property Events: TEventDefs read fEventDefs write fEventDefs stored StoreEventDefs; + end; + + +//------------------------------------------------------------ +//-- -- +//--class: TMembersContainer derived from TMethodsContainer -- +//-- -- +//------------------------------------------------------------ + + // class TMembersContainer + TMembersContainer = class(TMethodsContainer) + protected + function GetMembersStartOffset : Integer; virtual; + private + FMemberCount : Integer; + FAllocatedMemberCount : Integer; + FMembers : PPyMemberDef; + + procedure AllocMembers; + procedure FreeMembers; + function GetMembers( idx : Integer ) : PPyMemberDef; + + protected + procedure ReallocMembers; virtual; + + public + // Constructors & destructors + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + // public methods + procedure AddMember( MemberName : PAnsiChar; + MemberType : TPyMemberType; + MemberOffset : NativeInt; + MemberFlags : TPyMemberFlag; + MemberDoc : PAnsiChar ); + procedure ClearMembers; + procedure Finalize; override; + + // properties + property MemberCount : Integer read FMemberCount; + property Members[ idx : Integer ] : PPyMemberDef read GetMembers; + property MembersData : PPyMemberDef read FMembers; + end; + +//------------------------------------------------------------ +//-- -- +//--class: TGetSetContainer derived from TMembersContainer -- +//-- -- +//------------------------------------------------------------ + + // class TGetSetContainer + TGetSetContainer = class(TMembersContainer) + private + FGetSetCount : Integer; + FAllocatedGetSetCount : Integer; + FGetSets : PPyGetSetDef; + + procedure AllocGetSets; + procedure FreeGetSets; + function GetGetSet( idx : Integer ) : PPyGetSetDef; + + protected + procedure ReallocGetSets; virtual; + + public + // Constructors & destructors + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + // public methods + procedure AddGetSet( AName : PAnsiChar; + AGet : getter; + ASet : setter; + ADoc : PAnsiChar; + AClosure : Pointer); + procedure ClearGetSets; + procedure Finalize; override; + + // properties + property GetSetCount : Integer read FGetSetCount; + property GetSet[ idx : Integer ] : PPyGetSetDef read GetGetSet; + property GetSetData : PPyGetSetDef read FGetSets; + end; + +//------------------------------------------------------- +//-- -- +//--class: TPythonModule derived from TMethodsContainer-- +//-- -- +//------------------------------------------------------- + + TPythonModule = class; // forward declaration + TErrors = class; // forward declaration + + TErrorType = (etString, etClass); + + TParentClassError = class(TPersistent) + protected + FName : AnsiString; + FModule : AnsiString; + public + procedure AssignTo( Dest: TPersistent ); override; + published + property Module : AnsiString read FModule write FModule; + property Name : AnsiString read FName write FName; + end; + + TError = class(TCollectionItem) + protected + FName : AnsiString; + FText : AnsiString; + FError : PPyObject; + FErrorType : TErrorType; + FParentClass : TParentClassError; + + function GetDisplayName: string; override; + procedure SetName( const Value : AnsiString ); + procedure SetText( const Value : AnsiString ); + procedure SetErrorType( Value : TErrorType ); + procedure SetParentClass( Value : TParentClassError ); + public + constructor Create(ACollection: TCollection); override; + destructor Destroy; override; + procedure Assign(Source: TPersistent); override; + procedure BuildError( const ModuleName : AnsiString ); + procedure RaiseError(const msg : AnsiString); + procedure RaiseErrorObj(const msg : AnsiString; obj : PPyObject); + function Owner : TErrors; + property Error : PPyObject read FError write FError; + published + property Name : AnsiString read FName write SetName; + property Text : AnsiString read FText write SetText; + property ErrorType : TErrorType read FErrorType write SetErrorType; + property ParentClass : TParentClassError read FParentClass write SetParentClass; + end; + + TErrors = class(TCollection) + private + FModule: TPythonModule; + function GetError(Index: Integer): TError; + procedure SetError(Index: Integer; Value: TError); + protected + function GetOwner: TPersistent; override; + procedure Update(Item: TCollectionItem); override; + public + constructor Create(Module: TPythonModule); + function Add: TError; + function Owner : TPythonModule; + property Items[Index: Integer]: TError read GetError write SetError; default; + end; + + {$IF not Defined(FPC) and (CompilerVersion >= 23)} + [ComponentPlatformsAttribute(pidSupportedPlatforms)] + {$IFEND} + TPythonModule = class(TMethodsContainer) + protected + FModuleName : AnsiString; + FModule : PPyObject; + FClients : TList; + FErrors : TErrors; + FOnAfterInitialization : TNotifyEvent; + FDocString : TStringList; + + function GetClientCount : Integer; + function GetClients( idx : Integer ) : TEngineClient; + procedure SetErrors( val : TErrors ); + procedure SetModuleName( const val : AnsiString ); + procedure SetDocString( value : TStringList ); + public + // Constructors & destructors + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + // Public methods + procedure MakeModule; + procedure DefineDocString; + procedure Initialize; override; + procedure InitializeForNewInterpreter; + procedure AddClient(Client : TEngineClient); + procedure RemoveClient(Client : TEngineClient); + function ErrorByName( const AName : AnsiString ) : TError; + procedure RaiseError( const error, msg : AnsiString ); + procedure RaiseErrorFmt( const error, format : AnsiString; const Args : array of const ); + procedure RaiseErrorObj( const error, msg : AnsiString; obj : PPyObject ); + procedure BuildErrors; + procedure SetVar( const varName : AnsiString; value : PPyObject ); + function GetVar( const varName : AnsiString ) : PPyObject; + procedure DeleteVar( const varName : AnsiString ); + procedure ClearVars; + procedure SetVarFromVariant( const varName : AnsiString; const value : Variant ); + function GetVarAsVariant( const varName: AnsiString ) : Variant; + + // Public properties + property Module : PPyObject read FModule; + property Clients[ idx : Integer ] : TEngineClient read GetClients; + property ClientCount : Integer read GetClientCount; + published + property DocString : TStringList read FDocString write SetDocString; + property ModuleName : AnsiString read FModuleName write SetModuleName; + property Errors : TErrors read FErrors write SetErrors; + property OnAfterInitialization : TNotifyEvent read FOnAfterInitialization write FOnAfterInitialization; + end; + + +//------------------------------------------------------- +//-- -- +//--class: TPythonType derived from TGetSetContainer -- +//-- -- +//------------------------------------------------------- + +{ + A B C + +-------------------++------------------------------------------------------+ + | PyObject header || TPyObject class | + +----------+--------++-----------------+------------+----------+------------+ + |ob_refcnt |ob_type ||hidden Class Ptr |PythonType |IsSubType |PythonAlloc | + |integer |pointer ||pointer |TPythonType |Boolean |Boolean | + |4 bytes |4 bytes ||4 bytes |4 bytes |1 byte |1 byte | + +----------+--------++-----------------+------------+----------+------------+ + + ^ ^ + | | + ptr returned ptr returned by Adjust + by GetSelf + + - a Python object must start at A. + - a Delphi class class must start at B + - TPyObject.InstanceSize will return C-B + - Sizeof(TPyObject) will return C-B + - The total memory allocated for a TPyObject instance will be C-A, + even if its InstanceSize is C-B. + - When turning a Python object pointer into a Delphi instance pointer, PythonToDelphi + will offset the pointer from A to B. + - When turning a Delphi instance into a Python object pointer, GetSelf will offset + Self from B to A. + - Properties ob_refcnt and ob_type will call GetSelf to access their data. + + Further Notes: + - PyObject instances are not created directly, but via their python type + See TPythonType.CreateInstance and TPythonType.NewSubtypeInst (tp_new + slot). In the second case TPy_Object.NewInstance is not called and + the size of the memory is determined by the tp_basicsize slot. + - Their memory can be allocated either by pascal or python. PythonAlloc + keeps track of how the PyObject memory was allocated. + - PyObject instances are not destroyed directly, but by PyObjectDestructor + when their reference count goes down to zero (tp_dealloc slot) + - The value of PythonAlloc determines how the memory is freed + using either PyObject_Free (tp_free slot) or in the overwritten + FreeInstance. + - This class is heart of the P4D library. Pure magic!! +} + // The base class of all new Python types + TPyObject = class + private + function Get_ob_refcnt: NativeUInt; + function Get_ob_type: PPyTypeObject; + procedure Set_ob_refcnt(const Value: NativeUInt); + procedure Set_ob_type(const Value: PPyTypeObject); + public + PythonType : TPythonType; + IsSubtype : Boolean; + PythonAlloc : Boolean; + + // Constructors & Destructors + constructor Create(APythonType: TPythonType); virtual; + constructor CreateWith(APythonType: TPythonType; args, kwds: PPyObject); virtual; + destructor Destroy; override; + + class function NewInstance: TObject; override; + procedure FreeInstance; override; + + // Misc + function GetSelf : PPyObject; + procedure IncRef; + procedure Adjust(PyPointer: Pointer); + function GetModule : TPythonModule; + + property ob_refcnt : NativeUInt read Get_ob_refcnt write Set_ob_refcnt; + property ob_type : PPyTypeObject read Get_ob_type write Set_ob_type; + + // Type services + //////////////// + + // Basic services + function Print( var f: file; i: integer) : Integer; virtual; + function GetAttr(key : PAnsiChar) : PPyObject; virtual; + function SetAttr(key : PAnsiChar; value : PPyObject) : Integer; virtual; + function Repr : PPyObject; virtual; + function Compare( obj: PPyObject) : Integer; virtual; + function Hash : NativeInt; virtual; + function Str: PPyObject; virtual; + function GetAttrO( key: PPyObject) : PPyObject; virtual; + function SetAttrO( key, value: PPyObject) : Integer; virtual; + function Call( ob1, ob2 : PPyObject) : PPyObject; virtual; + function Traverse( proc: visitproc; ptr: Pointer) : integer; virtual; + function Clear: integer; virtual; + function RichCompare( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject; virtual; + function Iter : PPyObject; virtual; + function IterNext : PPyObject; virtual; + function Init( args, kwds : PPyObject ) : Integer; virtual; + function GetBuffer(view: PPy_buffer; flags: Integer): Integer; virtual; + procedure ReleaseBuffer(view: PPy_buffer); virtual; + + // Number services + function NbAdd( obj : PPyObject) : PPyObject; virtual; + function NbSubtract( obj : PPyObject) : PPyObject; virtual; + function NbMultiply( obj : PPyObject) : PPyObject; virtual; + function NbFloorDivide( obj : PPyObject) : PPyObject; virtual; + function NbTrueDivide( obj : PPyObject) : PPyObject; virtual; + function NbMatrixMultiply( obj : PPyObject) : PPyObject; virtual; + function NbRemainder( obj : PPyObject) : PPyObject; virtual; + function NbDivmod( obj : PPyObject) : PPyObject; virtual; + function NbPower( ob1, ob2 : PPyObject) : PPyObject; virtual; + function NbNegative : PPyObject; virtual; + function NbPositive : PPyObject; virtual; + function NbAbsolute : PPyObject; virtual; + function NbBool : Integer; virtual; + function NbInvert : PPyObject; virtual; + function NbLShift( obj : PPyObject) : PPyObject; virtual; + function NbRShift( obj : PPyObject) : PPyObject; virtual; + function NbAnd( obj : PPyObject) : PPyObject; virtual; + function NbXor( obj : PPyObject) : PPyObject; virtual; + function NbOr( obj : PPyObject) : PPyObject; virtual; + function NbInt : PPyObject; virtual; + function NbFloat : PPyObject; virtual; + function NbInplaceAdd( obj : PPyObject): PPyObject; virtual; + function NbInplaceSubtract( obj : PPyObject): PPyObject; virtual; + function NbInplaceMultiply( obj : PPyObject): PPyObject; virtual; + function NbInplaceDivide( obj : PPyObject): PPyObject; virtual; + function NbInplaceFloorDivide( obj : PPyObject) : PPyObject; virtual; + function NbInplaceTrueDivide( obj : PPyObject) : PPyObject; virtual; + function NbInplaceRemainder( obj : PPyObject): PPyObject; virtual; + function NbInplacePower( ob1, ob2 : PPyObject): PPyObject; virtual; + function NbInplaceLshift( obj : PPyObject): PPyObject; virtual; + function NbInplaceRshift( obj : PPyObject): PPyObject; virtual; + function NbInplaceAnd( obj : PPyObject): PPyObject; virtual; + function NbInplaceXor( obj : PPyObject): PPyObject; virtual; + function NbInplaceOr( obj : PPyObject): PPyObject; virtual; + function NbInplaceMatrixMultiply(obj: PPyObject): PPyObject; virtual; + // Sequence services + function SqLength : NativeInt; virtual; + function SqConcat( obj : PPyObject) : PPyObject; virtual; + function SqRepeat( val : NativeInt ) : PPyObject; virtual; + function SqItem( idx : NativeInt ) : PPyObject; virtual; + function SqAssItem( idx : NativeInt; obj : PPyObject) : Integer; virtual; + function SqContains( obj: PPyObject): integer; virtual; + function SqInplaceConcat( obj : PPyObject): PPyObject; virtual; + function SqInplaceRepeat( i: NativeInt): PPyObject; virtual; + // Mapping services + function MpLength : NativeInt; virtual; + function MpSubscript( obj : PPyObject) : PPyObject; virtual; + function MpAssSubscript( obj1, obj2 : PPyObject) : Integer; virtual; + + // Class methods + class procedure RegisterMethods( APythonType : TPythonType ); virtual; + class procedure RegisterMembers( APythonType : TPythonType ); virtual; + class procedure RegisterGetSets( APythonType : TPythonType ); virtual; + class procedure SetupType( APythonType : TPythonType ); virtual; + end; + TPyObjectClass = class of TPyObject; + + TBasicServices = set of (bsGetAttr, bsSetAttr, + bsRepr, bsCompare, bsHash, + bsStr, bsGetAttrO, bsSetAttrO, + bsCall, + // since version 2.0 + bsTraverse, bsClear, + // since version 2.1 + bsRichCompare, + // since version 2.2 + bsIter, bsIterNext, + bsBuffer); + TNumberServices = set of (nsAdd, nsSubtract, nsMultiply, + nsRemainder, nsDivmod, + nsPower, nsNegative, nsPositive, + nsAbsolute, nsInvert, + nsLShift, nsRShift, nsAnd, + nsXor, nsOr, + nsInt, nsFloat, + nsFloorDivide, nsTrueDivide, + // since version 3.0 + nsMatrixMultiply, nsBool); + + // TInplaceNumberServices exists since version 2.0 + TInplaceNumberServices = set of (nsInplaceAdd, nsInplaceSubtract, + nsInplaceMultiply, + nsInplaceRemainder, nsInplacePower, + nsInplaceLShift, nsInplaceRShift, + nsInplaceAnd, nsInplaceXor, nsInplaceOr, + nsInplaceFloorDivide, nsInplaceTrueDivide, + // since version 3.0 + nsInplaceMatrixMultiply); + + TSequenceServices = set of (ssLength, ssConcat, ssRepeat, + ssItem, ssAssItem, + ssContains, ssInplaceConcat, + ssInplaceRepeat + ); + + TMappingServices = set of (msLength, msSubscript, msAssSubscript); + + TTypeServices = class(TPersistent) + protected + FBasic : TBasicServices; + FNumber : TNumberServices; + FSequence : TSequenceServices; + FMapping : TMappingServices; + FInplaceNumber : TInplaceNumberServices; + + public + constructor Create; + procedure AssignTo( Dest: TPersistent ); override; + + published + property Basic : TBasicServices read FBasic write FBasic; + property InplaceNumber : TInplaceNumberServices read FInplaceNumber Write FInplaceNumber; + property Number : TNumberServices read FNumber write FNumber; + property Sequence : TSequenceServices read FSequence write FSequence; + property Mapping : TMappingServices read FMapping write FMapping; + end; + + // The component that initializes the Python type and + // that creates instances of itself. + {$IF not Defined(FPC) and (CompilerVersion >= 23)} + [ComponentPlatformsAttribute(pidSupportedPlatforms)] + {$IFEND} + TPythonType = class(TGetSetContainer) + protected + FType : PyTypeObject; + FTypeName : AnsiString; + FModule : TPythonModule; + FPyObjectClass : TPyObjectClass; + FPrefix : AnsiString; + FCreateFuncName : AnsiString; + FServices : TTypeServices; + FNumber: PyNumberMethods; + FSequence: PySequenceMethods; + FMapping: PyMappingMethods; + FCurrentDocString: AnsiString; + FDocString: TStringList; + FCreateFuncDoc : AnsiString; + FInstanceCount : Integer; + FCreateHits : Integer; + FDeleteHits : Integer; + FTypeFlags : TPFlags; + FCreateFunc : PPyObject; + FCreateFuncDef : PyMethodDef; + FBufferProcs: PyBufferProcs; + FGenerateCreateFunction: Boolean; + + procedure Notification( AComponent: TComponent; + Operation: TOperation); override; + function GetTypePtr : PPyTypeObject; + procedure SetPyObjectClass( val : TPyObjectClass ); + procedure SetModule( val : TPythonModule ); + procedure SetServices( val : TTypeServices ); + procedure SetTypeName( const val : AnsiString ); + procedure SetBaseType(AType: TPythonType); + function CreateMethod(pSelf, args, kwds: PPyObject): PPyObject; cdecl; + procedure InitServices; + procedure SetDocString( value : TStringList ); + function TypeFlagsAsInt : C_ULong; + function GetMembersStartOffset : Integer; override; + procedure ModuleReady(Sender : TObject); override; + procedure ReallocMethods; override; + procedure ReallocMembers; override; + procedure ReallocGetSets; override; + + // Type services + // They will be all forwarded to the Delphi class that + // implements the object through the use of virtual + // methods + /////////////////////////////////////// + function NewSubtypeInst( aType: PPyTypeObject; args, kwds : PPyObject) : PPyObject; cdecl; + public + const TYPE_COMP_NAME_SUFFIX = 'Type'; + public + constructor Create( AOwner : TComponent ); override; + destructor Destroy; override; + + procedure Initialize; override; + procedure Finalize; override; + function CreateInstance : PPyObject; + function CreateInstanceWith(args, kwds: PPyObject): PPyObject; + procedure AddTypeVar; + + property TheType : PyTypeObject read FType write FType; + property TheTypePtr : PPyTypeObject read GetTypePtr; + property PyObjectClass : TPyObjectClass read FPyObjectClass write SetPyObjectClass stored False; + property BaseType: TPythonType write SetBaseType; + property InstanceCount : Integer read FInstanceCount; + property CreateHits : Integer read FCreateHits; + property DeleteHits : Integer read FDeleteHits; + + published + property DocString : TStringList read FDocString write SetDocString; + property TypeName : AnsiString read FTypeName write SetTypeName; + property TypeFlags : TPFlags read FTypeFlags write FTypeFlags default TPFLAGS_DEFAULT; + property Prefix : AnsiString read FPrefix write FPrefix; + property Module : TPythonModule read FModule write SetModule; + property Services : TTypeServices read FServices write SetServices; + property GenerateCreateFunction : Boolean read fGenerateCreateFunction write fGenerateCreateFunction default True; + end; + +//------------------------------------------------------- +//-- -- +//-- class: TPythonVar derived from TEngineClient -- +//-- -- +//------------------------------------------------------- + + TGetDataEvent = procedure ( Sender : TObject; var Data : Variant ) of Object; + TSetDataEvent = procedure ( Sender : TObject; Data : Variant ) of Object; + TExtGetDataEvent = procedure ( Sender : TObject; var Data : PPyObject ) of Object; + TExtSetDataEvent = procedure ( Sender : TObject; Data : PPyObject) of Object; + + {$IF not Defined(FPC) and (CompilerVersion >= 23)} + [ComponentPlatformsAttribute(pidSupportedPlatforms)] + {$IFEND} + TPythonDelphiVar = class( TEngineClient ) + protected + FModule : AnsiString; + FVarName : AnsiString; + FVarObject : PPyObject; + FOnGetData : TGetDataEvent; + FOnSetData : TSetDataEvent; + FOnExtGetData : TExtGetDataEvent; + FOnExtSetData : TExtSetDataEvent; + FOnChange : TNotifyEvent; + + procedure CreateVarType; + procedure CreateVar; + function GetValue : Variant; + procedure SetValue( const val : Variant ); + function GetValueAsPyObject : PPyObject; + procedure SetValueFromPyObject( val : PPyObject ); + function GetValueAsString : string; + procedure SetVarName( const val : AnsiString ); + + public + // Constructors & Destructors + constructor Create( AOwner : TComponent ); override; + + // Public methods + procedure Initialize; override; + procedure Finalize; override; + function IsVariantOk( const v : Variant ) : Boolean; + + // Public properties + property Value : Variant read GetValue write SetValue; + // Warning: ValueObject returns a preincremented object ! + property ValueObject : PPyObject read GetValueAsPyObject write SetValueFromPyObject; + property ValueAsString : string read GetValueAsString; + property VarObject : PPyObject read FVarObject write FVarObject; + + published + property Module : AnsiString read FModule write FModule; + property VarName : AnsiString read FVarName write SetVarName; + property OnGetData : TGetDataEvent read FOnGetData write FOnGetData; + property OnSetData : TSetDataEvent read FOnSetData write FOnSetData; + property OnExtGetData : TExtGetDataEvent read FOnExtGetData write FOnExtGetData; + property OnExtSetData : TExtSetDataEvent read FOnExtSetData write FOnExtSetData; + property OnChange : TNotifyEvent read FOnChange write FOnChange; + end; + + TPyVar = class(TPyObject) + public + dv_var : Variant; + dv_component : TPythonDelphiVar; + dv_object : PPyObject; + + // Constructors & Destructors + constructor Create( APythonType : TPythonType ); override; + constructor CreateWith(APythonType: TPythonType; args, kwds: PPyObject); override; + destructor Destroy; override; + + // Type services + //////////////// + + // Basic services + function GetAttrO( key: PPyObject) : PPyObject; override; + function SetAttrO( key, value: PPyObject) : Integer; override; + function Repr : PPyObject; override; + + // Class methods + class procedure RegisterMethods( APythonType : TPythonType ); override; + + // Methods of TPyVar + function GetValue : PPyObject; + function GetValueAsVariant : Variant; + procedure SetValue( value : PPyObject ); + procedure SetValueFromVariant( const value : Variant ); + + // Interface methods + end; + +//####################################################### +//## ## +//## Thread Object with Python interpreter lock ## +//## ## +//####################################################### + TThreadExecMode = (emNewState, emNewInterpreter, emNewInterpreterOwnGIL); + +{$HINTS OFF} + TPythonThread = class(TThread) + private + fThreadState: PPyThreadState; + fThreadExecMode: TThreadExecMode; + private class threadvar + f_savethreadstate: PPyThreadState; + + protected + // Do not overwrite Execute! Use ExecuteWithPython instead! + procedure Execute; override; + procedure ExecuteWithPython; virtual; abstract; + function InterpreterConfig: PyInterpreterConfig; virtual; + public + class procedure Py_Begin_Allow_Threads; + class procedure Py_End_Allow_Threads; + // The following procedures are redundant and only for + // compatibility to the C API documentation. + class procedure Py_Begin_Block_Threads; + class procedure Py_Begin_Unblock_Threads; + + property ThreadState : PPyThreadState read fThreadState; + property ThreadExecMode: TThreadExecMode read fThreadExecMode write fThreadExecMode; + end; +{$HINTS ON} + +//####################################################### +//## ## +//## New Python objects ## +//## ## +//####################################################### + +//####################################################### +//## ## +//## Methods for new Python objects or modules ## +//## ## +//####################################################### + +// Module pyio for Python Input/Outputs +function pyio_write(self, args : PPyObject) : PPyObject; cdecl; +function pyio_read(self, args : PPyObject) : PPyObject; cdecl; +function pyio_SetDelayWrites(self, args : PPyObject) : PPyObject; cdecl; +function pyio_SetMaxLines(self, args : PPyObject) : PPyObject; cdecl; +function pyio_GetTypesStats(self, args : PPyObject) : PPyObject; cdecl; + + +//####################################################### +//## ## +//## Global procedures ## +//## ## +//####################################################### + +function GetPythonEngine : TPythonEngine; +function PythonOK : Boolean; +function PythonToDelphi( obj : PPyObject ) : TPyObject; +function FindPythonType(PyType: PPyTypeObject): TPythonType; +function IsDelphiObject( obj : PPyObject ) : Boolean; +procedure PyObjectDestructor( pSelf : PPyObject); cdecl; +procedure Register; +function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean; +function SysVersionFromDLLName(const DLLFileName : string): string; +procedure PythonVersionFromDLLName(LibName: string; out MajorVersion, MinorVersion: integer); +function PythonVersionFromRegVersion(const ARegVersion: string; + out AMajorVersion, AMinorVersion: integer): boolean; +function PyStatus_Exception(const APyStatus: PyStatus): Boolean; +function StringToWCharTString(Str: string): WcharTString; + +//####################################################### +//## ## +//## Support routines for running python ## +//## code in threads ## +//## ## +//####################################################### + +type + IPyEngineAndGIL = interface + function GetPyEngine: TPythonEngine; + function GetThreadState: PPyThreadState; + property PythonEngine: TPythonEngine read GetPyEngine; + property ThreadState: PPyThreadState read GetThreadState; + end; + +// Access the PythonEngine with thread safety + +// Gets the GIL and releases it automatically when the interface is cleared +function SafePyEngine: IPyEngineAndGIL; + +{$IFNDEF FPC} +{ + Executes Python code in a Delphi thread - Wrapper around TPythonThread + The TerminateProc is called using TThread.Queue +} +procedure ThreadPythonExec(ExecuteProc : TProc; TerminateProc : TProc = nil; + WaitToFinish: Boolean = False; ThreadExecMode : TThreadExecMode = emNewState); +{$ENDIF FPC} + +{ Helper functions} + +(* + Checks whether the PythonVersion x.x is Registered +*) +{$IFDEF MSWINDOWS} +function IsPythonVersionRegistered(PythonVersion : string; + out InstallPath: string; out AllUserInstall: Boolean) : Boolean; +{$ENDIF} + +(* + Mask FPU Excptions - Useful for importing SciPy and other Python libs + See http://bugs.python.org/issue9980 and + http://stackoverflow.com/questions/3933851/ +*) +procedure MaskFPUExceptions(ExceptionsMasked : boolean; + MatchPythonPrecision : Boolean = True); + +(* + Converts line breaks to LF and optionally adds a line break at the end +*) +function CleanString(const s : AnsiString; AppendLF : Boolean = True) : AnsiString; overload; +function CleanString(const s : UnicodeString; AppendLF : Boolean = True) : UnicodeString; overload; + +implementation + +uses + StrUtils, +{$IFNDEF FPC} + AnsiStrings, +{$ENDIF} +{$IFDEF MSWINDOWS} + Registry, +{$IFDEF FPC} + JwaPsApi, +{$ELSE} + PsAPI, +{$ENDIF} +{$ENDIF} + Math; + +(*******************************************************) +(** **) +(** Resource strings **) +(** **) +(*******************************************************) +resourcestring +SPyConvertionError = 'Conversion Error: %s expects a %s Python object'; +SPyExcStopIteration = 'Stop Iteration'; +SPyExcSystemError = 'Unhandled SystemExit exception. Code: %s'; +SPyInitFailed = 'Python initialization failed: %s'; +SPyInitFailedUnknown = 'Unknown initialization error'; +SCannotCreateMain = 'Run_CommandAsObject: can''t create __main__'; +SRaiseError = 'RaiseError: couldn''t fetch last exception'; +SMissingModuleDateTime = 'dcmToDatetime DatetimeConversionMode cannot be used with this version of python. Missing module datetime'; +SInvalidDateTimeConvMode = 'Invalid DatetimeConversionMode'; +SUnexpectedTypeInTimeObject = 'Unexpected type found in member %s of a time_struct object'; +SArguementTypeNotAllowed = 'Argument type not allowed'; +SCouldNotCreateTuple = 'Could not create a new tuple object'; +SCouldNotCreateList = 'Could not create a new list object'; +SCouldNotCreateDict = 'Could not create a new dict object'; +SArgumemntsShouldBeEven = 'You must provide an even number of arguments'; +SExpectedList = 'The python object is not a list'; +SExpectedTuple = 'The python object is not a tuple'; +SCouldNotSetVar = 'Could not set var "%s" in module "%s"'; +SCannotSetVarNoInit = 'Can''t set var "%s" in module "%s", because it is not yet initialized'; +SCannotGetDict = 'Can''t get __dict__ of module "%s"'; +SCannotDelVarNoInit = 'Can''t delete var "%s" in module "%s", because it is not yet initialized'; +SExpectedDelphiClass = 'Pytho;n object "%s" is not a Delphi class'; +SCannotCreateModule = 'CreateVar: can''t create module "%s"'; +SVarNotCreated = 'No variable was created'; +SVarExists = 'A variable "%s" already exists in the module "%s"'; +SCannotCreateThreadState = 'Could not create a new thread state'; +SCannotCreatePythonEngine = 'No Python engine was created'; +SCannotInitPythonEngine = 'The Python engine is not properly initialized'; +SThreadPythonExec = 'ThreadPythonExec should only be called from the main thread'; +SQuitMessage = 'Dll %s could not be loaded. We must quit.'; +SPythonQuitMessage = 'Python DLL %s could not be initialized. We must quit.'; +SErrCannotOpenDLL = 'Error %d: Could not open Dll "%s"'; +SPythonNoInit = 'Python is not initialized'; +SOnlyOnePythonEngine = 'You canott have more than one TPythonEngine component'; +SMoreThanOnePythonEngine = 'There is already one instance of TPythonEngine running'; +SGlobalVarsShouldBeDict = 'You must set a Python dictionary in the GlobalVars property'; +SLocalVarsShouldBeDict = 'You must set a Python dictionary in the LocalVars property'; +SCannotModifyFlags = 'You can''t modify Python flags after it has been initialized'; +SCannotFindType = 'Could not find type: %s'; +SCannotFindModule = 'Could not find module: %s'; +SCannotFindComponent = 'Could not find component: %s'; +SCannotHandleMoreThan3Dim = 'Can''t convert a variant array of more than 3 dimensions to a Python sequence'; +SNoEngineForComponent = 'No Engine defined for component "%s"'; +SIndexOutOfRange = '%s: Index %d out of range'; +SUnknownMemberType = 'Unknown member type'; +SUnknownMemberFlag = 'Unknown member flag'; +SDuplicateErrorName = 'In module "%s", there''s already an error named "%s"'; +SNoModuleWithParentClass = 'Could not find module containing the parent class of error "%s"'; +SCannotFindParentClass = 'Could not find the parent class "%s" of error "%s"'; +SObjectNotClass = 'The object "%s" in module "%s" is not a class'; +SErrorNotClass = 'Error without name in module "%s"'; +SCouldNotCreateError = 'Could not create error "%s"'; +STErrorCouldNotCreateInstance = 'TError.RaiseErrorObj: Could not create an instance of "%s"'; +STErrorCouldNotCreateTuple = 'TError.RaiseErrorObj: Could not create an empty tuple'; +STErrorNoInstance = 'TError.RaiseErrorObj: I didn''t get an instance'; +SCouldNotFindError = 'Could not find error "%s"'; +SCouldNotMapSymbol = 'Error %d: could not map symbol "%s"'; +SUndeterminedPythonVersion = 'Undetermined Python version'; + +(*******************************************************) +(** **) +(** Globals **) +(** **) +(*******************************************************) + +var + gPythonEngine : TPythonEngine; + gVarType : TPythonType; + + +(*******************************************************) +(** **) +(** class TPythonInputOutput **) +(** **) +(*******************************************************) + +constructor TPythonInputOutput.Create( AOwner : TComponent ); +begin + inherited; + FMaxLines := kMaxLines; + FQueue := TIOStringList.Create; + FDelayWrites := False; + FMaxLineLength := kMaxLineLength; + FLinesPerThread:= TIOStringList.Create; + FLock := TCriticalSection.Create; +end; + +destructor TPythonInputOutput.Destroy; +begin + FLinesPerThread.Free; + FQueue.Free; + FLock.Free; + inherited; +end; + +procedure TPythonInputOutput.Lock; +begin + FLock.Enter; +end; + +procedure TPythonInputOutput.Unlock; +begin + FLock.Leave; +end; + +procedure TPythonInputOutput.Write( const str : IOString ); + + procedure DropLine; + begin +{$IFDEF MSWINDOWS} + if DelayWrites then + AddWrite( FLine_Buffer ) + else +{$ENDIF} + if UnicodeIO then + SendUniData( FLine_Buffer ) + else + SendData( AnsiString(FLine_Buffer) ); + FLine_Buffer := ''; + UpdateCurrentThreadLine; + end; + +var + i : Integer; + c : IOChar; +begin + Lock; + try + FLine_Buffer := GetCurrentThreadLine; + if FRawOutput then begin + FLine_Buffer := FLine_Buffer + str; + DropLine; + end else begin + for i := 1 to length(str) do + begin + c := str[i]; + if c = #10 then + DropLine + else if (c >= ' ') or (c = #09) then + begin + Insert( c, FLine_Buffer, length(FLine_Buffer)+1 ); + if Length(FLine_Buffer) > MaxLineLength then + DropLine; + end; + end; + end; + UpdateCurrentThreadLine; + finally + Unlock; + end; +end; + +procedure TPythonInputOutput.WriteLine( const str : IOString ); +begin + Write( str+#10 ); +end; + +procedure TPythonInputOutput.AddWrite( const str : IOString ); +begin + FQueue.Add( string(str) ); + if FQueue.Count > FMaxLines then + FQueue.Delete(0) + else + AddPendingWrite; +end; + +procedure TPythonInputOutput.SendData( const Data : AnsiString ); +begin + if Assigned(FOnSendData) then + FOnSendData( Self, Data ); +end; + +procedure TPythonInputOutput.SendUniData(const Data: UnicodeString); +begin + if Assigned(FOnSendUniData) then + FOnSendUniData( Self, Data ); +end; + +function TPythonInputOutput.ReceiveData : AnsiString; +begin + Result := ''; + if Assigned(FOnReceiveData) then + FOnReceiveData( Self, Result ); +end; + +function TPythonInputOutput.ReceiveUniData: UnicodeString; +begin + Result := ''; + if Assigned(FOnReceiveUniData) then + FOnReceiveUniData( Self, Result ); +end; + +procedure TPythonInputOutput.AddPendingWrite; +begin +end; + +function TPythonInputOutput.GetCurrentThreadSlotIdx : Integer; +var + thread_id : TObject; + i : Integer; +begin + thread_id := TObject(GetCurrentThreadId); + for i := 0 to FLinesPerThread.Count-1 do + if FLinesPerThread.Objects[i] = thread_id then + begin + Result := i; + Exit; + end; + Result := FLinesPerThread.AddObject( '', thread_id ); +end; + +function TPythonInputOutput.GetCurrentThreadLine : IOString; +begin + Result := IOString(FLinesPerThread.Strings[ GetCurrentThreadSlotIdx ]); +end; + +procedure TPythonInputOutput.UpdateCurrentThreadLine; +begin + FLinesPerThread.Strings[ GetCurrentThreadSlotIdx ] := string(FLine_Buffer); +end; + +(*******************************************************) +(** **) +(** class TDynamicDll **) +(** **) +(*******************************************************) + +procedure TDynamicDll.DoOpenDll(const aDllName : string); +{$IFDEF MSWINDOWS} +const + LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = $00000100; + LOAD_LIBRARY_DEFAULT_DIRS = $00001000; +Var + ExceptMask: TFPUExceptionMask; +{$ENDIF} +begin + if not IsHandleValid then + begin + FDllName := aDllName; + {$IFDEF MSWINDOWS} + ExceptMask := GetExceptionMask; + try + {$IFDEF FPC} + FDLLHandle := LoadLibraryExA(PAnsiChar(AnsiString(GetDllPath+DllName)), + {$ELSE} + FDLLHandle := LoadLibraryEx(PWideChar(GetDllPath+DllName), + {$ENDIF} + 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR or LOAD_LIBRARY_DEFAULT_DIRS); + finally + SetExceptionMask(ExceptMask); + end; + {$ELSE} + //Linux: need here RTLD_GLOBAL, so Python can do "import ctypes" + FDLLHandle := THandle(dlopen(PAnsiChar(AnsiString(GetDllPath+DllName)), + RTLD_LAZY+RTLD_GLOBAL)); + {$ENDIF} + end; +end; + +function TDynamicDll.GetDllPath : string; +{$IFDEF MSWINDOWS} +var + AllUserInstall: Boolean; +{$ENDIF} +begin + Result := DllPath; + + if (DLLPath = '') and not FInExtensionModule then begin + {$IFDEF MSWINDOWS} + if IsPythonVersionRegistered(RegVersion, Result, AllUserInstall) and (Self is TPythonEngine) then + // https://github.com/python/cpython/issues/100171 + TPythonEngine(Self).SetPythonHome(Result); + {$ENDIF} + {$IFDEF DARWIN} + Result := '/Library/Frameworks/Python.framework/Versions/' + RegVersion + '/lib/'; + {$ENDIF} + end; + + if Result <> '' then + begin + Result := IncludeTrailingPathDelimiter(Result); + end; +end; + +function TDynamicDll.GetPythonModuleFromProcess(): NativeUInt; + +{$IFNDEF FPC} + +function HasSymbols(const AModule: NativeUInt): boolean; + begin + FDLLHandle := AModule; + try + Result := HasPythonSymbolsInLibrary(); + finally + FDLLHandle := 0; + end; + end; + +{$IFDEF LINUX} + function GetPythonModule: NativeUInt; + type + plink_map = ^link_map; + link_map = record + l_addr: Pointer; + l_name: PAnsiChar; + l_ld: Pointer; + l_next, l_prev: plink_map; + end; + var + LPseudoHandle: NativeUInt; + LPLinkMap: plink_map; + LModuleName: string; + LModuleHandle: NativeUInt; + begin + //In Linux pseudo handle is in fact a pointer to the the corresponding link_map structure + //The dlopen(nil, RTLD_NOW) result is the pseudo handle for the main executable (similar to GetModuleHandle(nil) in Windows). + LPseudoHandle := dlopen(nil, RTLD_NOW); + //Points to the first link_map + LPLinkMap := plink_map(LPseudoHandle).l_next.l_next; + while Assigned(LPLinkMap) do begin + LModuleName := String(LPLinkMap.l_name); + LModuleHandle := LoadLibrary(PChar(LModuleName)); + if HasSymbols(LModuleHandle) then + Exit(LModuleHandle); + LPLinkMap := LPLinkMap.l_next; + end; + Result := 0; + end; +{$ENDIF LINUX} + +{$IFDEF OSX} + function GetPythonModule: NativeUInt; + var + LIndex: integer; + LName: PAnsiChar; + LModuleName: string; + LModuleHandle: NativeUInt; + begin + LIndex := 0; + LName := _dyld_get_image_name(LIndex); + while (LName <> nil) do begin + LModuleName := String(LName); + LModuleHandle := LoadLibrary(PChar(LModuleName)); + if HasSymbols(LModuleHandle) then + Exit(LModuleHandle); + Inc(LIndex); + LName := _dyld_get_image_name(LIndex); + end; + Result := 0; + end; +{$ENDIF OSX} + +{$IFDEF MSWINDOWS} + function GetPythonModule: NativeUInt; + var + LHProcess: NativeUInt; + LHModules: array of NativeUInt; + LCbNeeded: Cardinal; + I: Integer; + LModName: array[0..1024] of char; + begin + SetLength(LHModules, 1024); + LHProcess := OpenProcess(PROCESS_QUERY_INFORMATION + PROCESS_VM_READ, false, GetCurrentProcessId()); + if LHProcess > 0 then begin + try + if EnumProcessModules(LHProcess, @LHModules[0], 1024 * SizeOf(HMODULE), LCbNeeded) then begin + SetLength(LHModules, LCbNeeded div SizeOf(THandle)); + for I := 0 to Length(LHModules) -1 do begin + GetModuleBaseName(LHProcess, LHModules[I], LModName, SizeOf(LModName)); + if HasSymbols(LHModules[I]) then begin + Exit(LHModules[I]); + end; + end; + end; + finally + CloseHandle(LHProcess); + end; + end; + Result := 0; + end; +{$ENDIF MSWINDOWS} +{$ENDIF FPC} + +begin + {$IF DEFINED(LINUX) OR DEFINED(OSX) OR DEFINED(MSWINDOWS)} + {$IFNDEF FPC} + Result := GetPythonModule(); + {$ELSE} + Result := 0; + {$ENDIF} + {$ELSE} + Result := 0; + {$IFEND} +end; + +procedure TDynamicDll.OpenDll(const aDllName : string); +var + s : string; +begin + UnloadDll; + + BeforeLoad; + + FDLLHandle := 0; + + DoOpenDll(aDllName); + + if not IsHandleValid then begin + {$IFDEF MSWINDOWS} + s := Format(SErrCannotOpenDLL, [GetLastError, DllName]); + {$ELSE} + s := Format('Error: Could not open Dll "%s"',[DllName]); + {$ENDIF} + if FatalMsgDlg then + {$IFDEF MSWINDOWS} + MessageBox( GetActiveWindow, PChar(s), 'Error', MB_TASKMODAL or MB_ICONSTOP ); + {$ELSE} + WriteLn(ErrOutput, s); + {$ENDIF} + + if FatalAbort then + Quit; + end else + AfterLoad; +end; + +constructor TDynamicDll.Create(AOwner: TComponent); +begin + inherited; + FFatalMsgDlg := True; + FFatalAbort := True; + FAutoLoad := True; + FUseLastKnownVersion := True; +end; + +destructor TDynamicDll.Destroy; +begin + if AutoUnload then + UnloadDll; + inherited; +end; + +function TDynamicDll.Import(const funcname: AnsiString; canFail : Boolean = True): Pointer; +var + E : EDllImportError; + {$IF not Defined(FPC) and not Defined(MSWINDOWS)} + S : string; + {$IFEND} +begin + {$IF Defined(FPC) or Defined(MSWINDOWS)} + Result := GetProcAddress( FDLLHandle, PAnsiChar(funcname) ); + {$ELSE} + S := string(funcname); + Result := GetProcAddress( FDLLHandle, PWideChar(S) ); + {$IFEND} + if (Result = nil) and canFail then begin + {$IFDEF MSWINDOWS} + E := EDllImportError.CreateFmt(SCouldNotMapSymbol, [GetLastError, funcname]); + E.ErrorCode := GetLastError; + {$ELSE} + E := EDllImportError.CreateFmt('Error: could not map symbol "%s"', [funcname]); + {$ENDIF} + E.WrongFunc := funcname; + raise E; + end; +end; + +procedure TDynamicDll.Loaded; +begin + inherited; + if AutoLoad and not (csDesigning in ComponentState) then + LoadDll; +end; + +function TDynamicDll.IsHandleValid : Boolean; +begin +{$IFDEF MSWINDOWS} + Result := (FDLLHandle >= 32); +{$ELSE} + Result := FDLLHandle <> 0; +{$ENDIF} +end; + +function TDynamicDll.TryLoadFromCurrentProcess: boolean; +begin + FDLLHandle := GetPythonModuleFromProcess(); + if not IsHandleValid() then + Exit(false); + + BeforeLoad(); + LoadPythonInfoFromModule(); + AfterLoad(); + Result := true; +end; + +function TDynamicDll.TryLoadFromHostSymbols: boolean; +begin + //We want to look in for host symbols at first + {$IFNDEF FPC} + FDLLHandle := LoadLibrary(''); + {$ELSE} + FDLLHandle := 0; + {$ENDIF} + Result := HasPythonSymbolsInLibrary(); + if Result then + LoadFromHostSymbols() + else + FDLLHandle := 0; +end; + +procedure TDynamicDll.LoadFromHostSymbols; +begin + BeforeLoad(); + LoadPythonInfoFromModule(); + AfterLoad(); +end; + +procedure TDynamicDll.LoadPythonInfoFromModule; +var + LPy_GetVersion: function: PAnsiChar; cdecl; + LPy_GetProgramFullPath: function: PAnsiChar; cdecl; + LVersion: string; + LInfo: TPythonVersionProp; + LFound: boolean; +begin + //According to the doc: + //Return the full program name of the Python executable. + //The value is available to Python code as sys.executable. + LPy_GetProgramFullPath := Import('Py_GetProgramFullPath'); + DllName := ExtractFileName(String(LPy_GetProgramFullPath())); + + //According to the doc: + //The first word (up to the first space character) is the current Python version + LPy_GetVersion := Import('Py_GetVersion'); + LVersion := String(LPy_GetVersion()); + LVersion := Copy(LVersion, 1, Pos(' ', LVersion)); + //the first three characters are the major and minor version separated by a period. + if (Length(LVersion) > 3) and (LVersion[4] <> '.') then + LVersion := Copy(LVersion, 1, 4) //e.g. 3.10 + else + LVersion := Copy(LVersion, 1, 3); //e.g. 3.9 + + LFound := false; + for LInfo in PYTHON_KNOWN_VERSIONS do + if (LInfo.RegVersion = LVersion) then begin + RegVersion := LInfo.RegVersion; + APIVersion := LInfo.APIVersion; + LFound := true; + Break; + end; + + if not LFound then + raise EDLLLoadError.Create(SUndeterminedPythonVersion); +end; + +procedure TDynamicDll.LoadDll; +begin + OpenDll( DllName ); +end; + +procedure TDynamicDll.LoadDllInExtensionModule; +begin + if not ModuleIsLib then + Exit; + + FInExtensionModule := True; + + if TryLoadFromHostSymbols() then + Exit; + + if TryLoadFromCurrentProcess() then + Exit; + + LoadDLL(); +end; + +procedure TDynamicDll.UnloadDll; +begin + if IsHandleValid then begin + BeforeUnload; + FreeLibrary(FDLLHandle); + FDLLHandle := 0; + end; +end; + +procedure TDynamicDll.BeforeLoad; +begin + if Assigned( FOnBeforeLoad ) then + FOnBeforeLoad( Self ); +end; + +procedure TDynamicDll.AfterLoad; +begin + if Assigned( FOnAfterLoad ) then + FOnAfterLoad( Self ); +end; + +procedure TDynamicDll.BeforeUnload; +begin + if Assigned( FOnBeforeUnload ) then + FOnBeforeUnload( Self ); +end; + +function TDynamicDll.GetQuitMessage : string; +begin + Result := Format(SQuitMessage, [DllName]); +end; + +function TDynamicDll.HasPythonSymbolsInLibrary: boolean; +var + LPy_GetBuildInfo: function: PAnsiChar; cdecl; + LPy_IsInitialized: function: integer; cdecl; +begin + LPy_GetBuildInfo := Import('Py_GetBuildInfo', false); + LPy_IsInitialized := Import('Py_IsInitialized', false); + Result := Assigned(LPy_GetBuildInfo) and Assigned(LPy_GetBuildInfo()) + and Assigned(LPy_IsInitialized) and (LPy_IsInitialized() <> 0); +end; + +procedure TDynamicDll.Quit; +begin + if not( csDesigning in ComponentState ) then begin +{$IFDEF MSWINDOWS} + MessageBox( GetActiveWindow, PChar(GetQuitMessage), 'Error', MB_TASKMODAL or MB_ICONSTOP ); + ExitProcess( 1 ); +{$ELSE} + WriteLn(ErrOutput, GetQuitMessage); + Halt( 1 ); +{$ENDIF} + end; +end; + +function TDynamicDll.IsAPIVersionStored: Boolean; +begin + Result := not UseLastKnownVersion; +end; + +function TDynamicDll.IsDllNameStored: Boolean; +begin + Result := not UseLastKnownVersion; +end; + +function TDynamicDll.IsRegVersionStored: Boolean; +begin + Result := not UseLastKnownVersion; +end; + +procedure TDynamicDll.SetDllName(const Value: string); +begin + FDllName := Value; +end; + + +(*******************************************************) +(** **) +(** class TPythonInterface **) +(** **) +(*******************************************************) + +constructor TPythonInterface.Create(AOwner: TComponent); +var + i : Integer; +begin + inherited; + FInitialized := False; + i := COMPILED_FOR_PYTHON_VERSION_INDEX; + DllName := PYTHON_KNOWN_VERSIONS[i].DllName; + FAPIVersion := PYTHON_KNOWN_VERSIONS[i].APIVersion; + FRegVersion := PYTHON_KNOWN_VERSIONS[i].RegVersion; + FAutoUnload := True; +end; + +procedure TPythonInterface.AfterLoad; +begin + inherited; + if not FInExtensionModule then + PythonVersionFromDLLName(DLLName, FMajorVersion, FMinorVersion) + else if not PythonVersionFromRegVersion(RegVersion, FMajorVersion, FMinorVersion) then + raise EDLLLoadError.Create(SUndeterminedPythonVersion); + + FBuiltInModuleName := 'builtins'; + + try + MapDll; + except + on E: Exception do begin + if FatalMsgDlg then +{$IFDEF MSWINDOWS} + MessageBox( GetActiveWindow, PChar(E.Message), 'Error', MB_TASKMODAL or MB_ICONSTOP ); +{$ELSE} + WriteLn( ErrOutput, E.Message ); +{$ENDIF} + if FatalAbort then Quit; + end; + end; +end; + +function TPythonInterface.GetQuitMessage : string; +begin + Result := Format(SPythonQuitMessage, [DllName]); +end; + +procedure TPythonInterface.CheckPython; +begin + if not Initialized then + raise Exception.Create(SPythonNoInit); +end; + +procedure TPythonInterface.MapDll; +begin + Py_None := Import('_Py_NoneStruct'); + Py_Ellipsis := Import('_Py_EllipsisObject'); + Py_False := Import('_Py_FalseStruct'); + Py_True := Import('_Py_TrueStruct'); + Py_NotImplemented := Import('_Py_NotImplementedStruct'); + + PyImport_FrozenModules := Import('PyImport_FrozenModules'); + + PyExc_AttributeError := Import('PyExc_AttributeError'); + PyExc_EOFError := Import('PyExc_EOFError'); + PyExc_IOError := Import('PyExc_IOError'); + PyExc_ImportError := Import('PyExc_ImportError'); + PyExc_IndexError := Import('PyExc_IndexError'); + PyExc_KeyError := Import('PyExc_KeyError'); + PyExc_KeyboardInterrupt := Import('PyExc_KeyboardInterrupt'); + PyExc_MemoryError := Import('PyExc_MemoryError'); + PyExc_NameError := Import('PyExc_NameError'); + PyExc_OverflowError := Import('PyExc_OverflowError'); + PyExc_RuntimeError := Import('PyExc_RuntimeError'); + PyExc_SyntaxError := Import('PyExc_SyntaxError'); + PyExc_SystemError := Import('PyExc_SystemError'); + PyExc_SystemExit := Import('PyExc_SystemExit'); + PyExc_TypeError := Import('PyExc_TypeError'); + PyExc_ValueError := Import('PyExc_ValueError'); + PyExc_ZeroDivisionError := Import('PyExc_ZeroDivisionError'); + PyExc_ArithmeticError := Import('PyExc_ArithmeticError'); + PyExc_Exception := Import('PyExc_Exception'); + PyExc_FloatingPointError := Import('PyExc_FloatingPointError'); + PyExc_LookupError := Import('PyExc_LookupError'); + PyExc_AssertionError := Import('PyExc_AssertionError'); + PyExc_EnvironmentError := Import('PyExc_EnvironmentError'); + PyExc_IndentationError := Import('PyExc_IndentationError'); + PyExc_NotImplementedError := Import('PyExc_NotImplementedError'); + PyExc_OSError := Import('PyExc_OSError'); + PyExc_TabError := Import('PyExc_TabError'); + PyExc_UnboundLocalError := Import('PyExc_UnboundLocalError'); + PyExc_UnicodeError := Import('PyExc_UnicodeError'); + {$IFDEF MSWINDOWS} + PyExc_WindowsError := Import('PyExc_WindowsError'); + {$ENDIF} + PyExc_Warning := Import('PyExc_Warning'); + PyExc_DeprecationWarning := Import('PyExc_DeprecationWarning'); + PyExc_RuntimeWarning := Import('PyExc_RuntimeWarning'); + PyExc_SyntaxWarning := Import('PyExc_SyntaxWarning'); + PyExc_UserWarning := Import('PyExc_UserWarning'); + PyExc_ReferenceError := Import('PyExc_ReferenceError'); + PyExc_StopIteration := Import('PyExc_StopIteration'); + PyExc_FutureWarning := Import('PyExc_FutureWarning'); + PyExc_PendingDeprecationWarning:= Import('PyExc_PendingDeprecationWarning'); + PyExc_UnicodeDecodeError := Import('PyExc_UnicodeDecodeError'); + PyExc_UnicodeEncodeError := Import('PyExc_UnicodeEncodeError'); + PyExc_UnicodeTranslateError:= Import('PyExc_UnicodeTranslateError'); + PyExc_BufferError := Import('PyExc_BufferError'); + + PyType_Type := Import('PyType_Type'); + PyCFunction_Type := Import('PyCFunction_Type'); + PyCode_Type := Import('PyCode_Type'); + PyComplex_Type := Import('PyComplex_Type'); + PyDict_Type := Import('PyDict_Type'); + PyFloat_Type := Import('PyFloat_Type'); + PyFrame_Type := Import('PyFrame_Type'); + PyFunction_Type := Import('PyFunction_Type'); + PyList_Type := Import('PyList_Type'); + PyLong_Type := Import('PyLong_Type'); + PyMethod_Type := Import('PyMethod_Type'); + PyModule_Type := Import('PyModule_Type'); + PyObject_Type := Import('PyObject_Type'); + PyRange_Type := Import('PyRange_Type'); + PySlice_Type := Import('PySlice_Type'); + PyBytes_Type := Import('PyBytes_Type'); + PyByteArray_Type := Import('PyByteArray_Type'); + PyTuple_Type := Import('PyTuple_Type'); + PyUnicode_Type := Import('PyUnicode_Type'); + PyBaseObject_Type := Import('PyBaseObject_Type'); + PyCallIter_Type := Import('PyCallIter_Type'); + PyCell_Type := Import('PyCell_Type'); + PyClassMethod_Type := Import('PyClassMethod_Type'); + PyProperty_Type := Import('PyProperty_Type'); + PySeqIter_Type := Import('PySeqIter_Type'); + PyStaticMethod_Type := Import('PyStaticMethod_Type'); + PySuper_Type := Import('PySuper_Type'); + PyTraceBack_Type := Import('PyTraceBack_Type'); + PyGetSetDescr_Type := Import('PyGetSetDescr_Type'); + PyWrapperDescr_Type := Import('PyWrapperDescr_Type'); + _PyWeakref_RefType := Import('_PyWeakref_RefType'); + _PyWeakref_ProxyType := Import('_PyWeakref_ProxyType'); + _PyWeakref_CallableProxyType:=Import('_PyWeakref_CallableProxyType'); + PyBool_Type := Import('PyBool_Type'); + PyEnum_Type := Import('PyEnum_Type'); + PySet_Type := Import('PySet_Type'); + PyFrozenSet_Type := Import('PyFrozenSet_Type'); + + PyComplex_FromCComplex := Import('PyComplex_FromCComplex'); + PyComplex_FromDoubles := Import('PyComplex_FromDoubles'); + PyComplex_RealAsDouble := Import('PyComplex_RealAsDouble'); + PyComplex_ImagAsDouble := Import('PyComplex_ImagAsDouble'); + PyComplex_AsCComplex := Import('PyComplex_AsCComplex'); + PyCFunction_GetFunction := Import('PyCFunction_GetFunction'); + PyCFunction_GetSelf := Import('PyCFunction_GetSelf'); + PyCallable_Check := Import('PyCallable_Check'); + PyDict_GetItem := Import('PyDict_GetItem'); + PyDict_SetItem := Import('PyDict_SetItem'); + PyDict_DelItem := Import('PyDict_DelItem'); + PyDict_Clear := Import('PyDict_Clear'); + PyDict_Next := Import('PyDict_Next'); + PyDict_Keys := Import('PyDict_Keys'); + PyDict_Values := Import('PyDict_Values'); + PyDict_Items := Import('PyDict_Items'); + PyDict_Size := Import('PyDict_Size'); + PyDict_DelItemString := Import('PyDict_DelItemString'); + PyDict_Copy := Import('PyDict_Copy'); + PyDict_New := Import('PyDict_New'); + PyDict_Update := Import('PyDict_Update'); + PyDict_SetItemString := Import('PyDict_SetItemString'); + PyDictProxy_New := Import('PyDictProxy_New'); + PyModule_Create2 := Import('PyModule_Create2'); + PyErr_Print := Import('PyErr_Print'); + PyErr_SetNone := Import('PyErr_SetNone'); + PyErr_SetObject := Import('PyErr_SetObject'); + PyErr_Restore := Import('PyErr_Restore'); + PyErr_BadArgument := Import('PyErr_BadArgument'); + PyErr_NoMemory := Import('PyErr_NoMemory'); + PyErr_SetFromErrno := Import('PyErr_SetFromErrno'); + PyErr_BadInternalCall := Import('PyErr_BadInternalCall'); + PyErr_CheckSignals := Import('PyErr_CheckSignals'); + PyErr_Occurred := Import('PyErr_Occurred'); + PyErr_Clear := Import('PyErr_Clear'); + PyErr_Fetch := Import('PyErr_Fetch'); + PyErr_SetString := Import('PyErr_SetString'); + PyErr_WarnEx := Import('PyErr_WarnEx'); + PyErr_WarnExplicit := Import('PyErr_WarnExplicit'); + PyEval_GetBuiltins := Import('PyEval_GetBuiltins'); + PyImport_GetModuleDict := Import('PyImport_GetModuleDict'); + PyArg_Parse := Import('PyArg_Parse'); + PyArg_ParseTuple := Import('PyArg_ParseTuple'); + PyArg_ParseTupleAndKeywords := Import('PyArg_ParseTupleAndKeywords'); + Py_BuildValue := Import('Py_BuildValue'); + Py_Initialize := Import('Py_Initialize'); + PyModule_GetDict := Import('PyModule_GetDict'); + PyObject_Str := Import('PyObject_Str'); + PyRun_String := Import('PyRun_String'); + PyRun_SimpleString := Import('PyRun_SimpleString'); + PyDict_GetItemString := Import('PyDict_GetItemString'); + Py_Exit := Import('Py_Exit'); + + PyCFunction_NewEx := Import('PyCFunction_NewEx'); + + PyBuffer_GetPointer := Import('PyBuffer_GetPointer'); + PyBuffer_ToContiguous := Import('PyBuffer_ToContiguous'); + PyBuffer_FromContiguous := Import('PyBuffer_FromContiguous'); + PyBuffer_IsContiguous := Import('PyBuffer_IsContiguous'); + PyBuffer_FillContiguousStrides := Import('PyBuffer_FillContiguousStrides'); + PyBuffer_FillInfo := Import('PyBuffer_FillInfo'); + PyBuffer_Release := Import('PyBuffer_Release'); + if (FMajorVersion > 3) or (FMinorVersion > 9) then + PyBuffer_SizeFromFormat := Import('PyBuffer_SizeFromFormat'); + + PyEval_GetFrame := Import('PyEval_GetFrame'); + PyEval_GetGlobals := Import('PyEval_GetGlobals'); + PyEval_GetLocals := Import('PyEval_GetLocals'); + PyEval_RestoreThread := Import('PyEval_RestoreThread'); + PyEval_SaveThread := Import('PyEval_SaveThread'); + PyFile_GetLine := Import('PyFile_GetLine'); + PyFile_WriteObject := Import('PyFile_WriteObject'); + PyFile_WriteString := Import('PyFile_WriteString'); + PyFloat_AsDouble := Import('PyFloat_AsDouble'); + PyFloat_FromDouble := Import('PyFloat_FromDouble'); + PyFloat_FromString := Import('PyFloat_FromString'); + PyFunction_GetCode := Import('PyFunction_GetCode'); + PyFunction_GetGlobals := Import('PyFunction_GetGlobals'); + PyFunction_New := Import('PyFunction_New'); + PyImport_AddModule := Import('PyImport_AddModule'); + PyImport_GetMagicNumber := Import('PyImport_GetMagicNumber'); + PyImport_ImportFrozenModule:= Import('PyImport_ImportFrozenModule'); + PyImport_ImportModule := Import('PyImport_ImportModule'); + PyImport_Import := Import('PyImport_Import'); + PyImport_ReloadModule := Import('PyImport_ReloadModule'); + PyList_Append := Import('PyList_Append'); + PyList_AsTuple := Import('PyList_AsTuple'); + PyList_GetItem := Import('PyList_GetItem'); + PyList_GetSlice := Import('PyList_GetSlice'); + PyList_Insert := Import('PyList_Insert'); + PyList_New := Import('PyList_New'); + PyList_Reverse := Import('PyList_Reverse'); + PyList_SetItem := Import('PyList_SetItem'); + PyList_SetSlice := Import('PyList_SetSlice'); + PyList_Size := Import('PyList_Size'); + PyList_Sort := Import('PyList_Sort'); + PyLong_AsDouble := Import('PyLong_AsDouble'); + PyLong_AsLong := Import('PyLong_AsLong'); + PyLong_FromDouble := Import('PyLong_FromDouble'); + PyLong_FromLong := Import('PyLong_FromLong'); + PyLong_FromString := Import('PyLong_FromString'); + PyLong_FromString := Import('PyLong_FromString'); + PyLong_FromUnsignedLong := Import('PyLong_FromUnsignedLong'); + PyLong_AsUnsignedLong := Import('PyLong_AsUnsignedLong'); + PyLong_FromUnicodeObject := Import('PyLong_FromUnicodeObject'); + PyLong_FromLongLong := Import('PyLong_FromLongLong'); + PyLong_FromUnsignedLongLong := Import('PyLong_FromUnsignedLongLong'); + PyLong_AsLongLong := Import('PyLong_AsLongLong'); + PyLong_AsVoidPtr := Import('PyLong_AsVoidPtr'); + PyLong_FromVoidPtr := Import('PyLong_FromVoidPtr'); + PyMapping_Check := Import('PyMapping_Check'); + PyMapping_GetItemString := Import('PyMapping_GetItemString'); + PyMapping_HasKey := Import('PyMapping_HasKey'); + PyMapping_HasKeyString := Import('PyMapping_HasKeyString'); + PyMapping_Length := Import('PyMapping_Length'); + PyMapping_SetItemString := Import('PyMapping_SetItemString'); + PyMapping_Keys := Import('PyMapping_Keys'); + PyMapping_Values := Import('PyMapping_Values'); + PyMethod_Function := Import('PyMethod_Function'); + PyMethod_New := Import('PyMethod_New'); + PyMethod_Self := Import('PyMethod_Self'); + PyModule_GetName := Import('PyModule_GetName'); + PyModule_New := Import('PyModule_New'); + PyNumber_Absolute := Import('PyNumber_Absolute'); + PyNumber_Add := Import('PyNumber_Add'); + PyNumber_And := Import('PyNumber_And'); + PyNumber_Check := Import('PyNumber_Check'); + PyNumber_FloorDivide := Import('PyNumber_FloorDivide'); + PyNumber_TrueDivide := Import('PyNumber_TrueDivide'); + PyNumber_Divmod := Import('PyNumber_Divmod'); + PyNumber_Float := Import('PyNumber_Float'); + PyNumber_Invert := Import('PyNumber_Invert'); + PyNumber_Long := Import('PyNumber_Long'); + PyNumber_Lshift := Import('PyNumber_Lshift'); + PyNumber_Multiply := Import('PyNumber_Multiply'); + PyNumber_Negative := Import('PyNumber_Negative'); + PyNumber_Or := Import('PyNumber_Or'); + PyNumber_Positive := Import('PyNumber_Positive'); + PyNumber_Power := Import('PyNumber_Power'); + PyNumber_Remainder := Import('PyNumber_Remainder'); + PyNumber_Rshift := Import('PyNumber_Rshift'); + PyNumber_Subtract := Import('PyNumber_Subtract'); + PyNumber_Xor := Import('PyNumber_Xor'); + PyOS_InterruptOccurred := Import('PyOS_InterruptOccurred'); + PyObject_CallObject := Import('PyObject_CallObject'); + PyObject_CallMethod := Import('PyObject_CallMethod'); + PyObject_RichCompare := Import('PyObject_RichCompare'); + PyObject_RichCompareBool := Import('PyObject_RichCompareBool'); + PyObject_GetAttr := Import('PyObject_GetAttr'); + PyObject_GetAttrString := Import('PyObject_GetAttrString'); + PyObject_GetItem := Import('PyObject_GetItem'); + PyObject_DelItem := Import('PyObject_DelItem'); + PyObject_HasAttr := Import('PyObject_HasAttr'); + PyObject_HasAttrString := Import('PyObject_HasAttrString'); + PyObject_Hash := Import('PyObject_Hash'); + PyObject_IsTrue := Import('PyObject_IsTrue'); + PyObject_Length := Import('PyObject_Length'); + PyObject_Repr := Import('PyObject_Repr'); + PyObject_SetAttr := Import('PyObject_SetAttr'); + PyObject_SetAttrString := Import('PyObject_SetAttrString'); + PyObject_SetItem := Import('PyObject_SetItem'); + PyObject_Init := Import('PyObject_Init'); + PyObject_InitVar := Import('PyObject_InitVar'); + PyObject_New := Import('_PyObject_New'); + PyObject_NewVar := Import('_PyObject_NewVar'); + PyObject_Free := Import('PyObject_Free'); + PyObject_GetIter := Import('PyObject_GetIter'); + PyIter_Next := Import('PyIter_Next'); + PyObject_IsInstance := Import('PyObject_IsInstance'); + PyObject_IsSubclass := Import('PyObject_IsSubclass'); + PyObject_Call := Import('PyObject_Call'); + PyObject_GenericGetAttr := Import('PyObject_GenericGetAttr'); + PyObject_GenericSetAttr := Import('PyObject_GenericSetAttr'); + PyObject_Malloc := Import('PyObject_Malloc'); + PyObject_GC_New := Import('_PyObject_GC_New'); + PyObject_GC_NewVar := Import('_PyObject_GC_NewVar'); + PyObject_GC_Resize := Import('_PyObject_GC_Resize'); + PyObject_GC_Del := Import('PyObject_GC_Del'); + PyObject_GC_Track := Import('PyObject_GC_Track'); + PyObject_GC_UnTrack := Import('PyObject_GC_UnTrack'); + PyObject_GetBuffer := Import('PyObject_GetBuffer'); + PyObject_CopyData := Import('PyObject_CopyData'); + PySequence_Check := Import('PySequence_Check'); + PySequence_Concat := Import('PySequence_Concat'); + PySequence_Count := Import('PySequence_Count'); + PySequence_GetItem := Import('PySequence_GetItem'); + PySequence_GetSlice := Import('PySequence_GetSlice'); + PySequence_In := Import('PySequence_In'); + PySequence_Index := Import('PySequence_Index'); + PySequence_Length := Import('PySequence_Length'); + PySequence_Repeat := Import('PySequence_Repeat'); + PySequence_SetItem := Import('PySequence_SetItem'); + PySequence_SetSlice := Import('PySequence_SetSlice'); + PySequence_DelSlice := Import('PySequence_DelSlice'); + PySequence_Tuple := Import('PySequence_Tuple'); + PySequence_Contains := Import('PySequence_Contains'); + PySequence_List := Import('PySequence_List'); + PySlice_GetIndices := Import('PySlice_GetIndices'); + PySeqIter_New := Import('PySeqIter_New'); + PySlice_GetIndicesEx := Import('PySlice_GetIndicesEx'); + PySlice_New := Import('PySlice_New'); + PyBytes_AsString := Import('PyBytes_AsString'); + PyBytes_AsStringAndSize := Import('PyBytes_AsStringAndSize'); + PyBytes_Concat := Import('PyBytes_Concat'); + PyBytes_ConcatAndDel := Import('PyBytes_ConcatAndDel'); + PyBytes_FromString := Import('PyBytes_FromString'); + PyBytes_FromStringAndSize := Import('PyBytes_FromStringAndSize'); + PyBytes_Size := Import('PyBytes_Size'); + PyBytes_DecodeEscape := Import('PyBytes_DecodeEscape'); + PyBytes_Repr := Import('PyBytes_Repr'); + _PyBytes_Resize := Import('_PyBytes_Resize'); + PyBytes_FromObject := Import('PyBytes_FromObject'); + PyByteArray_AsString := Import('PyByteArray_AsString'); + PyByteArray_Concat := Import('PyByteArray_Concat'); + PyByteArray_Resize := Import('PyByteArray_Resize'); + PyByteArray_FromObject := Import('PyByteArray_FromObject'); + PyByteArray_FromStringAndSize := Import('PyByteArray_FromStringAndSize'); + PyByteArray_Size := Import('PyByteArray_Size'); + PyFrozenSet_New := Import('PyFrozenSet_New'); + PySet_New := Import('PySet_New'); + PySet_Add := Import('PySet_Add'); + PySet_Clear := Import('PySet_Clear'); + PySet_Contains := Import('PySet_Contains'); + PySet_Discard := Import('PySet_Discard'); + PySet_Pop := Import('PySet_Pop'); + PySet_Size := Import('PySet_Size'); + PySys_GetObject := Import('PySys_GetObject'); + PySys_SetObject := Import('PySys_SetObject'); + PyTraceBack_Here := Import('PyTraceBack_Here'); + PyTraceBack_Print := Import('PyTraceBack_Print'); + PyTuple_GetItem := Import('PyTuple_GetItem'); + PyTuple_GetSlice := Import('PyTuple_GetSlice'); + PyTuple_New := Import('PyTuple_New'); + PyTuple_SetItem := Import('PyTuple_SetItem'); + PyTuple_Size := Import('PyTuple_Size'); + PyType_IsSubtype := Import('PyType_IsSubtype'); + PyType_GenericAlloc := Import('PyType_GenericAlloc'); + PyType_GenericNew := Import('PyType_GenericNew'); + PyType_Ready := Import('PyType_Ready'); + PyUnicode_FromWideChar := Import('PyUnicode_FromWideChar'); + PyUnicode_FromString := Import('PyUnicode_FromString'); + PyUnicode_FromStringAndSize := Import('PyUnicode_FromStringAndSize'); + PyUnicode_FromKindAndData := Import('PyUnicode_FromKindAndData'); + PyUnicode_AsWideChar := Import('PyUnicode_AsWideChar'); + PyUnicode_AsUTF8 := Import('PyUnicode_AsUTF8'); + PyUnicode_AsUTF8AndSize := Import('PyUnicode_AsUTF8AndSize'); + PyUnicode_Decode := Import('PyUnicode_Decode'); + PyUnicode_DecodeUTF16 := Import('PyUnicode_DecodeUTF16'); + PyUnicode_AsEncodedString := Import('PyUnicode_AsEncodedString'); + PyUnicode_FromOrdinal := Import('PyUnicode_FromOrdinal'); + PyUnicode_GetLength := Import('PyUnicode_GetLength'); + PyWeakref_GetObject := Import('PyWeakref_GetObject'); + PyWeakref_NewProxy := Import('PyWeakref_NewProxy'); + PyWeakref_NewRef := Import('PyWeakref_NewRef'); + PyWrapper_New := Import('PyWrapper_New'); + PyBool_FromLong := Import('PyBool_FromLong'); + PyThreadState_SetAsyncExc := Import('PyThreadState_SetAsyncExc'); + Py_AtExit := Import('Py_AtExit'); + Py_FatalError := Import('Py_FatalError'); + Py_CompileStringExFlags := Import('Py_CompileStringExFlags'); + _PyObject_New := Import('_PyObject_New'); + Py_Finalize := Import('Py_Finalize'); + PyImport_ExecCodeModule := Import('PyImport_ExecCodeModule'); + PyErr_ExceptionMatches := Import('PyErr_ExceptionMatches'); + PyErr_GivenExceptionMatches := Import('PyErr_GivenExceptionMatches'); + PyEval_EvalCode := Import('PyEval_EvalCode'); + Py_GetVersion := Import('Py_GetVersion'); + Py_GetCopyright := Import('Py_GetCopyright'); + Py_GetExecPrefix := Import('Py_GetExecPrefix'); + Py_GetPath := Import('Py_GetPath'); + Py_GetPythonHome := Import('Py_GetPythonHome'); + Py_GetPrefix := Import('Py_GetPrefix'); + Py_GetProgramName := Import('Py_GetProgramName'); + + PyErr_NewException := Import('PyErr_NewException'); + PyMem_Malloc := Import ('PyMem_Malloc'); + PyMem_Free := Import ('PyMem_Free'); + + Py_IsInitialized := Import('Py_IsInitialized'); + Py_GetProgramFullPath := Import('Py_GetProgramFullPath'); + Py_GetBuildInfo := Import('Py_GetBuildInfo'); + Py_NewInterpreter := Import('Py_NewInterpreter'); + if (FMajorVersion > 3) or (FMinorVersion >= 12) then + Py_NewInterpreterFromConfig := Import('Py_NewInterpreterFromConfig'); + Py_EndInterpreter := Import('Py_EndInterpreter'); + PyEval_AcquireThread := Import('PyEval_AcquireThread'); + PyEval_ReleaseThread := Import('PyEval_ReleaseThread'); + PyInterpreterState_New := Import('PyInterpreterState_New'); + PyInterpreterState_Clear := Import('PyInterpreterState_Clear'); + PyInterpreterState_Delete:= Import('PyInterpreterState_Delete'); + PyThreadState_New := Import('PyThreadState_New'); + PyThreadState_Clear := Import('PyThreadState_Clear'); + PyThreadState_Delete := Import('PyThreadState_Delete'); + PyThreadState_Get := Import('PyThreadState_Get'); + PyThreadState_Swap := Import('PyThreadState_Swap'); + PyErr_SetInterrupt := Import('PyErr_SetInterrupt'); + PyGILState_Ensure := Import('PyGILState_Ensure'); + PyGILState_Release := Import('PyGILState_Release'); + + PyWideStringList_Append := Import('PyWideStringList_Append'); + PyWideStringList_Insert := Import('PyWideStringList_Insert'); + PyConfig_InitPythonConfig := Import('PyConfig_InitPythonConfig'); + PyConfig_InitIsolatedConfig := Import('PyConfig_InitIsolatedConfig'); + PyConfig_Clear := Import('PyConfig_Clear'); + PyConfig_SetString := Import('PyConfig_SetString'); + PyConfig_Read := Import('PyConfig_Read'); + PyConfig_SetArgv := Import('PyConfig_SetArgv'); + PyConfig_SetWideStringList := Import('PyConfig_SetWideStringList'); + Py_InitializeFromConfig := Import('Py_InitializeFromConfig'); + + // PEP 741 + if (MajorVersion > 3) or (MinorVersion >= 14) then + begin + PyInitConfig_Create := Import('PyInitConfig_Create'); + PyInitConfig_Free := Import('PyInitConfig_Free'); + Py_InitializeFromInitConfig := Import('Py_InitializeFromInitConfig'); + PyInitConfig_SetInt := Import('PyInitConfig_SetInt'); + PyInitConfig_SetStr := Import('PyInitConfig_SetStr'); + PyInitConfig_SetStrList := Import('PyInitConfig_SetStrList'); + PyInitConfig_GetError := Import('PyInitConfig_GetError'); + PyConfig_Get := Import('PyConfig_Get'); + PyConfig_Set := Import('PyConfig_Set'); + end; +end; + +function TPythonInterface.Py_CompileString(str,filename:PAnsiChar;start:integer):PPyObject; +begin + Result := Py_CompileStringExFlags(str, filename, start, nil, -1); +end; + +class procedure TPythonInterface.Py_INCREF(op: PPyObject); +begin + Inc(op^.ob_refcnt); +end; + +class procedure TPythonInterface.Py_DECREF(op: PPyObject); +begin + with op^ do begin + Dec(ob_refcnt); + if ob_refcnt = 0 then begin + ob_type^.tp_dealloc(op); + end; + end; +end; + +class procedure TPythonInterface.Py_XINCREF(op: PPyObject); +begin + if op <> nil then Py_INCREF(op); +end; + +class procedure TPythonInterface.Py_XDECREF(op: PPyObject); +begin + if op <> nil then Py_DECREF(op); +end; + + +class procedure TPythonInterface.Py_CLEAR(var op: PPyObject); +Var + _py_tmp : PPyObject; +begin + _py_tmp := op; + if _py_tmp <> nil then + begin + op := nil; + Py_DECREF(_py_tmp); + end; +end; + +function TPythonInterface.PyByteArray_Check(obj: PPyObject): Boolean; +begin + Result := PyObject_TypeCheck(obj, PyByteArray_Type); +end; + +function TPythonInterface.PyByteArray_CheckExact(obj: PPyObject): Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PyByteArray_Type); +end; + +function TPythonInterface.PyBytes_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyBytes_Type); +end; + +function TPythonInterface.PyBytes_CheckExact(obj: PPyObject): Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PyBytes_Type); +end; + +function TPythonInterface.PyFloat_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyFloat_Type); +end; + +function TPythonInterface.PyFloat_CheckExact(obj: PPyObject): Boolean; +begin + Result := IsType(obj, PyFloat_Type); +end; + +function TPythonInterface.PyLong_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyLong_Type); +end; + +function TPythonInterface.PyLong_CheckExact(obj: PPyObject): Boolean; +begin + Result := IsType(obj, PyLong_Type); +end; + +function TPythonInterface.PyTuple_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyTuple_Type); +end; + +function TPythonInterface.PyTuple_CheckExact(obj: PPyObject): Boolean; +begin + Result := IsType(obj, PyTuple_Type); +end; + +function TPythonInterface.PyClass_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (PyObject_IsInstance(obj, PPyObject(PyType_Type)) = 1); +end; + +function TPythonInterface.PyType_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := IsType(obj, PyType_Type); +end; + +function TPythonInterface.PyMethod_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PyMethod_Type); +end; + +function TPythonInterface.PyList_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyList_Type); +end; + +function TPythonInterface.PyList_CheckExact(obj: PPyObject): Boolean; +begin + Result := IsType(obj, PyList_Type); +end; + +function TPythonInterface.PyDict_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyDict_Type); +end; + +function TPythonInterface.PyDict_CheckExact(obj: PPyObject): Boolean; +begin + Result := IsType(obj, PyDict_Type); +end; + +function TPythonInterface.PyModule_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyModule_Type); +end; + +function TPythonInterface.PyModule_CheckExact(obj: PPyObject): Boolean; +begin + Result := IsType(obj, PyModule_Type); +end; + +function TPythonInterface.PySlice_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PySlice_Type)); +end; + +function TPythonInterface.PyFunction_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and + ((obj^.ob_type = PyCFunction_Type) or (obj^.ob_type = PyFunction_Type)); +end; + +function TPythonInterface.PyIter_Check(obj: PPyObject): Boolean; +begin + Result := Assigned(obj) and Assigned(obj^.ob_type^.tp_iternext); +end; + +function TPythonInterface.PyUnicode_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyUnicode_Type); +end; + +function TPythonInterface.PyUnicode_CheckExact(obj: PPyObject): Boolean; +begin + Result := IsType(obj, PyUnicode_Type); +end; + +function TPythonInterface.PyType_IS_GC(t : PPyTypeObject ) : Boolean; +begin + Result := PyType_HasFeature(t, Py_TPFLAGS_HAVE_GC); +end; + +function TPythonInterface.PyObject_IS_GC( obj : PPyObject ) : Boolean; +begin + Result := PyType_IS_GC(obj^.ob_type) and + (not Assigned(obj^.ob_type^.tp_is_gc) or (obj^.ob_type^.tp_is_gc(obj) = 1)); +end; + +function TPythonInterface.PyObject_CheckBuffer(obj: PPyObject): Boolean; +begin + Result := Assigned(obj^.ob_type^.tp_as_buffer) and + Assigned(obj^.ob_type^.tp_as_buffer.bf_getbuffer); +end; + +function TPythonInterface.PyWeakref_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (PyWeakref_CheckRef(obj) or PyWeakref_CheckProxy(obj)); +end; + +function TPythonInterface.PyWeakref_CheckRef( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(_PyWeakref_RefType)); +end; + +function TPythonInterface.PyWeakref_CheckProxy( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and + ( (obj^.ob_type = PPyTypeObject(_PyWeakref_ProxyType)) or + (obj^.ob_type = PPyTypeObject(_PyWeakref_CallableProxyType)) ); +end; + +function TPythonInterface.PyBool_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PyBool_Type); +end; + +function TPythonInterface.PyEnum_Check( obj : PPyObject ) : Boolean; +begin + Result := Assigned( obj ) and (obj^.ob_type = PPyTypeObject(PyEnum_Type)); +end; + +function TPythonInterface.Py_Type(ob: PPyObject): PPyTypeObject; +begin + Result := ob^.ob_type; +end; + +function TPythonInterface.IsType(ob: PPyObject; obt: PPyTypeObject): Boolean; +begin + Result := ob^.ob_type = obt; +end; + +function TPythonInterface.PyObject_TypeCheck(obj: PPyObject; t: PPyTypeObject): Boolean; +begin + Result := IsType(obj, t) or (PyType_IsSubtype(obj^.ob_type, t) = 1); +end; + +function TPythonInterface.Py_InitModule(const md: PyModuleDef): PPyObject; +Var + modules : PPyObject; +begin + CheckPython; + Result:= PyModule_Create2(@md, APIVersion); + if not Assigned(Result) then + GetPythonEngine.CheckError; + // To emulate Py_InitModule4 we need to add the module to sys.modules + modules := PyImport_GetModuleDict; + if PyDict_SetItemString(modules, md.m_name, Result) <> 0 then + GetPythonEngine.CheckError; +end; + + +(*******************************************************) +(** **) +(** class TPythonTraceback **) +(** **) +(*******************************************************) + +function TPythonTraceback.GetItemCount : Integer; +begin + Result := FItems.Count; +end; + +function TPythonTraceback.GetItem( idx : Integer ) : TTracebackItem; +begin + Result := TTracebackItem(FItems.Items[idx]); +end; + +constructor TPythonTraceback.Create; +begin + inherited; + FLimit := 1000; + FItems := TList.Create; +end; + +destructor TPythonTraceback.Destroy; +begin + Clear; + FItems.Free; + inherited; +end; + +procedure TPythonTraceback.AddItem(const Context, FileName: string; + LineNo: Integer); +var + Item: TTracebackItem; +begin + Item := TTracebackItem.Create; + Item.Context := Context; + Item.FileName := FileName; + Item.LineNo := LineNo; + FItems.Add(Item); +end; + +procedure TPythonTraceback.Clear; +var + i : Integer; +begin + for i := 0 to ItemCount - 1 do + Items[i].Free; + FItems.Clear; +end; + +{****** + * Warning ! + * This method must be called after the PyErr_Print function, + * otherwise it can't extract the traceback informations. + * + * This method is automatically called by the Exec/Eval methods of + * TPythonEngine. But if you use the Python core API, then don't + * forget to refresh the traceback yourself. Or much better, + * simply use the method CheckError which will call PyErr_Print, + * Traceback.Refresh and RaiseError for you. +} +procedure TPythonTraceback.Refresh(pytraceback: PPyObject); +var + tb, tb1 : PPyObject; + obj : PPyObject; + frame : PPyObject; + code : PPyObject; + depth : Integer; + limitv : PPyObject; + aLimit : Integer; + item : TTracebackItem; +begin + Clear; + with GetPythonEngine do + begin + // get the limit of the traceback + alimit := FLimit; + limitv := PySys_GetObject('tracebacklimit'); + if Assigned(limitv) and PyLong_Check(limitv) then + alimit := PyLong_AsLong(limitv); + tb := pytraceback; + if tb = nil then + tb := PySys_GetObject('last_traceback'); + tb1 := tb; + Py_XIncRef(tb1); + depth := 0; + // Evaluate the depth of the traceback + while Assigned(tb1) and (tb1 <> Py_None) do + begin + Inc(depth); + Py_XDecRef(tb1); + tb1 := PyObject_GetAttrString(tb1, 'tb_next'); + CheckError(False); + end; + Py_XDecRef(tb1); + // build the trace back + Py_XIncRef(tb); + while Assigned(tb) and (tb <> Py_None) do + begin + try + if depth <= alimit then + begin + item := TTracebackItem.Create; + try + obj := PyObject_GetAttrString(tb, 'tb_lineno'); + CheckError(False); + try + item.LineNo := PyObjectAsVariant(obj); + finally + Py_XDecRef(obj); + end; + frame := PyObject_GetAttrString(tb, 'tb_frame'); + CheckError(False); + try + if Assigned(frame) and (frame <> Py_None) then + begin + code := PyObject_GetAttrString(frame, 'f_code'); + CheckError(False); + try + obj := PyObject_GetAttrString(code, 'co_filename'); + CheckError(False); + try + item.Filename := PyObjectAsVariant( obj ); + finally + Py_XDecRef(obj); + end; + obj := PyObject_GetAttrString(code, 'co_name'); + CheckError(False); + try + item.Context := PyObjectAsVariant( obj ); + finally + Py_XDecRef(obj); + end; + finally + Py_XDecRef(code); + end; + end; + finally + Py_XDecRef(frame); + end; + except + item.Free; + raise; + end; + FItems.Add( item ); + end; + Dec( depth ); + finally + Py_XDecRef(tb); + end; + tb := PyObject_GetAttrString(tb, 'tb_next'); + CheckError(False); + end; + Py_XDecRef(tb); + end; +end; + + +(*******************************************************) +(** **) +(** class TPythonEngine **) +(** **) +(*******************************************************) + + +constructor TPythonEngine.Create(AOwner: TComponent); +var + i : Integer; +begin + inherited; + FInitScript := TstringList.Create; + FClients := TList.Create; + FRedirectIO := True; + FExecModule := '__main__'; + FAutoFinalize := True; + FTraceback := TPythonTraceback.Create; + FUseWindowsConsole := False; + FPyFlags := DEFAULT_FLAGS; + FDatetimeConversionMode := DEFAULT_DATETIME_CONVERSION_MODE; + if csDesigning in ComponentState then + begin + for i := 0 to AOwner.ComponentCount - 1 do + if (AOwner.Components[i] is TPythonEngine) and + (AOwner.Components[i] <> Self) then + raise Exception.Create(SOnlyOnePythonEngine); + end; +end; + +destructor TPythonEngine.Destroy; +var + I: Integer; +begin + LocalVars := nil; + GlobalVars := nil; + Destroying; + Finalize; + for I := 0 to ClientCount - 1 do + Clients[I].ClearEngine; + FClients.Free; + FInitScript.Free; + FTraceback.Free; + inherited; +end; + +procedure TPythonEngine.Finalize; +var + i: integer; +begin + // switch off redirection when the component is destroying, + // because the form or datamodule is beeing closed, and + // redirecting output may crash the application. + if FIORedirected and not (csDestroying in ComponentState) and Initialized then + begin + RedirectIO := False; + // restore the initial streams also. + ExecString('import sys'+LF+ + 'if hasattr(sys, "old_stdin"): sys.stdin=sys.old_stdin'+LF+ + 'if hasattr(sys, "old_stdout"): sys.stdout=sys.old_stdout'+LF+ + 'if hasattr(sys, "old_stderr"): sys.stderr=sys.old_stderr' ); + end; + // First finalize our clients + if Initialized then + for i := 0 to ClientCount - 1 do + with Clients[i] do + begin + if Initialized then + Finalize; + end; + // Then finalize Python, if we have to + if Initialized and FAutoFinalize then begin + try + try + FFinalizing := True; + Py_Finalize; + finally + FFinalizing := False; + FInitialized := False; + end; + except + end; + end; + // Free our reference + gPythonEngine := nil; + FTimeStruct := nil; + FPyDateTime_DateType := nil; + FPyDateTime_DateTimeType := nil; + FPyDateTime_DeltaType := nil; + FPyDateTime_TimeType := nil; + FPyDateTime_TZInfoType := nil; + FPyDateTime_TimeTZType := nil; + FPyDateTime_DateTimeTZType := nil; +end; + +procedure TPythonEngine.AfterLoad; +begin + inherited; + Initialize; +end; + +procedure TPythonEngine.BeforeLoad; +begin + if UseWindowsConsole then + InitWinConsole; + inherited; +end; + +procedure TPythonEngine.DoOpenDll(const aDllName : string); +var + i : Integer; +begin + if UseLastKnownVersion then + for i:= Integer(COMPILED_FOR_PYTHON_VERSION_INDEX) downto 1 do + begin + RegVersion := PYTHON_KNOWN_VERSIONS[i].RegVersion; + inherited DoOpenDll(PYTHON_KNOWN_VERSIONS[i].DllName); + if IsHandleValid then + begin + DllName := PYTHON_KNOWN_VERSIONS[i].DllName; + APIVersion := PYTHON_KNOWN_VERSIONS[i].APIVersion; + Exit; + end; + end + else + begin + RegVersion := SysVersionFromDLLName(aDllName); + inherited; + end; +end; + +procedure TPythonEngine.Initialize; + + procedure ConfigPEP587(var ErrMsg: string); + // Initialize according to PEP587 available since python 3.8 + + procedure AssignPyFlags(var Config: PyConfig); + begin + PInteger(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.parser_debug])^ := + IfThen(pfDebug in FPyFlags, 1, 0); + PInteger(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.verbose])^ := + IfThen(pfVerbose in FPyFlags, 1, 0); + PInteger(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.interactive])^ := + IfThen(pfInteractive in FPyFlags, 1, 0); + PInteger(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.optimization_level])^ := + IfThen(pfOptimize in FPyFlags, 1, 0); + PInteger(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.site_import])^ := + IfThen(pfNoSite in FPyFlags, 0, 1); + PInteger(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.pathconfig_warnings])^ := + IfThen(pfFrozen in FPyFlags, 1, 0); + PInteger(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.use_environment])^ := + IfThen(pfIgnoreEnvironment in FPyFlags, 0, 1); + end; + + procedure SetProgramArgs(var Config: PyConfig); + var + I: Integer; + TempS: UnicodeString; + Str: WCharTString; + + begin + // do not parse further + PInteger(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.parse_argv])^ := 0; + for I := 0 to ParamCount do + begin + { + ... the first entry should refer to the script file to be executed rather + than the executable hosting the Python interpreter. If there isn’t a + script that will be run, the first entry in argv can be an empty string. + } + if I = 0 then + TempS := '' + else + TempS := ParamStr(I); + {$IFDEF POSIX} + Str := UnicodeStringToUCS4String(TempS); + {$ELSE} + Str := TempS; + {$ENDIF} + PyWideStringList_Append( + PPyWideStringList(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.argv]), + PWCharT(Str)); + end; + end; + + procedure SetPythonPath(var Config: PyConfig); + var + Paths: TStringDynArray; + I: Integer; + PWSL: PPyWideStringList; + begin + if FPythonPath = '' then Exit; + + PWSL := PPyWideStringList(PByte(@Config) + ConfigOffests[MinorVersion, + TConfigFields.module_search_paths]); + Paths := SplitString(string(FPythonPath), PathSep); + for I := 0 to Length(Paths) - 1 do + begin + if (Paths[I] = '') and (I > 0) then + Continue; + PyWideStringList_Append(PWSL, PWCharT(StringToWCharTString(Paths[I]))); + end; + + if PWSL^.length > 0 then + PInteger(PByte(@Config) + ConfigOffests[MinorVersion, + TConfigFields.module_search_paths_set])^ := 1; + end; + + var + Config: PyConfig; + Status: PyStatus; + begin + // Fills Config with zeros and then sets some default values + if pfIsolated in FPyFlags then + PyConfig_InitIsolatedConfig(Config) + else + PyConfig_InitPythonConfig(Config); + try + AssignPyFlags(Config); + + // Set programname and pythonhome if available + if FProgramName <> '' then + PyConfig_SetString(Config, + PPWcharT(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.program_name]), + PWCharT(StringToWCharTString(FProgramName))); + if FPythonHome <> '' then + PyConfig_SetString(Config, + PPWcharT(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.home]), + PWCharT(StringToWCharTString(FPythonHome))); + // Set venv executable if available + if FPythonExecutable <> '' then + PyConfig_SetString(Config, + PPWcharT(PByte(@Config) + ConfigOffests[MinorVersion, TConfigFields.executable]), + PWCharT(StringToWCharTString(FPythonExecutable))); + + // Set program arguments (sys.argv) + SetProgramArgs(Config); + + // PythonPath + SetPythonPath(Config); + + // Fine tune Config + if Assigned(FOnConfigInit) then + FOnConfigInit(Self, @Config); + + Status := Py_InitializeFromConfig(Config); + FInitialized := Py_IsInitialized() <> 0; + + if PyStatus_Exception(Status) then + ErrMsg := Format(SPyInitFailed, [string(Status.err_msg)]) + else if not FInitialized then + ErrMsg := Format(SPyInitFailed, [SPyInitFailedUnknown]); + + finally + PyConfig_Clear(Config); + end; + end; + + procedure ConfigPEP741(var ErrMsg: string); + // Initialize according to PEP587 available since python 3.8 + + procedure AssignPyFlags(Config: PPyInitConfig); + begin + PyInitConfig_SetInt(Config, 'isolated', IfThen(pfIsolated in FPyFlags, 1, 0)); + PyInitConfig_SetInt(Config, 'parser_debug', IfThen(pfDebug in FPyFlags, 1, 0)); + PyInitConfig_SetInt(Config, 'verbose', IfThen(pfVerbose in FPyFlags, 1, 0)); + PyInitConfig_SetInt(Config, 'interactive', IfThen(pfInteractive in FPyFlags, 1, 0)); + PyInitConfig_SetInt(Config, 'optimization_level', IfThen(pfOptimize in FPyFlags, 1, 0)); + PyInitConfig_SetInt(Config, 'site_import', IfThen(pfNoSite in FPyFlags, 0, 1)); + PyInitConfig_SetInt(Config, 'pathconfig_warnings', IfThen(pfFrozen in FPyFlags, 1, 0)); + PyInitConfig_SetInt(Config, 'use_environment', IfThen(pfIgnoreEnvironment in FPyFlags, 0, 1)); + PyInitConfig_SetInt(Config, 'user_site_directory', IfThen(pfNoUserSiteDirectory in FPyFlags, 0, 1)); + PyInitConfig_SetInt(Config, 'write_bytecode', IfThen(pfDontWriteBytecode in FPyFlags, 0, 1)); + end; + + procedure SetProgramArgs(Config: PPyInitConfig); + var + I: Integer; + Params: TArray; + PParams: TArray; + begin + // do not parse further + PyInitConfig_SetInt(Config, 'parse_argv', 0); + + SetLength(Params, ParamCount + 1); + SetLength(PParams, ParamCount + 1); + for I := 0 to ParamCount do + begin + { + ... the first entry should refer to the script file to be executed rather + than the executable hosting the Python interpreter. If there isn’t a + script that will be run, the first entry in argv can be an empty string. + } + if I = 0 then + Params[I] := '' + else + Params[I] := EncodeString(ParamStr(I)); + PParams[I] := PAnsiChar(Params[I]) + end; + PyInitConfig_SetStrList(Config, 'argv', ParamCount + 1, @PParams[0]); + end; + + procedure SetPythonPath(Config: PPyInitConfig); + var + Paths: TStringDynArray; + I: Integer; + Utf8Paths: TArray; + PUtf8Paths: TArray; + begin + if FPythonPath = '' then Exit; + + Paths := SplitString(string(FPythonPath), PathSep); + + if Length(Paths) = 0 then Exit; + + SetLength(Utf8Paths, Length(Paths)); + SetLength(PUtf8Paths, Length(Paths)); + + for I := 0 to Length(Paths) - 1 do + begin + Utf8Paths[I] := EncodeString(Paths[I]); + PUtf8Paths[I] := PAnsiChar(Utf8Paths[I]); + end; + + // The following Also sets module_search_paths_set + PyInitConfig_SetStrList(Config, 'module_search_paths', Length(Paths), @PUtf8Paths[0]); + end; + + var + Config: PPyInitConfig; + PErrMsg: PAnsiChar; + begin + Config := PyInitConfig_Create; + try + AssignPyFlags(Config); + + // Set programname and pythonhome if available + if FProgramName <> '' then + PyInitConfig_SetStr(Config, 'program_name', PAnsiChar(EncodeString(FProgramName))); + if FPythonHome <> '' then + PyInitConfig_SetStr(Config, 'home', PAnsiChar(EncodeString(FPythonHome))); + // Set venv executable if available + if FPythonExecutable <> '' then + PyInitConfig_SetStr(Config, 'executable', PAnsiChar(EncodeString(FPythonExecutable))); + + // Set program arguments (sys.argv) + SetProgramArgs(Config); + + // PythonPath + SetPythonPath(Config); + + // Fine tune Config + if Assigned(FOnConfigInit) then + FOnConfigInit(Self, Config); + + if Py_InitializeFromInitConfig(Config) <> 0 then + begin + FInitialized := False; + PyInitConfig_GetError(Config, @PErrMsg); + if PErrMsg <> nil then + ErrMsg := Format(SPyInitFailed, [UTF8ToString(AnsiString(PErrMsg))]); + end + else + FInitialized := Py_IsInitialized() <> 0; + if not FInitialized and (ErrMsg = '') then + ErrMsg := Format(SPyInitFailed, [SPyInitFailedUnknown]); + finally + PyInitConfig_Free(Config); + end; + end; + + procedure InitSysPath; + var + _path : PPyObject; + begin + _path := PySys_GetObject('path'); + if Assigned(FOnSysPathInit) then + FOnSysPathInit(Self, _path); + end; + + function GetVal(AModule : PPyObject; AVarName : AnsiString) : PPyObject; + begin + Result := PyObject_GetAttrString(AModule, PAnsiChar(AVarName)); + if PyErr_Occurred <> nil then + PyErr_Clear + else + Py_XDecRef(Result); // keep a borrowed reference. + end; // } + + procedure GetTimeStructType; + var + timeModule : PPyObject; + begin + timeModule := PyImport_ImportModule('time'); + try + if Assigned(timeModule) then + FTimeStruct := GetVal(timeModule, 'struct_time') + else + PyErr_Clear; + finally + Py_XDecRef(timeModule); + end; + end; + + procedure GetDateTimeTypes; + var + dateTimeModule : PPyObject; + begin + dateTimeModule := PyImport_ImportModule('datetime'); + try + if Assigned(dateTimeModule) then + begin + FPyDateTime_DateType := GetVal(dateTimeModule, 'date'); + FPyDateTime_DateTimeType := GetVal(dateTimeModule, 'datetime'); + FPyDateTime_DeltaType := GetVal(dateTimeModule, 'timedelta'); + FPyDateTime_TimeType := GetVal(dateTimeModule, 'time'); + FPyDateTime_TZInfoType := GetVal(dateTimeModule, 'tzinfo'); + FPyDateTime_TimeTZType := GetVal(dateTimeModule, 'timetz'); + FPyDateTime_DateTimeTZType := GetVal(dateTimeModule, 'datetimetz'); + end + else + PyErr_Clear; + finally + Py_XDecRef(dateTimeModule); + end; + end; + +var + i : Integer; + ErrMsg: string; +begin + if Assigned(gPythonEngine) then + raise Exception.Create(SMoreThanOnePythonEngine); + + gPythonEngine := Self; + + FIORedirected := False; + if FInExtensionModule then + FInitialized := True + else + begin + if (MajorVersion > 3) or (MinorVersion >= 14) then + ConfigPEP741(ErrMsg) + else + ConfigPEP587(ErrMsg); + + if not FInitialized then + begin + if FatalMsgDlg then + {$IFDEF MSWINDOWS} + MessageBox( GetActiveWindow, PChar(ErrMsg), 'Error', MB_TASKMODAL or MB_ICONSTOP ); + {$ELSE} + WriteLn(ErrOutput, ErrMsg); + {$ENDIF} + if FatalAbort then + Quit + else + raise Exception.Create(ErrMsg); + end; + + InitSysPath; + if RedirectIO and Assigned(FIO) then + DoRedirectIO; + end; + + GetTimeStructType; + GetDateTimeTypes; + + for i := 0 to ClientCount - 1 do + with Clients[i] do + if not Initialized then + Initialize; + + {$IFDEF MSWINDOWS} + // fix #504 + if not FRedirectIO and UseWindowsConsole then + PyRun_SimpleString( + 'import sys, io'#10 + + 'sys.stdout = io.TextIOWrapper(open("CONOUT$", "wb", buffering=0), ' + + 'encoding="utf-8", errors="replace", line_buffering=True)'#10 + + 'sys.stderr = io.TextIOWrapper(open("CONOUT$", "wb", buffering=0), ' + + 'encoding="utf-8", errors="replace", line_buffering=False)'#10 + + 'sys.stdin = io.TextIOWrapper(open("CONIN$", "rb", buffering=0), ' + + 'encoding="utf-8", errors="replace", line_buffering=True)'#10); + {$ENDIF} + + if InitScript.Count > 0 then + ExecStrings(InitScript); + if Assigned(FOnAfterInit) then + FOnAfterInit(Self); +end; + + + procedure TPythonEngine.Initialize2; + + procedure InitSysPath; + var + _path : PPyObject; + const Script = + 'import sys' + sLineBreak + + 'sys.executable = r"%s"' + sLineBreak + + 'path = sys.path' + sLineBreak + + 'for i in range(len(path)-1, -1, -1):' + sLineBreak + + ' if path[i].find("site-packages") > 0:' + sLineBreak + + ' path.pop(i)' + sLineBreak + + 'import site' + sLineBreak + + 'site.main()' + sLineBreak + + 'del sys, path, i, site'; + begin + if Pythonexecutable {VenvPythonExe} <> '' then + ExecString(AnsiString(Format(Script, [Pythonexecutable]))); + _path := PySys_GetObject('path'); + if Assigned(FOnSysPathInit) then + FOnSysPathInit(Self, _path); + end; + + function GetVal(AModule : PPyObject; AVarName : AnsiString) : PPyObject; + begin + Result := PyObject_GetAttrString(AModule, PAnsiChar(AVarName)); + if PyErr_Occurred <> nil then + PyErr_Clear + else + Py_XDecRef(Result); // keep a borrowed reference. + end; + + + procedure GetTimeStructType; + var + timeModule : PPyObject; + begin + timeModule := PyImport_ImportModule('time'); + try + if Assigned(timeModule) then + FTimeStruct := GetVal(timeModule, 'struct_time') + else + PyErr_Clear; + finally + Py_XDecRef(timeModule); + end; + end; + + procedure GetDateTimeTypes; + var + dateTimeModule : PPyObject; + begin + dateTimeModule := PyImport_ImportModule('datetime'); + try + if Assigned(dateTimeModule) then + begin + FPyDateTime_DateType := GetVal(dateTimeModule, 'date'); + FPyDateTime_DateTimeType := GetVal(dateTimeModule, 'datetime'); + FPyDateTime_DeltaType := GetVal(dateTimeModule, 'timedelta'); + FPyDateTime_TimeType := GetVal(dateTimeModule, 'time'); + FPyDateTime_TZInfoType := GetVal(dateTimeModule, 'tzinfo'); + FPyDateTime_TimeTZType := GetVal(dateTimeModule, 'timetz'); + FPyDateTime_DateTimeTZType := GetVal(dateTimeModule, 'datetimetz'); + end + else + PyErr_Clear; + finally + Py_XDecRef(dateTimeModule); + end; + end; + +var + i : Integer; + ErrMsg: string; +begin + if Assigned(gPythonEngine) then + raise Exception.Create(SMoreThanOnePythonEngine); + + gPythonEngine := Self; + CheckRegistry; + {if Assigned(Py_SetProgramName) then + begin + if FProgramName = '' then + FProgramName := UnicodeString(ParamStr(0)); + Py_SetProgramName(PWideChar(FProgramName)); + end; } + //AssignPyFlags; + //if FPythonHome <> '' then + //Py_SetPythonHome(PWideChar(FPythonHome)); + Py_Initialize; + if Assigned(Py_IsInitialized) then + FInitialized := Py_IsInitialized() <> 0 + else + FInitialized := True; + FIORedirected := False; + InitSysPath; + //SetProgramArgs; + GetTimeStructType; + GetDateTimeTypes; + //if InitThreads and Assigned(PyEval_InitThreads) then + // PyEval_InitThreads; + if RedirectIO and Assigned(FIO) then + DoRedirectIO; + for i := 0 to ClientCount - 1 do + with Clients[i] do + if not Initialized then + Initialize; + if InitScript.Count > 0 then + ExecStrings( InitScript ); + if Assigned(FOnAfterInit) then + FOnAfterInit(Self); +end; + +procedure TPythonEngine.DoOpenDll2(const aDllName : string); +var + i : Integer; +begin + if UseLastKnownVersion then + for i:= Integer(COMPILED_FOR_PYTHON_VERSION_INDEX) downto 1 do + begin + RegVersion := PYTHON_KNOWN_VERSIONS[i].RegVersion; + inherited DoOpenDll(PYTHON_KNOWN_VERSIONS[i].DllName); + if IsHandleValid then + begin + DllName := PYTHON_KNOWN_VERSIONS[i].DllName; + APIVersion := PYTHON_KNOWN_VERSIONS[i].APIVersion; + Exit; + end; + end + else + RegVersion := SysVersionFromDLLName(aDllName); + inherited; +end; + +procedure TPythonEngine.SetProgramArgs2; +var + i, argc : Integer; + wargv : array of PWideChar; + {$IFDEF POSIX} + UCS4L : array of UCS4String; + {$ELSE} + WL : array of UnicodeString; + {$ENDIF} +begin + // we build a string list of the arguments, because ParamStr returns a volatile string + // and we want to build an array of PAnsiChar, pointing to valid strings. + argc := ParamCount; + SetLength(wargv, argc + 1); + // build the PWideChar array + {$IFDEF POSIX} + // Note that Linux uses UCS4 strings, whereas it declares using UCS2 strings!!! + SetLength(UCS4L, argc+1); + for i := 0 to argc do begin + UCS4L[i] := WideStringToUCS4String(ParamStr(i)); + wargv[i] := @UCS4L[i][0]; + end; + {$ELSE} + SetLength(WL, argc+1); + for i := 0 to argc do begin + WL[i] := UnicodeString(ParamStr(i)); + wargv[i] := PWideChar(WL[i]); + end; + {$ENDIF} + // set the argv list of the sys module with the application arguments + //PySys_SetArgv( argc + 1, PPWideChar(wargv) ); +end; + + + +procedure TPythonEngine.SetInitScript(Value: TStrings); +begin + FInitScript.Assign(Value); +end; + +function TPythonEngine.GetThreadState: PPyThreadState; +begin + if Assigned(PyThreadState_Get) then + Result := PyThreadState_Get + else + Result := nil; +end; + +procedure TPythonEngine.SetIO(InputOutput: TPythonInputOutput); +begin + if InputOutput <> fIO then + begin + if Assigned(fIO) then + fIO.RemoveFreeNotification(Self); + fIO := InputOutput; + if Assigned(fIO) then + fIO.FreeNotification(Self); + end; +end; + +function TPythonEngine.GetClientCount : Integer; +begin + Result := FClients.Count; +end; + +function TPythonEngine.GetClients( idx : Integer ) : TEngineClient; +begin + Result := TEngineClient( FClients.Items[idx] ); +end; + +procedure TPythonEngine.Notification( AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and (AComponent = IO) then + IO := nil +end; + +procedure TPythonEngine.CheckRegistry; +{$IFDEF MSWINDOWS} +var + key : string; + Path : string; + NewPath : string; +{$IFDEF CPUX86} + MajorVersion : integer; + MinorVersion : integer; +{$ENDIF} + VersionSuffix: string; +{$ENDIF} +begin +{$IFDEF MSWINDOWS} + if Assigned( FOnPathInitialization ) then + try + with TRegistry.Create(KEY_ALL_ACCESS and not KEY_NOTIFY) do + try + VersionSuffix := ''; +{$IFDEF CPUX86} + MajorVersion := StrToInt(RegVersion[1]); + MinorVersion := StrToInt(Copy(RegVersion, 3)); + if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 5)) then + VersionSuffix := '-32'; +{$ENDIF} + key := Format('\Software\Python\PythonCore\%s%s\PythonPath', [RegVersion, VersionSuffix]); + + RootKey := HKEY_LOCAL_MACHINE; + if not KeyExists( key ) then + begin + // try a current user installation + RootKey := HKEY_CURRENT_USER; + if not KeyExists( key ) then Exit; + end; + // Key found + OpenKey( key, True ); + try + Path := ReadString(''); + NewPath := Path; + FOnPathInitialization( Self, NewPath ); + if NewPath <> Path then + begin + WriteString( '', NewPath ); + end; + finally + CloseKey; + end; + finally + Free; + end; + except + // under WinNT, with a user without admin rights, the access to the + // LocalMachine keys would raise an exception. + end; +{$ENDIF} +end; + +procedure TPythonEngine.InitWinConsole; +begin +{$IFDEF MSWINDOWS} + FreeConsole; + AllocConsole; + SetConsoleTitle( 'Python console' ); +{$ENDIF} +end; + +procedure TPythonEngine.SetUseWindowsConsole( const Value : Boolean ); +begin + FUseWindowsConsole := Value; + if (csDesigning in ComponentState) then + RedirectIO := False; +end; + +// GlobalVars contains a dictionary object used by the Run_CommandAsObject method, if not nil. +// Warning ! SetGlobalVars increments the reference count of the dictionary object ! +procedure TPythonEngine.SetGlobalVars(const Value: PPyObject); +begin + Py_XDecRef(FGlobalVars); + if Assigned(Value) then + if PyDict_Check(Value) then + FGlobalVars := Value + else + begin + FGlobalVars := nil; + raise Exception.Create(SGlobalVarsShouldBeDict); + end + else + FGlobalVars := nil; + Py_XIncRef(FGlobalVars); +end; + +// LocalVars contains a dictionary object used by the Run_CommandAsObject method, if not nil. +// Warning ! SetLocalVars increments the reference count of the dictionary object ! +procedure TPythonEngine.SetLocalVars(const Value: PPyObject); +begin + Py_XDecRef(FLocalVars); + if Assigned(Value) then + if PyDict_Check(Value) then + FLocalVars := Value + else + begin + FLocalVars := nil; + raise Exception.Create(SLocalVarsShouldBeDict); + end + else + FLocalVars := nil; + Py_XIncRef(FLocalVars); +end; + +procedure TPythonEngine.SetPyFlags(const Value: TPythonFlags); +begin + if FPyFlags <> Value then + begin + if Initialized then + raise Exception.Create(SCannotModifyFlags); + FPyFlags := Value; + end; // of if +end; + +function TPythonEngine.GetSequenceItem(sequence: PPyObject; + idx: Integer): Variant; + var + val : PPyObject; + begin + val := PySequence_GetItem( sequence, idx ); + try + Result := PyObjectAsVariant( val ); + finally + Py_XDecRef( val ); + end; +end; + +procedure TPythonEngine.SetPythonHome(const PythonHome: UnicodeString); +begin + FPythonHome := PythonHome; +end; + +procedure TPythonEngine.SetProgramName(const ProgramName: UnicodeString); +begin + FProgramName := ProgramName; +end; + +function TPythonEngine.EvalPyFunction(pyfunc, pyargs:PPyObject): Variant; +var presult :PPyObject; +begin + CheckPython; + Result := -1; + if pyfunc = nil then exit; + try + presult := PyObject_Call(pyfunc,pyargs, nil); + CheckError(False); + if presult = nil then + // should not happen since an exception would have been raised + // in that case by CheckError + Result := Null + else + begin + try + if presult = Py_None then + Result := 0 + else + Result := PyObjectAsVariant( presult ); + finally + Py_DECREF(presult); + end; + end; + except + if PyErr_Occurred <> nil then + CheckError(False) + else + raise; + end; +end; + +function TPythonEngine.EvalFunction(pyfunc:PPyObject; const args: array of const): Variant; +var pargs: PPyObject; +begin + CheckPython; + pargs := ArrayToPyTuple(args); + try + Result := EvalPyFunction(pyfunc,pargs); + finally + Py_DECREF(pargs); + end; +end; + +function TPythonEngine.EvalFunctionNoArgs(pyfunc:PPyObject): Variant; +var pargs: PPyObject; +begin + CheckPython; + pargs := PyTuple_New(0); + try + Result := EvalPyFunction(pyfunc, pargs); + finally + Py_DECREF(pargs); + end; +end; + +function TPythonEngine.EvalStringAsStr(const command: AnsiString; const + FileName: string = ''): string; +begin + Result := Run_CommandAsString(command, eval_input, FileName); +end; + +function TPythonEngine.EvalString(const command: AnsiString; const FileName: + string = ''): PPyObject; +begin + Result := Run_CommandAsObject(command, eval_input, FileName); +end; + +procedure TPythonEngine.ExecString(const command: AnsiString; const FileName: + string = ''); +begin + Py_XDecRef(Run_CommandAsObject(command, file_input, FileName)); +end; + +function TPythonEngine.Run_CommandAsString(const command: AnsiString; mode: + Integer; const FileName: string = ''): string; +var + PRes : PPyObject; +begin + Result := ''; + PRes := Run_CommandAsObject(command, mode, FileName); + Result := PyObjectAsString(PRes); + Py_XDECREF(PRes); +end; + +function TPythonEngine.Run_CommandAsObject(const command: AnsiString; mode: + Integer; const FileName: string = ''): PPyObject; +begin + Result := Run_CommandAsObjectWithDict(command, mode, nil, nil, FileName); +end; + +function TPythonEngine.Run_CommandAsObjectWithDict(const command: AnsiString; + mode: Integer; locals, globals: PPyObject; const FileName: string = + ''): PPyObject; +{ + This is the core function for executing/evaluating python code + Parameters: + - command: utf-8 encoded AnsiString with the code that will be executed or evaluated + - mode: one of the constants file_input, single_input, eval_input + - locals, globals: python dictionaries with local/global namespaces. Can be nil. + - FileName; optional string used when debugging code with external debuggers +} +var + m : PPyObject; + _locals, _globals, Code : PPyObject; +begin + CheckPython; + Result := nil; + Traceback.Clear; + CheckError(False); + + m := GetMainModule; + if m = nil then + raise EPythonError.Create(SCannotCreateMain); + + if Assigned(locals) then + _locals := locals + else if Assigned(FLocalVars) then + _locals := LocalVars + else + _locals := PyModule_GetDict(m); + + if Assigned(globals) then + _globals := globals + else if Assigned(FGlobalVars) then + _globals := GlobalVars + else + _globals := _locals; + + try + Code := Py_CompileString(PAnsiChar(CleanString(command)), + PAnsiChar(EncodeString(FileName)), mode); + if Code = nil then + CheckError(False) + else + begin + Result := PyEval_EvalCode(Code, _globals, _locals ); + Py_DECREF(Code); + if Result = nil then + CheckError(False); + end; + except + if PyErr_Occurred <> nil then + CheckError(False) + else + raise; + end; +end; + +procedure TPythonEngine.ExecStrings(strings: TStrings; const FileName: string = + ''); +begin + Py_XDecRef(Run_CommandAsObject(EncodeString(strings.Text), file_input, FileName)); +end; + +function TPythonEngine.EvalStrings(strings: TStrings; const FileName: string = + ''): PPyObject; +begin + Result := Run_CommandAsObject(EncodeString(strings.Text) , eval_input, FileName); +end; + +procedure TPythonEngine.ExecFile(const FileName: string; locals, + globals: PPyObject); +var + SL: TStringList; +begin + SL := TStringList.Create; + try + SL.LoadFromFile(FileName, TEncoding.UTF8); + ExecStrings(SL, locals, globals, FileName); + finally + SL.Free; + end; +end; + +procedure TPythonEngine.ExecString(const command: AnsiString; locals, globals: + PPyObject; const FileName: string = ''); +begin + Py_XDecRef(Run_CommandAsObjectWithDict(command, file_input, locals, globals, FileName)); +end; + +procedure TPythonEngine.ExecStrings(strings: TStrings; locals, globals: + PPyObject; const FileName: string = ''); +begin + Py_XDecRef( Run_CommandAsObjectWithDict(EncodeString(strings.Text), + file_input, locals, globals, FileName)); +end; + +function TPythonEngine.EvalString(const command: AnsiString; locals, globals: + PPyObject; const FileName: string = ''): PPyObject; +begin + Result := Run_CommandAsObjectWithDict(command, eval_input, locals, globals, FileName); +end; + +function TPythonEngine.EvalStrings(strings: TStrings; locals, globals: + PPyObject; const FileName: string = ''): PPyObject; +begin + Result := Run_CommandAsObjectWithDict(EncodeString(strings.Text), + eval_input, locals, globals, FileName); +end; + +function TPythonEngine.EvalStringsAsStr(strings: TStrings; const FileName: + string = ''): string; +begin + Result := Run_CommandAsString(EncodeString(strings.Text), eval_input, FileName); +end; + +function TPythonEngine.CheckEvalSyntax( const str : AnsiString ) : Boolean; +begin + result := CheckSyntax( str, eval_input ); +end; + +function TPythonEngine.CheckExecSyntax( const str : AnsiString ) : Boolean; +begin + result := CheckSyntax( str, file_input ); +end; + +function TPythonEngine.CheckSyntax( const str : AnsiString; mode : Integer ) : Boolean; +var + PyCode: PPyObject; +begin + PyCode := Py_CompileString(PAnsiChar(str), '', mode); + Result := Assigned(PyCode); + Py_XDECREF(PyCode); +end; + +procedure TPythonEngine.RaiseError; + + function Define( E : EPythonError; const sType, sValue : string ) : EPythonError; + begin + E.EName := sType; + E.EValue := sValue; + if sValue <> '' then + E.Message := Format('%s: %s',[sType,sValue]) + else + E.Message := sType; + Result := E; + end; + + function DefineSyntaxError( E : EPySyntaxError; const sType, sValue : UnicodeString; err_type, err_value : PPyObject ) : EPySyntaxError; + var + s_value : UnicodeString; + s_line : UnicodeString; + s_filename : UnicodeString; + i_line_number : Integer; + i_offset : Integer; + i_end_line_number : Integer; + i_end_offset : Integer; + tmp : PPyObject; + begin + Result := E; + Result.EName := sType; + Result.EValue := sValue; + s_value := ''; + s_line := ''; + s_filename := ''; + i_line_number := 0; + i_offset := 0; + i_end_line_number := 0; + i_end_offset := 0; + // Sometimes there's a tuple instead of instance... + if PyTuple_Check(err_value) and (PyTuple_Size( err_value) >= 2) then + begin + s_value := PyObjectAsString(PyTuple_GetItem( err_value, 0)); + err_value := PyTuple_GetItem( err_value, 1); + if PyTuple_Check( err_value ) and (PyTuple_Size( err_value) >= 4) then + begin + i_line_number := PyLong_AsLong(PyTuple_GetItem( err_value, 1)); + i_offset := PyLong_AsLong(PyTuple_GetItem( err_value, 2)); + s_line := Trim(PyObjectAsString(PyTuple_GetItem( err_value, 3))); + end; + end else + // Is it an instance of the SyntaxError class ? + if (PyType_IsSubtype(PPyTypeObject(err_type), PPyTypeObject(PyExc_SyntaxError^)) = 1) + and IsType(err_value, PPyTypeObject(err_type)) + then + begin + // Get the filename + tmp := PyObject_GetAttrString(err_value, 'filename'); + if tmp <> nil then begin + if PyUnicode_Check(tmp) then + s_filename := PyUnicodeAsString(tmp) + else if tmp = Py_None then + s_filename := '???'; + Py_XDECREF(tmp); + end; + // Get the text containing the error, cut of carriage return + tmp := PyObject_GetAttrString(err_value, 'text'); + if Assigned(tmp) and PyUnicode_Check(tmp) then + s_line := Trim(PyUnicodeAsString(tmp)); + Py_XDECREF(tmp); + // Get the offset where the error should appear + tmp := PyObject_GetAttrString(err_value, 'offset' ); + if Assigned(tmp) and PyLong_Check(tmp) then + i_offset := PyLong_AsLong(tmp); + Py_XDECREF(tmp); + // Get the line number of the error + tmp := PyObject_GetAttrString(err_value, 'lineno' ); + if Assigned(tmp) and PyLong_Check(tmp) then + i_line_number := PyLong_AsLong(tmp); + Py_XDECREF(tmp); + // Get the message of the error + tmp := PyObject_GetAttrString(err_value, 'msg' ); + if Assigned(tmp) and PyUnicode_Check(tmp) then + s_value := PyUnicodeAsString(tmp); + Py_XDECREF(tmp); + if (MajorVersion > 3) or (MinorVersion >= 10) then + begin + // Get the end offset of the error + tmp := PyObject_GetAttrString(err_value, 'end_offset' ); + if Assigned(tmp) and PyLong_Check(tmp) then + i_end_offset := PyLong_AsLong(tmp); + Py_XDECREF(tmp); + // Get the end line number of the error + tmp := PyObject_GetAttrString(err_value, 'end_lineno' ); + if Assigned(tmp) and PyLong_Check(tmp) then + i_end_line_number := PyLong_AsLong(tmp); + Py_XDECREF(tmp); + end; + end; + // If all is ok + if s_value <> '' then + begin + with Result do + begin + Message := Format('%s: %s (line %d, offset %d): ''%s''', [sType,s_value,i_line_number, i_offset,s_line]); + EName := sType; + EValue := s_value; + EFileName := s_filename; + ELineNumber := i_line_number; + EOffset := i_offset; + EEndLineNumber := i_end_line_number; + EEndOffset := i_end_offset; + ELineStr := s_line; + end; + end + else + Result.Message := sType; + end; + + function GetTypeAsString( obj : PPyObject ) : string; + begin + if PyType_CheckExact( obj ) then + Result := string(PPyTypeObject(obj).tp_name) + else + Result := PyObjectAsString(obj); + end; + +var + err_type, err_value : PPyObject; + s_type : string; + s_value : string; +begin + s_value := ''; + + if PyErr_Occurred <> nil then + PyErr_Print; + err_type := PySys_GetObject('last_type'); + err_value := PySys_GetObject('last_value'); + if Assigned(err_type) then + begin + s_type := GetTypeAsString(err_type); + s_value := PyObjectAsString(err_value); + + if (PyErr_GivenExceptionMatches(err_type, PyExc_SystemExit^) <> 0) then + raise Define( EPySystemExit.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_StopIteration^) <> 0) then + raise Define( EPyStopIteration.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_KeyboardInterrupt^) <> 0) then + raise Define( EPyKeyboardInterrupt.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_ImportError^) <> 0) then + raise Define( EPyImportError.Create(''), s_type, s_value ) + {$IFDEF MSWINDOWS} + else if (PyErr_GivenExceptionMatches(err_type, PyExc_WindowsError^) <> 0) then + raise Define( EPyWindowsError.Create(''), s_type, s_value ) + {$ENDIF} + else if (PyErr_GivenExceptionMatches(err_type, PyExc_IOError^) <> 0) then + raise Define( EPyIOError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_OSError^) <> 0) then + raise Define( EPyOSError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_EnvironmentError^) <> 0) then + raise Define( EPyEnvironmentError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_EOFError^) <> 0) then + raise Define( EPyEOFError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_NotImplementedError^) <> 0) then + raise Define( EPyNotImplementedError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_RuntimeError^) <> 0) then + raise Define( EPyRuntimeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UnboundLocalError^) <> 0) then + raise Define( EPyUnboundLocalError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_NameError^) <> 0) then + raise Define( EPyNameError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_AttributeError^) <> 0) then + raise Define( EPyAttributeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_TabError^) <> 0) then + raise DefineSyntaxError( EPyTabError.Create(''), s_type, s_value, err_type, err_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_IndentationError^) <> 0) then + raise DefineSyntaxError( EPyIndentationError.Create(''), s_type, s_value, err_type, err_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_SyntaxError^) <> 0) then + raise DefineSyntaxError( EPySyntaxError.Create(''), s_type, s_value, err_type, err_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_TypeError^) <> 0) then + raise Define( EPyTypeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_AssertionError^) <> 0) then + raise Define( EPyAssertionError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_IndexError^) <> 0) then + raise Define( EPyIndexError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_KeyError^) <> 0) then + raise Define( EPyKeyError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_LookupError^) <> 0) then + raise Define( EPyLookupError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_OverflowError^) <> 0) then + raise Define( EPyOverflowError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_ZeroDivisionError^) <> 0) then + raise Define( EPyZeroDivisionError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_FloatingPointError^) <> 0) then + raise Define( EPyFloatingPointError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_ArithmeticError^) <> 0) then + raise Define( EPyArithmeticError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UnicodeEncodeError^) <> 0) then + raise Define( UnicodeEncodeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UnicodeDecodeError^) <> 0) then + raise Define( UnicodeDecodeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UnicodeTranslateError^) <> 0) then + raise Define( UnicodeTranslateError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UnicodeError^) <> 0) then + raise Define( EPyUnicodeError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_ValueError^) <> 0) then + raise Define( EPyValueError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_ReferenceError^) <> 0) then + raise Define( EPyReferenceError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_BufferError^) <> 0) then + raise Define( EPyBufferError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_SystemError^) <> 0) then + raise Define( EPySystemError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_MemoryError^) <> 0) then + raise Define( EPyMemoryError.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_UserWarning^) <> 0) then + raise Define( EPyUserWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_DeprecationWarning^) <> 0) then + raise Define( EPyDeprecationWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_SyntaxWarning^) <> 0) then + raise Define( EPySyntaxWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_RuntimeWarning^) <> 0) then + raise Define( EPyRuntimeWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_FutureWarning^) <> 0) then + raise Define( FutureWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_PendingDeprecationWarning^) <> 0) then + raise Define( PendingDeprecationWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_Warning^) <> 0) then + raise Define( EPyWarning.Create(''), s_type, s_value ) + else if (PyErr_GivenExceptionMatches(err_type, PyExc_Exception^) <> 0) then + raise Define( EPyException.Create(''), s_type, s_value ) + else // Else if no known exception was detected, + // then build an ExecError exception + raise Define( EPyExecError.Create(''), s_type, s_value ); + end + else + raise EPythonError.Create(SRaiseError); +end; + +function TPythonEngine.PyObjectAsString( obj : PPyObject ) : string; +var + S : PPyObject; +begin + Result := ''; + if not Assigned( obj ) then + Exit; + + if PyUnicode_Check(obj) then + Result := string(PyUnicodeAsString(obj)) + else if PyBytes_Check(obj) then + Result := string(UTF8ToString(PyBytesAsAnsiString(obj))) + else + begin + S := PyObject_Str( obj ); + if Assigned(S) and PyUnicode_Check(S) then + Result := string(PyUnicodeAsString(S)); + Py_XDECREF(S); + end; +end; + +procedure TPythonEngine.DoRedirectIO; +const + code = 'import sys'+LF+ + 'class DebugOutput:'+LF+ + ' pyio = __import__("pyio")'+LF+ + ' softspace=0'+LF+ + ' encoding=None'+LF+ + ' def write(self,message):'+LF+ + ' self.pyio.write(message)'+LF+ + ' def readline(self, size=None):'+LF+ + ' return self.pyio.read(size)'+LF+ + ' def flush(self):' + LF + + ' pass' + LF + + ' def isatty(self):' + LF + + ' return False' + LF + + 'sys.old_stdin=sys.stdin'+LF+ + 'sys.old_stdout=sys.stdout'+LF+ + 'sys.old_stderr=sys.stderr'+LF+ + 'sys.stdin=sys.stderr=sys.stdout=DebugOutput()'+LF+#0; +begin + if csDesigning in ComponentState then + Exit; + CheckPython; + if not Assigned(FIOPythonModule) then + begin + // create a new module called pyio + FIOPythonModule := TPythonModule.Create( Self ); + with FIOPythonModule as TPythonModule do + begin + Engine := Self; + ModuleName := 'pyio'; + AddMethod( 'write', pyio_write, 'write(string) -> None' ); + AddMethod( 'read', pyio_read, 'read() -> string' ); + AddMethod( 'SetDelayWrites', pyio_SetDelayWrites, 'SetDelayWrites(Boolean) -> None' ); + AddMethod( 'SetMaxLines', pyio_SetMaxLines, 'SetMaxLines(Integer) -> None' ); + AddMethod( 'GetTypesStats', pyio_GetTypesStats, 'GetTypesStats( [type name] ) -> a list of tuple (TypeName, InstanceCount, CreateHits, DeleteHits)' ); + end; + end; + with FIOPythonModule as TPythonModule do + if not Initialized then + Initialize; + // execute the code + ExecString(code); + FIORedirected := True; +end; + +procedure TPythonEngine.AddClient( client : TEngineClient ); +begin + FClients.Add( client ); +end; + +procedure TPythonEngine.RemoveClient( client : TEngineClient ); +begin + // We finalize the PythonEngine, as soon as a client should + // be freed, because the destroy order of the components + // is not predictable and may cause some memory crashes ! + if (csDesigning in ComponentState) then + FClients.Remove( client ) + else if Initialized then begin + FClients.Remove( client ); + if (ClientCount = 0) then + Finalize; + end; +end; + +function TPythonEngine.FindClient( const aName : string ) : TEngineClient; +var + i : Integer; +begin + Result := nil; + for i := 0 to ClientCount - 1 do + with TPythonType( Clients[i] ) do + if Name = aName then + begin + Result := Clients[i]; + Break; + end; +end; + +function TPythonEngine.EncodeString(const str: UnicodeString): AnsiString; +begin + Result := UTF8Encode(str); +end; + +function TPythonEngine.EncodeString(const str: AnsiString): AnsiString; +begin + Result := UTF8Encode(str); +end; + +function TPythonEngine.EncodeWindowsFilePath(const str: string): AnsiString; +{PEP 529} +begin + if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >=6) )then + Result := UTF8Encode(str) + else + Result := AnsiString(str); +end; + +function TPythonEngine.TypeByName( const aTypeName : AnsiString ) : PPyTypeObject; +var + i : Integer; +begin + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonType then + with TPythonType( Clients[i] ) do + if TypeName = aTypeName then + begin + Result := TheTypePtr; + Exit; + end; + raise Exception.CreateFmt(SCannotFindType, [aTypeName]); +end; + +function TPythonEngine.ModuleByName( const aModuleName : AnsiString ) : PPyObject; +var + i : Integer; +begin + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonModule then + with TPythonModule( Clients[i] ) do + if ModuleName = aModuleName then + begin + Result := Module; + Exit; + end; + raise Exception.CreateFmt(SCannotFindModule, [aModuleName]); +end; + +function TPythonEngine.MethodsByName( const aMethodsContainer: string ) : PPyMethodDef; +var + i : Integer; +begin + for i := 0 to ClientCount - 1 do + if Clients[i] is TMethodsContainer then + with TMethodsContainer( Clients[i] ) do + if Name = aMethodsContainer then + begin + Result := MethodsData; + Exit; + end; + raise Exception.CreateFmt(SCannotFindComponent, [aMethodsContainer]); +end; + +function TPythonEngine.VariantAsPyObject( const V : Variant ) : PPyObject; +Var + DeRefV : Variant; + + function ArrayVarDim1 : PPyObject; + var + i, cpt : Integer; + begin + Result := PyList_New( VarArrayHighBound( DeRefV, 1 ) - VarArrayLowBound( DeRefV, 1 ) + 1 ); + cpt := 0; + for i := VarArrayLowBound( DeRefV, 1 ) to VarArrayHighBound( DeRefV, 1 ) do + begin + PyList_SetItem( Result, cpt, VariantAsPyObject(DeRefV[i]) ); + Inc(cpt); + end; + end; + + function ArrayVarDim2 : PPyObject; + var + i, j, cpt, cpt2 : Integer; + L : PPyObject; + begin + Result := PyList_New( VarArrayHighBound( DeRefV, 1 ) - VarArrayLowBound( DeRefV, 1 ) + 1 ); + cpt := 0; + for i := VarArrayLowBound( DeRefV, 1 ) to VarArrayHighBound( DeRefV, 1 ) do + begin + L := PyList_New( VarArrayHighBound( DeRefV, 2 ) - VarArrayLowBound( DeRefV, 2 ) + 1 ); + PyList_SetItem( Result, cpt, L ); + cpt2 := 0; + for j := VarArrayLowBound( DeRefV, 2 ) to VarArrayHighBound( DeRefV, 2 ) do + begin + PyList_SetItem( L, cpt2, VariantAsPyObject(DeRefV[i, j]) ); + Inc(cpt2); + end; + Inc(cpt); + end; + end; + + function ArrayVarDim3 : PPyObject; + var + i, j, k, cpt, cpt2, cpt3 : Integer; + L, L2 : PPyObject; + begin + Result := PyList_New( VarArrayHighBound( DeRefV, 1 ) - VarArrayLowBound( DeRefV, 1 ) + 1 ); + cpt := 0; + for i := VarArrayLowBound( DeRefV, 1 ) to VarArrayHighBound( DeRefV, 1 ) do + begin + L := PyList_New( VarArrayHighBound( DeRefV, 2 ) - VarArrayLowBound( DeRefV, 2 ) + 1 ); + PyList_SetItem( Result, cpt, L ); + cpt2 := 0; + for j := VarArrayLowBound( DeRefV, 2 ) to VarArrayHighBound( DeRefV, 2 ) do + begin + L2 := PyList_New( VarArrayHighBound( DeRefV, 3 ) - VarArrayLowBound( DeRefV, 3 ) + 1 ); + PyList_SetItem( L, cpt2, L2 ); + cpt3 := 0; + for k := VarArrayLowBound( DeRefV, 3 ) to VarArrayHighBound( DeRefV, 3 ) do + begin + PyList_SetItem( L2, cpt3, VariantAsPyObject(DeRefV[i, j, k]) ); + Inc(cpt3); + end; + Inc(cpt2); + end; + Inc(cpt); + end; + end; + +var + s : AnsiString; + y, m, d, h, mi, sec, ms, jd, wd : WORD; + dt : TDateTime; + dl : Integer; + wStr : UnicodeString; + args : PPyObject; +begin + //Dereference Variant + DerefV := V; + while VarType(DeRefV) = varByRef or varVariant do + DeRefV := Variant(PVarData(TVarData(DeRefV).VPointer)^); + + case VarType(DeRefV) and (VarTypeMask or VarArray) of + varBoolean: begin + if DeRefV = true then + Result := PPyObject(Py_True) + else + Result := PPyObject(Py_False); + Py_XIncRef(Result); + end; + varSmallint, + varByte, + varShortInt, + varWord, + varLongWord, + {$IFDEF FPC} + // See https://github.com/pyscripter/python4delphi/issues/334 + varInteger: Result := PyLong_FromLong(Integer(DeRefV)); + {$ELSE} + varInteger: Result := PyLong_FromLong(DeRefV); + {$ENDIF} + varInt64: Result := PyLong_FromLongLong( DeRefV ); + varSingle, + varDouble, + varCurrency: Result := PyFloat_FromDouble( DeRefV ); + varDate: + begin + dt := DeRefV; + DecodeDate( dt, y, m, d ); + DecodeTime( dt, h, mi, sec, ms ); + if (DatetimeConversionMode = dcmToTuple) then + begin + wd := (DayOfWeek( dt ) + 7 - 2) mod 7; // In Python, Monday is the first day (=0) + jd := Round(EncodeDate(y,m,d)-EncodeDate(y,1,1))+1; // This shoud be the Julian day, the day in a year (0-366) + dl := -1; // This is daylight save... ?Ώ?Ώ? I don't know what it is... + Result := ArrayToPyTuple( [y, m, d, h, mi, sec, wd, jd, dl] ); + end + else if (DatetimeConversionMode = dcmToDatetime) then + begin + if not Assigned(FPyDateTime_DateTimeType) then + raise EPythonError.Create(SMissingModuleDateTime); + args := ArrayToPyTuple([y, m, d, h, mi, sec, ms*1000]); + try + Result := PyObject_Call(FPyDateTime_DateTimeType, args, nil); + CheckError(False); + finally + Py_DecRef(args); + end; + end + else + raise EPythonError.Create(SInvalidDateTimeConvMode); + end; + varOleStr: + begin + if (TVarData(DeRefV).VOleStr = nil) or (TVarData(DeRefV).VOleStr^ = #0) then + wStr := '' + else + wStr := DeRefV; + Result := PyUnicodeFromString(wStr); + end; + varString: + begin + s := AnsiString(DeRefV); + Result := PyBytes_FromStringAndSize(PAnsiChar(s), Length(s)); + end; + varUString: + begin + wStr := DeRefV; + Result := PyUnicodeFromString(wStr); + end; + else + if VarType(DeRefV) and varArray <> 0 then + begin + case VarArrayDimCount(DeRefV) of + 1: Result := ArrayVarDim1; + 2: Result := ArrayVarDim2; + 3: Result := ArrayVarDim3; + else + raise Exception.Create(SCannotHandleMoreThan3Dim); + end; + end + else if VarIsNull(DeRefV) or VarIsEmpty(DeRefV) then + begin + Result := ReturnNone; + end + else + // if we cannot get something useful then + Result := ReturnNone; + end; // of case +end; + +function TPythonEngine.PyObjectAsVariant( obj : PPyObject ) : Variant; + + function ExtractDate( var date : Variant ) : Boolean; + + function GetStructMember( obj : PPyObject; const AMember : AnsiString ) : Integer; + var + member : PPyObject; + begin + member := PyObject_GetAttrString( obj, PAnsiChar(AMember) ); + CheckError(False); + if PyLong_Check(member) then + Result := PyLong_AsLong(member) + else + raise EPythonError.CreateFmt(SUnexpectedTypeInTimeObject, [AMember]); + Py_XDecRef(member); + end; + + var + i, wd, jd, dl : Integer; + dt : TDateTime; + y, m, d, h, mi, sec, msec : WORD; + delta : PPyDateTime_Delta; + begin + Result := False; + if PyTimeStruct_Check( obj ) then + begin + y := GetStructMember( obj, 'tm_year' ); + m := GetStructMember( obj, 'tm_mon' ); + d := GetStructMember( obj, 'tm_mday' ); + h := GetStructMember( obj, 'tm_hour' ); + mi := GetStructMember( obj, 'tm_min' ); + sec := GetStructMember( obj, 'tm_sec' ); + //wd := GetStructMember( obj, 'tm_wday' ); + //jd := GetStructMember( obj, 'tm_yday' ); + //dl := GetStructMember( obj, 'tm_isdst' ); + dt := EncodeDate( y, m, d ) + EncodeTime( h, mi, sec, 0 ); + Date := dt; + Result := True; + end + else if PyDateTime_Check( obj ) then + begin + y := GetStructMember(obj, 'year'); + m := GetStructMember(obj, 'month'); + d := GetStructMember(obj, 'day'); + h := GetStructMember(obj, 'hour'); + mi := GetStructMember(obj, 'minute'); + sec := GetStructMember(obj, 'second'); + msec := GetStructMember(obj, 'microsecond') div 1000; + dt := EncodeDate( y, m, d ) + EncodeTime( h, mi, sec, msec ); + Date := dt; + Result := True; + end + else if PyDate_Check( obj ) then + begin + y := GetStructMember(obj, 'year'); + m := GetStructMember(obj, 'month'); + d := GetStructMember(obj, 'day'); + dt := EncodeDate( y, m, d ); + Date := dt; + Result := True; + end + else if PyTime_Check( obj ) then + begin + h := GetStructMember(obj, 'hour'); + mi := GetStructMember(obj, 'minute'); + sec := GetStructMember(obj, 'second'); + msec := GetStructMember(obj, 'microsecond') div 1000; + dt := EncodeTime( h, mi, sec, msec ); + Date := dt; + Result := True; + end + else if PyDelta_Check( obj ) then + begin + delta := PPyDateTime_Delta(obj); + dt := delta^.days + (delta^.seconds / (24*60*60)) + ((delta^.microseconds div 1000) / (24*60*60*1000)); + Date := dt; + Result := True; + end + else if PyTuple_Check( obj ) and (PyTuple_Size(obj) = 9) then + begin + for i := 0 to 8 do + if not PyLong_Check(PyTuple_GetItem(obj, i)) then + Exit; + y := PyLong_AsLong( PyTuple_GetItem(obj, 0) ); + m := PyLong_AsLong( PyTuple_GetItem(obj, 1) ); + d := PyLong_AsLong( PyTuple_GetItem(obj, 2) ); + h := PyLong_AsLong( PyTuple_GetItem(obj, 3) ); + mi := PyLong_AsLong( PyTuple_GetItem(obj, 4) ); + sec := PyLong_AsLong( PyTuple_GetItem(obj, 5) ); + wd := PyLong_AsLong( PyTuple_GetItem(obj, 6) ); + jd := PyLong_AsLong( PyTuple_GetItem(obj, 7) ); + dl := PyLong_AsLong( PyTuple_GetItem(obj, 8) ); + if not (m in [1..12]) or + not (d in [1..31]) or + not (h in [0..23]) or + not (mi in [0..59]) or + not (sec in [0..59]) or + not (wd in [0..6]) or + not ((jd>=0) and (jd<=366)) or + not ((dl>=-1) and (dl<=1)) then + Exit; + try + dt := EncodeDate( y, m, d ); + dt := dt + EncodeTime( h, mi, sec, 0 ); + Date := dt; + Result := True; + except + end; + end; + end; + +var + i, seq_length : Integer; +begin + if PyFloat_Check(obj) then + Result := PyFloat_AsDouble(obj) + else if PyBool_Check(obj) then // we must check Bool before Int, as Boolean type inherits from Int. + Result := PyObject_IsTrue(obj) = 1 + else if PyLong_Check(obj) then + Result := PyLong_AsLongLong(obj) + else if PyUnicode_Check(obj) then + Result := PyUnicodeAsString(obj) + else if PyBytes_Check(obj) then + Result := AnsiString(PyBytes_AsString(obj)) + else if ExtractDate( Result ) then + begin + // Nothing to do + end + else if PySequence_Check( obj ) = 1 then + begin + seq_length := PySequence_Length( obj ); + // if we have at least one object in the sequence, + if seq_length > 0 then + // we try to get the first one, simply to test if the sequence API + // is really implemented. + Py_XDecRef( PySequence_GetItem( obj, 0 ) ); + // check if the Python object did really implement the sequence API + if PyErr_Occurred = nil then + begin + // Convert a Python sequence into an array of Variant + Result := VarArrayCreate( [0, seq_length-1], varVariant ); + for i := 0 to PySequence_Length( obj )-1 do + Result[i] := GetSequenceItem( obj, i ); + end + else // the object didn't implement the sequence API, so we return Null + begin + PyErr_Clear; + Result := Null; + end; + end + else + Result := Null; +end; + +function TPythonEngine.VarRecAsPyObject( const v : TVarRec ) : PPyObject; +begin + case v.VType of + vtInteger: Result := PyLong_FromLong( v.VInteger ); + vtBoolean: Result := PyLong_FromLong( Integer(v.VBoolean) ); + vtChar: Result := PyUnicodeFromString(AnsiString(v.VChar)); + vtExtended: Result := PyFloat_FromDouble( v.VExtended^ ); + vtString: + begin + if Assigned(v.VString) then + Result := PyUnicodeFromString(AnsiString(v.VString^)) + else + Result := PyUnicodeFromString(''); + end; + vtPChar: Result := PyUnicodeFromString(AnsiString(v.VPChar)); + vtAnsiString: + begin + if Assigned(v.VAnsiString) then + Result := PyUnicodeFromString(PAnsiChar(v.VAnsiString)) + else + Result := PyUnicodeFromString(''); + end; + vtCurrency: Result := PyFloat_FromDouble( v.VCurrency^ ); + vtVariant: Result := VariantAsPyObject( v.VVariant^ ); + vtPointer: Result := v.VPointer; + vtInt64: Result := PyLong_FromLongLong( v.VInt64^ ); + vtWideChar: Result := PyUnicodeFromString(UnicodeString(v.VWideChar)); + vtPWideChar: + begin + if Assigned(v.VPWideChar) then + Result := PyUnicodeFromString(UnicodeString(v.VPWideChar)) + else + Result := PyUnicodeFromString(''); + end; + vtWideString: + begin + if Assigned(v.VWideString) then + Result := PyUnicodeFromString(WideString(v.VWideString)) + else + Result := PyUnicodeFromString(''); + end; + vtUnicodeString: + begin + if Assigned(v.VUnicodeString) then + Result := PyUnicodeFromString(UnicodeString(v.VUnicodeString)) + else + Result := PyUnicodeFromString(''); + end; + else + Raise Exception.Create(SArguementTypeNotAllowed); + end; +end; + +// This function prevents Python from deleting the objects contained +// when the container will be freed, because we increment each +// object's refcount. +function TPythonEngine.MakePyTuple( const objects : array of PPyObject ) : PPyObject; +var + i : Integer; +begin + Result := PyTuple_New( High(objects)+1 ); + if not Assigned(Result) then + raise EPythonError.Create(SCouldNotCreateTuple); + for i := Low(objects) to High(objects) do + begin + Py_XINCREF( objects[i] ); + PyTuple_SetItem( Result, i, objects[i] ); + end; +end; + +// This function prevents Python from deleting the objects contained +// when the container will be freed, because we increment each +// object's refcount. +function TPythonEngine.MakePyList( const objects : array of PPyObject ) : PPyObject; +var + i : Integer; +begin + Result := PyList_New( High(objects)+1 ); + if not Assigned(Result) then + raise EPythonError.Create(SCouldNotCreateList); + for i := Low(objects) to High(objects) do + begin + Py_XIncRef( objects[i] ); + PyList_SetItem( Result, i, objects[i] ); + end; +end; + +function TPythonEngine.ArrayToPyTuple( const items : array of const) : PPyObject; +var + i : Integer; +begin + Result := PyTuple_New( High(items)+1 ); + if not Assigned(Result) then + raise EPythonError.Create(SCouldNotCreateTuple); + for i := Low(items) to High(items) do + PyTuple_SetItem( Result, i, VarRecAsPyObject( items[i] ) ); +end; + +function TPythonEngine.ArrayToPyList( const items : array of const) : PPyObject; +var + i : Integer; +begin + Result := PyList_New( High(items)+1 ); + if not Assigned(Result) then + raise EPythonError.Create(SCouldNotCreateList); + for i := Low(items) to High(items) do + PyList_SetItem( Result, i, VarRecAsPyObject( items[i] ) ); +end; + +// You must give each entry as a couple key(string)/value +function TPythonEngine.ArrayToPyDict( const items : array of const) : PPyObject; + + function VarRecAsString( const v : TVarRec ) : AnsiString; + begin + case v.VType of + vtChar: Result := v.VChar; + vtString: + begin + if Assigned(v.VString) then + Result := v.VString^ + else + Result := ''; + end; + vtPChar: + begin + Result := v.VPChar; + end; + vtWideChar: + begin + Result := AnsiString(v.VWideChar); + end; + vtAnsiString: + begin + if Assigned(v.VAnsiString) then + Result := Ansistring(v.VAnsiString) + else + Result := ''; + end; + vtVariant: + begin + if Assigned(v.VVariant) then + Result := AnsiString(v.VVariant^) + else + Result := ''; + end; + vtWideString : + begin + if Assigned(v.VWideString) then + Result := AnsiString(WideString(v.VWideString)) + else + Result := ''; + end; + vtUnicodeString: + begin + if Assigned(v.VUnicodeString) then + Result := AnsiString(UnicodeString(v.VUnicodeString)) + else + Result := ''; + end; + else + Raise Exception.Create(SArguementTypeNotAllowed); + end; + end; + +var + i : Integer; + s : AnsiString; + obj : PPyObject; +begin + if ((High(items)+1) mod 2) <> 0 then + raise Exception.Create(SArgumemntsShouldBeEven); + Result := PyDict_New; + if not Assigned(Result) then + raise EPythonError.Create(SCouldNotCreateDict); + i := Low(items); + try + while i <= High(items) do + begin + s := VarRecAsString( items[i] ); + obj := VarRecAsPyObject( items[i+1] ); + if s = '' then + PyDict_SetItemString( Result, '', obj ) + else + PyDict_SetItemString( Result, PAnsiChar(s), obj ); + Py_XDecRef(obj); + Inc( i, 2 ); + end; + except + Py_XDECREF( Result ); + end; +end; + +function TPythonEngine.StringsToPyList( strings : TStrings ) : PPyObject; +var + i : Integer; +begin + Result := PyList_New( strings.Count ); + if not Assigned(Result) then + raise EPythonError.Create(SCouldNotCreateList); + for i := 0 to strings.Count - 1 do + PyList_SetItem( Result, i, + PyUnicodeFromString(strings.Strings[i])); +end; + +function TPythonEngine.StringsToPyTuple( strings : TStrings ) : PPyObject; +var + i : Integer; +begin + Result := PyTuple_New( strings.Count ); + if not Assigned(Result) then + raise EPythonError.Create(SCouldNotCreateTuple); + for i := 0 to strings.Count - 1 do + PyTuple_SetItem( Result, i, + PyUnicodeFromString(strings.Strings[i])); +end; + +procedure TPythonEngine.PyListToStrings(list: PPyObject; Strings: TStrings; + ClearStrings: Boolean = True); +var + i : Integer; +begin + if not PyList_Check(list) then + raise EPythonError.Create(SExpectedList); + if ClearStrings then + Strings.Clear; + for i := 0 to PyList_Size( list ) - 1 do + Strings.Add( PyObjectAsString( PyList_GetItem( list, i ) ) ); +end; + +procedure TPythonEngine.PyTupleToStrings( tuple: PPyObject; strings : TStrings ); +var + i : Integer; +begin + if not PyTuple_Check(tuple) then + raise EPythonError.Create(SExpectedTuple); + strings.Clear; + for i := 0 to PyTuple_Size( tuple ) - 1 do + strings.Add( PyObjectAsString( PyTuple_GetItem( tuple, i ) ) ); +end; + +function TPythonEngine.PyByteArrayAsAnsiString(obj: PPyObject): AnsiString; +var + LBuffer: PAnsiChar; + LSize: Py_ssize_t; +begin + if PyByteArray_Check(obj) then + begin + LSize := PyByteArray_Size(obj); + LBuffer := PyByteArray_AsString(obj); + SetString(Result, LBuffer, LSize); + end + else + raise EPythonError.CreateFmt(SPyConvertionError, ['PyByteArrayAsAnsiString', 'ByteArray']); +end; + +function TPythonEngine.PyBytesAsAnsiString(obj: PPyObject): AnsiString; +var + buffer: PAnsiChar; + size: NativeInt; +begin + if PyBytes_Check(obj) then + begin + PyBytes_AsStringAndSize(obj, buffer, size); + SetString(Result, buffer, size); + end + else + raise EPythonError.CreateFmt(SPyConvertionError, ['PyBytesAsAnsiString', 'Bytes']); +end; + +function TPythonEngine.PyUnicodeAsString(obj : PPyObject): UnicodeString; +var + Buffer: PAnsiChar; + Size: NativeInt; + NewSize: Cardinal; +begin + if PyUnicode_Check(obj) then + begin + // Size does not include the final #0 + Buffer := PyUnicode_AsUTF8AndSize(obj, @Size); + SetLength(Result, Size); + if (Size = 0) or (Buffer = nil) then + Exit; + + // The second argument is the size of the destination (Result) including #0 + NewSize := Utf8ToUnicode(PWideChar(Result), Cardinal(Size + 1), Buffer, Cardinal(Size)); + + // NewSize includes #0 + SetLength(Result, NewSize - 1); + end + else + raise EPythonError.CreateFmt(SPyConvertionError, ['PyUnicodeAsString', 'Unicode']); +end; + +function TPythonEngine.PyUnicodeAsUTF8String( obj : PPyObject ) : RawByteString; +var + buffer: PAnsiChar; + size: NativeInt; +begin + if PyUnicode_Check(obj) then + begin + Result := ''; + buffer := PyUnicode_AsUTF8AndSize(obj, @size); + if Assigned(buffer) then + SetString(Result, buffer, size) + else + Result := ''; + SetCodePage(Result, CP_UTF8, False); + end + else + raise EPythonError.CreateFmt(SPyConvertionError, ['PyUnicodeAsUTF8String', 'Unicode']); +end; + + +function TPythonEngine.PyUnicodeFromString(const AString : UnicodeString) : PPyObject; +{$IFDEF POSIX} +var + _ucs4Str : UCS4String; +{$ENDIF} +begin +{$IFDEF POSIX} + // Note that Linux uses UCS4 strings, whereas it declares using UCS2 strings!!! + _ucs4Str := WideStringToUCS4String(AString); + Result := PyUnicode_FromWideChar(@_ucs4Str[0], Length(_ucs4Str)-1 {trim trailing zero}); +{$ELSE} + Result := PyUnicode_FromWideChar(PWideChar(AString), Length(AString)); +{$ENDIF} +end; + +function TPythonEngine.ReturnFalse : PPyObject; +begin + Result := Py_False; + Py_INCREF( Result ); +end; + +function TPythonEngine.ReturnNone : PPyObject; +begin + Result := Py_None; + Py_INCREF( Result ); +end; + +function TPythonEngine.ReturnTrue : PPyObject; +begin + Result := Py_True; + Py_INCREF( Result ); +end; + +function TPythonEngine.FindModule( const ModuleName : AnsiString ) : PPyObject; +var + modules, m : PPyObject; +begin + modules := PyImport_GetModuleDict; + m := PyDict_GetItemString(modules, PAnsiChar(ModuleName) ); + if (m <> nil) and (PyModule_Check(m)) then + Result := m + else + Result := nil; +end; + +function TPythonEngine.FindPythonType(const TypeName: AnsiString): TPythonType; +var + i : Integer; +begin + Result := nil; + for i := 0 to ClientCount - 1 do + if (Clients[i] is TPythonType) and (TPythonType(Clients[i]).TypeName = TypeName) then + begin + Result := TPythonType(Clients[i]); + Break; + end; +end; + +function TPythonEngine.FindFunction(const ModuleName,FuncName: AnsiString): PPyObject; +var + module,func: PPyObject; +begin + module := FindModule(ModuleName); + if module = nil then result := nil + else begin + func := PyObject_GetAttrString(module, PAnsiChar(FuncName)); + if Assigned(func) then begin + if PyFunction_Check(func) then + Result := func + else + begin + Py_XDecRef(func); + Result := nil; + end; + end else begin + Result := nil; + PyErr_Clear; + end; + end; +end; + +function TPythonEngine.SetToList( data : Pointer; size : Integer ) : PPyObject; + + function GetBit( idx : Integer ) : Boolean; + var + tmp : PAnsiChar; + begin + if idx >= size*8 then + begin + Result := False; + Exit; + end; + tmp := PAnsiChar(data); + tmp := tmp + (idx div 8); + Result := (Ord(tmp^) and (1 shl (idx mod 8))) <> 0; + end; + +var + i, cpt : Integer; +begin + cpt := 0; + for i := 0 to size*8-1 do + if GetBit(i) then + Inc(cpt); + Result := PyList_New( cpt ); + cpt := 0; + for i := 0 to size*8-1 do + if GetBit(i) then + begin + PyList_SetItem( Result, cpt, PyLong_FromLong(i) ); + Inc(cpt); + end; +end; + +procedure TPythonEngine.ListToSet( List : PPyObject; data : Pointer; size : Integer ); + + procedure SetBit( idx : Integer ); + var + tmp : PAnsiChar; + begin + if idx >= size*8 then + Exit; + tmp := PAnsiChar(data); + tmp := tmp + (idx div 8); + tmp^ := AnsiChar(Chr((Ord(tmp^) or (1 shl (idx mod 8))))); + end; + +var + i : Integer; +begin + FillChar( PAnsiChar(data)^, size, #0 ); + for i := 0 to PyList_Size(list)-1 do + SetBit( PyObjectAsVariant( PyList_GetItem(list, i) ) ); +end; + +procedure TPythonEngine.CheckError(ACatchStopEx : Boolean = False); + + procedure ProcessSystemExit; + var + errtype, errvalue, errtraceback: PPyObject; + SErrValue: string; + begin + // PyErr_Fetch clears the error. The returned python objects are new references + PyErr_Fetch(errtype, errvalue, errtraceback); + Traceback.Refresh(errtraceback); + SErrValue := PyObjectAsString(errvalue); + Py_XDECREF(errtype); + Py_XDECREF(errvalue); + Py_XDECREF(errtraceback); + raise EPySystemExit.CreateResFmt(@SPyExcSystemError, [SErrValue]); + end; + +var + PyException: PPyObject; +begin + PyException := PyErr_Occurred; + if PyException <> nil then + begin + if ACatchStopEx and (PyErr_GivenExceptionMatches(PyException, PyExc_StopIteration^) <> 0) then + begin + PyErr_Clear; + raise EPyStopIteration.CreateRes(@SPyExcStopIteration); + end + else if PyErr_GivenExceptionMatches(PyException, PyExc_SystemExit^) <> 0 then + // Special treatment for SystemExit. Calling PyErr_Print would terminate the process + ProcessSystemExit + else + begin + PyErr_Print; + Traceback.Refresh; + RaiseError; + end; + end; +end; + +function TPythonEngine.GetMainModule : PPyObject; +begin + Result := PyImport_AddModule(PAnsiChar(ExecModule)); +end; + +function TPythonEngine.PyTimeStruct_Check(obj : PPyObject): Boolean; +begin + Result := Assigned(FTimeStruct) and (Pointer(obj^.ob_type) = FTimeStruct); +end; + +function TPythonEngine.PyDate_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PPyTypeObject(FPyDateTime_DateType)); +end; + +function TPythonEngine.PyDate_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_DateType); +end; + +function TPythonEngine.PyDateTime_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PPyTypeObject(FPyDateTime_DateTimeType)); +end; + +function TPythonEngine.PyDateTime_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_DateTimeType); +end; + +function TPythonEngine.PyTime_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PPyTypeObject(FPyDateTime_TimeType)); +end; + +function TPythonEngine.PyTime_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_TimeType); +end; + +function TPythonEngine.PyDelta_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PPyTypeObject(FPyDateTime_DeltaType)); +end; + +function TPythonEngine.PyDelta_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_DeltaType); +end; + +function TPythonEngine.PyTZInfo_Check( obj : PPyObject ) : Boolean; +begin + Result := PyObject_TypeCheck(obj, PPyTypeObject(FPyDateTime_TZInfoType)); +end; + +function TPythonEngine.PyTZInfo_CheckExact( obj : PPyObject ) : Boolean; +begin + Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_TZInfoType); +end; + +function TPythonEngine.PyUnicodeFromString(const AString: AnsiString): PPyObject; +begin + Result := PyUnicodeFromString(UnicodeString(AString)); +end; + + +(*******************************************************) +(** **) +(** class TEngineClient **) +(** **) +(*******************************************************) + +procedure TEngineClient.SetEngine( val : TPythonEngine ); +begin + if val <> FEngine then + begin + if Assigned(FEngine) {and not(csDesigning in ComponentState)} then + FEngine.RemoveClient( Self ); + FEngine := val; + if Assigned(FEngine) {and not(csDesigning in ComponentState)} then + FEngine.AddClient( Self ); + end; +end; + +procedure TEngineClient.ModuleReady(Sender : TObject); +begin +end; + +constructor TEngineClient.Create( AOwner : TComponent ); +var + i : Integer; +begin + inherited; + if (csDesigning in ComponentState) and Assigned(AOwner) then + with AOwner do + for i := 0 to ComponentCount - 1 do + if Components[i] is TPythonEngine then + begin + Self.Engine := TPythonEngine(Components[i]); + Break; + end; +end; + +destructor TEngineClient.Destroy; +begin + // if the client is destroyed before the Python Engine then + // we need to finalize it. Otherwise it will already be finalized + if FInitialized then + Finalize; + Engine := nil; // This detaches the client from the Engine. + if Assigned( FOnDestroy ) then + FOnDestroy( Self ); + inherited; +end; + +procedure TEngineClient.Loaded; +begin + inherited; + if Assigned( FOnCreate ) then + FOnCreate( Self ); +end; + +procedure TEngineClient.Initialize; +begin + if FInitialized then + Exit; + if Assigned( FOnInitialization ) then + FOnInitialization( Self ); + FInitialized := True; +end; + +procedure TEngineClient.Finalize; +begin + if not FInitialized then + Exit; + if Assigned( FOnFinalization ) then + FOnFinalization( Self ); + FInitialized := False; +end; + +procedure TEngineClient.ClearEngine; +begin + FEngine := nil; +end; + +procedure TEngineClient.CheckEngine; +begin + if not Assigned(FEngine) then + raise Exception.CreateFmt(SNoEngineForComponent, [Name]); +end; + + +(*******************************************************) +(** **) +(** class TMethodsContainer **) +(** **) +(*******************************************************) + +//////////////////////////////////////// +// class TEventDef + +constructor TEventDef.Create(ACollection: TCollection); +begin + inherited; + FDocString := TStringList.Create; + Name := Format('PythonEvent%d',[Collection.Count - 1]); +end; + +destructor TEventDef.Destroy; +begin + FDocString.Free; + inherited; +end; + +function TEventDef.GetDisplayName: string; +begin + Result := string(FName); +end; + +function TEventDef.GetDocString : AnsiString; +begin + Owner.Container.CheckEngine; + FTmpDocString := + Owner.Container.Engine.EncodeString(CleanString(FDocString.Text, False)); + Result := fTmpDocString; +end; + +function TEventDef.PythonEvent(pself, args: PPyObject): PPyObject; +begin + Owner.Container.CheckEngine; + with Owner.Container.Engine do + begin + if Assigned(fOnExecute) then + fOnExecute(Self, pself, args, Result); + end; +end; + +function TEventDef.Owner : TEventDefs; +begin + Result := Collection as TEventDefs; +end; + +procedure TEventDef.SetDisplayName(const Value: string); +begin + FName := AnsiString(Value); + inherited; +end; + +procedure TEventDef.Assign(Source: TPersistent); +begin + if Source is TEventDef then + begin + Name := TEventDef(Source).Name; + DocString := TEventDef(Source).DocString; + end + else + inherited Assign(Source); +end; + +procedure TEventDef.SetDocString(const Value: TStringList); +begin + FDocString.Assign(Value); +end; + +//////////////////////////////////////// +// class TEventDefs + +constructor TEventDefs.Create(AMethodsContainer : TMethodsContainer ); +begin + inherited Create(TEventDef); + FMethodsContainer := AMethodsContainer; +end; + +function TEventDefs.GetItems( idx : Integer ) : TEventDef; +begin + Result := TEventDef(inherited GetItem(idx)); +end; + +procedure TEventDefs.SetItems( idx : Integer; Value : TEventDef ); +begin + inherited SetItem( idx, Value ); +end; + +function TEventDefs.GetOwner: TPersistent; +begin + Result := FMethodsContainer; +end; + +function TEventDefs.Add : TEventDef; +begin + Result := TEventDef(inherited Add); +end; + +procedure TEventDefs.RegisterEvents; +var + i : Integer; +begin + for i := 0 to Count - 1 do + with Items[i] do + FMethodsContainer.AddDelphiMethod(PAnsiChar(FName), PythonEvent, PAnsiChar(GetDocString)); +end; + +//////////////////////////////////////// +// class TMethodsContainer + +procedure TMethodsContainer.AllocMethods; +begin + Assert(FMethods = nil); + FAllocatedMethodCount := PYT_METHOD_BUFFER_INCREASE; + FMethodCount := 0; + FMethods := PPyMethodDef(AllocMem(SizeOf(PyMethodDef)*(FAllocatedMethodCount+1))); +end; + +procedure TMethodsContainer.FreeMethods; +begin + if Assigned(FMethods) then + begin + FreeMem(FMethods); + FMethods := nil; + end; + FAllocatedMethodCount := 0; + FMethodCount := 0; +end; + +procedure TMethodsContainer.ReallocMethods; +begin + Inc( FAllocatedMethodCount, PYT_METHOD_BUFFER_INCREASE ); + ReAllocMem( FMethods, SizeOf(PyMethodDef)*(FAllocatedMethodCount+1)); + FillChar( FMethods[MethodCount+1] ,SizeOf(PyMethodDef)*PYT_METHOD_BUFFER_INCREASE,0); +end; + +function TMethodsContainer.GetMethods( idx : Integer ) : PPyMethodDef; +begin + if (idx < 0) or (idx > MethodCount) then + raise Exception.CreateFmt(SIndexOutOfRange, [ClassName, idx]); + Result := @( FMethods[idx] ); +end; + +function TMethodsContainer.StoreEventDefs: Boolean; +begin + Result := (FEventDefs <> nil) and (FEventDefs.Count > 0); +end; + +constructor TMethodsContainer.Create( AOwner : TComponent ); +begin + inherited; + AllocMethods; + fEventDefs := TEventDefs.Create(Self); +end; + +destructor TMethodsContainer.Destroy; +begin + fEventDefs.Free; + fEventDefs := nil; + FreeMethods; + inherited; +end; + +procedure TMethodsContainer.Initialize; +begin + inherited; + Events.RegisterEvents; +end; + +procedure TMethodsContainer.Finalize; +begin + if not (csDestroying in ComponentState) then + ClearMethods; + inherited; +end; + +function TMethodsContainer.AddMethod( AMethodName : PAnsiChar; + AMethod : PyCFunction; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + if FMethodCount = FAllocatedMethodCount then + ReallocMethods; + Result := Methods[ MethodCount ]; + Result^.ml_name := AMethodName; + Result^.ml_meth := AMethod; + Result^.ml_flags := METH_VARARGS; + Result^.ml_doc := ADocString; + Inc( FMethodCount ); +end; + +function TMethodsContainer.AddMethodWithKeywords( AMethodName : PAnsiChar; + AMethod : PyCFunctionWithKW; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + Result := AddMethod( AMethodName, + PyCFunction(AMethod), + ADocString ); + Result^.ml_flags := Result^.ml_flags or METH_KEYWORDS; +end; + +function TMethodsContainer.AddStaticMethodWithKeywords(AMethodName: PAnsiChar; + AMethod: PyCFunctionWithKW; ADocString: PAnsiChar): PPyMethodDef; +begin + Result := AddMethodWithKeywords(AMethodName, AMethod, ADocString); + Result^.ml_flags := Result^.ml_flags or METH_STATIC; +end; + +function TMethodsContainer.AddClassMethodWithKeywords(AMethodName: PAnsiChar; + AMethod: PyCFunctionWithKW; ADocString: PAnsiChar): PPyMethodDef; +begin + Result := AddMethodWithKeywords(AMethodName, AMethod, ADocString); + Result^.ml_flags := Result^.ml_flags or METH_CLASS; +end; + +function TMethodsContainer.AddDelphiMethod( AMethodName : PAnsiChar; + ADelphiMethod: TDelphiMethod; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + Result := AddMethod( AMethodName, + GetOfObjectCallBack( TCallBack(ADelphiMethod), 2, DEFAULT_CALLBACK_TYPE), + ADocString ); +end; + +function TMethodsContainer.AddDelphiMethodWithKeywords( AMethodName : PAnsiChar; + ADelphiMethod: TDelphiMethodWithKW; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + Result := AddMethod( AMethodName, + GetOfObjectCallBack( TCallBack(ADelphiMethod), 3, DEFAULT_CALLBACK_TYPE), + ADocString ); + Result^.ml_flags := Result^.ml_flags or METH_KEYWORDS; +end; + +procedure TMethodsContainer.ClearMethods; +begin + FMethodCount := 0; + FillChar(FMethods^, Sizeof(FMethods^)*FAllocatedMethodCount, 0); +end; + +//////////////////////////////////////// +// class TMembersContainer + +function TMembersContainer.GetMembersStartOffset : Integer; +begin + Result := 0; +end; + +procedure TMembersContainer.AddMember(MemberName: PAnsiChar; MemberType : TPyMemberType; + MemberOffset : NativeInt; MemberFlags: TPyMemberFlag; MemberDoc: PAnsiChar); +begin + if FMemberCount = FAllocatedMemberCount then + ReallocMembers; + with Members[ MemberCount ]^ do + begin + name := MemberName; + case MemberType of + mtShort: _type := T_Short; + mtInt: _type := T_Int; + mtLong: _type := T_Long; + mtFloat: _type := T_Float; + mtDouble: _type := T_Double; + mtString: _type := T_String; + mtObject: _type := T_Object; + mtChar: _type := T_Char; + mtByte: _type := T_Byte; + mtUByte: _type := T_UByte; + mtUShort: _type := T_UShort; + mtUInt: _type := T_UInt; + mtULong: _type := T_ULong; + mtStringInplace: _type := T_STRING_INPLACE; + mtObjectEx: _type := T_OBJECT_EX; + else + raise Exception.Create(SUnknownMemberType); + end; + offset := MemberOffset + GetMembersStartOffset; + case MemberFlags of + mfDefault: flags := 0; + mfReadOnly: flags := READONLY; + mfReadRestricted: flags := READ_RESTRICTED; + mfWriteRestricted: flags := PY_WRITE_RESTRICTED; + mfRestricted: flags := RESTRICTED; + else + raise Exception.Create(SUnknownMemberFlag); + end; + doc := MemberDoc; + end; + Inc( FMemberCount ); +end; + +procedure TMembersContainer.AllocMembers; +begin + FAllocatedMemberCount := PYT_MEMBER_BUFFER_INCREASE; + Assert(not Assigned(FMembers)); + FMembers := PPyMemberDef(AllocMem(SizeOf(PyMemberDef)*(FAllocatedMemberCount+1))); +end; + +procedure TMembersContainer.ClearMembers; +begin + FMemberCount := 0; + FillChar(FMembers^, Sizeof(FMembers^)*FAllocatedMemberCount, 0); +end; + +constructor TMembersContainer.Create(AOwner: TComponent); +begin + inherited; + AllocMembers; +end; + +destructor TMembersContainer.Destroy; +begin + FreeMembers; + inherited; +end; + +procedure TMembersContainer.Finalize; +begin + if not (csDestroying in ComponentState) then + ClearMembers; + inherited; +end; + +procedure TMembersContainer.FreeMembers; +begin + if Assigned(FMembers) then + begin + FreeMem(FMembers); + FMembers := nil; + end; + FMemberCount := 0; + FAllocatedMemberCount := 0; +end; + +function TMembersContainer.GetMembers(idx: Integer): PPyMemberDef; +begin + if (idx < 0) or (idx > MemberCount) then + raise Exception.CreateFmt(SIndexOutOfRange, [ClassName, idx]); + Result := @( FMembers[idx] ); +end; + +procedure TMembersContainer.ReallocMembers; +begin + Inc( FAllocatedMemberCount, PYT_MEMBER_BUFFER_INCREASE ); + ReAllocMem( FMembers, SizeOf(PyMemberDef)*(FAllocatedMemberCount+1)); + FillChar( FMembers[MemberCount+1], SizeOf(PyMemberDef)*PYT_MEMBER_BUFFER_INCREASE,0); +end; + +//////////////////////////////////////// +// class TGetSetContainer + + +procedure TGetSetContainer.AddGetSet(AName: PAnsiChar; AGet: getter; + ASet: setter; ADoc: PAnsiChar; AClosure: Pointer); +begin + if FGetSetCount = FAllocatedGetSetCount then + ReallocGetSets; + with GetSet[ GetSetCount ]^ do + begin + name := AName; + get := AGet; + _set := ASet; + doc := ADoc; + closure := AClosure; + end; + Inc( FGetSetCount ); +end; + +procedure TGetSetContainer.AllocGetSets; +begin + FAllocatedGetSetCount := PYT_GETSET_BUFFER_INCREASE; + Assert(not Assigned(FGetSets)); + FGetSets := PPyGetSetDef(AllocMem(SizeOf(PyGetSetDef)*(FAllocatedGetSetCount+1))); +end; + +procedure TGetSetContainer.ClearGetSets; +begin + FGetSetCount := 0; + FillChar(FGetSets^, Sizeof(FGetSets^)*FAllocatedGetSetCount, 0); +end; + +constructor TGetSetContainer.Create(AOwner: TComponent); +begin + inherited; + AllocGetSets; +end; + +destructor TGetSetContainer.Destroy; +begin + FreeGetSets; + inherited; +end; + +procedure TGetSetContainer.Finalize; +begin + if not (csDestroying in ComponentState) then + ClearGetSets; + inherited; +end; + +procedure TGetSetContainer.FreeGetSets; +begin + if Assigned(FGetSets) then + begin + FreeMem(FGetSets); + FGetSets := nil; + end; + FGetSetCount := 0; + FAllocatedGetSetCount := 0; +end; + +function TGetSetContainer.GetGetSet(idx: Integer): PPyGetSetDef; +begin + if (idx < 0) or (idx > GetSetCount) then + raise Exception.CreateFmt(SIndexOutOfRange, [ClassName, idx]); + Result := @( FGetSets[idx] ); +end; + +procedure TGetSetContainer.ReallocGetSets; +begin + Inc( FAllocatedGetSetCount, PYT_GETSET_BUFFER_INCREASE ); + ReAllocMem( FGetSets, SizeOf(PyGetSetDef)*(FAllocatedGetSetCount+1)); + FillChar( FGetSets[GetSetCount+1], SizeOf(PyGetSetDef)*PYT_GETSET_BUFFER_INCREASE,0); +end; + +(*******************************************************) +(** **) +(** class TPythonModule **) +(** **) +(*******************************************************) + +//////////////////////////////////////// +// class TParentClassError + +procedure TParentClassError.AssignTo( Dest: TPersistent ); +begin + if Dest is TParentClassError then + with TParentClassError( Dest ) do + begin + FName := Self.FName; + FModule := Self.FModule; + end; + inherited; +end; + +//////////////////////////////////////// +// class TError + +function TError.GetDisplayName: string; +begin + Result := string(Name); + if Result = '' then + Result := inherited GetDisplayName; +end; + +procedure TError.SetName( const Value : AnsiString ); + + procedure CheckName; + var + i : Integer; + m : TPythonModule; + begin + with Collection as TErrors do + begin + if GetOwner = nil then + Exit; + m := GetOwner as TPythonModule; + for i := 0 to Count - 1 do + with Items[i] do + if Name = Value then + raise Exception.CreateFmt(SDuplicateErrorName, + [m.ModuleName, Value]); + end; + end; + + procedure UpdateDependencies; + var + i, j : Integer; + m : TPythonModule; + begin + if FName = '' then + Exit; + with Collection as TErrors do + with GetOwner as TPythonModule do + begin + if not Assigned(Engine) then + Exit; + m := TPythonModule( TErrors(Self.Collection).GetOwner ); + with Engine do + begin + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonModule then + with TPythonModule(Clients[i]) do + begin + for j := 0 to Errors.Count - 1 do + with Errors.Items[j] do + if (ParentClass.Module = m.ModuleName) and + (ParentClass.Name = Self.Name) then + ParentClass.Name := Value; + end; + end; + end; + end; + +begin + if (FName <> Value) and (Value <> '') then + begin + CheckName; + if ErrorType = etClass then + UpdateDependencies; + FName := Value; + Changed(False); + end; +end; + +procedure TError.SetText( const Value : AnsiString ); +begin + if FText <> Value then + begin + FText := Value; + Changed(False); + end; +end; + +procedure TError.SetErrorType( Value : TErrorType ); +begin + if FErrorType <> Value then + begin + FErrorType := Value; + if FErrorType = etString then + FParentClass.Name := ''; + Changed(False); + end; +end; + +procedure TError.SetParentClass( Value : TParentClassError ); +begin + FParentClass.Assign( Value ); + Changed(False); +end; + +constructor TError.Create(ACollection: TCollection); +begin + inherited; + FErrorType := etString; + FParentClass := TParentClassError.Create; +end; + +destructor TError.Destroy; +begin + FParentClass.Free; + inherited; +end; + +procedure TError.Assign(Source: TPersistent); +begin + if Source is TError then + begin + Name := TError(Source).Name; + Text := TError(Source).Text; + ErrorType := TError(Source).ErrorType; + Exit; + end; + inherited Assign(Source); +end; + +procedure TError.BuildError( const ModuleName : AnsiString ); + + function FindParentClass : PPyObject; + var + m, d : PPyObject; + begin + Owner.Owner.CheckEngine; + with Owner.Owner.Engine do + begin + if ParentClass.Module <> '' then + //m := PyImport_ImportModule( PAnsiChar(ParentClass.Module) ) + m := PyImport_AddModule( PAnsiChar(ParentClass.Module) ) + else + m := FindModule( ModuleName ); + if not Assigned(m) then + raise Exception.CreateFmt(SNoModuleWithParentClass, [Self.Name]); + d := PyModule_GetDict(m); + Result := PyDict_GetItemString( d, PAnsiChar(ParentClass.Name) ); + if not Assigned(Result) then + raise Exception.CreateFmt(SCannotFindParentClass, [ParentClass.Name, Self.Name]); + if not PyClass_Check( Result ) and not PyType_CheckExact( Result ) then + raise Exception.CreateFmt(SObjectNotClass, [ParentClass.Name, ParentClass.Module] ); + end; + end; + +var + parent : PPyObject; +begin + if Assigned(Error) then + Exit; + if Name = '' then + with GetOwner as TPythonModule do + raise Exception.CreateFmt(SErrorNotClass, [ModuleName] ); + if Text = '' then + Text := Name; + Owner.Owner.CheckEngine; + with Owner.Owner.Engine do + begin + if ErrorType = etString then + Error := PyUnicodeFromString(Text) + else if ErrorType = etClass then + begin + if FParentClass.Name <> '' then + parent := FindParentClass + else + parent := nil; + Error := PyErr_NewException( + PAnsiChar(AnsiString(Format('%s.%s', [ModuleName, Self.Name]))), + parent, nil ); + end; + end; + if not Assigned(Error) then + raise Exception.CreateFmt(SCouldNotCreateError, [Name]); +end; + +procedure TError.RaiseError(const msg : AnsiString); +begin + Owner.Owner.CheckEngine; + with Owner.Owner.Engine do + PyErr_SetString(Error, PAnsiChar(EncodeString(msg))); +end; + +procedure TError.RaiseErrorObj(const msg : AnsiString; obj : PPyObject); +var + args, res, str : PPyObject; + i : Integer; + keys : PPyObject; + key : PPyObject; + val : PPyObject; +begin + Owner.Owner.CheckEngine; + with Owner.Owner.Engine do + // if we give a dictionary as argument, then we use it for the + // instance. + if PyDict_Check( obj ) then + begin + res := PyObject_CallObject(Error, nil); + if not Assigned(res) then + raise Exception.CreateFmt(STErrorCouldNotCreateInstance, [Self.Name]); + if PyObject_TypeCheck(res, PPyTypeObject(PyExc_Exception^)) then + begin + args := PyTuple_New(1); + if not Assigned(args) then + raise Exception.Create(STErrorCouldNotCreateTuple); + str := PyUnicodeFromString(msg); + PyTuple_SetItem(args, 0, str); + res := PyObject_Call(Error, args, nil); + Py_DECREF(args); + if not Assigned(res) then + raise Exception.CreateFmt(STErrorCouldNotCreateInstance, [Self.Name]); + keys := PyDict_Keys(obj); + for i := 0 to PySequence_Length(keys)-1 do + begin + key := PySequence_GetItem(keys, i); + val := PyDict_GetItem(obj, key); + if Assigned(val) then + begin + PyObject_SetAttr(res, key, val); + Py_DECREF(val); + end; + Py_XDECREF(key); + end; + Py_XDECREF(keys); + end + else + raise Exception.Create(STErrorNoInstance); + PyErr_SetObject(Error, res); + Py_XDECREF(res); + end + else + PyErr_SetObject(Error, obj); +end; + +function TError.Owner : TErrors; +begin + Result := GetOwner as TErrors; +end; + +//////////////////////////////////////// +// class TErrors + +function TErrors.GetError(Index: Integer): TError; +begin + Result := TError(inherited GetItem(Index)); +end; + +procedure TErrors.SetError(Index: Integer; Value: TError); +begin + inherited SetItem(Index, Value); +end; + +function TErrors.GetOwner: TPersistent; +begin + Result := FModule; +end; + +procedure TErrors.Update(Item: TCollectionItem); +begin + inherited; +end; + +constructor TErrors.Create(Module: TPythonModule ); +begin + inherited Create( TError ); + FModule := Module; +end; + +function TErrors.Add: TError; +begin + Result := TError(inherited Add); +end; + +function TErrors.Owner : TPythonModule; +begin + Result := GetOwner as TPythonModule; +end; + +//////////////////////////////////////// +// class TPythonModule + +function TPythonModule.GetClientCount : Integer; +begin + Result := FClients.Count; +end; + +function TPythonModule.GetClients( idx : Integer ) : TEngineClient; +begin + Result := TEngineClient(FClients.Items[idx]); +end; + +procedure TPythonModule.SetErrors( val : TErrors ); +begin + FErrors.Assign( val ); +end; + +procedure TPythonModule.SetModuleName( const val : AnsiString ); + + procedure UpdateDependencies; + var + i, j : Integer; + begin + if not Assigned(Engine) then + Exit; + if FModuleName = '' then + Exit; + with Engine do + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonModule then + with TPythonModule(Clients[i]) do + for j := 0 to Errors.Count - 1 do + with Errors.Items[j] do + if ParentClass.Module = Self.FModuleName then + ParentClass.Module := val; + end; + +begin + if (FModuleName <> val) and (val <> '') then + begin + UpdateDependencies; + FModuleName := val; + end; +end; + +constructor TPythonModule.Create( AOwner : TComponent ); +begin + inherited; + FClients := TList.Create; + FErrors := TErrors.Create(Self); + FDocString := TStringList.Create; +end; + +destructor TPythonModule.Destroy; +begin + FDocString.Free; + FClients.Free; + FErrors.Free; + inherited; +end; + +procedure TPythonModule.SetDocString( value : TStringList ); +begin + FDocString.Assign( value ); +end; + +procedure TPythonModule.DefineDocString; +var + doc : PPyObject; +begin + with Engine do + begin + if DocString.Text <> '' then + begin + doc := + PyUnicodeFromString(CleanString(FDocString.Text, False)); + PyObject_SetAttrString( FModule, '__doc__', doc ); + Py_XDecRef(doc); + CheckError(False); + end; + end; +end; + +procedure TPythonModule.MakeModule; +begin + CheckEngine; + if Assigned(FModule) then + Exit; + with Engine do + begin + FillChar(FModuleDef, SizeOf(FModuleDef), 0); + FModuleDef.m_base.ob_refcnt := 1; + FModuleDef.m_name := PAnsiChar(ModuleName); + FModuleDef.m_methods := MethodsData; + FModuleDef.m_size := -1; + FModule := Py_InitModule( ModuleDef ); + DefineDocString; + end; +end; + +procedure TPythonModule.Initialize; +var + i : Integer; +begin + inherited; + FModule := nil; + MakeModule; + for i := 0 to ClientCount - 1 do + Clients[i].ModuleReady(Self); + BuildErrors; + if Assigned(FOnAfterInitialization) then + FOnAfterInitialization( Self ); +end; + +procedure TPythonModule.InitializeForNewInterpreter; +var + initialized : Boolean; + oldModule : PPyObject; +begin + initialized := FInitialized; + oldModule := FModule; + FModule := nil; + FInitialized := False; + try + Initialize; + finally + FInitialized := initialized; + FModule := oldModule; + end; +end; + +procedure TPythonModule.AddClient(Client : TEngineClient); +begin + if FClients.IndexOf(Client) < 0 then + FClients.Add(Client); +end; + +function TPythonModule.ErrorByName( const AName : AnsiString ) : TError; +var + i : Integer; +begin + for i := 0 to Errors.Count - 1 do + if CompareText( string(Errors.Items[i].Name), string(AName) ) = 0 then + begin + Result := Errors.Items[i]; + Exit; + end; + raise Exception.CreateFmt(SCouldNotFindError, [AName] ); +end; + +procedure TPythonModule.RaiseError( const error, msg : AnsiString ); +begin + ErrorByName( error ).RaiseError( msg ); +end; + +procedure TPythonModule.RaiseErrorFmt( const error, format : AnsiString; const Args : array of const ); +begin + RaiseError( error, AnsiString(SysUtils.Format( string(format), Args )) ); +end; + +procedure TPythonModule.RaiseErrorObj( const error, msg : AnsiString; obj : PPyObject ); +begin + ErrorByName( error ).RaiseErrorObj( msg, obj ); +end; + +procedure TPythonModule.RemoveClient(Client: TEngineClient); +begin + // Remove does not raise an exception if not found + FClients.Remove(Client); +end; + +procedure TPythonModule.BuildErrors; +var + i : Integer; + d : PPyObject; +begin + CheckEngine; + with Engine do + begin + d := PyModule_GetDict( Module ); + if not Assigned(d) then + Exit; + for i := 0 to Errors.Count - 1 do + with Errors.Items[i] do + begin + BuildError( ModuleName ); + PyDict_SetItemString( d, PAnsiChar(Name), Error ); + end; + end; +end; + +// warning, this function will increase the refcount of value, +// so, if you don't want to keep a link, don't forget to decrement +// the refcount after the SetVar method. +procedure TPythonModule.SetVar( const varName : AnsiString; value : PPyObject ); +begin + if Assigned(FEngine) and Assigned( FModule ) then + begin + if Engine.PyObject_SetAttrString(Module, PAnsiChar(varName), value ) <> 0 then + raise EPythonError.CreateFmt(SCouldNotSetVar, [varName, ModuleName]); + end + else + raise EPythonError.CreateFmt(SCannotSetVarNoInit, [varName, ModuleName]); +end; + +// warning, this function will increase the refcount of value, +// so, if you don't want to keep a link, don't forget to decrement +// the refcount after the GetVar method. +function TPythonModule.GetVar( const varName : AnsiString ) : PPyObject; +begin + if Assigned(FEngine) and Assigned( FModule ) then + begin + Result := Engine.PyObject_GetAttrString(Module, PAnsiChar(varName) ); + Engine.PyErr_Clear; + end + else + raise EPythonError.CreateFmt(SCannotSetVarNoInit, [varName, ModuleName]); +end; + +procedure TPythonModule.DeleteVar( const varName : AnsiString ); +var + dict : PPyObject; +begin + if Assigned(FEngine) and Assigned( FModule ) then + with Engine do + begin + dict := PyModule_GetDict( Module ); + if not Assigned(dict) then + raise EPythonError.CreateFmt(SCannotGetDict, [ModuleName] ); + PyDict_DelItemString( dict, PAnsiChar(varName) ); + end + else + raise EPythonError.CreateFmt(SCannotDelVarNoInit, [varName, ModuleName]); +end; + +procedure TPythonModule.ClearVars; +var + dict : PPyObject; +begin + if Assigned(FEngine) and Assigned( FModule ) then + with Engine do begin + dict := PyModule_GetDict( Module ); + PyDict_Clear(dict); + end; +end; + +procedure TPythonModule.SetVarFromVariant( const varName : AnsiString; const value : Variant ); +var + obj : PPyObject; +begin + CheckEngine; + with Engine do + begin + obj := VariantAsPyObject( value ); + try + SetVar( varName, obj ); + finally + Py_XDecRef(obj); + end; + end; +end; + +function TPythonModule.GetVarAsVariant( const varName : AnsiString ) : Variant; +var + obj : PPyObject; +begin + CheckEngine; + with Engine do + begin + obj := GetVar( varName ); + if Assigned(obj) then + try + Result := PyObjectAsVariant( obj ); + finally + Py_XDecRef(obj); + end; + end; +end; + +(*******************************************************) +(** **) +(** class TPythonType **) +(** **) +(*******************************************************) + +////////////////////////////// +// TPyObject + +// Constructors & Destructors +constructor TPyObject.Create(APythonType: TPythonType); +begin + inherited Create; + if Assigned(APythonType) then + begin + ob_refcnt := 1; + PythonType := APythonType; + with APythonType do + begin + Inc(FInstanceCount); + Inc(FCreateHits); + end; + end; +end; + +constructor TPyObject.CreateWith(APythonType: TPythonType; args, + kwds: PPyObject); +begin + Create(APythonType); +end; + +destructor TPyObject.Destroy; +begin + if Assigned(PythonType) then + begin + Dec(PythonType.FInstanceCount); + Inc(PythonType.FDeleteHits); + end; + inherited; +end; + +class function TPyObject.NewInstance: TObject; +var + mem : PAnsiChar; +begin + GetMem(mem, InstanceSize + Sizeof(PyObject)); + PPyObject(mem)^.ob_refcnt := 1; + PPyObject(mem)^.ob_type := nil; + Result := InitInstance(Mem+Sizeof(PyObject)); +end; + +procedure TPyObject.FreeInstance; +begin + CleanupInstance; + if not PythonAlloc then + FreeMem(PAnsiChar(Self)-Sizeof(PyObject)); +end; + +// Misc +function TPyObject.GetSelf : PPyObject; +begin + Result := PPyObject( PAnsiChar(Self)-Sizeof(PyObject) ) +end; + +procedure TPyObject.IncRef; +begin + Inc(GetSelf^.ob_refcnt); +end; + +procedure TPyObject.Adjust(PyPointer: Pointer); +var + ptr : PNativeInt; +begin + ptr := PyPointer; + ptr^ := NativeInt(PythonToDelphi(PPyObject(ptr^))); +end; + +function TPyObject.GetModule : TPythonModule; +begin + if Assigned(PythonType) then + Result := PythonType.Module + else + Result := nil; +end; + +function TPyObject.Get_ob_refcnt: NativeUInt; +begin + Result := GetSelf^.ob_refcnt; +end; + +function TPyObject.Get_ob_type: PPyTypeObject; +begin + Result := GetSelf^.ob_type; +end; + +procedure TPyObject.Set_ob_refcnt(const Value: NativeUInt); +begin + GetSelf^.ob_refcnt := Value; +end; + +procedure TPyObject.Set_ob_type(const Value: PPyTypeObject); +begin + GetSelf^.ob_type := Value; +end; + +// Type services +//////////////// + +// Basic services +function TPyObject.Print( var f: file; i: integer) : Integer; +begin + Result := -1; +end; + +function TPyObject.GetAttr(key : PAnsiChar) : PPyObject; +var + PyKey : PPyObject; +begin + with GetPythonEngine do + begin + PyKey := PyUnicodeFromString(key); + try + Result := PyObject_GenericGetAttr(GetSelf, PyKey) + finally + Py_XDecRef(PyKey); + end; + end; +end; + +function TPyObject.SetAttr(key : PAnsiChar; value : PPyObject) : Integer; +begin + with GetPythonEngine do + begin + Result := -1; + PyErr_SetString(PyExc_AttributeError^, + PAnsiChar(EncodeString(Format('Unknown attribute "%s"',[key])))); + end; +end; + +function TPyObject.Repr : PPyObject; +begin + Result := + GetPythonEngine.PyUnicodeFromString(Format('<%s at %x>', + [PythonType.TypeName, NativeInt(self)])); +end; + +function TPyObject.Compare( obj: PPyObject) : Integer; +begin + Result := 0; +end; + +function TPyObject.Hash : NativeInt; +begin + Result := NativeInt(Self); +end; + +function TPyObject.Str: PPyObject; +begin + Result := Repr; +end; + +function TPyObject.GetAttrO( key: PPyObject) : PPyObject; +begin + Result := GetPythonEngine.PyObject_GenericGetAttr(GetSelf, key); +end; + +function TPyObject.GetBuffer(view: PPy_buffer; flags: Integer): Integer; +// Default implementation that raises an exception +// Subclass implementing the buffer protocol will need to override this +begin + view^.obj := nil; + with GetPythonEngine do + PyErr_SetString(PyExc_BufferError^, ''); + Result := -1; +end; + +function TPyObject.SetAttrO( key, value: PPyObject) : Integer; +begin + Result := GetPythonEngine.PyObject_GenericSetAttr(GetSelf, key, value); +end; + +function TPyObject.Call( ob1, ob2 : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.Traverse( proc: visitproc; ptr: Pointer) : integer; +begin + Result := 0; +end; + +function TPyObject.Clear: integer; +begin + Result := 0; +end; + +function TPyObject.RichCompare( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject; +Var + Res : Boolean; +begin + Res := False; + case Op of + pyLT: Res := Compare(obj) < 0; + pyLE: Res := Compare(obj) <= 0; + pyEQ: Res := Compare(obj) = 0; + pyNE: Res := Compare(obj) <> 0; + pyGT: Res := Compare(obj) > 0; + pyGE: Res := Compare(obj) >= 0; + end; + if Res then + Result := PPyObject(GetPythonEngine.Py_True) + else + Result := PPyObject(GetPythonEngine.Py_False); + GetPythonEngine.Py_INCREF( Result ); +end; + +function TPyObject.Iter : PPyObject; +begin + Result := nil; +end; + +function TPyObject.IterNext : PPyObject; +begin + Result := nil; +end; + +{ Called when an instance of a subtype has been created. Same as __init__ in a class } +function TPyObject.Init( args, kwds : PPyObject ) : Integer; +begin + Result := 0; +end; + +// Number services +function TPyObject.NbAdd( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbSubtract( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbMultiply( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbFloorDivide( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbTrueDivide( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbMatrixMultiply( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbRemainder( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbDivmod( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbPower( ob1, ob2 : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbNegative : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbPositive : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbAbsolute : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbBool : Integer; +begin + Result := 0; +end; + +function TPyObject.NbInvert : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbLShift( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbRShift( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbAnd( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbXor( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbOr( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInt : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbFloat : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceAdd(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceAnd(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceDivide(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceFloorDivide( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceTrueDivide( obj : PPyObject) : PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceLshift(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceMultiply(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceOr(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceMatrixMultiply(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplacePower(ob1, ob2: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceRemainder(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceRshift(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceSubtract(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.NbInplaceXor(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +// Sequence services +function TPyObject.SqLength : NativeInt; +begin + Result := 0; +end; + +function TPyObject.SqConcat( obj : PPyObject) : PPyObject; +begin + Result := GetPythonEngine.ReturnNone; +end; + +function TPyObject.SqRepeat( val : NativeInt ) : PPyObject; +begin + Result := GetPythonEngine.ReturnNone; +end; + +function TPyObject.SqItem( idx : NativeInt ) : PPyObject; +begin + Result := GetPythonEngine.ReturnNone; +end; + +function TPyObject.SqAssItem( idx : NativeInt; obj : PPyObject) : Integer; +begin + Result := -1; +end; + +function TPyObject.SqContains(obj: PPyObject): integer; +begin + Result := -1; +end; + +function TPyObject.SqInplaceConcat(obj: PPyObject): PPyObject; +begin + Result := nil; +end; + +function TPyObject.SqInplaceRepeat(i: NativeInt): PPyObject; +begin + Result := nil; +end; + +// Mapping services +function TPyObject.MpLength : NativeInt; +begin + Result := 0; +end; + +function TPyObject.MpSubscript( obj : PPyObject) : PPyObject; +begin + Result := GetPythonEngine.ReturnNone; +end; + +function TPyObject.MpAssSubscript( obj1, obj2 : PPyObject) : Integer; +begin + Result := -1; +end; + + +// Class methods +class procedure TPyObject.RegisterMethods( APythonType : TPythonType ); +begin +end; + +procedure TPyObject.ReleaseBuffer(view: PPy_buffer); +begin + // Do nothing. Subclasses may provide an implementation. +end; + +class procedure TPyObject.RegisterMembers( APythonType : TPythonType ); +begin +end; + +class procedure TPyObject.RegisterGetSets( APythonType : TPythonType ); +begin +end; + +class procedure TPyObject.SetupType(APythonType: TPythonType); +begin + +end; + + +////////////////////////////// +// TTypeServices + +constructor TTypeServices.Create; +begin + inherited; + FBasic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr]; +end; + +procedure TTypeServices.AssignTo( Dest: TPersistent ); +begin + if Dest is TTypeServices then + with TTypeServices( Dest ) do + begin + FBasic := Self.FBasic; + FNumber := Self.FNumber; + FSequence := Self.FSequence; + FMapping := Self.FMapping; + FInplaceNumber := Self.FInplaceNumber; + end; + inherited; +end; + +////////////////////////////// +// TPythonType + +function PythonToDelphi( obj : PPyObject ) : TPyObject; +begin + if IsDelphiObject( obj ) then + Result := TPyObject(PAnsiChar(obj)+Sizeof(PyObject)) + else + raise EPythonError.CreateFmt(SExpectedDelphiClass, [GetPythonEngine.PyObjectAsString(obj)]); +end; + +procedure PyObjectDestructor( pSelf : PPyObject); cdecl; +var + call_tp_free : Boolean; + obj : TPyObject; +begin + obj := PythonToDelphi(pSelf); + call_tp_free := obj.PythonAlloc; + if PythonOk then + obj.Free; + if call_tp_free and Assigned(pSelf.ob_type) and Assigned(pSelf.ob_type^.tp_free) then + pSelf.ob_type^.tp_free(pSelf); +end; + +procedure TPythonType.Notification( AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if Operation = opRemove then + if AComponent = FModule then + FModule := nil; +end; + +procedure TPythonType.SetPyObjectClass( val : TPyObjectClass ); +begin + if val <> FPyObjectClass then + begin + if Assigned(FPyObjectClass) then + begin + ClearMethods; + ClearMembers; + ClearGetSets; + end; + FPyObjectClass := val; + if Assigned(val) then + begin + FType.tp_basicsize := val.InstanceSize + Sizeof(PyObject); + val.RegisterMethods( Self ); + val.RegisterMembers( Self ); + val.RegisterGetSets( Self ); + val.SetupType( Self ); + end; + end; +end; + +procedure TPythonType.SetModule( val : TPythonModule ); +begin + if val <> FModule then + begin + if Assigned(FModule) then + begin + FModule.RemoveFreeNotification(Self); + FModule.RemoveClient(Self); + end; + FModule := val; + if Assigned(val) then + begin + val.FreeNotification(Self); + if Initialized and not (csLoading in ComponentState) then + if val.Initialized then + AddTypeVar + else + val.AddClient(Self); + end; + end; +end; + +procedure TPythonType.ModuleReady(Sender : TObject); +begin + inherited; + AddTypeVar; +end; + +procedure TPythonType.SetServices( val : TTypeServices ); +begin + FServices.Assign( val ); +end; + +procedure TPythonType.SetTypeName( const val : AnsiString ); +begin + if (FTypeName <> val) and (val <> '') then + begin + FTypeName := val; + end; +end; + +function TPythonType.CreateMethod(pSelf, args, kwds: PPyObject): PPyObject; +begin + Result := CreateInstanceWith(args, kwds); +end; + +procedure TPythonType.ReallocGetSets; +begin + inherited; + if tpfBaseType in TypeFlags then + FType.tp_getset := GetSetData; +end; + +procedure TPythonType.ReallocMembers; +begin + inherited; + if tpfBaseType in TypeFlags then + FType.tp_members := MembersData; +end; + +procedure TPythonType.ReallocMethods; +begin + inherited; + if tpfBaseType in TypeFlags then + FType.tp_methods := MethodsData; +end; + +procedure TPythonType.SetBaseType(AType: TPythonType); +begin + if AType = nil then + FType.tp_base := nil + else + FType.tp_base := @AType.FType; +end; + +procedure TPythonType.SetDocString( value : TStringList ); +begin + FDocString.Assign( value ); +end; + +function TPythonType.TypeFlagsAsInt : C_ULong; +begin + Result := 0; + if tpfHeapType in TypeFlags then + Result := Result or Py_TPFLAGS_HEAPTYPE; + if tpfBaseType in TypeFlags then + Result := Result or Py_TPFLAGS_BASETYPE; + if tpfReady in TypeFlags then + Result := Result or Py_TPFLAGS_READY; + if tpfReadying in TypeFlags then + Result := Result or Py_TPFLAGS_READYING; + if tpfHaveGC in TypeFlags then + Result := Result or Py_TPFLAGS_HAVE_GC; + if tpVectorCall in TypeFlags then + Result := Result or _Py_TPFLAGS_HAVE_VECTORCALL; + if tpMethodDescriptor in TypeFlags then + Result := Result or Py_TPFLAGS_METHOD_DESCRIPTOR; + if tpHaveVersionTag in TypeFlags then + Result := Result or Py_TPFLAGS_HAVE_VERSION_TAG; + if tpValidVersionTag in TypeFlags then + Result := Result or Py_TPFLAGS_VALID_VERSION_TAG; + if tpIsAbstract in TypeFlags then + Result := Result or Py_TPFLAGS_IS_ABSTRACT; + if tpLongSubclass in TypeFlags then + Result := Result or Py_TPFLAGS_LONG_SUBCLASS; + if tpListSubClass in TypeFlags then + Result := Result or Py_TPFLAGS_LIST_SUBCLASS; + if tpTupleSubclass in TypeFlags then + Result := Result or Py_TPFLAGS_TUPLE_SUBCLASS; + if tpBytesSubclass in TypeFlags then + Result := Result or Py_TPFLAGS_BYTES_SUBCLASS; + if tpBaseExcSubclass in TypeFlags then + Result := Result or Py_TPFLAGS_BASE_EXC_SUBCLASS; + if tpTypeSubclass in TypeFlags then + Result := Result or Py_TPFLAGS_TYPE_SUBCLASS; +end; + +// Type services +// They will be all forwarded to the Delphi class that +// implements the object through the use of virtual +// methods +/////////////////////////////////////// + +// Basic services + +function TPythonType_Print( pSelf : PPyObject; var f: file; i: integer) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).Print( f, i ); +end; + +function TPythonType_GetAttr( pSelf : PPyObject; key : PAnsiChar) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).GetAttr( key ); +end; + +function TPythonType_SetAttr( pSelf : PPyObject; key : PAnsiChar; value : PPyObject) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).SetAttr( key, value ); +end; + +function TPythonType_Repr( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).Repr; +end; + +function TPythonType_Compare( pSelf, obj : PPyObject ) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).Compare( obj ); +end; + +function TPythonType_Hash( pSelf : PPyObject) : NativeInt; cdecl; +begin + Result := PythonToDelphi(pSelf).Hash; +end; + +function TPythonType_Str( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).Str; +end; + +function TPythonType_GetAttrO( pSelf, key: PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).GetAttrO( key ); +end; + +function TPythonType_SetAttrO( pSelf, key, value: PPyObject) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).SetAttrO( key, value ); +end; + +function TPythonType_Call( pSelf, ob1, ob2 : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).Call( ob1, ob2 ); +end; + +function TPythonType_Traverse( pSelf: PPyObject; proc: visitproc; ptr: Pointer) : integer; cdecl; +begin + Result := PythonToDelphi(pSelf).Traverse( proc, ptr ); +end; + +function TPythonType_Clear( pSelf: PPyObject): integer; cdecl; +begin + Result := PythonToDelphi(pSelf).Clear; +end; + +function TPythonType_RichCmp( pSelf, obj : PPyObject; i : Integer) : PPyObject; cdecl; +begin + Assert(i >= Ord(Low(TRichComparisonOpcode))); + Assert(i <= Ord(High(TRichComparisonOpcode))); + Result := PythonToDelphi(pSelf).RichCompare( obj, TRichComparisonOpcode(i) ); +end; + +function TPythonType_Iter( pSelf: PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).Iter; +end; + +function TPythonType_IterNext( pSelf: PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).IterNext; +end; + +function TPythonType_InitSubtype( pSelf, args, kwds : PPyObject) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).Init(args, kwds); +end; + +function TPythonType_GetBuffer(exporter: PPyObject; view: PPy_buffer; flags: Integer): Integer; cdecl; +begin + Result := PythonToDelphi(exporter).GetBuffer(view, flags); +end; + +procedure TPythonType_ReleaseBuffer(exporter: PPyObject; view: PPy_buffer); cdecl; +begin + PythonToDelphi(exporter).ReleaseBuffer(view); +end; + +function TPythonType.NewSubtypeInst( aType: PPyTypeObject; args, kwds : PPyObject) : PPyObject; +var + obj : TPyObject; +begin + // Allocate memory in the python heap for both the pascal and the python + // PyObject (see tp_basicsize in SetPyObjectClass) + // nitems = 0 because PyType_GenericAlloc adds +1 + Result := aType^.tp_alloc(aType, 0); + if Assigned(Result) then + begin + obj := PythonToDelphi(Result); + PyObjectClass.InitInstance(obj); + obj.ob_type := aType; + obj.IsSubtype := aType <> @FType; + obj.PythonAlloc := True; + obj.CreateWith(Self, args, kwds); + if Engine.PyErr_Occurred <> nil then + begin + Engine.Py_DECREF(Result); + Result := nil; + end; + end; +end; + +// Number services + +function TPythonType_NbAdd( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbAdd( obj ); +end; + +function TPythonType_NbSubtract( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbSubtract( obj ); +end; + +function TPythonType_NbMultiply( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbMultiply( obj ); +end; + +function TPythonType_NbFloorDivide( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbFloorDivide( obj ); +end; + +function TPythonType_NbTrueDivide( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbTrueDivide( obj ); +end; + +function TPythonType_NbMatrixMultiply( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbMatrixMultiply( obj ); +end; + +function TPythonType_NbRemainder( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbRemainder( obj ); +end; + +function TPythonType_NbDivmod( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbDivmod( obj ); +end; + +function TPythonType_NbPower( pSelf, ob1, ob2 : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbPower( ob1, ob2 ); +end; + +function TPythonType_NbNegative( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbNegative; +end; + +function TPythonType_NbPositive( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbPositive; +end; + +function TPythonType_NbAbsolute( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbAbsolute; +end; + +function TPythonType_NbBool( pSelf : PPyObject ) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).NbBool; +end; + +function TPythonType_NbInvert( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInvert; +end; + +function TPythonType_NbLShift( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbLShift( obj ); +end; + +function TPythonType_NbRShift( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbRShift( obj ); +end; + +function TPythonType_NbAnd( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbAnd( obj ); +end; + +function TPythonType_NbXor( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbXor( obj ); +end; + +function TPythonType_NbOr( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbOr( obj ); +end; + +function TPythonType_NbInt( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInt; +end; + +function TPythonType_NbFloat( pSelf : PPyObject ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbFloat; +end; + +function TPythonType_NbInplaceAdd(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceAdd( obj ); +end; + +function TPythonType_NbInplaceAnd(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceAnd( obj ); +end; + +function TPythonType_NbInplaceDivide(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceDivide( obj ); +end; + +function TPythonType_NbInplaceFloorDivide( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceFloorDivide( obj ); +end; + +function TPythonType_NbInplaceTrueDivide( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceTrueDivide( obj ); +end; + +function TPythonType_NbInplaceLshift(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceLshift( obj ); +end; + +function TPythonType_NbInplaceMultiply(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceMultiply( obj ); +end; + +function TPythonType_NbInplaceOr(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceOr( obj ); +end; + +function TPythonType_NbInplaceMatrixMultiply(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceMatrixMultiply( obj ); +end; + +function TPythonType_NbInplacePower(pSelf, ob1, ob2: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplacePower( ob1, ob2 ); +end; + +function TPythonType_NbInplaceRemainder(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceRemainder( obj ); +end; + +function TPythonType_NbInplaceRshift(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceRshift( obj ); +end; + +function TPythonType_NbInplaceSubtract(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceSubtract( obj ); +end; + +function TPythonType_NbInplaceXor(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).NbInplaceXor( obj ); +end; + +// Sequence services + +function TPythonType_SqLength( pSelf : PPyObject ) : NativeInt; cdecl; +begin + Result := PythonToDelphi(pSelf).SqLength; +end; + +function TPythonType_SqConcat( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).SqConcat( obj ); +end; + +function TPythonType_SqRepeat( pSelf : PPyObject; val : NativeInt ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).SqRepeat( val ); +end; + +function TPythonType_SqItem( pSelf : PPyObject; idx : NativeInt ) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).SqItem( idx ); +end; + +function TPythonType_SqAssItem( pSelf : PPyObject; idx : NativeInt; obj : PPyObject) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).SqAssItem( idx, obj ); +end; + +// Mapping services + +function TPythonType_MpLength( pSelf : PPyObject ) : NativeInt; cdecl; +begin + Result := PythonToDelphi(pSelf).MpLength; +end; + +function TPythonType_MpSubscript( pSelf, obj : PPyObject) : PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).MpSubscript( obj ); +end; + +function TPythonType_MpAssSubscript( pSelf, obj1, obj2 : PPyObject) : Integer; cdecl; +begin + Result := PythonToDelphi(pSelf).MpAssSubscript( obj1, obj2 ); +end; + +function TPythonType_SqContains(pSelf, obj : PPyObject): integer; cdecl; +begin + Result := PythonToDelphi(pSelf).SqContains( obj ); +end; + +function TPythonType_SqInplaceConcat(pSelf, obj: PPyObject): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).SqInplaceConcat( obj ); +end; + +function TPythonType_SqInplaceRepeat(pSelf : PPyObject; i: NativeInt): PPyObject; cdecl; +begin + Result := PythonToDelphi(pSelf).SqInplaceRepeat( i ); +end; + +procedure TPythonType.InitServices; +{ Called from TPythonType.Initialize which first calls CheckEngine - FEngine is alread assigned } +begin + with FType do + begin + // Basic services + if FDocString.Count > 0 then + with Engine do + begin + FCurrentDocString := EncodeString(CleanString(FDocString.Text, False)); + tp_doc := PAnsiChar(FCurrentDocString); + end; + tp_dealloc := @PyObjectDestructor; + if bsGetAttr in Services.Basic then + tp_getattr := TPythonType_GetAttr; + if bsSetAttr in Services.Basic then + tp_setattr := TPythonType_SetAttr; + if bsRepr in Services.Basic then + tp_repr := TPythonType_Repr; + if bsStr in Services.Basic then + tp_str := TPythonType_Str; + if bsHash in Services.Basic then + tp_hash := TPythonType_Hash; + if bsGetAttrO in Services.Basic then + tp_getattro := TPythonType_GetAttrO; + if bsSetAttrO in Services.Basic then + tp_setattro := TPythonType_SetAttrO; + if bsCall in Services.Basic then + tp_call := TPythonType_Call; + if bsTraverse in Services.Basic then + tp_traverse := TPythonType_Traverse; + if bsClear in Services.Basic then + tp_clear := TPythonType_Clear; + if bsRichCompare in Services.Basic then + tp_richcompare := TPythonType_RichCmp; + if bsIter in Services.Basic then + tp_iter := TPythonType_Iter; + if bsIterNext in Services.Basic then + tp_iternext := TPythonType_IterNext; + if bsBuffer in Services.Basic then + begin + FBufferProcs.bf_getbuffer := TPythonType_GetBuffer; + FBufferProcs.bf_releasebuffer := TPythonType_ReleaseBuffer; + tp_as_buffer := @FBufferProcs; + end; + if tpfBaseType in TypeFlags then + begin + tp_init := TPythonType_InitSubtype; + tp_alloc := FEngine.PyType_GenericAlloc; + tp_new := GetCallBack( Self, @TPythonType.NewSubtypeInst, 3, DEFAULT_CALLBACK_TYPE); + tp_free := FEngine.PyObject_Free; + tp_methods := MethodsData; + tp_members := MembersData; + tp_getset := GetSetData; + end; + + // Number services + if Services.Number <> [] then + begin + tp_as_number := @FNumber; + + with FNumber do + begin + if nsAdd in Services.Number then nb_add := TPythonType_NbAdd; // #3.1 + if nsSubtract in Services.Number then nb_subtract := TPythonType_NbSubtract; // #3.2 + if nsMultiply in Services.Number then nb_multiply := TPythonType_NbMultiply; // #3.3 + if nsFloorDivide in Services.Number then nb_floor_divide := TPythonType_NbFloorDivide; // #3.30 + if nsTrueDivide in Services.Number then nb_true_divide := TPythonType_NbTrueDivide; // #3.31 + if (nsMatrixMultiply in Services.Number) and ((FEngine.MajorVersion > 3) + or ((FEngine.MajorVersion = 3) and (FEngine.MinorVersion >= 5))) + then + nb_matrix_multiply := TPythonType_NbMatrixMultiply; // #3.35 + if nsRemainder in Services.Number then nb_remainder := TPythonType_NbRemainder; // #3.4 + if nsDivmod in Services.Number then nb_divmod := TPythonType_NbDivmod; // #3.5 + if nsPower in Services.Number then nb_power := TPythonType_NbPower; // #3.6 + if nsNegative in Services.Number then nb_negative := TPythonType_NbNegative; // #3.7 + if nsPositive in Services.Number then nb_positive := TPythonType_NbPositive; // #3.8 + if nsAbsolute in Services.Number then nb_absolute := TPythonType_NbAbsolute; // #3.9 + if nsBool in Services.Number then nb_bool := TPythonType_NbBool; // #3.10 + if nsInvert in Services.Number then nb_invert := TPythonType_NbInvert; // #3.11 + if nsLShift in Services.Number then nb_lshift := TPythonType_NbLShift; // #3.12 + if nsRShift in Services.Number then nb_rshift := TPythonType_NbRShift; // #3.13 + if nsAnd in Services.Number then nb_and := TPythonType_NbAnd; // #3.14 + if nsXor in Services.Number then nb_xor := TPythonType_NbXor; // #3.15 + if nsOr in Services.Number then nb_or := TPythonType_NbOr; // #3.16 + if nsInt in Services.Number then nb_int := TPythonType_NbInt; // #3.17 + if nsFloat in Services.Number then nb_float := TPythonType_NbFloat; // #3.19 + if nsInplaceAdd in Services.InplaceNumber then nb_inplace_add := TPythonType_NbInplaceAdd; // #3.20 + if nsInplaceSubtract in Services.InplaceNumber then nb_inplace_subtract := TPythonType_NbInplaceSubtract; // #3.21 + if nsInplaceMultiply in Services.InplaceNumber then nb_inplace_multiply := TPythonType_NbInplaceMultiply; // #3.22 + if nsInplaceFloorDivide in Services.InplaceNumber then nb_inplace_floor_divide := TPythonType_NbInplaceFloorDivide; // #3.32 + if nsInplaceTrueDivide in Services.InplaceNumber then nb_inplace_true_divide := TPythonType_NbInplaceTrueDivide; // #3.33 + if nsInplaceRemainder in Services.InplaceNumber then nb_inplace_remainder := TPythonType_NbInplaceRemainder; // #3.23 + if nsInplacePower in Services.InplaceNumber then nb_inplace_power := TPythonType_NbInplacePower; // #3.24 + if nsInplaceLShift in Services.InplaceNumber then nb_inplace_lshift := TPythonType_NbInplaceLShift; // #3.25 + if nsInplaceRShift in Services.InplaceNumber then nb_inplace_rshift := TPythonType_NbInplaceRShift; // #3.26 + if nsInplaceAnd in Services.InplaceNumber then nb_inplace_and := TPythonType_NbInplaceAnd; // #3.27 + if nsInplaceXor in Services.InplaceNumber then nb_inplace_xor := TPythonType_NbInplaceXor; // #3.28 + if nsInplaceOr in Services.InplaceNumber then nb_inplace_or := TPythonType_NbInplaceOr; // #3.29 + if (nsInplaceMatrixMultiply in Services.InplaceNumber) and + ((FEngine.MajorVersion > 3) or ((FEngine.MajorVersion = 3) + and (FEngine.MinorVersion >= 5))) + then + nb_inplace_matrix_multiply := TPythonType_NbInplaceMatrixMultiply; // #3.36 + end; + end; + + // Sequence services + if Services.Sequence <> [] then + begin + tp_as_sequence := @FSequence; + + with FSequence do + begin + if ssLength in Services.Sequence then + sq_length := TPythonType_SqLength; + if ssConcat in Services.Sequence then + sq_concat := TPythonType_SqConcat; + if ssRepeat in Services.Sequence then + sq_repeat := TPythonType_SqRepeat; + if ssItem in Services.Sequence then + sq_item := TPythonType_SqItem; + if ssAssItem in Services.Sequence then + sq_ass_item := TPythonType_SqAssItem; + if ssContains in Services.Sequence then + sq_contains := TPythonType_SqContains; + if ssInplaceConcat in Services.Sequence then + sq_inplace_concat := TPythonType_SqInplaceConcat; + if ssInplaceRepeat in Services.Sequence then + sq_inplace_repeat := TPythonType_SqInplaceRepeat; + end; + end; + + // Mapping services + if Services.Mapping <> [] then + begin + tp_as_mapping := @FMapping; + + with FMapping do + begin + if msLength in Services.Mapping then + mp_length := TPythonType_MpLength; + if msSubScript in Services.Mapping then + mp_subscript := TPythonType_MpSubscript; + if msAssSubscript in Services.Mapping then + mp_ass_subscript := TPythonType_MpAssSubscript; + end; + end; + end; +end; + +// Public methods + +constructor TPythonType.Create( AOwner : TComponent ); +begin + inherited; + FPrefix := 'Create'; + FServices := TTypeServices.Create; + FDocString := TStringList.Create; + FTypeFlags := TPFLAGS_DEFAULT; + FGenerateCreateFunction := True; +end; + +destructor TPythonType.Destroy; +begin + if gVarType = Self then + gVarType := nil; + Module := nil; + FDocString.Free; + FServices.Free; + inherited; +end; + +function TPythonType.GetTypePtr : PPyTypeObject; +begin + Result := PPyTypeObject(@FType); +end; + +procedure TPythonType.Initialize; +begin + CheckEngine; + with Engine, FType do + begin + ob_type := PPyTypeObject(PyType_Type); + ob_refcnt := 1; + tp_name := PAnsiChar(FTypeName); + tp_flags := TypeFlagsAsInt; + end; + if Assigned(FModule) then + begin + if Module.Initialized then + AddTypeVar + else + Module.AddClient( Self ); + end; + InitServices; + FType.tp_pythontype := Self; // Store self into FType + inherited; + if Engine.PyType_Ready(TheTypePtr) <> 0 then + Engine.CheckError; +end; + +procedure TPythonType.Finalize; +begin + if Assigned(Engine) then + Engine.Py_CLEAR(FCreateFunc); + FCreateFunc := nil; + + inherited; +end; + +function TPythonType.CreateInstance : PPyObject; +var + obj : TPyObject; +begin + CheckEngine; + with Engine do + begin + obj := PyObjectClass.Create( Self ); + obj.ob_type := @FType; + if PyErr_Occurred <> nil then + begin + obj.Free; + Result := nil; + end + else + Result := obj.GetSelf; + end; +end; + +function TPythonType.CreateInstanceWith(args, kwds: PPyObject): PPyObject; +var + obj : TPyObject; +begin + CheckEngine; + with Engine do + begin + obj := PyObjectClass.CreateWith(Self, args, kwds); + obj.ob_type := @FType; + if PyErr_Occurred <> nil then + begin + obj.Free; + Result := nil; + end + else + Result := obj.GetSelf; + end; +end; + +procedure TPythonType.AddTypeVar; +var + d : PPyObject; + meth : TDelphiMethodWithKW; +begin + CheckEngine; + Assert(Module <> nil); + Assert(Module.Module <> nil); + if FGenerateCreateFunction then + begin + FCreateFuncName := FPrefix+FTypeName; + FCreateFuncDoc := AnsiString(Format('Creates a new instance of type %s', [TypeName])); + if not Assigned(FCreateFunc) then + begin + meth := CreateMethod; + FCreateFuncDef.ml_name := PAnsiChar(FCreateFuncName); + FCreateFuncDef.ml_meth := GetOfObjectCallBack(TCallBack(meth), 3, DEFAULT_CALLBACK_TYPE); + FCreateFuncDef.ml_flags := METH_VARARGS or METH_KEYWORDS; + FCreateFuncDef.ml_doc := PAnsiChar(FCreateFuncDoc); + FCreateFunc := Engine.PyCFunction_NewEx(@FCreateFuncDef, nil, nil); + Engine.Py_INCREF(FCreateFunc); + end; + Assert(Assigned(FCreateFunc)); + end; + with Engine do + begin + d := PyModule_GetDict( Module.Module ); + Assert(Assigned(d)); + PyDict_SetItemString( d, PAnsiChar(TypeName), PPyObject(TheTypePtr) ); + if FGenerateCreateFunction then + PyDict_SetItemString( d, PAnsiChar(FCreateFuncName), FCreateFunc ); + end; +end; + +function TPythonType.GetMembersStartOffset : Integer; +begin + Result := Sizeof(PyObject); +end; + +(*******************************************************) +(** **) +(** class TPythonDelphiVar **) +(** **) +(*******************************************************) + +procedure TPythonDelphiVar.CreateVarType; +begin + if not Assigned(gVarType) then + begin + gVarType := TPythonType.Create( Self.Engine ); + with gVarType do + begin + TypeName := 'PythonDelphiVar'; + Engine := Self.Engine; + PyObjectClass := TPyVar; + Initialize; + end; + end; +end; + +procedure TPythonDelphiVar.CreateVar; +var + v : TPyVar; + m, d : PPyObject; +begin + if not Assigned(Engine) then + Exit; + Assert(Assigned(gVarType), 'missing TPythonType for TPythonDelphiVar'); + with Engine do + begin + // Create an instance of PythonDelphiVar + FVarObject := gVarType.CreateInstance; + CheckError(False); + v := TPyVar(PythonToDelphi(FVarObject)); + v.dv_component := Self; + // Add a reference to this var in the module + m := PyImport_AddModule(PAnsiChar(Module)); + if m = nil then + raise EPythonError.CreateFmt(SCannotCreateModule, [Module]); + d := PyModule_GetDict(m); + if @PyDict_SetItemString = nil then + raise Exception.Create('nil'); + PyDict_SetItemString( d, PAnsiChar(VarName), FVarObject ); + end; +end; + +function TPythonDelphiVar.GetValue : Variant; +begin + if Assigned( FVarObject ) then + with TPyVar(PythonToDelphi(FVarObject)) do + Result := GetValueAsVariant + else + raise Exception.Create(SVarNotCreated); +end; + +procedure TPythonDelphiVar.SetValue( const val : Variant ); +begin + if Assigned( FVarObject ) then + with TPyVar(PythonToDelphi(FVarObject)) do + SetValueFromVariant(val) + else + raise Exception.Create(SVarNotCreated); +end; + +// Warning: GetValueAsPyObject returns a preincremented object ! +function TPythonDelphiVar.GetValueAsPyObject : PPyObject; +begin + if Assigned( FVarObject ) then + with TPyVar(PythonToDelphi(FVarObject)) do + Result := GetValue + else + raise Exception.Create(SVarNotCreated); +end; + +procedure TPythonDelphiVar.SetValueFromPyObject( val : PPyObject ); +begin + if Assigned( FVarObject ) then + with TPyVar(PythonToDelphi(FVarObject)) do + SetValue(val) + else + raise Exception.Create(SVarNotCreated); +end; + +function TPythonDelphiVar.IsVariantOk( const v : Variant ) : Boolean; +var + t : Integer; +begin + t := VarType(v) and VarTypeMask; + Result := (t = varSmallint) or + (t = varInteger) or + (t = varSingle) or + (t = varDouble) or + (t = varCurrency) or + (t = varDate) or + (t = varOleStr) or + (t = varBoolean) or + (t = varByte) or + (t = varUString) or + (t = varString); +end; + +function TPythonDelphiVar.GetValueAsString : string; +var + v : Variant; + obj : PPyObject; +begin + v := Value; + if IsVariantOk( v ) then + Result := v + else + begin + CheckEngine; + obj := GetValueAsPyObject; + try + Result := Engine.PyObjectAsString( obj ); + finally + Engine.Py_XDecRef(obj); + end; + end; +end; + +procedure TPythonDelphiVar.SetVarName( const val : AnsiString ); + + procedure CheckVarName; + var + i : Integer; + begin + if Owner = nil then Exit; + if (val = FVarName) or (val = '') then Exit; + for i := 0 to Owner.ComponentCount - 1 do + if Owner.Components[i] is TPythonDelphiVar then + with TPythonDelphiVar(Owner.Components[i]) do + if (VarName = val) and (Module = Self.Module) then + raise Exception.CreateFmt(SVarExists, [val, Module]); + end; + +begin + if val <> FVarName then + begin + CheckVarName; + FVarName := val; + end; +end; + +constructor TPythonDelphiVar.Create( AOwner : TComponent ); + + procedure AdjustName; + var + i, cpt : Integer; + done : Boolean; + begin + if AOwner = nil then Exit; + cpt := 1; + done := False; + while not done do + begin + done := True; + for i := 0 to AOwner.ComponentCount - 1 do + if AOwner.Components[i] is TPythonDelphiVar then + with TPythonDelphiVar(AOwner.Components[i]) do + if (VarName = Self.FVarName+AnsiString(IntToStr(cpt))) and + (Module = Self.Module) then + begin + Inc(cpt); + done := False; + Break; + end; + end; + FVarName := FVarName + AnsiString(IntToStr(cpt)); + end; + +begin + inherited; + FModule := '__main__'; + FVarName := 'varname'; + if csDesigning in ComponentState then + AdjustName; +end; + +procedure TPythonDelphiVar.Initialize; +begin + if csDesigning in ComponentState then + Exit; + CheckEngine; + CreateVarType; + CreateVar; + inherited; +end; + +procedure TPythonDelphiVar.Finalize; +begin + inherited; + if not PythonOK then + Exit; + if Assigned(FVarObject) then + with TPyVar(PythonToDelphi(FVarObject)) do + begin + dv_component := nil; + SetValue( nil ); + end; + with Engine do + Py_XDECREF( FVarObject ); + FVarObject := nil; +end; + + +constructor TPyVar.Create( APythonType : TPythonType ); +begin + inherited; +end; + +// Don't call the Create constructor of TPyVar, because +// we call the inherited constructor CreateWith that calls +// the Create constructor first, and because the constructors +// are virtual, TPyVar.Create will be automatically be called. + +constructor TPyVar.CreateWith(APythonType: TPythonType; args, kwds: PPyObject); +begin + Create(APythonType); + with GetPythonEngine do + begin + if PyArg_ParseTuple( args, 'O:CreateVar',@dv_object ) = 0 then + exit; + end; +end; + +destructor TPyVar.Destroy; +begin + with GetPythonEngine do + begin + if Assigned(dv_object) then + begin + Py_DecRef(dv_object); + dv_object := nil; + end; + end; + inherited; +end; + +// Then we override the needed services + +function TPyVar.GetAttrO( key: PPyObject) : PPyObject; +begin + with GetPythonEngine do + begin + if CompareText( PyObjectAsString(key), 'Value') = 0 then + Result := GetValue + else + Result := inherited GetAttrO(key); + end; +end; + +function TPyVar.SetAttrO( key, value: PPyObject) : Integer; +begin + Result := 0; + with GetPythonEngine do + begin + if CompareText( PyObjectAsString(key), 'Value' ) = 0 then + SetValue( value ) + else + Result := inherited SetAttrO(key, value); + end; +end; + +function TPyVar.Repr : PPyObject; +var + obj : PPyObject; +begin + with GetPythonEngine do + begin + obj := GetValue; + try + Result := + PyUnicodeFromString(Format('<%s: %s>', + [PythonType.TypeName, PyObjectAsString(obj)])); + finally + Py_XDecRef(obj); + end; + end; +end; + +// Class methods +// We register the methods of our type + +class procedure TPyVar.RegisterMethods( APythonType : TPythonType ); +begin + inherited; + with APythonType do + begin + //AddMethod( 'OffsetBy', @TPyPoint.DoOffsetBy, 'Point.OffsetBy( dx, dy )' ); + end; +end; + +// Methods of TPyVar + + +// Warning: GetValue returns a preincremented object ! +function TPyVar.GetValue : PPyObject; +var + v : Variant; +begin + Result := nil; + with GetPythonEngine do + begin + if Assigned( dv_component ) and + (@dv_component.OnExtGetData <> nil) then + begin + dv_component.OnExtGetData( dv_component, Result ); + end + else if Assigned( dv_component ) and + (@dv_component.OnGetData <> nil) then + begin + dv_component.OnGetData( dv_component, v ); + Result := VariantAsPyObject(v); + end + else if Assigned(dv_object) then + begin + Result := dv_object; + Py_XIncRef(Result); + end; + if Result = nil then + Result := ReturnNone; + end; +end; + +function TPyVar.GetValueAsVariant : Variant; +var + obj : PPyObject; +begin + with GetPythonEngine do + begin + obj := GetValue; + try + try + Result := PyObjectAsVariant( obj ); + except + Result := PyObjectAsString(obj); + end; + finally + Py_XDecRef(obj); + end; + end; +end; + +procedure TPyVar.SetValue( value : PPyObject ); +begin + with GetPythonEngine do + begin + if Assigned( dv_component ) and + (@dv_component.OnExtSetData <> nil) then + begin + dv_component.OnExtSetData( dv_component, value); + end + else if Assigned( dv_component ) and + (@dv_component.OnSetData <> nil) then + begin + dv_component.OnSetData( dv_component, PyObjectAsVariant(value) ); + end; + Py_XDecRef(dv_object); + dv_object := value; + Py_XIncRef(dv_object); + if Assigned( dv_component ) and + (@dv_component.OnChange <> nil) then + dv_component.OnChange( dv_component ); + end; +end; + +procedure TPyVar.SetValueFromVariant( const value : Variant ); +var + obj : PPyObject; +begin + with GetPythonEngine do + begin + obj := VariantAsPyObject( value ); + SetValue(obj); + Py_XDecRef(obj); + end; +end; + +(*******************************************************) +(** **) +(** class TPythonThread **) +(** **) +(*******************************************************) + +procedure TPythonThread.Execute; +var + global_state: PPyThreadState; + gilstate: PyGILState_STATE; + Config: PyInterpreterConfig; +begin + with GetPythonEngine do + begin + if fThreadExecMode = emNewState then + begin + gilstate := PyGILState_Ensure(); + try + fThreadState := GetThreadState; + ExecuteWithPython; + finally + PyGILState_Release(gilstate); + end; + end else + begin + gilstate := PyGILState_Ensure(); + global_state := PyThreadState_Get; + PyThreadState_Swap(nil); + + if (fThreadExecMode = emNewInterpreterOwnGIL) then + Config := InterpreterConfig; + + if (fThreadExecMode = emNewInterpreter) or + ((FMajorVersion = 3) and (FMinorVersion < 12)) or + PyStatus_Exception(Py_NewInterpreterFromConfig(@fThreadState, @Config)) + then + fThreadState := Py_NewInterpreter; + + if Assigned( fThreadState) then + begin + PyThreadState_Swap(fThreadState); + ExecuteWithPython; + Py_EndInterpreter( fThreadState); + PyThreadState_Swap(global_state); + PyGILState_Release(gilstate); + end else + raise EPythonError.Create(SCannotCreateThreadState); + end; + end; +end; + +function TPythonThread.InterpreterConfig: PyInterpreterConfig; +begin + Result := _PyInterpreterConfig_INIT; +end; + +class procedure TPythonThread.Py_Begin_Allow_Threads; +begin + with GetPythonEngine do + f_savethreadstate := PyEval_SaveThread; +end; + +class procedure TPythonThread.Py_End_Allow_Threads; +begin + with GetPythonEngine do + PyEval_RestoreThread(f_savethreadstate); +end; + +class procedure TPythonThread.Py_Begin_Block_Threads; +begin + Py_End_Allow_Threads; +end; + +class procedure TPythonThread.Py_Begin_Unblock_Threads; +begin + Py_Begin_Allow_Threads; +end; + +(*******************************************************) +(** **) +(** Methods for new Python objects or modules **) +(** **) +(*******************************************************) + +///////////////////////////////////////////////////////// +// Module pyio for Python Input/Outputs +// + +function pyio_write(self, args : PPyObject) : PPyObject; +var + a1 : PPyObject; +begin + // Forbid printing for any other thread than the main one + {$IFNDEF FPC} + if GetCurrentThreadId <> MainThreadId then + with GetPythonEngine do + begin + if RedirectIO and (IO <> nil) and (IO.ClassName <> 'TPythonInputOutput') and not IO.DelayWrites then + begin + Result := GetPythonEngine.ReturnNone; + Exit; + end; + end; + {$ENDIF} + with GetPythonEngine do + begin + if Assigned(args) and (PyTuple_Size(args) > 0) then + begin + a1 := PyTuple_GetItem(args, 0); + if RedirectIO and (IO <> nil) and Assigned(a1) then + begin + if PyUnicode_Check(a1) then + IO.Write(PyUnicodeAsString(a1)) + else + IO.Write(IOString(PyObjectAsString(a1))); + end; + Result := ReturnNone; + end + else + begin + PyErr_BadArgument; + Result := nil; + end; + end; +end; + +function pyio_read(self, args : PPyObject) : PPyObject; +var + txt : AnsiString; + Widetxt : UnicodeString; +begin + with GetPythonEngine do + begin + if RedirectIO then + begin + txt := ''; + if Assigned(IO) then + if IO.UnicodeIO then begin + Widetxt := IO.ReceiveUniData; + if PyErr_Occurred <> nil then + Result := nil + else + Result := PyUnicodeFromString(Widetxt); + end else begin + txt := IO.ReceiveData; + if PyErr_Occurred <> nil then + Result := nil + else + Result := PyUnicodeFromString(txt); + end + else + Result := PyUnicodeFromString(txt); + end + else + Result := ReturnNone; + end; +end; + +function pyio_SetDelayWrites(self, args : PPyObject) : PPyObject; +var + val : Integer; +begin + with GetPythonEngine do + begin + if PyArg_ParseTuple( args, 'i:SetDelayWrites',@val ) <> 0 then + begin + if IO <> nil then + IO.DelayWrites := val <> 0; + Result := ReturnNone; + end + else + Result := nil; + end; +end; + +function pyio_SetMaxLines(self, args : PPyObject) : PPyObject; +var + val : Integer; +begin + with GetPythonEngine do + begin + if PyArg_ParseTuple( args, 'i:SetMaxLines',@val ) <> 0 then + begin + if IO <> nil then + IO .MaxLines := val; + Result := ReturnNone; + end + else + Result := nil; + end; +end; + +// With no args, it will look at all types +// With args, it will look only at the types listed in the args. + +// It returns a list of tuples. Each tuple contains: +// the Type name, the InstanceCount, the CreateHits and the DeleteHits + +function pyio_GetTypesStats(self, args : PPyObject) : PPyObject; + + function HandleType( T : TPythonType ) : PPyObject; + begin + with GetPythonEngine do + begin + Result := PyTuple_New(4); + PyTuple_SetItem( Result, 0, PyUnicodeFromString(T.TypeName)); + PyTuple_SetItem( Result, 1, PyLong_FromLong(T.InstanceCount) ); + PyTuple_SetItem( Result, 2, PyLong_FromLong(T.CreateHits) ); + PyTuple_SetItem( Result, 3, PyLong_FromLong(T.DeleteHits) ); + end; + end; + +var + i : Integer; + T : TPythonType; + obj : PPyObject; + str : AnsiString; +begin + with GetPythonEngine do + begin + Result := PyList_New(0); + if PyTuple_Size(args) > 0 then + for i := 0 to PyTuple_Size(args)-1 do + begin + str := AnsiString(PyObjectAsString( PyTuple_GetItem(args, i) )); + T := FindPythonType( str ); + if Assigned(T) then + begin + obj := HandleType( T ); + PyList_Append( Result, obj ); + Py_XDecRef(obj); + end; + end + else + for i := 0 to ClientCount - 1 do + if Clients[i] is TPythonType then + begin + obj := HandleType( TPythonType(Clients[i]) ); + PyList_Append( Result, obj ); + Py_XDecRef(obj); + end; + end; +end; + + +(*******************************************************) +(** **) +(** Global procedures **) +(** **) +(*******************************************************) + +function GetPythonEngine : TPythonEngine; +begin + if not Assigned( gPythonEngine ) then + raise Exception.Create(SCannotCreatePythonEngine); + if not gPythonEngine.Finalizing and not gPythonEngine.Initialized then + raise Exception.Create(SCannotInitPythonEngine); + Result := gPythonEngine; +end; + +function PythonOK : Boolean; +begin + Result := Assigned( gPythonEngine ) and + (gPythonEngine.Initialized or gPythonEngine.Finalizing); +end; + +function FindPythonType(PyType: PPyTypeObject): TPythonType; +var + Typ : PPyTypeObject; +begin + Result := nil; + // Here's a simple trick: we compare the object destructor to + // our special destructor for Delphi objects, or + // we check if one of the parent types of obj has a Delphi destructor. + Typ := PyType; + while Assigned(Typ) do + begin + if @Typ^.tp_dealloc = @PyObjectDestructor then + Exit(Typ.tp_pythontype); + Typ := Typ^.tp_base; + end; +//var +end; + +function IsDelphiObject( obj : PPyObject ) : Boolean; +begin + Result := Assigned(obj) and (FindPythonType(obj^.ob_type) <> nil); +end; + +procedure Register; +begin + RegisterComponents('Python',[ TPythonEngine, TPythonInputOutput, + TPythonType, TPythonModule, TPythonDelphiVar]); +end; + +function SysVersionFromDLLName(const DLLFileName : string): string; +var + Minor, Major: integer; +begin + PythonVersionFromDLLName(DLLFileName, Major, Minor); + Result := Format('%d.%d', [Major, Minor]); +end; + +function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean; +begin + //(((t)->tp_flags & (f)) != 0) + Result := (((AType)^.tp_flags and (AFlag)) <> 0); +end; + +procedure MaskFPUExceptions(ExceptionsMasked : boolean; + MatchPythonPrecision : Boolean); +begin + {$IF Defined(CPUX86) or Defined(CPUX64)} + if ExceptionsMasked then + SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, + exOverflow, exUnderflow, exPrecision]) + else + SetExceptionMask([exDenormalized, exUnderflow, exPrecision]); + {$WARN SYMBOL_PLATFORM OFF} + {$IF Defined(FPC) or Defined(MSWINDOWS)} + if MatchPythonPrecision then + SetPrecisionMode(pmDouble) + else + SetPrecisionMode(pmExtended); + {$WARN SYMBOL_PLATFORM ON} + {$IFEND} + {$IFEND} +end; + +function CleanString(const s : AnsiString; AppendLF : Boolean) : AnsiString; +var + i : Integer; +begin + result := s; + if s = '' then + Exit; + i := Pos(AnsiString(CR),s); + while i > 0 do + begin + Delete( result, i, 1 ); + i := PosEx(AnsiString(CR),result, i); + end; + if AppendLF and (result[length(result)] <> LF) then + Result := Result + LF; +end; + +function CleanString(const s : UnicodeString; AppendLF : Boolean) : UnicodeString; +begin + {$IFDEF FPC} + Result := UnicodeString(AdjustLineBreaks(AnsiString(s), tlbsLF)); + {$ELSE} + Result := AdjustLineBreaks(s, tlbsLF); + {$ENDIF} + if AppendLF and (result[length(result)] <> LF) then + Result := Result + LF; +end; + +{$IFDEF MSWINDOWS} +function IsPythonVersionRegistered(PythonVersion : string; + out InstallPath: string; out AllUserInstall: Boolean) : Boolean; + // Python provides for All user and Current user installations + // All User installations place the Python DLL in the Windows System directory + // and write registry info to HKEY_LOCAL_MACHINE + // Current User installations place the DLL in the install path and + // the registry info in HKEY_CURRENT_USER. + // Hence, for Current user installations we need to try and find the install path + // since it may not be on the system path. + + // The above convension was changed in Python 3.5. Now even for all user + // installations the dll is located at the InstallPath. + // Also from version 3.5 onwards 32 bit version have a suffix -32 e.g. "3.6-32" + // See also PEP 514 + +var + key: string; + VersionSuffix: string; + LMajorVersion : integer; + LMinorVersion : integer; +begin + Result := False; + InstallPath := ''; + AllUserInstall := False; + VersionSuffix := ''; + PythonVersionFromRegVersion(PythonVersion, LMajorVersion, LMinorVersion); +{$IFDEF CPUX86} + if (LMajorVersion > 3) or ((LMajorVersion = 3) and (LMinorVersion >= 5)) then + VersionSuffix := '-32'; +{$ENDIF} + key := Format('\Software\Python\PythonCore\%s%s\InstallPath', [PythonVersion, VersionSuffix]); + + // First try HKEY_CURRENT_USER as per PEP514 + try + with TRegistry.Create(KEY_READ and not KEY_NOTIFY) do + try + RootKey := HKEY_CURRENT_USER; + if OpenKey(Key, False) then begin + InstallPath := ReadString(''); + Result := True; + Exit; + end; + finally + Free; + end; + except + end; + + //Then try for an all user installation + try + with TRegistry.Create(KEY_READ and not KEY_NOTIFY) do + try + RootKey := HKEY_LOCAL_MACHINE; + if OpenKey(Key, False) then begin + AllUserInstall := True; + if (LMajorVersion > 3) or ((LMajorVersion = 3) and (LMinorVersion >= 5)) then + InstallPath := ReadString(''); + Result := True; + end; + finally + Free; + end; + except + end; +end; + +{$ENDIF} + +procedure PythonVersionFromDLLName(LibName: string; out MajorVersion, MinorVersion: integer); +//Windows: 'c:\some\path\python310.dll' +//Linux: '/some/path/libpython3.10m.so' +const + cPython = 'python'; + DefaultMajor = 3; + DefaultMinor = 4; +var + NPos: integer; + ch: char; +begin + MajorVersion:= DefaultMajor; + MinorVersion:= DefaultMinor; + LibName:= LowerCase(ExtractFileName(LibName)); //strip path + NPos:= Pos(cPython, LibName); + if NPos=0 then exit; + Inc(NPos, Length(cPython)); + if NPos>Length(LibName) then exit; + ch:= LibName[NPos]; + case ch of + '2'..'5': //support major versions 2...5 + MajorVersion:= StrToIntDef(ch, DefaultMajor); + else + exit; + end; + Delete(LibName, 1, NPos); + if LibName='' then exit; + case LibName[1] of + '.': //Unix name with dot + Delete(LibName, 1, 1); + '0'..'9': //Windows name w/o dot + begin end; + else //unknown char after major version + exit; + end; + //strip file extension and handle 'libpython3.10m.so' + for NPos:= 1 to Length(LibName) do + begin + case LibName[NPos] of + '.', 'a'..'z': + begin + SetLength(LibName, NPos-1); + Break + end; + end; + end; + //the rest is minor version number '0'...'999' + MinorVersion:= StrToIntDef(LibName, DefaultMinor); +end; + +function PythonVersionFromRegVersion(const ARegVersion: string; + out AMajorVersion, AMinorVersion: integer): boolean; +var + LSepPos: integer; +begin + //RegVersion supported format: [x.x or x.xx or x[..].x[..]] + LSepPos := Pos('.', ARegVersion); + AMajorVersion := StrToIntDef(Copy(ARegVersion, 1, LSepPos - 1), 0); + AMinorVersion := StrToIntDef(Copy(ARegVersion, LSepPos + 1, Length(ARegVersion) - LSepPos), 0); + + Result := (AMajorVersion > 0) and (AMinorVersion > 0); +end; + +function PyStatus_Exception(const APyStatus: PyStatus): Boolean; +begin + Result := APyStatus._type <> _PyStatus_TYPE_OK; +end; + +function StringToWCharTString(Str: string): WcharTString; +begin + {$IFDEF POSIX} + Result := UnicodeStringToUCS4String(UnicodeString(Str)); + {$ELSE} + Result := WcharTString(Str); + {$ENDIF} +end; + +{ TPyEngineAndGIL - Internal class for SafePythonEngine } + +type + TPyEngineAndGIL = class(TInterfacedObject, IPyEngineAndGIL) + private + fPythonEngine: TPythonEngine; + fThreadState: PPyThreadState; + fGILState: PyGILstate_STATE; + function GetPyEngine: TPythonEngine; + function GetThreadState: PPyThreadState; + public + constructor Create; + destructor Destroy; override; + end; + + +constructor TPyEngineAndGIL.Create; +begin + inherited Create; + fPythonEngine := GetPythonEngine; + fGILState := fPythonEngine.PyGILState_Ensure; + fThreadState := fPythonEngine.PyThreadState_Get; +end; + +destructor TPyEngineAndGIL.Destroy; +begin + fPythonEngine.PyGILState_Release(fGILState); + inherited; +end; + +function TPyEngineAndGIL.GetPyEngine: TPythonEngine; +begin + Result := fPythonEngine; +end; + +function TPyEngineAndGIL.GetThreadState: PPyThreadState; +begin + Result := fThreadState; +end; + +{ SafePythonEngine } +function SafePyEngine: IPyEngineAndGIL; +begin + Result := TPyEngineAndGIL.Create +end; + + + +{$IFNDEF FPC} + +{ TAnonymousPythonThread } + +type + TAnonymousPythonThread = class(TPythonThread) + private + fTerminateProc : TProc; + fExecuteProc : TProc; + procedure DoTerminate; override; + public + procedure ExecuteWithPython; override; + constructor Create(ExecuteProc : TProc; TerminateProc : TProc = nil; + Suspended: Boolean = False; AThreadExecMode : TThreadExecMode = emNewState); + end; + +constructor TAnonymousPythonThread.Create(ExecuteProc : TProc; TerminateProc : TProc; + Suspended: Boolean; AThreadExecMode : TThreadExecMode); +begin + inherited Create(Suspended); + fExecuteProc := ExecuteProc; + fTerminateProc := TerminateProc; + FreeOnTerminate := True; + ThreadExecMode := AThreadExecMode; +end; + +procedure TAnonymousPythonThread.ExecuteWithPython; +begin + if Assigned(fExecuteProc) then + try + fExecuteProc(); + except + end; +end; + +procedure TAnonymousPythonThread.DoTerminate; +// Use Thread.Queue to run the TerminateProc in the main thread +// Could use Synchronize instead, but such calls better be avoided +var + TerminateProc: TProc; +begin + TerminateProc := fTerminateProc; // to keep fTerminateProc alive at destruction + if Assigned(TerminateProc) then + TThread.Queue(nil, procedure + begin + TerminateProc(); + end); +end; + + +{ InternalThreadPythonExec } + +procedure ThreadPythonExec(ExecuteProc : TProc; TerminateProc : TProc; + WaitToFinish: Boolean; ThreadExecMode : TThreadExecMode); +var + Thread: TAnonymousPythonThread; +begin + if GetCurrentThreadId <> MainThreadID then + raise Exception.Create(SThreadPythonExec); + Thread := TAnonymousPythonThread.Create(ExecuteProc, TerminateProc, WaitToFinish, ThreadExecMode); + if WaitToFinish then + begin + Thread.FreeOnTerminate := False; + Thread.Start; + Thread.WaitFor; // Note that it calls CheckSyncrhonize + Thread.Free; + end; +end; + +{$ENDIF FPC} + +end. + diff --git a/Source/PythonEngine_mX5.xml b/Source/PythonEngine_mX5.xml new file mode 100644 index 00000000..9dc472c4 --- /dev/null +++ b/Source/PythonEngine_mX5.xml @@ -0,0 +1,18560 @@ + + + + ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// + + + + $1FD4DF + + + + + + + + + + + + + + + $7 + + + + + $A + + + + + $A + + + + + $A + + + + + $1 + + + + + $2 + + + + + $10 + + + + + $20 + + + + + $40 + + + + + $1 + + + + + $2 + + + + + $4 + + + + + $8 + + + + + $0 + + + + + $1 + + + + + $2 + + + + + $3 + + + + + $4 + + + + + $5 + + + + + + pyLT + + + + + pyLE + + + + + pyEQ + + + + + pyNE + + + + + pyGT + + + + + pyGE + + + + + + + + + + + + + + + + + + + + $200 + + + + + $400 + + + + + $1000 + + + + + $2000 + + + + + $4000 + + + + + $800 + + + + + $20000 + + + + + $40000 + + + + + $80000 + + + + + $100000 + + + + + $1000000 + + + + + $2000000 + + + + + $4000000 + + + + + $8000000 + + + + + $10000000 + + + + + $20000000 + + + + + $40000000 + + + + + $80000000 + + + + + $40400 + + + + + tpfHeapType + + + + + tpfBaseType + + + + + tpfReady + + + + + tpfReadying + + + + + tpfHaveGC + + + + + tpVectorCall + + + + + tpMethodDescriptor + + + + + tpHaveVersionTag + + + + + tpValidVersionTag + + + + + tpIsAbstract + + + + + tpLongSubclass + + + + + tpListSubClass + + + + + tpTupleSubclass + + + + + tpBytesSubclass + + + + + tpBaseExcSubclass + + + + + tpTypeSubclass + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [tpfBaseType,tpHaveVersionTag] + + + + + $100 + + + + + $101 + + + + + $102 + + + + + $0 + + + + + $1 + + + + + $2 + + + + + $4 + + + + + $0 + + + + + $1 + + + + + $2 + + + + + $3 + + + + + $4 + + + + + $5 + + + + + $6 + + + + + $7 + + + + + $8 + + + + + $9 + + + + + $A + + + + + $B + + + + + $C + + + + + $D + + + + + $10 + + + + + $1 + + + + + $1 + + + + + $2 + + + + + $4 + + + + + $6 + + + + + mtShort + + + + + mtInt + + + + + mtLong + + + + + mtFloat + + + + + mtDouble + + + + + mtString + + + + + mtObject + + + + + mtChar + + + + + mtByte + + + + + mtUByte + + + + + mtUShort + + + + + mtUInt + + + + + mtULong + + + + + mtStringInplace + + + + + mtObjectEx + + + + + mfDefault + + + + + mfReadOnly + + + + + mfReadRestricted + + + + + mfWriteRestricted + + + + + mfRestricted + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $40 + + + + + $0 + + + + + $1 + + + + + $4 + + + + + $8 + + + + + $18 + + + + + $38 + + + + + $58 + + + + + $98 + + + + + $118 + + + + + $9 + + + + + $8 + + + + + $19 + + + + + $18 + + + + + $1D + + + + + $1C + + + + + $11D + + + + + $11C + + + + + $100 + + + + + $200 + + + + + $D + + + + + $A + + + + + $9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $400 + + + + + $4 + + + + + $6 + + + + + $A + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $0 + + + + + $1 + + + + + $2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $0 + + + + + $1 + + + + + + $0 + + + + + $1 + + + + + $2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $3E8 + + + + + $100 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This constructor creates new string list with specified QuoteChar + and Delimiter property values. + + + + + + + + + + + This constructor creates new string list with specified QuoteChar, + Delimiter and Options property values. + + + + + + + + + + + + This constructor creates new string list with specified Duplicates, + Sorted and CaseSensitive property values. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dcmToTuple + + + + + dcmToDatetime + + + + + pfDebug + + + + + pfInteractive + + + + + pfNoSite + + + + + pfOptimize + + + + + pfVerbose + + + + + pfFrozen + + + + + pfIgnoreEnvironment + + + + + pfNoUserSiteDirectory + + + + + pfDontWriteBytecode + + + + + pfIsolated + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dcmToTuple + + + + + [] + + + + + etString + + + + + etClass + + + + + bsGetAttr + + + + + bsSetAttr + + + + + bsRepr + + + + + bsCompare + + + + + bsHash + + + + + bsStr + + + + + bsGetAttrO + + + + + bsSetAttrO + + + + + bsCall + + + + + bsTraverse + + + + + bsClear + + + + + bsRichCompare + + + + + bsIter + + + + + bsIterNext + + + + + bsBuffer + + + + + nsAdd + + + + + nsSubtract + + + + + nsMultiply + + + + + nsRemainder + + + + + nsDivmod + + + + + nsPower + + + + + nsNegative + + + + + nsPositive + + + + + nsAbsolute + + + + + nsInvert + + + + + nsLShift + + + + + nsRShift + + + + + nsAnd + + + + + nsXor + + + + + nsOr + + + + + nsInt + + + + + nsFloat + + + + + nsFloorDivide + + + + + nsTrueDivide + + + + + nsMatrixMultiply + + + + + nsBool + + + + + nsInplaceAdd + + + + + nsInplaceSubtract + + + + + nsInplaceMultiply + + + + + nsInplaceRemainder + + + + + nsInplacePower + + + + + nsInplaceLShift + + + + + nsInplaceRShift + + + + + nsInplaceAnd + + + + + nsInplaceXor + + + + + nsInplaceOr + + + + + nsInplaceFloorDivide + + + + + nsInplaceTrueDivide + + + + + nsInplaceMatrixMultiply + + + + + ssLength + + + + + ssConcat + + + + + ssRepeat + + + + + ssItem + + + + + ssAssItem + + + + + ssContains + + + + + ssInplaceConcat + + + + + ssInplaceRepeat + + + + + msLength + + + + + msSubscript + + + + + msAssSubscript + + + + + emNewState + + + + + emNewInterpreter + + + + + emNewInterpreterOwnGIL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nil + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <string> + + + + + + + + + + + + <string> + + + + + + + + + + + + + + <string> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <string> + + + + + + + + + + <string> + + + + + + + + + + + + <string> + + + + + + + + + + nil + + + + + nil + + + + + + + + + + + + <string> + + + + + + + + + + <string> + + + + + + + + + + + <string> + + + + + + + + + + + <string> + + + + + + + + + + + + + <string> + + + + + + + + + + + + + <string> + + + + + + + + + + + <string> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + //////////////////////////////////// + + + + + + + + + + + Type + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ///////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /////////////////////////// + + + + + + + + + + + + + + ////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + + + + + + + + + + True + + + + + + + + + + + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nil + + + + + False + + + + + emNewState + + + + + diff --git a/Source/PythonVersions_class.pas b/Source/PythonVersions_class.pas new file mode 100644 index 00000000..8e4fd2e3 --- /dev/null +++ b/Source/PythonVersions_class.pas @@ -0,0 +1,540 @@ +{----------------------------------------------------------------------------- + Unit Name: PythonVersions + Author: Kiriakos + Date: PyScripter + Purpose: Discover and get info about Python versions + Part of the Python for Delphi library + + History: convert record to class cause scripts +-----------------------------------------------------------------------------} + +unit PythonVersions; + +interface +Uses + Classes; + +type + + TPythonVersion = class (TObject) //record + private + FDisplayName: string; + FHelpFile: string; + fSysArchitecture : string; + function GetDLLName: string; + function ExpectedArchitecture:string; + function GetIsPython3K: Boolean; + function GetHelpFile: string; + function GetDisplayName: string; + function GetApiVersion: integer; + function GetSysArchitecture: string; + function GetPythonExecutable: string; + public + IsRegistered: Boolean; + IsAllUsers: Boolean; + SysVersion: string; + Version: string; + DLLPath: string; + InstallPath: string; + PythonPath: string; + //constructor Create; override; + function Is_venv: Boolean; + function Is_virtualenv: Boolean; + function Is_conda: Boolean; + procedure AssignTo(PythonEngine: TPersistent); + property PythonExecutable: string read GetPythonExecutable; + property DLLName: string read GetDLLName; + property SysArchitecture: string read GetSysArchitecture; + property IsPython3K: Boolean read GetIsPython3K; + property HelpFile: string read GetHelpFile write FHelpFile; + property DisplayName: string read GetDisplayName write FDisplayName; + property ApiVersion: integer read GetApiVersion; + end; + + TPythonVersions = array of TPythonVersion; + + (* + Compares two Version strings and returns -1, 0, 1 depending on result + The function result has the semantics of Delphi compare functions + -1: A is bigger (newer), 0: equal versions, 1: B is bigger (newer) + *) + function CompareVersions(A, B : string) : Integer; + + + {$IFDEF MSWINDOWS} + (* Checks whether an executable was compiled for X64 *) + function IsEXEx64(const EXEName: string): Boolean; + (* Checks whether a DLL was compiled for X64 *) + function Isx64(const FileName: string): Boolean; + (* Checks whether a Python version is registered and returns the related info *) + function GetRegisteredPythonVersion(SysVersion: string; + out PythonVersion: TPythonVersion): Boolean; + (* Returns all registered Python versions *) + function GetRegisteredPythonVersions : TPythonVersions; + (* Returns the highest numbered registered Python version *) + function GetLatestRegisteredPythonVersion(out PythonVersion: TPythonVersion): Boolean; + function PythonVersionFromPath(const Path: string; out PythonVersion: TPythonVersion; + AcceptVirtualEnvs: Boolean = True): Boolean; + {$ENDIF} + +implementation + +Uses + {$IFDEF MSWINDOWS} + Windows, + Registry, + {$ENDIF} + SysUtils, + Math, + PythonEngine; + +{ TPythonVersion } + +function TPythonVersion.GetDLLName: string; +begin + {$IFDEF MSWINDOWS} + Result := SysVersion; + Delete(Result, 2, 1); + Result := 'python' + Result + '.dll'; + {$ELSE} + Result := 'libpython' + SysVersion + '.so'; + {$ENDIF} +end; + +function TPythonVersion.ExpectedArchitecture: string; +begin + Result := ''; + {$IFDEF CPUX64} + Result := '64bit'; + {$ENDIF} + {$IFDEF CPU64} + Result := '64bit'; + {$ENDIF} + {$IFDEF CPU64bits} + Result := '64bit'; + {$ENDIF} + if Result = '' then + Result := '32bit'; +end; + +procedure TPythonVersion.AssignTo(PythonEngine: TPersistent); +begin + if PythonEngine is TPythonEngine then + begin + TPythonEngine(PythonEngine).UseLastKnownVersion := False; + TPythonEngine(PythonEngine).RegVersion := SysVersion; + TPythonEngine(PythonEngine).DllName := DLLName; + TPythonEngine(PythonEngine).DllPath := DLLPath; + TPythonEngine(PythonEngine).APIVersion := ApiVersion; + if Is_venv then begin + TPythonEngine(PythonEngine).VenvPythonExe := PythonExecutable; + TPythonEngine(PythonEngine).SetPythonHome(DLLPath); + end else if not IsRegistered or Is_conda then + { + Not sure why but PythonHome needs to be set even for + registered conda distributions + Note also that for conda distributions to work properly, + you need to add Format('%s;%0:s\Library\bin;', [Version.InstallPath] + to your Windows path if it is not there already. + } + TPythonEngine(PythonEngine).SetPythonHome(InstallPath); + end; +end; + +function TPythonVersion.GetApiVersion: integer; +begin + if CompareVersions(SysVersion, '2.4') < 0 then + Result := 1013 + else + Result := 1012; +end; + +function TPythonVersion.GetDisplayName: string; +Var + FormatStr: string; +begin + if FDisplayName = '' then + begin + if Is_conda then + FormatStr := 'Conda %s (%s)' + else + FormatStr := 'Python %s (%s)'; + if Is_virtualenv then + FormatStr := FormatStr + ' -virtualenv' + else if Is_venv then + FormatStr := FormatStr + ' -venv'; + + FDisplayName := Format(FormatStr, [SysVersion, SysArchitecture]); + end; + Result := FDisplayName; +end; + +function TPythonVersion.GetHelpFile: string; +var + PythonHelpFilePath: string; + Res: Integer; + SR: TSearchRec; +begin + Result := FHelpFile; + // for unregistered Python + if (Result = '') and (InstallPath <> '') then + begin + PythonHelpFilePath := InstallPath + '\Doc\python*.chm'; + Res := FindFirst(PythonHelpFilePath, faAnyFile, SR); + if Res = 0 then + Result := InstallPath + '\Doc\' + SR.Name; + FindClose(SR); + end; +end; + +function TPythonVersion.GetIsPython3K: Boolean; +begin + try + Result := StrToInt(SysVersion[1]) >= 3; + except + Result := False; + end; +end; + +function TPythonVersion.GetPythonExecutable: string; +begin + Result := IncludeTrailingPathDelimiter(InstallPath) + 'python.exe'; + if not FileExists(Result) then begin + Result := IncludeTrailingPathDelimiter(InstallPath) + 'Scripts' + PathDelim + 'python.exe'; + if not FileExists(Result) then Result := ''; + end; +end; + +function TPythonVersion.GetSysArchitecture: string; +begin + Result := fSysArchitecture; + if Result = '' then + Result := 'Unknown platform'; +end; + +function TPythonVersion.Is_conda: Boolean; +begin + Result := DirectoryExists(IncludeTrailingPathDelimiter(InstallPath) + 'conda-meta'); +end; + +function TPythonVersion.Is_venv: Boolean; +{ + Check weather this is python venv folder introduced in python 3.5 + Note: venv is different from virtualenv +} +begin + Result := not IsRegistered and (InstallPath <> DLLPath) and + FileExists(IncludeTrailingPathDelimiter(InstallPath) + 'pyvenv.cfg'); +end; + +function TPythonVersion.Is_virtualenv: Boolean; +begin + Result := Is_venv and FileExists(IncludeTrailingPathDelimiter(InstallPath) + 'Scripts' + PathDelim + DLLName); +end; + +function CompareVersions(A, B : string) : Integer; + + function GetNextNumber(var Version: string): Integer; + var + P: Integer; + S: string; + begin + P := Pos('.', Version); + if P > 0 then + begin + S := Copy(Version, 1, P - 1); + Version := Copy(Version, P + 1, Length(Version) - P); + end + else + begin + S := Version; + Version := ''; + end; + Result := StrToIntDef(S, 0) + end; + +var + N1, N2: Integer; +begin + Result := 0; + repeat + N1 := GetNextNumber(A); + N2 := GetNextNumber(B); + if N2 > N1 then + begin + Result := 1; + Exit; + end + else + if N2 < N1 then + begin + Result := -1; + Exit; + end + until (A = '') and (B = ''); +end; + +{$IFDEF MSWINDOWS} + +const SCS_64BIT_BINARY = 6; + {$EXTERNALSYM SCS_64BIT_BINARY} + +function IsEXEx64(const EXEName: string): Boolean; +var + BinaryType: DWORD; +begin + Result := FileExists(EXEName) and + GetBinaryType(PChar(ExeName), Binarytype) and + (BinaryType = SCS_64BIT_BINARY); +end; + +function Isx64(const FileName: string): Boolean; +var + Strm : TFileStream; + Header: TImageDosHeader; + ImageNtHeaders: TImageNtHeaders; +begin + Strm := TFileStream.Create(FileName, fmOpenRead); + try + Strm.ReadBuffer(Header, SizeOf(Header)); + if (Header.e_magic <> IMAGE_DOS_SIGNATURE) or (Header._lfanew = 0) then begin + result:= false; + exit + end; + //Exit(False); + Strm.Position := Header._lfanew; + Strm.ReadBuffer(ImageNtHeaders, SizeOf(ImageNtHeaders)); + if ImageNtHeaders.Signature <> IMAGE_NT_SIGNATURE then begin + result:= false; + exit + end; + Result := ImageNtHeaders.FileHeader.Machine <> IMAGE_FILE_MACHINE_I386; + finally + Strm.Free; + end; +end; + +function GetRegisteredPythonVersion(SysVersion: string; + out PythonVersion: TPythonVersion): Boolean; + // Python provides for All user and Current user installations + // All User installations place the Python DLL in the Windows System directory + // and write registry info to HKEY_LOCAL_MACHINE + // Current User installations place the DLL in the install path and + // the registry info in HKEY_CURRENT_USER. + // Hence, for Current user installations we need to try and find the install path + // since it may not be on the system path. + + // The above convension was changed in Python 3.5. Now even for all user + // installations the dll is located at the InstallPath. + // Also from version 3.5 onwards 32 bit version have a suffix -32 e.g. "3.6-32" + // See also PEP 514 + + function ReadFromRegistry(Root: HKEY; key: string): Boolean; + begin + Result := False; + try + with TRegistry.Create(KEY_READ and not KEY_NOTIFY) do + try + RootKey := Root; + if OpenKey(Key + '\InstallPath', False) then begin + PythonVersion.InstallPath := ReadString(''); + if PythonVersion.IsAllUsers and (CompareVersions(SysVersion, '3.5') > 0) then + PythonVersion.DLLPath := '' + else + PythonVersion.DLLPath := PythonVersion.InstallPath; + CloseKey; + end; + Result := (PythonVersion.InstallPath <> '') and + DirectoryExists(ExcludeTrailingPathDelimiter(PythonVersion.InstallPath)); + if not Result then Exit; + + if OpenKey(Key, False) then begin + PythonVersion.DisplayName := ReadString('DisplayName'); + PythonVersion.Version := ReadString('Version'); + PythonVersion.fSysArchitecture := ReadString('SysArchitecture'); + CloseKey; + end; + if OpenKey(Key + '\PythonPath', False) then begin + PythonVersion.PythonPath := ReadString(''); + CloseKey; + end; + if OpenKey(Key + '\Help\Main Python Documentation', False) then begin + PythonVersion.HelpFile := ReadString(''); + CloseKey; + end; + finally + Free; + end; + except + end; + + end; + +var + key: string; + VersionSuffix: string; + APythonVersion: TPythonVersion; +begin + // Initialize PythohVersion + APythonVersion:= TPythonVersion.create; + //PythonVersion:= TPythonVersion.create; + Finalize(PythonVersion); + //PythonVersion:= TPythonVersion.create; + //FillChar(PythonVersion, SizeOf(TPythonVersion), 0); + + VersionSuffix := ''; + {$IFDEF CPUX86} + if CompareVersions(SysVersion, '3.5') <= 0 then + VersionSuffix := '-32'; + {$ENDIF} + key := Format('\Software\Python\PythonCore\%s%s', [SysVersion, VersionSuffix]); + + + PythonVersion.SysVersion := SysVersion; + // First try HKEY_CURRENT_USER as per PEP514 + PythonVersion.IsAllUsers := False; + Result := ReadFromRegistry(HKEY_CURRENT_USER, key); + + //Then try for an all user installation + if not Result then begin + PythonVersion.IsAllUsers := True; + Result := ReadFromRegistry(HKEY_LOCAL_MACHINE, key); + if PythonVersion.fSysArchitecture = '' then + // for all user installations we can be sure. + /// But not for local user installations + PythonVersion.fSysArchitecture := PythonVersion.ExpectedArchitecture; + end; + + if Result and (PythonVersion.fSysArchitecture = '') then begin + // We need to check it is the proper platform + Result := PythonVersionFromPath(PythonVersion.InstallPath, APythonVersion); + if Result then + PythonVersion.fSysArchitecture := PythonVersion.ExpectedArchitecture; + end; + + PythonVersion.IsRegistered := Result; +end; + +function GetRegisteredPythonVersions : TPythonVersions; +Var + Count: Integer; + I: Integer; + PythonVersion : TPythonVersion; +begin + PythonVersion:= TPythonVersion.create; + Count := 0; + SetLength(Result, High(PYTHON_KNOWN_VERSIONS)); + for I := High(PYTHON_KNOWN_VERSIONS) downto 1 do + if GetRegisteredPythonVersion(PYTHON_KNOWN_VERSIONS[I].RegVersion, PythonVersion) then + begin + Result[Count] := PythonVersion; + Inc(Count); + end; + SetLength(Result, Count); +end; + +function GetLatestRegisteredPythonVersion(out PythonVersion: TPythonVersion): Boolean; +Var + I: Integer; +begin + for I := High(PYTHON_KNOWN_VERSIONS) downto 1 do + begin + Result := GetRegisteredPythonVersion(PYTHON_KNOWN_VERSIONS[I].RegVersion, PythonVersion); + if Result then break; + end; +end; + +function PythonVersionFromPath(const Path: string; out PythonVersion: TPythonVersion; + AcceptVirtualEnvs: Boolean = True): Boolean; + + function FindPythonDLL(APath : string): string; + Var + FindFileData: TWIN32FindData; + Handle : THandle; + DLLFileName: string; + begin + Result := ''; + Handle := FindFirstFile(PChar(APath+'\python??.dll'), FindFileData); + if Handle = INVALID_HANDLE_VALUE then Exit; // not python dll + DLLFileName:= FindFileData.cFileName; + // skip if python3.dll was found + if Length(DLLFileName) <> 12 then FindNextFile(Handle, FindFileData); + if Handle = INVALID_HANDLE_VALUE then Exit; + Windows.FindClose(Handle); + DLLFileName:= FindFileData.cFileName; + if Length(DLLFileName) = 12 then + Result := DLLFileName; + end; + + function GetVenvBasePrefix(InstallPath: string): string; + var + SL : TStringList; + begin + SL := TStringList.Create; + try + try + SL.LoadFromFile(IncludeTrailingPathDelimiter(InstallPath)+'pyvenv.cfg'); + Result := Trim(SL.Values['home']); + if Result = '' then + Result := Trim(SL.Values['home ']); + except + end; + finally + SL.Free; + end; + end; + +Var + DLLFileName: string; + DLLPath: string; + SysVersion: string; + BasePrefix: string; + I: integer; +begin + Result := False; + PythonVersion:= TPythonVersion.create; + Finalize(PythonVersion); + FillChar(PythonVersion, SizeOf(TPythonVersion), 0); + DLLPath := ExcludeTrailingPathDelimiter(Path); + + PythonVersion.InstallPath := DLLPath; + + DLLFileName := FindPythonDLL(DLLPath); + + if DLLFileName = '' then begin + if AcceptVirtualEnvs and PythonVersion.Is_venv then + begin + BasePrefix := GetVenvBasePrefix(PythonVersion.InstallPath); + if (BasePrefix <> '') and PythonVersionFromPath(BasePrefix, PythonVersion, False) then + begin + // Install path points to venv but the rest of the info is from base_prefix + PythonVersion.InstallPath := ExcludeTrailingPathDelimiter(Path); + Result := True; + end; + end; + Exit; + end; + + // check if same platform + try + if {$IFDEF CPUX64}not {$ENDIF}IsEXEx64(DLLPath+'\python.exe') then Exit; + except + Exit; + end; + PythonVersion.DLLPath := DLLPath; + + SysVersion := SysVersionFromDLLName(DLLFileName); + + PythonVersion.SysVersion := SysVersion; + PythonVersion.fSysArchitecture := PythonVersion.ExpectedArchitecture; + + for I := High(PYTHON_KNOWN_VERSIONS) downto 1 do + if PYTHON_KNOWN_VERSIONS[I].RegVersion = SysVersion then begin + Result := True; + break; + end; +end; + +{$ENDIF} + +end. diff --git a/Source/VerInfo.pas b/Source/VerInfo.pas new file mode 100644 index 00000000..f5687f59 --- /dev/null +++ b/Source/VerInfo.pas @@ -0,0 +1,438 @@ +{*******************************************************} +{ } +{ Delphi VCL Extensions (RX) } +{ } +{ Copyright (c) 1995, 1996 AO ROSNO } +{ } +{*******************************************************} + +unit VerInfo; + +{ Working with VERSIONINFO resourse type } + +interface + +{I RX.INC} + +{$IFDEF WIN32} +uses Windows; +{$ELSE} +uses Ver; +{$ENDIF} + +type + TVersionLanguage = (vlArabic, vlBulgarian, vlCatalan, vlTraditionalChinese, + vlCzech, vlDanish, vlGerman, vlGreek, vlUSEnglish, vlCastilianSpanish, + vlFinnish, vlFrench, vlHebrew, vlHungarian, vlIcelandic, vlItalian, + vlJapanese, vlKorean, vlDutch, vlNorwegianBokmel, vlPolish, + vlBrazilianPortuguese, vlRhaetoRomanic, vlRomanian, vlRussian, + vlCroatoSerbian, vlSlovak, vlAlbanian, vlSwedish, vlThai, vlTurkish, + vlUrdu, vlBahasa, vlSimplifiedChinese, vlSwissGerman, vlUKEnglish, + vlMexicanSpanish, vlBelgianFrench, vlSwissItalian, vlBelgianDutch, + vlNorwegianNynorsk, vlPortuguese, vlSerboCroatian, vlCanadianFrench, + vlSwissFrench, vlUnknown); + + TVersionCharSet = (vcsASCII, vcsJapan, vcsKorea, vcsTaiwan, vcsUnicode, + vcsEasternEuropean, vcsCyrillic, vcsMultilingual, vcsGreek, vcsTurkish, + vcsHebrew, vcsArabic, vcsUnknown); + +{$IFNDEF WIN32} + PVSFixedFileInfo = Pvs_FixedFileInfo; + DWORD = Longint; +{$ENDIF} + + TLongVersion = record + case Integer of + 0: (All: array[1..4] of Word); + 1: (MS, LS: LongInt); + end; + +{ TVersionInfo } + + TVersionInfo = class(TObject) + private + FFileName: PChar; + FValid: Boolean; + FSize: DWORD; + FBuffer: PChar; + FHandle: DWORD; + procedure ReadVersionInfo; + function GetFileName: string; + procedure SetFileName(const Value: string); + function GetTranslation: Pointer; + function GetFixedFileInfo: PVSFixedFileInfo; + function GetFileLongVersion: TLongVersion; + function GetProductLongVersion: TLongVersion; + function GetTranslationString: string; + function GetComments: string; + function GetCompanyName: string; + function GetFileDescription: string; + function GetFileVersion: string; + function GetVersionNum: Longint; + function GetInternalName: string; + function GetLegalCopyright: string; + function GetLegalTrademarks: string; + function GetOriginalFilename: string; + function GetProductVersion: string; + function GetProductName: string; + function GetSpecialBuild: string; + function GetPrivateBuild: string; + function GetVersionLanguage: TVersionLanguage; + function GetVersionCharSet: TVersionCharSet; + function GetVerFileDate: TDateTime; + public + constructor Create(const AFileName: string); + destructor Destroy; override; + function GetVerValue(const VerName: string): string; + property FileName: string read GetFileName write SetFileName; + property Valid: Boolean read FValid; + property FixedFileInfo: PVSFixedFileInfo read GetFixedFileInfo; + property FileLongVersion: TLongVersion read GetFileLongVersion; + property ProductLongVersion: TLongVersion read GetProductLongVersion; + property Translation: Pointer read GetTranslation; + property VersionLanguage: TVersionLanguage read GetVersionLanguage; + property VersionCharSet: TVersionCharSet read GetVersionCharSet; + property VersionNum: Longint read GetVersionNum; + property Comments: string read GetComments; + property CompanyName: string read GetCompanyName; + property FileDescription: string read GetFileDescription; + property FileVersion: string read GetFileVersion; + property InternalName: string read GetInternalName; + property LegalCopyright: string read GetLegalCopyright; + property LegalTrademarks: string read GetLegalTrademarks; + property OriginalFilename: string read GetOriginalFilename; + property ProductVersion: string read GetProductVersion; + property ProductName: string read GetProductName; + property SpecialBuild: string read GetSpecialBuild; + property PrivateBuild: string read GetPrivateBuild; + property Values[const Name: string]: string read GetVerValue; + property VerFileDate: TDateTime read GetVerFileDate; + end; + +function LongVersionToString(const Version: TLongVersion): string; +function StringToLongVersion(const Str: string): TLongVersion; + +{ Installation utility routine } + +function OkToWriteModule(ModuleName: string; NewVer: Longint): Boolean; + +implementation + +{$IFDEF WIN32} +uses SysUtils{, FileUtil, DateUtil}; +{$ELSE} +uses WinTypes, WinProcs, SysUtils, FileUtil, DateUtil; +{$ENDIF} + +const +{$IFDEF WIN32} + NullDate: TDateTime = {-693594} 0; +{$ELSE} + NullDate: TDateTime = 0; +{$ENDIF} + +function MemAlloc(Size: Longint): Pointer; +{$IFDEF WIN32} +begin + GetMem(Result, Size); +end; +{$ELSE} +var + Handle: THandle; +begin + if Size < 65535 then GetMem(Result, Size) + else begin + Handle := GlobalAlloc(HeapAllocFlags, Size); + Result := GlobalLock(Handle); + end; +end; +{$ENDIF WIN32} + +const + LanguageValues: array[TVersionLanguage] of Word = ($0401, $0402, $0403, + $0404, $0405, $0406, $0407, $0408, $0409, $040A, $040B, $040C, $040D, + $040E, $040F, $0410, $0411, $0412, $0413, $0414, $0415, $0416, $0417, + $0418, $0419, $041A, $041B, $041C, $041D, $041E, $041F, $0420, $0421, + $0804, $0807, $0809, $080A, $080C, $0810, $0813, $0814, $0816, $081A, + $0C0C, $100C, $0000); + +const + CharacterSetValues: array[TVersionCharSet] of Integer = (0, 932, 949, 950, + 1200, 1250, 1251, 1252, 1253, 1254, 1255, 1256, -1); + +{ TVersionInfo } + +constructor TVersionInfo.Create(const AFileName: string); +begin + inherited Create; + FFileName := StrPCopy(StrAlloc(Length(AFileName) + 1), AFileName); + ReadVersionInfo; +end; + +destructor TVersionInfo.Destroy; +begin + if FBuffer <> nil then FreeMem(FBuffer, FSize); + StrDispose(FFileName); + inherited Destroy; +end; + +procedure TVersionInfo.ReadVersionInfo; +begin + FValid := False; + FSize := GetFileVersionInfoSize(FFileName, FHandle); + if FSize > 0 then + try + FBuffer := MemAlloc(FSize); + FValid := GetFileVersionInfo(FFileName, FHandle, FSize, FBuffer); + except + FValid := False; + raise; + end; +end; + +function TVersionInfo.GetFileName: string; +begin + Result := StrPas(FFileName); +end; + +procedure TVersionInfo.SetFileName(const Value: string); +begin + if FBuffer <> nil then FreeMem(FBuffer, FSize); + FBuffer := nil; + StrDispose(FFileName); + FFileName := StrPCopy(StrAlloc(Length(Value) + 1), Value); + ReadVersionInfo; +end; + +function TVersionInfo.GetTranslation: Pointer; +var +{$IFDEF WIN32} + Len: UINT; +{$ELSE} + Len: Cardinal; +{$ENDIF} +begin + if not (Valid and VerQueryValue(FBuffer, '\VarFileInfo\Translation', Result, Len)) then + Result := nil; +end; + +function TVersionInfo.GetTranslationString: string; +var + P: Pointer; +begin + Result := ''; + P := GetTranslation; + if P <> nil then Result := IntToHex(MakeLong(HiWord(Longint(P^)), LoWord(Longint(P^))), 8) + else Result := '040904E4'; +end; + +function TVersionInfo.GetVersionLanguage: TVersionLanguage; +var + P: Pointer; +begin + P := GetTranslation; + for Result := vlArabic to vlUnknown do + if LoWord(Longint(P^)) = LanguageValues[Result] then Break; +end; + +function TVersionInfo.GetVersionCharSet: TVersionCharSet; +var + P: Pointer; +begin + P := GetTranslation; + for Result := vcsASCII to vcsUnknown do + if HiWord(Longint(P^)) = CharacterSetValues[Result] then Break; +end; + +function TVersionInfo.GetFixedFileInfo: PVSFixedFileInfo; +var +{$IFDEF WIN32} + Len: UINT; +{$ELSE} + Len: Cardinal; +{$ENDIF} +begin + if Valid then VerQueryValue(FBuffer, '\', Pointer(Result), Len) + else Result := nil; +end; + +function TVersionInfo.GetProductLongVersion: TLongVersion; +begin + if FixedFileInfo <> nil then begin; + Result.MS := FixedFileInfo^.dwProductVersionMS; + Result.LS := FixedFileInfo^.dwProductVersionLS; + end else begin + Result.MS := 0; + Result.LS := 0; + end; +end; + +function TVersionInfo.GetFileLongVersion: TLongVersion; +begin + if FixedFileInfo <> nil then begin; + Result.MS := FixedFileInfo^.dwFileVersionMS; + Result.LS := FixedFileInfo^.dwFileVersionLS; + end else begin + Result.MS := 0; + Result.LS := 0; + end; +end; + +function TVersionInfo.GetVersionNum: Longint; +begin + if Valid then Result := FixedFileInfo^.dwFileVersionMS + else Result := 0; +end; + +function TVersionInfo.GetVerValue(const VerName: string): string; +var + szName: array[0..255] of Char; + Value: Pointer; +{$IFDEF WIN32} + Len: UINT; +{$ELSE} + Len: Cardinal; +{$ENDIF} +begin + Result := ''; + if Valid then begin + StrPCopy(szName, '\StringFileInfo\' + GetTranslationString + '\' + VerName); + if VerQueryValue(FBuffer, szName, Value, Len) then + Result := StrPas(PChar(Value)); + end; +end; + +function TVersionInfo.GetComments: string; +begin + Result := GetVerValue('Comments'); +end; + +function TVersionInfo.GetCompanyName: string; +begin + Result := GetVerValue('CompanyName'); +end; + +function TVersionInfo.GetFileDescription: string; +begin + Result := GetVerValue('FileDescription'); +end; + +function TVersionInfo.GetFileVersion: string; +begin + Result := GetVerValue('FileVersion'); + if (Result = '') and Valid then + Result := LongVersionToString(FileLongVersion); +end; + +function TVersionInfo.GetInternalName: string; +begin + Result := GetVerValue('InternalName'); +end; + +function TVersionInfo.GetLegalCopyright: string; +begin + Result := GetVerValue('LegalCopyright'); +end; + +function TVersionInfo.GetLegalTrademarks: string; +begin + Result := GetVerValue('LegalTrademarks'); +end; + +function TVersionInfo.GetOriginalFilename: string; +begin + Result := GetVerValue('OriginalFilename'); +end; + +function TVersionInfo.GetProductVersion: string; +begin + Result := GetVerValue('ProductVersion'); + if (Result = '') and Valid then + Result := LongVersionToString(ProductLongVersion); +end; + +function TVersionInfo.GetProductName: string; +begin + Result := GetVerValue('ProductName'); +end; + +function TVersionInfo.GetSpecialBuild: string; +begin + Result := GetVerValue('SpecialBuild'); +end; + +function TVersionInfo.GetPrivateBuild: string; +begin + Result := GetVerValue('PrivateBuild'); +end; + +function FileDateTime(const FileName: string): System.TDateTime; +var + Age: Longint; +begin + Age := FileAge(FileName); + if Age = -1 then + Result := NullDate + else + Result := FileDateToDateTime(Age); +end; + +function TVersionInfo.GetVerFileDate: TDateTime; +begin + if FileExists(FileName) then + Result := FileDateTime(FileName) + else Result := NullDate; +end; + +{ Long version string routines } + +function LongVersionToString(const Version: TLongVersion): string; +begin + with Version do + Result := Format('%d.%d.%d.%d', [All[2], All[1], All[4], All[3]]); +end; + +function StringToLongVersion(const Str: string): TLongVersion; +var + Sep: Integer; + Tmp, Fragment: string; + I: Byte; +begin + Tmp := Str; + for I := 1 to 4 do begin + Sep := Pos('.', Tmp); + if Sep = 0 then Sep := Pos(',', Tmp); + if Sep = 0 then Fragment := Tmp + else begin + Fragment := Copy(Tmp, 1, Sep - 1); + Tmp := Copy(Tmp, Sep + 1, MaxInt); + end; + if Fragment = '' then Result.All[I] := 0 + else Result.All[I] := StrToInt(Fragment); + end; + I := Result.All[1]; + Result.All[1] := Result.All[2]; + Result.All[2] := I; + I := Result.All[3]; + Result.All[3] := Result.All[4]; + Result.All[4] := I; +end; + +{ Installation utility routines } + +function OkToWriteModule(ModuleName: string; NewVer: Longint): Boolean; +{ Return True if it's ok to overwrite ModuleName with NewVer } +begin + {Assume we should overwrite} + OkToWriteModule := True; + with TVersionInfo.Create(ModuleName) do begin + try + if Valid then {Should we overwrite?} + OkToWriteModule := NewVer > VersionNum; + finally + Free; + end; + end; +end; + +end. diff --git a/Source/XMLUtils.pas b/Source/XMLUtils.pas new file mode 100644 index 00000000..ff438443 --- /dev/null +++ b/Source/XMLUtils.pas @@ -0,0 +1,186 @@ +unit XMLUtils; + +interface + +uses + System.Classes, Winapi.msxml; + +type + TStoreFormStruct = record + Width: Integer; + Height: Integer; + Left: Integer; + Top: Integer; + Maximized: Boolean; + end; + +function GetArrayIndexByName(const AName: string; const Arr: array of string): Integer; +procedure StringsToXML(AStrings: TStrings; ANode: IXMLDOMNode); +procedure XMLToStrings(AStrings: TStrings; ANode: IXMLDOMNode); +procedure FormToXML(const AStore: TStoreFormStruct; ANode: IXMLDOMNode); +procedure XMLToForm(var AStore: TStoreFormStruct; ANode: IXMLDOMNode); +procedure SaveXMLToFile(const AFileName: string; ADomDoc: IXMLDOMDocument); +procedure AddCDataNodeName(const AName: string); + +implementation + +uses + SysUtils, JobConsts, Windows; + +const + CDataXMLFormat = ''; + XMLFormat = '' + + '' + + ' %s ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ''; + +var + CDataNodeNames: TStrings = nil; + +procedure AddCDataNodeName(const AName: string); +begin + if (CDataNodeNames = nil) then + begin + CDataNodeNames := TStringList.Create(); + end; + if (CDataNodeNames.IndexOf(AName) < 0) then + begin + CDataNodeNames.Add(AName); + end; +end; + +procedure SaveXMLToFile(const AFileName: string; ADomDoc: IXMLDOMDocument); + function GetXMLFormat: string; + var + i: Integer; + begin + Result := ''; + if (CDataNodeNames <> nil) then + begin + for i := 0 to CDataNodeNames.Count - 1 do + begin + Result := Result + #32 + Format(CDataXMLFormat, [CDataNodeNames[i]]); + end; + end; + Result := Format(XMLFormat, [Result]); + end; + +var + b: Boolean; + TransDoc, ResDoc: IXMLDOMDocument; +begin + TransDoc := CoDOMDocument.Create(); + ResDoc := CoDOMDocument.Create(); + TransDoc.loadXML(GetXMLFormat()); + try + ADomDoc.transformNodeToObject(TransDoc, ResDoc); + b := (ResDoc.xml <> ''); + except + b := False; + end; + if b then + begin + ResDoc.save(AFileName); + end else + begin + ADomDoc.save(AFileName); + end; +end; + +function GetArrayIndexByName(const AName: string; const Arr: array of string): Integer; +begin + for Result := Low(Arr) to High(Arr) do + begin + if (CompareText(Arr[Result], AName) = 0) then Exit; + end; + Result := -1; +end; + +procedure StringsToXML(AStrings: TStrings; ANode: IXMLDOMNode); +var + ChildNode: IXMLDOMNode; +begin + ChildNode := ANode.ownerDocument.createCDATASection(AStrings.Text); + ANode.appendChild(ChildNode); +end; + +procedure XMLToStrings(AStrings: TStrings; ANode: IXMLDOMNode); +begin + AStrings.Text := ANode.text; +end; + +procedure FormToXML(const AStore: TStoreFormStruct; ANode: IXMLDOMNode); +var + ChildNode: IXMLDOMNode; +begin + ChildNode := ANode.ownerDocument.createElement('Height'); + ANode.appendChild(ChildNode); + ChildNode.text := IntToStr(AStore.Height); + + ChildNode := ANode.ownerDocument.createElement('Width'); + ANode.appendChild(ChildNode); + ChildNode.text := IntToStr(AStore.Width); + + ChildNode := ANode.ownerDocument.createElement('Left'); + ANode.appendChild(ChildNode); + ChildNode.text := IntToStr(AStore.Left); + + ChildNode := ANode.ownerDocument.createElement('Top'); + ANode.appendChild(ChildNode); + ChildNode.text := IntToStr(AStore.Top); + + ChildNode := ANode.ownerDocument.createElement('Maximized'); + ANode.appendChild(ChildNode); + ChildNode.text := cStoreBoolean[AStore.Maximized]; +end; + +procedure XMLToForm(var AStore: TStoreFormStruct; ANode: IXMLDOMNode); +var + v: Integer; + ChildNode: IXMLDOMNode; +begin + ZeroMemory(@AStore, SizeOf(AStore)); + + ChildNode := ANode.selectSingleNode('Height'); + if ChildNode <> nil then + begin + AStore.Height := StrToIntDef(ChildNode.text, 0); + end; + + ChildNode := ANode.selectSingleNode('Width'); + if ChildNode <> nil then + begin + AStore.Width := StrToIntDef(ChildNode.text, 0); + end; + + ChildNode := ANode.selectSingleNode('Left'); + if ChildNode <> nil then + begin + AStore.Left := StrToIntDef(ChildNode.text, 0); + end; + + ChildNode := ANode.selectSingleNode('Top'); + if ChildNode <> nil then + begin + AStore.Top := StrToIntDef(ChildNode.text, 0); + end; + + ChildNode := ANode.selectSingleNode('Maximized'); + if ChildNode <> nil then + begin + v := GetArrayIndexByName(ChildNode.text, cStoreBoolean); + if (v > -1) then AStore.Maximized := Boolean(v); + end; +end; + +initialization + +finalization + CDataNodeNames.Free(); + +end. diff --git a/Source/cParameters.pas b/Source/cParameters.pas new file mode 100644 index 00000000..30e1b3f3 --- /dev/null +++ b/Source/cParameters.pas @@ -0,0 +1,975 @@ +{ + syn + Copyright © 2002, Danail Traichev. All rights reserved. + neum@developer.bg + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + The Original Code is cEdParam.pas, released Sun, 8 Sep 2002 03:44:18 UTC. + + The Initial Developer of the Original Code is Danail Traichev. + Portions created by Danail Traichev are Copyright © 2002 Danail Traichev. + All Rights Reserved. + + Contributor(s): . + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License Version 2 or later (the "GPL"), in which case + the provisions of the GPL are applicable instead of those above. + If you wish to allow use of your version of this file only under the terms + of the GPL and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the GPL. + If you do not delete the provisions above, a recipient may use your version + of this file under either the MPL or the GPL. + + You may retrieve the latest version of this file at the syn home page, + located at http://syn.sourceforge.net/ + + parameters related functions and classes + + $Id: cEdParam.pas,v 1.22 2004/03/02 13:20:33 seier Exp $ + + Simplified version for the purposes of PyScripter by Kiriakos Vlahos + +} + +unit cParameters; + +interface + +uses + Winapi.Windows, + System.UITypes, + System.Classes, + System.SysUtils, + Vcl.Dialogs, + Vcl.Controls; + +type + (* function, that returns value of a system parameter *) + TGetParameterProc = function : string; + + (* function, that will be replaced in texts with its value *) + TParameterFunction = function (const AParameters: string): string; + + (* function, that will return property value for given oobject *) + TObjectPropertyFunction = function (AObject: TObject;const AObjectName, + APropertyName: string): string; + + (* function, that will be called if parameter or modifier value is not found *) + TUnknownParameterFunction = function (Sender: TObject; const AName: string; + var AValue: string): Boolean of object; + + (* function, that will be called if object is not found *) + TUnknownObjectFunction = function (Sender: TObject; const AName: string; + var AObject: TObject): Boolean of object; + + (* function, that will be called if object property is not found *) + TUnknownPropertyFunction = function (Sender, AObject: TObject; + const AObjectName, APropertyName: string; + var AValue: string): Boolean of object; + + (* list of all parameters *) + TParameterList = class(TStringList) + private + FOnUnknownParameter: TUnknownParameterFunction; + FOnUnknownModifier: TUnknownParameterFunction; + FProperties: TStrings; + FObjectNames: TStrings; + FModifiers: TStrings; + FOnUnknownObject: TUnknownObjectFunction; + FOnUnknownProperty: TUnknownPropertyFunction; + FStartMask: string; + FStopMask: string; + FUsedParameters: TStrings; + function GetValue(const Name: string): string; + procedure SetModifiers(const Value: TStrings); + procedure SetObjectNames(const Value: TStrings); + procedure SetProperties(const Value: TStrings); + protected + procedure SkipParameter(var AText: PChar); + procedure SkipParameterValue(var AText: PChar; ASeparators: TSysCharSet); + function ReadParameterValue(var AText: PChar; ASeparators: TSysCharSet): string; + function ReadParameters(var AText: PChar): string; + function ReadCondition(var AText: PChar): Boolean; + procedure DoAddParameter(const AName, AValue: string; + GetProc: TGetParameterProc); + procedure DoChangeParameter(const AName, AValue: string; + GetProc: TGetParameterProc; CanAdd: Boolean); + procedure DoRemoveParameter(const AName: string); + property UsedParameters: TStrings read FUsedParameters; + public + constructor Create; + destructor Destroy; override; + procedure Assign(Source: TPersistent); override; + public + (* system parameters *) + procedure RegisterParameter(const AName, AValue: string; GetProc: TGetParameterProc); + procedure UnRegisterParameter(const AName: string); + procedure ChangeParameter(const AName, AValue: string; + GetProc: TGetParameterProc = nil; + CanAdd: Boolean = False); + property OnUnknownParameter: TUnknownParameterFunction + read FOnUnknownParameter write FOnUnknownParameter; + public + (* parameter modifiers *) + procedure RegisterModifier(const AName, Comment: string; AFunc: TParameterFunction); + procedure UnRegisterModifier(const AName: string); + property Modifiers: TStrings read FModifiers write SetModifiers; + property OnUnknownModifier: TUnknownParameterFunction + read FOnUnknownModifier write FOnUnknownModifier; + public + (* objects and their properties *) + procedure RegisterObject(const AName: string; AObject: TObject); + procedure UnRegisterObject(const AName: string); + procedure RegisterProperty(const AObjectName, APropertyName: string; + GetProc: TObjectPropertyFunction = nil); + procedure UnRegisterProperty(const AObjectName, APropertyName: string); + property ObjectNames: TStrings read FObjectNames write SetObjectNames; + property Properties: TStrings read FProperties write SetProperties; + property OnUnknownObject: TUnknownObjectFunction + read FOnUnknownObject write FOnUnknownObject; + property OnUnknownProperty: TUnknownPropertyFunction + read FOnUnknownProperty write FOnUnknownProperty; + public + (* parameter usage *) + function ReplaceInText(const AText: string): string; + function ReplaceInTextEx(const AText, AStartMask, AStopMask: string): string; + function EvaluteCondition(const ACondition: string): Boolean; + function CalcValue(const AParams: string): string; + function FindValue(const AName: string; var AValue: string): Boolean; + procedure ExtractParameters(const AText: string; AParams: TStrings); + procedure Split(AIndex: Integer; var AName, AValue: string; + DoCalc: Boolean = True); + function MakeParameter(const AName: string): string; + property StartMask: string read FStartMask write FStartMask; + property StopMask: string read FStopMask write FStopMask; + property Values[const Name: string]: string read GetValue; + end; + +(* returns string value for given property *) +function GetPropertyValue(AObject: TObject; + const AObjectName, APropertyName: string): string; + +(* adds markers for finding replaced text later *) +function SetMarkers(const AParameters: string): string; + +(* returns positions of the markers in the text *) +function FindMarkers(var AText: string; out Start, Stop: Integer): Boolean; + +(* clears markers, set before *) +procedure ClearMarkers(var AText: string); + +var + (* moment state of all parameters *) + Parameters: TParameterList; + +implementation + +uses + System.TypInfo, + System.Variants, + JvGnugettext, + StringResources, + uCommonFunctions, + JclStrings; + +const + WhiteSpaces: TSysCharSet = [#1..' ']; + +function GetPropertyValue(AObject: TObject; const AObjectName, + APropertyName: string): string; +(* returns string value for given property *) +var + AValue: Variant; +begin + AValue:= GetPropValue(AObject, APropertyName, True); + if VarIsNull(AValue) then begin + StyledMessageDlg(Format(_(SInvalidObjectProperty), + [AObjectName, APropertyName]), mtError, [mbOK], 0); + Abort; + end else Result:= AValue; +end; + +function SetMarkers(const AParameters: string): string; +(* adds markers for finding replaced text later *) +begin + Result:= Concat('$[>]', AParameters, '$[<]'); +end; + +function FindMarkers(var AText: string; out Start, Stop: Integer): Boolean; +(* returns positions of the markers in the text *) +begin + Start:= Pos('$[>]', AText); + Result:= Start > 0; + if Result then begin + Delete(AText, Start, 4); + Stop:= Pos('$[<]', Copy(AText, Start, MaxInt)); + if Stop > 0 then begin + Inc(Stop, Start - 1); + Delete(AText, Stop, 4); + end; + end; +end; + +procedure ClearMarkers(var AText: string); +(* clears markers, set before *) +var + T1, T2: Integer; +begin + while FindMarkers(AText, T1, T2) do ; +end; + +{ TParameterList } + +procedure TParameterList.Assign(Source: TPersistent); +begin + if Source is TParameterList then + with TParameterList(Source) do begin + inherited; + Self.FStartMask:= StartMask; + Self.FStopMask:= StopMask; + Self.Modifiers.Assign(FModifiers); + Self.ObjectNames.Assign(FObjectNames); + Self.Properties.Assign(FProperties); + Self.UsedParameters.Assign(FUsedParameters); + end + else inherited; +end; + +function TParameterList.CalcValue(const AParams: string): string; +(* calculates parameter value *) +var + P: PChar; +begin + P:= PChar(AParams); + Result:= ReadParameters(P); + (* check if we have something after parameter *) + if P^ <> #0 then begin + if StrIsLeft(P, PChar(StopMask)) then begin + Inc(P, Length(StopMask)); + if P^ = #0 then Exit; + end; + Result:= Result + ReplaceInText(P); + end; +end; + +procedure TParameterList.ChangeParameter(const AName, AValue: string; + GetProc: TGetParameterProc; CanAdd: Boolean); +(* changes system parameter value *) +begin + DoChangeParameter(AName, AValue, GetProc, CanAdd); +end; + +constructor TParameterList.Create; + + function CreateSortedList: TStringList; + begin + Result:= TStringList.Create; + with Result do begin + Duplicates:= dupError; + Sorted:= True; + end; + end; + +begin + inherited; + FStartMask:= '$['; + FStopMask:= ']'; + FModifiers:= CreateSortedList; + FObjectNames:= CreateSortedList; + FProperties:= CreateSortedList; + FUsedParameters:= CreateSortedList; +end; + +destructor TParameterList.Destroy; +begin + FUsedParameters.Free; + FProperties.Free; + FObjectNames.Free; + FModifiers.Free; + inherited; +end; + +procedure TParameterList.DoAddParameter(const AName, + AValue: string; GetProc: TGetParameterProc); +begin + AddObject(Concat(AName, '=', AValue), TObject(@GetProc)); +end; + +procedure TParameterList.DoChangeParameter(const AName, AValue: string; + GetProc: TGetParameterProc; CanAdd: Boolean); +var + i, L : Integer; + Param: string; +begin + Param:= AName + '='; + L:= Length(Param); + for i:= Count - 1 downto 0 do + if SameText(Param, Copy(Strings[i], 1, L)) then begin + Strings[i]:= Concat(AName, '=', AValue); + Objects[i]:= TObject(@GetProc); + Exit; + end; + if CanAdd then + AddObject(Concat(AName, '=', AValue), TObject(@GetProc)); +end; + +procedure TParameterList.DoRemoveParameter(const AName: string); +var + i, L: Integer; + Param: string; +begin + Param:= AName + '='; + L:= Length(Param); + for i:= Count - 1 downto 0 do + if SameText(Param, Copy(Strings[i], 1, L)) then begin + Delete(i); + Break; + end; +end; + +function TParameterList.EvaluteCondition(const ACondition: string): Boolean; +(* evalutes simple paramater condition *) +var + P: PChar; +begin + P:= PChar(ACondition); + Result:= ReadCondition(P); + if P^ <> #0 then begin + StyledMessageDlg(_(SInvalidConditionFormat), mtError, [mbOK], 0); + Abort; + end; +end; + +procedure TParameterList.ExtractParameters(const AText: string; + AParams: TStrings); +(* extracts parameters from AText to AParams *) +var + PParam: PChar; + AParam, AValue: string; + Delimiters: TSysCharSet; +begin + Delimiters:= []; + Include(Delimiters, AnsiChar(StartMask[1])); + Include(Delimiters, AnsiChar(StopMask[1])); + with AParams do try + BeginUpdate; + PParam:= PChar(AText); + repeat + PParam:= StrPos(PParam, PChar(StartMask)); + (* maybe parameter is found *) + if Assigned(PParam) then begin + Inc(PParam, Length(StartMask)); + (* we want only real parameters *) + AValue:= ''; + AParam:= StrGetToken(PParam, Delimiters + ['(', '-', '.', '=', '?'], [], ['''']); + if CharInSet(PChar(AParam)^, ['(', '''']) or CharInSet(PParam^, ['.', '=']) then + AParam:= ''; + (* skip to the end of block *) + SkipParameter(PParam); + if PParam^ = #0 then Exit; + (* get parameter values *) + if (AParam <> '') and (IndexOfName(AParam) < 0) then begin + try + FindValue(AParam, AValue); + except ; + end; + Add(Concat(AParam, '=', AValue)); + end; + Inc(PParam, Length(StopMask)); + end + until PParam = nil; + finally + EndUpdate; + end; +end; + +function TParameterList.FindValue(const AName: string; + var AValue: string): Boolean; +var + Temp: string; + i: Integer; +begin + i:= IndexOfName(AName); + Result:= I >= 0; + if Result then + Split(i, Temp, AValue, True); +end; + +function TParameterList.GetValue(const Name: string): string; +begin + if not FindValue(Name, Result) then + Result:= ''; +end; + +function TParameterList.MakeParameter(const AName: string): string; +begin + Result:= Concat(StartMask, AName, StopMask); +end; + +function TParameterList.ReadCondition(var AText: PChar): Boolean; +(* reads parameter condition and evalutes it *) +const + Signs: TSysCharSet = ['<', '>', '=']; + +(* evalutes simple paramater condition *) + + function CompareValue(ALeft, ARight: Extended): integer; + begin + if Abs(ALeft - ARight) < 0.0000001 then + Result:= 0 + else if ALeft < ARight then + Result:= -1 + else Result:= 1; + end; + +var + i: Integer; + ALeft, AOperation, ARight: string; +begin + if AText^ = '(' then Inc(AText); + while CharInSet(AText^, WhiteSpaces) do Inc(AText); + (* read left value *) + ALeft:= ReadParameterValue(AText, Signs + [')']); + while CharInSet(AText^, WhiteSpaces) do Inc(AText); + (* read operation *) + if CharInSet(AText^, Signs) then begin + if CharInSet((AText + 1)^, Signs) then begin + SetString(AOperation, AText, 2); + Inc(AText, 2); + end + else begin + AOperation:= AText^; + Inc(AText); + end; + while CharInSet(AText^, WhiteSpaces) do Inc(AText); + (* read right value *) + ARight:= ReadParameterValue(AText, [')']); + end + else begin + if AText^ = '?' then begin + Result:= True; + Inc(AText); + while CharInSet(AText^, WhiteSpaces) do Inc(AText); + case MessageDlg(ALeft, mtConfirmation, mbYesNoCancel, 0) of + mrYes: Result:= True; + mrNo: Result:= False; + else Abort; + end; + Exit; + end + else if SameText(Copy(AText, 1, 7), 'IS NULL') then begin + AOperation:= '='; + Inc(AText, 7); + end + else if SameText(Copy(AText, 1, 11), 'IS NOT NULL') then begin + AOperation:= '<>'; + Inc(AText, 11); + end + else begin + StyledMessageDlg(_(SInvalidConditionFormat), mtError, [mbOK], 0); + Abort; + end; + ARight:= ''; + end; + while CharInSet(AText^, WhiteSpaces) do Inc(AText); + (* evalute condition *) + if AOperation = '' then begin + StyledMessageDlg(_(SInvalidConditionFormat), mtError, [mbOK], 0); + Abort; + end; + (* compare numbers *) + if StrConsistsOfNumberChars(ALeft) and StrConsistsOfNumberChars(ARight) then + i:= CompareValue(StrToFloat(ALeft), StrToFloat(ARight)) + (* compare strings *) + else i:= AnsiCompareText(ALeft, ARight); + Result:= ((AOperation = '=') and (i = 0)) or + ((AOperation = '>') and (i > 0)) or + ((AOperation = '<') and (i < 0)) or + ((AOperation = '>=') and ((i = 0) or (i > 0))) or + ((AOperation = '<=') and ((i = 0) or (i < 0))) or + ((AOperation = '<>') and ((i < 0) or (i > 0))); +end; + +function TParameterList.ReadParameters(var AText: PChar): string; +(* reads parameters and modifiers and calculates value *) +const + Delimiters: TSysCharSet = ['.', '-']; +var + Separators: TSysCharSet; + + procedure CalcCondition; + (* calculates conditional parameter *) + var + IsTrue: Boolean; + begin + (* find the result *) + IsTrue:= ReadCondition(AText); + if AText^ <> ')' then begin + StyledMessageDlg(_(SInvalidConditionFormat), mtError, [mbOK], 0); + Abort; + end; + + Inc(AText); + (* returns true value *) + if IsTrue then begin + if AText^ = ':' then Result:= '' + else Result:= ReadParameterValue(AText, [':']); + if AText^ = ':' then Inc(AText); + SkipParameterValue(AText, ['-']); + end + (* returns false value *) + else begin + SkipParameterValue(AText, [':']); + if (AText^ = #0) or StrIsLeft(AText, PChar(StopMask)) then + Result:= '' + else begin + Inc(AText); + Result:= ReadParameterValue(AText, Separators) + end; + end; + end; + + procedure CalcParameterValue(const AParam: string); + (* calculates parameter value *) + var + P: PChar; + AName, AQuestion, ExistingValue: string; + ValueExists, HasValue, HasQuestion: Boolean; + begin + P:= PChar(AParam); + (* empty parameter are special case *) + if P^ = #0 then Result:= '' + (* quoted parameter is returned as it is *) + else if P^ = '''' then + Result:= ReplaceInText(AnsiExtractQuotedStr(P, '''')) + else begin + (* split parameter to components *) + AName:= StrGetToken(P, ['=', '?'], [], ['''']); + HasValue:= P^ = '='; + if HasValue then begin + Inc(P); + Result:= ReadParameterValue(P, Separators + ['?']); + end + else Result:= ''; + HasQuestion:= P^ = '?'; + (* search in parameters first for actual value *) + ValueExists:= ((AName <> '') and FindValue(AName, ExistingValue)); + (* if we have assigned question - query for parameter value *) + if HasQuestion then begin + Inc(P); + AQuestion:= P; + if AQuestion = '' then + AQuestion:= _(SEnterParameterText) + (* AQuestion can contain parameters *) + else if PChar(AQuestion)^ = '''' then + AQuestion:= ReplaceInText(AnsiExtractQuotedStr(P, '''')); + InputQuery(_(SEnterParameterCaption), AQuestion, Result); + end; + if HasValue and (AName <> '') then begin + (* Register/Remove parameter*) + if ValueExists and not HasQuestion and (Result = '') then begin + DoRemoveParameter(AName); + Exit; + end else if not ValueExists and (Result <> '') then + RegisterParameter(AName, Result, nil); + end; + if not HasQuestion and ValueExists then + Result := ExistingValue; + (* check if someone can help us *) + if not (ValueExists or HasQuestion or HasValue) then + if not Assigned(FOnUnknownParameter) then begin + StyledMessageDlg(_(SParameterNotFound), mtError, [mbOK], 0); + Abort; + end else if not FOnUnknownParameter(Self, AName, Result) then + Abort; // quiet exit after helper event + end; + end; + + procedure CalcModifierValue(const AModifier: string); + (* modifies calculated parameter value *) + var + i: Integer; + begin + (* quoted modifier is returned as it is *) + if PChar(AModifier)^ = '''' then + Result:= Concat(Result, '-''', ReplaceInText(StrUnquote(AModifier)), '''') + else begin + i:= Modifiers.IndexOfName(AModifier); + (* modify parameter value *) + if i >= 0 then + Result:= TParameterFunction(Modifiers.Objects[i])(Result) + (* check if someone can help us *) + else if not Assigned(FOnUnknownModifier) then begin + StyledMessageDlg(Format(_(SModifierNotFound), [AModifier]), mtError, [mbOK], 0); + Abort; + end else if not FOnUnknownModifier(Self, AModifier, Result) then + Abort; // quiet exit after helper event + end; + end; + +var + AObjectName: string; + AObject: TObject; + StartOfText, EndOfText: Boolean; + + procedure CalcPropertyValue(const APropertyName: string); + (* calculates property value *) + var + i: Integer; + begin + Result:= Concat(AObjectName, '.', APropertyName); + i:= FProperties.IndexOf(Result); + (* get value, if it's registered *) + if i >= 0 then begin + Result:= TObjectPropertyFunction(FProperties.Objects[i])(AObject, + AObjectName, + APropertyName); + AObject:= nil; + AObjectName:= ''; + end + (* maybe someone can help us *) + else if Assigned(FOnUnknownProperty) and + FOnUnknownProperty(Self, AObject, AObjectName, + APropertyName, Result) then begin + AObject:= nil; + AObjectName:= ''; + end + (* maybe this is a subobject *) + else if not EndOfText then begin + if TStringList(ObjectNames).Find(Result, i) then + AObject:= ObjectNames.Objects[i] + (* or even sub-sub-object :) *) + else if not Assigned(FOnUnknownObject) or + not FOnUnknownObject(Self, Result, AObject) then + if (i >= 0) and (i < ObjectNames.Count) and SameText(Result + '.', + Copy(ObjectNames[i], 1, Length(Result)+1)) then + AObject:= nil + else if Assigned(FOnUnknownObject) then Abort // quiet exit after helper event + else begin + StyledMessageDlg(Format(_(SPropertyNotFound), + [AObjectName, APropertyName]), mtError, [mbOK], 0); + Abort; + end; + AObjectName:= Result; + StartOfText:= AObject = nil; + end + else if Assigned(FOnUnknownProperty) then Abort // quiet exit after helper event + else begin + StyledMessageDlg(Format(_(SPropertyNotFound), + [AObjectName, APropertyName]), mtError, [mbOK], 0); + Abort; + end; + end; + +var + AName: string; + i: Integer; +begin + Result:= ''; + (* empty parameter *) + if AText = '' then Exit; + StartOfText:= True; + (* calculate conditional parameter *) + Separators:= Delimiters; + Include(Separators, AnsiChar(StopMask[1])); + if AText^ = '(' then begin + CalcCondition; + if (AText^ = #0) or StrIsLeft(AText, PChar(StopMask)) then Exit; + StartOfText:= False; + end; + AObject:= nil; + AObjectName:= ''; + EndOfText:= AText^ = #0; + while not EndOfText do begin + (* reads next object, property, parameter or modifier *) + AName:= ''; + repeat + AName:= AName + StrGetToken(AText, Separators, [], ['''']); + EndOfText:= (AText^ = #0) or StrIsLeft(AText, PChar(StopMask)); + if not EndOfText then Inc(AText); + until EndOfText or CharInSet((AText-1)^, Delimiters); + (* find it's value *) + if StartOfText then begin + (* this is parameter *) + if (EndOfText and (AObjectName = '')) or ((AText-1)^ = '-') then begin + CalcParameterValue(AName); + StartOfText:= False; + end + (* this is object name *) + else begin + (* get object or subobject name *) + if AObjectName = '' then AObjectName:= AName + else AObjectName:= Concat(AObjectName, '.', AName); + (* is it registered? *) + if not TStringList(ObjectNames).Find(AObjectName, i) then begin + if not Assigned(FOnUnknownObject) or + not FOnUnknownObject(Self, AObjectName, AObject) then begin + (* check if there is subobject of this object *) + if (i >= 0) and (i < ObjectNames.Count) and + SameText(AObjectName + '.', + Copy(ObjectNames[i], 1, Length(AObjectName)+1)) then + AObject:= nil + else if Assigned(FOnUnknownObject) then Abort // quiet exit after helper event + else begin + StyledMessageDlg(Format(_(SObjectNotFound), [AObjectName]), mtError, [mbOK], 0); + Abort; + end; + end + end + else AObject:= ObjectNames.Objects[i]; + StartOfText:= AObject = nil; + end; + end + (* calculate property value *) + else if Assigned(AObject) then + CalcPropertyValue(AName) + (* calculate modified value *) + else CalcModifierValue(AName); + end; +end; + +function TParameterList.ReadParameterValue(var AText: PChar; + ASeparators: TSysCharSet): string; +(* reads parameter value *) +begin + (* parameter value is text and parameters *) + if AText^ = '''' then + Result:= ReplaceInText(AnsiExtractQuotedStr(AText, '''')) + (* parameter value is other parameter *) + else if StrIsLeft(AText, PChar(StartMask)) then begin + Inc(AText, Length(StartMask)); + Result:= ReadParameters(AText); + if StrIsLeft(AText, PChar(StopMask)) then + Inc(AText, Length(StopMask)); + end + (* parameter value is simple value *) + else Result:= StrGetToken(AText, ASeparators, WhiteSpaces, ['''']); +end; + +procedure TParameterList.RegisterModifier(const AName, Comment: string; + AFunc: TParameterFunction); +(* registers parameter modifier - small name after the parameter, + that can change parameter value - for example: + ActiveDoc-Path - returns active document path + ActiveDoc-Ext - returns active document extension + Project-Long - returns long project filename +*) +begin + if Modifiers.IndexOfName(AName) >= 0 then + raise Exception.CreateFmt(SDuplicateModifier, [AName]); + Modifiers.AddObject(AName + '=' + Comment, TObject(@AFunc)) +end; + +procedure TParameterList.RegisterObject(const AName: string; AObject: TObject); +begin + ObjectNames.AddObject(AName, AObject); +end; + +procedure TParameterList.RegisterParameter(const AName, AValue: string; + GetProc: TGetParameterProc); +begin + DoAddParameter(AName, AValue, GetProc); +end; + +procedure TParameterList.RegisterProperty(const AObjectName, + APropertyName: string; GetProc: TObjectPropertyFunction = nil); +begin + if not Assigned(GetProc) then GetProc:= GetPropertyValue; + FProperties.AddObject(Concat(AObjectName, '.', APropertyName), TObject(@GetProc)) +end; + +function TParameterList.ReplaceInText(const AText: string): string; +(* replaces parameters in AText with their values *) +var + PText, PParam: PChar; + AValue: string; +begin + Result:= ''; + PText:= PChar(AText); + repeat + PParam:= StrPos(PText, PChar(StartMask)); + // maybe parameter is found + if Assigned(PParam) then begin + Result:= Result + Copy(PText, 1, PParam - PText); + Inc(PParam, Length(StartMask)); + // reads parameter value + PText:= PParam; + AValue:= ReadParameters(PText); + // invalid parameter + if PText^ = #0 then begin + Dec(PParam, Length(StartMask)); + Result:= Result + PParam; + PParam:= nil; + end + // read parameter values + else begin + Result:= Result + AValue; + Inc(PText, Length(StopMask)); + end; + end + else Result:= Result + PText; + until PParam = nil; +end; + +function TParameterList.ReplaceInTextEx(const AText, AStartMask, + AStopMask: string): string; +(* like ReplaceInText, but uses different parameter start and stop masks *) +var + OldStartMask, OldStopMask: string; +begin + OldStartMask:= StartMask; + OldStopMask:= StopMask; + try + StartMask:= AStartMask; + StopMask:= AStopMask; + Result:= ReplaceInText(AText); + finally + StartMask:= OldStartMask; + StopMask:= OldStopMask; + end; +end; + +procedure TParameterList.SetModifiers(const Value: TStrings); +begin + FModifiers.Assign(Value); +end; + +procedure TParameterList.SetObjectNames(const Value: TStrings); +begin + FObjectNames.Assign(Value); +end; + +procedure TParameterList.SetProperties(const Value: TStrings); +begin + FProperties.Assign(Value); +end; + +procedure TParameterList.SkipParameter(var AText: PChar); +var + Level: Integer; + Delimiters: TSysCharSet; +begin + Delimiters:= []; + Include(Delimiters, AnsiChar(StartMask[1])); + Include(Delimiters, AnsiChar(StopMask[1])); + Level:= Ord(not StrIsLeft(AText, PChar(StartMask))); + repeat + if StrIsLeft(AText, PChar(StartMask)) then Inc(Level); + if StrIsLeft(AText, PChar(StopMask)) then begin + Dec(Level); + if Level = 0 then Break; + end; + StrGetToken(AText, Delimiters, [], ['''']); + until AText^ = #0; + if AText^ <> #0 then Inc(AText, Length(StopMask)); +end; + +procedure TParameterList.SkipParameterValue(var AText: PChar; ASeparators: TSysCharSet); +begin + (* parameter value is text and parameters *) + if AText^ = '''' then + AnsiExtractQuotedStr(AText, '''') + (* parameter value is other parameter *) + else if StrIsLeft(AText, PChar(StartMask)) then + SkipParameter(AText) + (* parameter value is simple value *) + else begin + Include(ASeparators, AnsiChar(StopMask[1])); + StrGetToken(AText, ASeparators, WhiteSpaces, ['''']); + end; +end; + +procedure TParameterList.Split(AIndex: Integer; var AName, AValue: string; + DoCalc: Boolean); +var + i, ui: Integer; + P: PChar; +begin + // get parameter name and value + AName:= Strings[AIndex]; + i:= Pos('=', AName); + if i > 0 then begin + AValue:= Copy(AName, i+1, MaxInt); + System.Delete(AName, i, MaxInt); + end + else AValue:= ''; + if not DoCalc then Exit; + + // check for circular references + try + ui:= FUsedParameters.Add(AName); + except + raise Exception.CreateFmt(_(SParamCircularReference), [AName]); + end; + try + // dynamic parameter + if Assigned(Objects[AIndex]) then + AValue:= TGetParameterProc(Objects[AIndex]) + + // static parameter + else if (AValue <> '') then + // parameter can point to other parameters + if AValue[1] = '''' then begin + P:= PChar(AValue); + AValue:= ReplaceInText(AnsiExtractQuotedStr(P, '''')); + end + else if StrIsLeft(PChar(AValue), PChar(StartMask)) then + AValue:= CalcValue(Copy(AValue, Length(StartMask)+1, MaxInt)); + finally + FUsedParameters.Delete(ui); + end; +end; + +procedure TParameterList.UnRegisterModifier(const AName: string); +(* unregisters parameter modifier *) +var + i: Integer; +begin + with Modifiers do begin + i:= IndexOfName(AName); + if i >= 0 then Delete(i); + end; +end; + +procedure TParameterList.UnRegisterObject(const AName: string); +(* unregisters parameter modifier *) +var + i: Integer; +begin + with ObjectNames do begin + i:= IndexOf(AName); + if i >= 0 then Delete(i); + end; +end; + +procedure TParameterList.UnRegisterParameter(const AName: string); +begin + DoRemoveParameter(AName); +end; + +procedure TParameterList.UnRegisterProperty(const AObjectName, + APropertyName: string); +var + i: Integer; +begin + with Properties do begin + i:= IndexOf(Concat(AObjectName, '.', APropertyName)); + if i >= 0 then Delete(i); + end; +end; + +initialization + Parameters:= TParameterList.Create; +finalization + FreeAndNil(Parameters); +end. diff --git a/Source/clErrorHandling.pas b/Source/clErrorHandling.pas new file mode 100644 index 00000000..dbc0d63b --- /dev/null +++ b/Source/clErrorHandling.pas @@ -0,0 +1,268 @@ +{ + Copyright (C) 1999 - 2002 Clever Components + www.CleverComponents.com +} + +unit clErrorHandling; + +interface + +uses + SysUtils, Forms; + +type + TclLogger = class + private + FPrevOnAppException: TExceptionEvent; + procedure HandleAppException(Sender: TObject; E: Exception); + procedure HookExceptions; + procedure UnhookExceptions; + function GetModuleVersionInfo: string; + constructor CreateInstance; + class function AccessInstance(Request: Integer): TclLogger; + procedure PutMessageToFile(const AMessage: string); + public + constructor Create; + destructor Destroy; override; + class function Instance: TclLogger; + class procedure ReleaseInstance; + procedure LogMessage(const AMessage: string); + end; + +implementation + +uses + Windows, VerInfo{, imagehlp}; + +const + StoredCallStackDepth = 26; + +type + TCallStack = Array[0..StoredCallStackDepth] of Pointer; + +var + frame: TCallStack; + fOldExceptObjProc: Pointer; + +procedure FillCallStack(var St : TCallStack; const ExcludeFirstLevel: Boolean); +var + i : integer; + _EBP : Integer; + _ESP : Integer; +begin + asm + mov _ESP, esp + mov _EBP, ebp + end; + if ExcludeFirstLevel then + begin + _ESP:= _EBP; + _EBP:= PInteger(_EBP)^; + end; + FillChar(St, SizeOf(St), 0); + if (_EBP<_ESP) or (_EBP-_ESP>30000) then Exit; + for i:= 0 to StoredCallStackDepth do + begin + _ESP:= _EBP; + _EBP:= PInteger(_EBP)^; + if (_EBP<_ESP) or (_EBP-_ESP>30000) then Exit; + St[i]:= Pointer(PInteger(_EBP+4)^-4); + end; +end; + +{procedure GetCallStack(var St : TCallStack); +var + i: Integer; + stk: STACKFRAME; + Cnt: _CONTEXT; +begin + FillChar(St, SizeOf(St), 0); + Cnt.ContextFlags := CONTEXT_CONTROL; + GetThreadContext(GetCurrentThread(), Cnt); + ZeroMemory(@stk, SizeOf(STACKFRAME)); + stk.AddrPC.Offset := Cnt.Eip; + stk.AddrPC.Mode := AddrModeFlat; + stk.AddrStack.Offset := Cnt.Esp; + stk.AddrStack.Mode := AddrModeFlat; + stk.AddrFrame.Offset := Cnt.Ebp; + stk.AddrFrame.Mode := AddrModeFlat; + for i := 0 to StoredCallStackDepth do + begin + if (not StackWalk(IMAGE_FILE_MACHINE_I386, GetCurrentProcess(), GetCurrentThread(), + @stk, @Cnt, nil, + SymFunctionTableAccess, SymGetModuleBase, nil)) then + begin + Break; + end; + St[i]:= Pointer(stk.AddrPC.Offset); + end; +end;} + +function CallStackTextualRepresentation(const S: TCallStack; const LineHeader: string): string; +var + i: integer; +begin + i:= 0; + Result:= ''; + while (i <= StoredCallStackDepth) and (S[i] <> Nil) do + begin + Result:= Result + LineHeader + 'call stack - ' + IntToStr(i) + ' : 0x' + IntToHex(Cardinal(S[i]), 8) + #13#10; + i:= i + 1; + end; +end; + +procedure clUnwindStack(P: PExceptionRecord); stdcall; +var + s: string; +begin + s := Format('Exception Code: 0x%.8x', [P.ExceptionCode]); + if (P.ExceptionCode = EXCEPTION_ACCESS_VIOLATION) then + begin + if (P.ExceptionInformation[0] = 1) then + s := s + Format(#13#10 + 'AV at 0x%.8x, write at address 0x%.8x', [Integer(P.ExceptionAddress), Integer(P.ExceptionInformation[1])]) + else + s := s + Format(#13#10 + 'AV at 0x%.8x, read at address 0x%.8x', [Integer(P.ExceptionAddress), Integer(P.ExceptionInformation[1])]) + end; + FillCallStack(frame, True); +// GetCallStack(frame); + s := s + #13#10 + CallStackTextualRepresentation(frame, ''); + TclLogger.Instance().LogMessage('Stack Trace: ' + s); +end; + +function clGetExceptionObject(P: PExceptionRecord): Exception; +asm + pusha + push p + call clUnwindStack; + popa + mov edx, fOldExceptObjProc + test edx, edx + jz @@no_handler + call edx +@@no_handler: +end; + +{ TclLogger } + +class function TclLogger.AccessInstance(Request: Integer): TclLogger; +const + FInstance: TclLogger = nil; +begin + case Request of + 0 : ; + 1 : if not Assigned(FInstance) then FInstance := CreateInstance; + 2 : FInstance := nil; + else + raise Exception.CreateFmt('Illegal request %d in AccessInstance', + [Request]); + end; + Result := FInstance; +end; + +constructor TclLogger.Create; +begin + inherited Create; + raise Exception.CreateFmt('Access class %s through Instance only', + [ClassName]); +end; + +constructor TclLogger.CreateInstance; +begin + inherited Create(); +end; + +destructor TclLogger.Destroy; +begin + if AccessInstance(0) = Self then AccessInstance(2); + UnhookExceptions(); + inherited Destroy(); +end; + +function TclLogger.GetModuleVersionInfo: string; +var + Info: TVersionInfo; +begin + Info := TVersionInfo.Create(ParamStr(0)); + try + Result := Info.FileVersion; + finally + Info.Free(); + end; +end; + +procedure TclLogger.HandleAppException(Sender: TObject; E: Exception); +begin + if (E is EAccessViolation) then Exit; + LogMessage(Format('Exception (%s): %s', [E.ClassName, E.Message])); +end; + +procedure TclLogger.HookExceptions; +begin + FPrevOnAppException := Application.OnException; + Application.OnException := HandleAppException; +end; + +class function TclLogger.Instance: TclLogger; +begin + Result := AccessInstance(1); +end; + +procedure TclLogger.LogMessage(const AMessage: string); +var + s: string; +begin + s := GetModuleVersionInfo(); + if (s <> '') then + begin + s := 'File Version: ' + s + #13#10; + end; + s := DateTimeToStr(Now()) + ': ' + s + AMessage; + PutMessageToFile(s + #13#10#13#10); +end; + +procedure TclLogger.PutMessageToFile(const AMessage: string); +var + FileName: string; + hFile: THandle; + len, cnt: Cardinal; + buf: PChar; +begin + FileName := ChangeFileExt(ParamStr(0), '.log'); + hFile := CreateFile(PChar(FileName), GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, nil, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + if (hFile = INVALID_HANDLE_VALUE) then + begin + hFile := CreateFile(PChar(FileName), GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, nil, + CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0); + end; + if (hFile <> INVALID_HANDLE_VALUE) then + begin + SetFilePointer(hFile, 0, nil, FILE_END); + len := Length(AMessage) + 1; + GetMem(buf, len); + StrCopy(buf, PCHAR(AMessage)); + WriteFile(hFile, buf[0], len - 1, cnt, nil); + FreeMem(buf); + CloseHandle(hFile); + end; +end; + +class procedure TclLogger.ReleaseInstance; +begin + AccessInstance(0).Free(); +end; + +procedure TclLogger.UnhookExceptions; +begin + Application.OnException := FPrevOnAppException; +end; + +initialization + fOldExceptObjProc := ExceptObjProc; + ExceptObjProc := @clGetExceptionObject; + TclLogger.Instance().HookExceptions(); + +finalization + TclLogger.ReleaseInstance(); + +end. diff --git a/Source/iso7185rules.html b/Source/iso7185rules.html new file mode 100644 index 00000000..9e4d6d76 --- /dev/null +++ b/Source/iso7185rules.html @@ -0,0 +1,1144 @@ + + + + + + + Rules of ISO 7185 PASCAL + + + +
+

Rules of ISO 7185 Pascal

+
+ +
+

This file contains an overview of the basic rules of ISO 7185 Pascal. See +also the books on the subject. For serious users, I recommend:

+

Standard Pascal: Users Reference Manual, Doug Cooper

+

Oh ! Pascal !, Doug Cooper

+

Both available from Amazon.com.

+

Note that the following description could be wrong or incomplete.

+
+

Index

+

Lexography

+

Program structure

+

Label declaration

+

Constant declaration

+

Types

+

Variable declaration

+

Block declaration

+

Declaration order

+

Predefined types

+

Basic types

+

Integer types

+

Enumerated types

+

Boolean types

+

Character types

+

Subrange types

+

Real types

+

Structured types

+

Packing

+

Set types

+

Array types

+

Record types

+

File types

+

Pointer types

+

Type compatibility

+

Expressions

+

Predefined functions

+

Statements

+

Assignment

+

If statement

+

While statement

+

Repeat statement

+

For statement

+

Case statement

+

Goto statement

+

Compound statement

+

Procedures and functions

+

Predefined procedures and file operations

+

Predefined procedures and text files

+

Header files

+

Packing procedures

+

Dynamic allocation

+
+

Lexography

+

Pascal source consists of identifiers, keywords, numbers and special  character +sequences. A Pascal identifier must begin with 'a' to 'z', but may continue +with 'a' to 'z' and '0' to '9'. There is no length limit on labels, but there +may be a practical limit. If the compiler cannot process a source line longer +than N, you cannot have a label longer than N, since labels may not cross lines.

+

Keywords (or reserved words) appear just as labels, but have special meaning +wherever they appear, and may never be used as identifiers:

+
and      array     begin     case      const     div       do
+
downto   else      end       file      for       function  goto
+
if       in        label     mod       nil       not       of
+
or       packed    procedure program   record    repeat    set
+
then     to        type      until     var       while     with
+

A number can appear in both integer and real form. Integers will appear as +a sequence of digits:

+
83
+
00004
+

Are valid integer numbers. For a number to be taken as "real" (or +"floating point") format, it must either have a decimal point, or +use scientific notation:

+
1.0
+
1e-12
+
0.000000001
+

Are all valid reals. At least one digit must exist on either side of a decimal +point. Strings are made up of a sequence of characters between single quotes:

+
'string'
+

The single quote itself can appear as two single quotes back to back in a +string:

+
'isn''t'
+

Finally, special character sequences are one of the following:

+
+        -         *         /         =         <         >
+
[        ]         .         ,         :         ;         ^
+
(        )         <>        <=        >=        ..        @
+
{        }         (*        *)        (.        .)
+

Note that these are just aliases for the same character sequence:

+
@  and ^ (or the "up arrow" if allowed in the typeface)
+
(. and [
+
.) and ]
+
(* and {
+
*) and }
+

Spaces and line endings in the source are ignored except that they may act +as "separators". No identifier, keyword, special character sequence +or number may be broken by a separator or other object. No two identifiers, +keywords or numbers may appear in sequence without an intervening separator:

+
MyLabel         - Valid
+
My Label        - Invalid
+
begin farg := 1 - Valid
+
beginfarg := 1  - Invalid
+
1.0e-12         - Valid
+
1.e-122e-3      - Invalid
+

Program structure

+

A Pascal program appears as a nested set of "blocks", each of which +has the following form:

+
block_type name(parameter [, parameter]...);
+
label x[, y]...
+
 
+
const x = y; 
+
      [q = r;]...
+
 
+
type x = y;
+
     [q = r;]...
+
 
+
var  x[,y]...: z;
+
     [x[,y]...: z;]...
+
 
+
[block]...
+
 
+
begin
+
 
+
   statement[; statement]
+
 
+
end[. | ;]
+

Note that:

+
[option]    means optional.
+
[repeat]... means can appear 0 or more times.
+
[x | y]     means one or the other.
+

There are three types of blocks, program, procedure and function. Every program +must contain a program block, and exactly one program block exists in the source +file.

+

Each block has two distinct sections, the declaration and statements sections. +The declarations immediately before a statement section are considered "local" +to that section.

+

The declaration section builds a description of the data used by the coming +statement section in a logical order. For example, constants are usually used +to build type declarations, and type declarations are used to build variables, +and all of these may be used by nested blocks.

+

Label declaration

+

The first declaration, labels, are numeric sequences that denote the target +of any goto's appearing in the block:

+
label 99,
+
      1234;
+

Are valid labels. Labels "appear" to be numbers, and must be in +the range 0 to 9999. The "appearance" of a number means that:

+
label 1,
+
      01,
+

Are the same label.

+

Constant declaration

+

Constant declarations introduce fixed valued data as a specified identifier:

+
const x = 10;
+
      q= -1;
+
      y = 'hi there';
+
      r = 1.0e-12;
+
      z = x;
+

Are all valid constant declarations. Only integer, real and character constants +may be so defined (no sets may appear).

+

Types

+

The type declaration allows types to be given names, and are used to create +variables later:

+
type x = array [1..10] of integer;
+
     i = integer;
+
     z = x;
+

Types can be new types, aliases of old types, etc.

+

Variable declaration

+

Variables set aside computer storage for a element of the given type:

+
var x, y: integer;
+
    z:    array [1..10] of char;
+

Block declaration

+

A block can be declared within a block, and that block can declare blocks +within it, etc. There is no defined limit as to the nesting level. Because only +one program block may exist, by definition all "sub blocks" must be +either procedure or function blocks. Once defined, a block may be accessed by +the block it was declared in. But the "surrounding" block cannot access +blocks that are declared within such blocks:

+
program test;
+
 
+
procedure junk;
+
 
+
procedure trash;
+
 
+
begin { trash }
+
 
+
   ...
+
 
+
end;  { trash }
+
 
+
begin { junk }
+
 
+
   trash;
+
   ...
+
 
+
end;  { junk }
+
 
+
begin { test }
+
 
+
   junk;
+
   ...
+
 
+
end.  { test }
+

Here test can call junk, but only junk can call trash. Trash is "hidden" +from the view of test. Similarly, a subblock can access any of the variables +or other blocks that are defined in surrounding blocks:

+
program test;
+
 
+
var x;
+
 
+
procedure q;
+
 
+
begin
+
 
+
end;
+
 
+
procedure y;
+
 
+
begin
+
 
+
   q;
+
   x := 1
+
 
+
end;
+
 
+
begin
+
 
+
   y;
+
   writeln('x')
+
 
+
end.
+

The variable "x" can be accessed from all blocks declared within +the same block. It is also possible for a block to call itself, or another block +that calls it. This means that recursion is allowed in Pascal.

+

Declaration order

+

Every identifier must be declared before it is used, with only one exception, +pointers, which are discussed later. But there is a way to declare procedures +and functions before they are fully defined to get around problems this may +cause.

+

Predefined types

+

Several types are predeclared in Pascal. These include integer, boolean, +char, real and text. predeclared types, just as predeclared functions and procedures, +exist in a conceptual "outer block" around the program, and can be +replaced by other objects in the program.

+

Basic types

+

Types in Pascal can be classed as ordinal, real and structured. The ordinal +and real types are referred to as the "basic" types, because they +have no complex internal structure.  Ordinal types are types whose elements +can be numbered, and there are a  finite number of such elements.

+

Integer types

+

The basic ordinal type is "integer", and typically it represents +the accuracy of a single word on the target machine:

+
var i: integer;
+

A predefined constant exists, "maxint", which tells you what the +maximum integral value of an integer is. So:

+
type integer = -maxint..maxint;
+

Would be identical to the predefined type "integer". Specifically, +the results of any operation involving ordinals will only be error free if they +lie within -maxint to +maxint. Although other ordinal types exist in Pascal, +all such types have a mapping into the type "integer", and are bounded +by the same rules. The "ord" function can be used on any ordinal to +find the corresponding integer.

+

Enumerated types

+

Enumerated types allow you to specify an identifier for each and every value +of an ordinal:

+
type x = (one, two, three, four);
+

Introduces four new identifiers, each one having a constant value in sequence +from the number 0. So for the above:

+
one   = 0
+
two   = 1
+
three = 2
+
four  = 3
+

Enumerated types may have no relationship to numbers whatever:

+
type y = (red, green, blue);
+

Or some relationship:

+
type day = (mon, tue, wed, thur, fri, sat, sun);
+

Here the fact that "day"s are numbers (say, isn't that a lyric +?) is useful because the ordering has real world applications:

+
if mon < fri then writeln('yes');
+

And of course, subranges of enumerated types are quite possible:

+
type workday = (mon..fri);
+

Enumerated types are fundamentally different from integer and subrange types +in the fact that they cannot be freely converted to and from each other. There +is only one conversion direction defined, to integer, and that must be done +by special predefined function:

+
var i: integer;
+
    d: day;
+
 
+
...
+
 
+
i := ord(d); { find integral value of d }
+

Boolean types

+

The only predefined enumerated type is "boolean", which could be +declared:

+
type boolean = (false, true);
+

However, booleans cannot be cross converted (being enumerated types), this +user created type could not in fact be used just as the predeclared one. Booleans +are special in that several predefined procedures, and all of the Comparison +operators ("=", ">", etc.) give boolean results. In addition, +several special operators are defined just for booleans, such as "and", +"or" etc.

+

Character types

+

Character types in Pascal hold the values of the underlying character set, +usually ISO single byte encoded (including ASCII). The Pascal standard makes +no requirements as to what characters will be present or what order they will +appear in. However, as a practical matter, most Pascal programs rely on the +characters of the alphabet and the digits '0'-'9' being present, and that these +are numbered sequentially (which leaves out EBCDIC, for example). A character +declaration appears as:

+
var c: char;
+

Character values can also be converted to and from integers at will, but +only by using the special functions to do so:

+
ord(c); { find integer value of character }
+
chr(i); { find character value of integer }
+

Subrange types

+

Subrange types are simply a voluntary programmer restriction of the values +an ordinal type may hold:

+
type constrained = -10..50;
+

(the notation x..y means all values from x to y inclusive.)

+

It is an error to assign a value outside of the corresponding range to a +variable of that type:

+
var x: constrained
+
 
+
...
+
 
+
x := 100; { invalid! }
+

But note that there are no restrictions on the USE of such a type:

+
writeln('The sum is: ', x+100);
+

Here, even though the result of x+100 is greater than the type of x, it is +not an error. When used in an expression, a subrange is directly equivalent +to the type "integer".

+

Subranges can be declared of any ordinal type:

+
type enum = (one, two, three, four, five, six, seven, eight, nine, ten);
+
 
+
var e: three..seven;
+
 
+
var c: 'a'..'z';
+

Etc.

+

Real types

+

Real types, or "floating point", allow approximations of a large +range of numbers to be stored. The tradeoff is that reals have no direct ordinality +(cannot be counted), and so have no direct relationship with integers. Real +types are the only basic type which is not ordinal.

+
var r: real;
+

Integers are considered "promotable" to reals. That is, is is assumed +that an integer can always be represented as a real. However, there may be a +loss of precision when this is done (because the mantissa of a real may not +be as large as an integer). Reals are never automatically promoted to integer, +however, and the programmer must choose between finding the nearest whole number +to the real, or simply discarding the fraction. This choice must be made explicitly +by predefined function.

+

Structured types

+

A structured type is a type with a complex internal structure. In fact, the +structured types all have one thing in common: they can hold more than one basic +type object at one time. They are structured because they are "built up" +from basic types, and from other structured types.

+

Packing

+

Structured types can also be "packed", which is indicated by the +keyword "packed" before the type declaration. Packing isn't supposed +to change the function of the program at all. Stripping the "packed" +keywords out of a program will not change the way it works (with the exception +of "strings", below). Packing means that (if implemented: its optional) +the program should conserve space by placing the values in as few bits as possible, +even if this takes more code (and time) to perform.

+

Packing is better understood if you understand the state of computers before +Microprocessors (the Jurassic age of computers ?). Most mainframe computers +access memory as a single word size only, and not even a neat multiple of 8 +bits either (for example, 36 bit computer; the CDC 6000 has 60 bit words). The +machine reads or writes in words only. There is no byte access, no even/odd +addressing, etc. Because storage on such a machine of small items could be wasteful +(especially characters), programs often pack many single data items into a single +word.

+

The advent of the Minicomputer changed that. DEC started with an 8 bit machine +(just as microprocessors did), and when they changed to 16, then 32 bits the + ability to address single bytes was maintained.

+

For this reason, many people refer to such a machine as "automatically +packed", or that Pascal's packing feature is unnecessary on such machines. +However,  quantizing data by 8 bit bytes is not necessarily the most extreme +packing method available. For example, a structure of boolean values, which +take up only 1 bit per element, left to byte packing would waste 7/8s of the +storage allocated.

+

Set types

+

Set types are perhaps the most radical feature of Pascal. A set type can +be thought of as an array of bits indicating the presence or absence of each +value in the base type:

+
var s: set of char;
+

Would declare a set containing a yes/present or no/not present indicator +for each character in the computer's character set. The base type of a set must +be ordinal.

+

Array types

+

The most basic structured type is the array. Pascal is unusual in that both +the upper and lower bounds of arrays are declared (instead of just the upper +bound or length), and that the index type can be any ordinal type:

+
var a: array [1..10] of integer;
+

Would declare an array of 10 integers with indexes from 1 to 10. You may +recognize the index declaration as a subrange, and indeed any subrange type +can be used as an index type:

+
type sub = 0..99;
+
var a: array [sub] of integer;
+

Arrays can also be declared as multidimensional:

+
var a: array [1..10] of array [1..10] of char;
+

There is also a shorthand form for array declarations:

+
var a: array [1..10, 1..10] of char;
+

Is equivalent to the last declaration.

+

A special type of array definition is a "string". Strings are arrays +of packed characters, with integer indexes, whose lower bound is 1:

+
var s: packed array [1..10] of char;
+

String types are special in that any two strings with the same number of +components are compatible with each other, including constant strings.

+

Record types

+

Records give the ability to store completely different component types together +as a unit. There they can be manipulated, copied and passed as a unit. It is +also possible to create different typed objects that occupy the same storage +space.

+
var r: record
+
 
+
          a: integer;
+
          b: char
+
 
+
       end;
+

Gives a single variable with two completely different components, which can +be accessed independently, or used as a unit.

+
var vr: record
+
 
+
           a: integer;
+
           case b: boolean of { variant }
+
 
+
              true: (c: integer; d: char);
+
              false: (e: real)
+
 
+
           { end }
+
 
+
        end;
+

Variant records allow the same "collection of types", but introduce +the idea that not all of the components are in use at the same time, and thus +can occupy the same storage area. In the above definition, a, b, c, d, and e +are all elements of the record, and can be addressed individually. However, +there are three basic "types" of record elements in play:

+

1. "base" or normal fixed record elements, such as a.

+

2. The "tagfield" element. Such as b.

+

3. The "variants", such as c, d, and e.

+

All the elements before the case variant are normal record elements and are +always present in the record. The tagfield is also always present, but has special +function with regards to the variant. It must be an ordinal type, and ALL of +it's possible values must be accounted for by a corresponding variant. The tagfield +gives both the program and the compiler the chance to tell what the rest of +the record holds (ie., what case variant is "active"). The tagfield +can also be omitted optionally:

+
var vr: record
+
 
+
           a: integer;
+
           case boolean of { variant }
+
 
+
              true: (c: integer; d: char);
+
              false: (e: real)
+
 
+
           { end }
+
 
+
        end;
+

In this case, the variant can be anything the program says it is, without + checking. The variants introduce what essentially is a "sub record" +definition that gives the record elements that are only present if the selecting +variant is "active". A variant can hold any number of such elements. +If the compiler chooses to implement variants, the total size of the resulting +record will be no larger than the fixed record parts plus the size of the  largest +variant. It is possible for the compiler to treat the variant as a normal record, + allocating each record element normally, in which case the variant record +would be no different from a normal record.

+

File types

+

Files are identical to arrays in that they store a number of identical components. +Files are different from arrays in that the number of components they may store +is not limited or fixed beforehand. The number of components in a file can change +during the run of a program. A file can have any type as a component type, with +the exception of other file types. This rule is strict: you may not even have +structures which contain files as components. A typical file declaration is:

+
var f: file of integer;
+

Would declare a file with standard integer components. A special predefined +file type exists:

+
var f: text;
+

Text files are supposedly equivalent to:

+
type text = file of char;
+

But there are special procedures and functions that apply to text files only.

+

Pointer types

+

Pointers are indirect references to variables that are created at runtime:

+
var ip: ^integer;
+

Pointers are neither basic or structured types (they are not structured because +they do not have multiple components). Any type can be pointed to. In practice, +pointers allow you to create a series of unnamed components which can be arranged +in various ways. The type declaration for pointers is special in that the type + specified to the right of "^" must be a type name, not a full +type specification. Pointer declarations are also special in that a pointer +type can be declared using base types that have not been declared yet:

+
type rp: ^rec;
+
     rec: record
+
 
+
             next: rp;
+
             val:  integer
+
 
+
          end;
+

The declaration for rp contains a reference to an undeclared type, rec. This +"forward referencing" of pointers allows recursive definition of pointer +types, essential in list processing.

+

Type compatibility

+

Type compatibility (ability to use two different objects in relation to each +other), occurs on three different levels:

+

1. Two types are identical.

+

2. Two types are compatible.

+

3. Two types are assignment compatible.

+

Two types are identical if the exact same type definition was used to create +the objects in question. This can happen in several different ways. Two objects +can be declared in the same way:

+
var a, b: array [1..10] of record a, b: integer end;
+

Here a and b are the same (unnamed) type. They can also be declared using +the same type name:

+
type mytype = record a, b: integer end;
+
 
+
var a: mytype;
+
    b: mytype;
+

Finally, an "alias" can be used to create types:

+
type mytype = array [1..10] of integer;
+
     myother = mytype;
+
 
+
var a: mytype;
+
    b: myother;
+

Even though an alias is used, these objects till have the same type. Two +types are considered compatible if:

+

1. They are identical types (as described above).

+

2. Both are ordinal types, and one or both are subranges of an identical +type.

+

3. Both are sets with compatible base types and "packed" status.

+

4. Both are string types with the same number of components.

+

Finally, two types are assignment compatible if:

+

1. The types are compatible, as described above.

+

2. Neither is a file, or has components of file type.

+

3. The destination is real, and the source is integer (because integers can +always be promoted to real, as above).

+

4. The source "fits" within the destination. If the types are subranges +of the same base type, the source must fall within the destination's range:

+
var x: 1..10;
+
 
+
...
+
 
+
x := 1; { legal }
+
x := 20; { not legal }
+

5. Both are sets, and the source "fits" within the destination. +If the base types of the sets are subranges, all the source elements must also +exist in the destination:

+
var s1: set of 1..10;
+
 
+
...
+
 
+
s1 := [1, 2, 3]; { legal }
+
s1 := [1, 15]; { not legal } 
+

Expressions

+

The basic operands in Pascal are:

+
xxx        - Integer constant. A string of digits, without sign, whose
+
             value is bounded by -maxint..maxint.
+
x.xex      - Real constant.
+
'string'   - String constant.
+
[set]      - Set constant. A set constant consists of zero or more elements
+
             separated by ",":
+
 
+
                [1, 2, 3]
+
 
+
             A range of elements can also appear:
+
 
+
                [1, 2..5, 10]
+
 
+
             The elements of a set must be of the same type, and the 
+
             "apparent" base type of the set is the type of the elements.
+
             The packed or unpacked status of the set is whatever is
+
             required for the context where it appears.
+
ident      - Identifier. Can be a variable or constant from a const 
+
             declaration.
+
func(x, y) - A function call. Each parameter is evaluated, and the
+
             function called. The result of the function is then used
+
             in the encompassing expression.
+

The basic construct built on these operands is a "variable access", +where "a" is any variable access.

+
ident    - A variable indentifier.
+
a[index] - Array access. It is also possible to access any number of
+
           dimensions by listing multiple indexes separated by ",":
+
 
+
              [x, y, z, ...]
+
 
+
a.off    - Record access. The "off" will be the element identifier as
+
           used in the record declaration.
+
 
+
a^       - Pointer reference. The resulting reference will be of the
+
           variable that the pointer indexes. If the variable reference
+
           is a file, the result is a reference to the "buffer variable"
+
           for the file.
+

Note that a VAR parameter only allows a variable reference, not a full  expression. +For the rest of the expression operators, here they are in precedence, with +the operators appearing in groups according to priority (highest first). "a" +and "b" are operands.

+
(a)      - A subexpresion.
+
not      - The boolean "not" of the operand, which must be boolean.
+
 
+
a*b      - Multiplication/set intersection. If the operands are real or
+
           integer, the multiplication is found. If either operand is
+
           real, the result is real. If the operands are sets, the 
+
           intersection is found, or a new set with elements that exist
+
           in both sets.
+
a/b      - Divide. The operands are real or integer. The result is a real
+
           representing a divided by b.
+
a div b  - Integer divide. The operands must be integer. The result is an
+
           integer giving a divided by b with no fractional part.
+
a mod b  - Integer modulo. The operands must be integer. The result is an
+
           integer giving the modulo of a divided by b.
+
a and b  - Boolean "and". Both operands must be boolean. The result is a
+
           boolean, giving the "and" of the operands.
+
 
+
+a       - Identity. The operand is real or integer. The result is the
+
           same type as the operand, and gives the same sign result as the
+
           operand (essentially a no-op).
+
-a       - Negation. The operand is real or integer. The result is the
+
           same type as the operand, and gives the negation of the
+
           operand.
+
a+b      - Add/set union. If the operands are real or integer, finds the
+
           sum of the operands. If either operand is real, the result is
+
           real. If both operands are sets, finds a new set which contains
+
           the elements of both.
+
a-b      - Subtract/set difference. If the operands are real or integer,
+
           finds a minus b. If either operand is real, the result is
+
           real. If both operands are sets, finds a new set which contains
+
           the elements of a that are not also elements of b.
+
a or b   - Boolean "or". Both operands must be boolean. The result is
+
           boolean, giving the boolean "or" of the operands.
+
 
+
a < b    - Finds if a is less than b, and returns a boolean result.
+
           The operands can be basic or string types.
+
a > b    - Finds if a is greater than b, and returns a boolean result.
+
           The operands can be basic or string types.
+
a <= b   - Finds if a is less than or equal to b, and returns a boolean
+
           result. The operands can be basic, string, set or pointer
+
           types.
+
a >= b   - Finds if a is greater than or equal to b, and returns a boolean
+
           result. The operands can be basic, string, set or pointer
+
           types.
+
a = b    - Finds if a is equal to b, and returns a boolean result.
+
           The operands can be basic, string, set or pointer types.
+
a <> b   - Finds if a is not equal to b, and returns a boolean result.
+
           The operands can be basic, string, set or pointer types.
+
a in b   - Set inclusion. A is an ordinal, b is a set with the same base
+
           type as a. Returns true if there is an element matching a in
+
           the set.
+

Predefined functions

+
The following predefined functions exist:
+
 
+
sqr(x)    - Finds the square of x, which can be real or integer. The
+
            result is the same type as x.
+
sqrt(x)   - Finds the square root of x, which can be real or integer. The
+
            result is always real.
+
abs(x)    - Finds the absolute value of x, which can be real or integer.
+
            The result is the same type as x.
+
sin(x)    - Finds the sine of x,which can be real or integer. x is
+
            expressed in radians. The result is always real.
+
cos(x)    - Finds the cosine of x,which can be real or integer. x is 
+
            expressed in radians. The result is always real.
+
arctan(x) - Finds the arctangent of x, which can be real or integer. The
+
            result is always real, and is expressed in radians.
+
exp(x)    - Finds the exponential of x, which can be real or integer. The
+
            result is always real.
+
ln(x)     - Finds the natural logarithm of x, which can be real or
+
            integer. The result is always real.
+
 
+
ord(x)    - Finds the integer equivalent of any ordinal type x.
+
succ(x)   - Finds the next value of any ordinal type x.
+
pred(x)   - Finds the last value of any ordinal type x.
+
chr(x)    - Finds the char type equivalent of any integer x.
+
trunc(x)  - Finds the nearest integer below the given real x (converts a
+
            real to an integer).
+
round(x)  - Finds the nearest integer to the given real x.
+

Statements

+

Pascal uses "structured statements". This means you are given a +few standard control flow methods to build a program with.

+

Assignment

+

The fundamental statement is the assignment statement:

+
v := x;
+

There is a special operator for assignment, ":=" (or "becomes"). +Only a single variable reference may appear to the right, and any expression +may appear to the left. The operands must be assignment compatible, as defined +above.

+

If statement

+

The if statement is the fundamental flow of control structure:

+
if cond then statement [else statement]
+

In Pascal, only boolean type expressions may appear for the condition (not +integers). The if statement specifies a single statement to be executed if the +condition is true, and an optional statement if the condition is false. You +must beware of the "bonding problem" if you create multiple nested +if statements:

+
if a = 1 then if b = 2 then writeln('a = 1, b = 2')
+
else writeln('a <> 1');
+

Here the else clause is attached to the very last statement that appeared, +which may not be the one we want.

+

While statement

+

Just as if is the fundamental flow of control statement, while is the fundamental +loop statement:

+
while cond do statement
+

The while statement continually executes it's single statement as long as +the condition is true. It may not execute the statement at all if the condition +is never true.

+

Repeat statement

+

A repeat statement executes a block of statements one or more times:

+
repeat statement [; statement] until cond
+

It will execute the block of statements as long as the condition is false. +The statement block will always be executed at least once.

+

For statement

+

The for statement executes a statement a fixed number of times:

+
for i := lower to upper do statement
+
for i := upper downto lower do statement
+

The for statement executes the target statement as long as the "control +variable" lies within the set range of lower..upper. It may not execute +at all if lower > upper. The control variable in a for is special, and it +must obey several rules:

+

1. It must be ordinal.

+

2. It must be local to the present block (declared in the present block).

+

3. It must not be "threatened" in the executed statement. To threaten +means to modify, or give the potential to modify, as in passing as a VAR parameter +to a procedure or function (see below).

+

Case statement

+

The case statement defines an action to be executed on each of the values +of an ordinal:

+
case x of
+
 
+
  c1: statement;
+
  c2: statement;
+
  ...
+
 
+
end;
+

The "selector" is an expression that must result in an ordinal +type. Each of the "case labels" must be type compatible with the selector. +The case  statement will execute one, and only one, statement that matches +the current selector value. If the selector matches none of the cases, then +an error results. It is NOT possible to assume that execution simply continues +if none of the cases are matched. A case label MUST match the value of the selector.

+

Goto statement

+
The goto statement directly branches to a given labeled statement:
+
goto 123
+
 
+
...
+
 
+
123:
+

Several requirements exist for gotos:

+

1. The goto label must have been declared in a label declaration.

+

2. A goto cannot jump into any one of the structured statements above (if, +while, repeat, for or case statements).

+

3. If the target of the goto is in another procedure or function, that +target label must be in the "outer level" of the procedure or function. +That means that it may not appear inside any structured statement at all.

+

Compound statement

+

A statement block gives the ability to make any number of statements appear +as one:

+
begin statement [; statement]... end
+

All of the above statements control only one statement at a time, with the +exception of repeat. The compound statement allows the inclusion of a whole +substructure to be controlled by those statements.

+

Procedures and functions

+

When you need to use a block of the same statements several times, a compound +block can be turned into a procedure or function and given a name:

+
procedure x;
+
 
+
begin
+
 
+
   ...
+
 
+
end;
+
 
+
function y: integer;
+
 
+
begin
+
 
+
   ...
+
 
+
end;
+

Then, the block of statements can be called from anywhere:

+
var i: integer;
+
 
+
x; { calls the procedure }
+
 
+
i := y; { calls the function }
+

The difference between a procedure and a function is that a function returns +a result, which can only be a basic or pointer type (not structured). This makes +it possible to use a function in an expression. In a function, the result is +returned by a special form of the assign statement:

+
function y: integer;
+
 
+
begin
+
 
+
   ...
+
   y := 1 { set function return }
+
 
+
end;
+

The assignment is special because only the name of the function appears on +the left hand side of ":=". It does not matter where the function +return assignment appears in the function, and it is even possible to have multiple +assignments to the function, but AT LEAST one such assignment must be executed +before the function ends. If the procedure or function uses parameters, they +are declared as:

+
procedure x(one: integer; two, three: char);
+
 
+
begin
+
 
+
   ...
+
 
+
end;
+

The declaration of a parameter is special in that only a type name may be +specified, not a full type specification. Once appearing in the procedure or +function header, parameters can be treated as variables that just happen to +have been initialized to the value passed to the procedure or function. The +modification of parameters has no effect on the original parameters themselves. +Any expression that is assignment compatible with the parameter declaration +can be used in place of the parameter during it's call:

+
x(x*3, 'a', succ('a'));
+

If it is desired that the original parameter be modified, then a special +form of parameter declaration is used:

+
procedure x(var y: integer);
+
 
+
begin
+
 
+
   y := 1
+
 
+
end;
+

Declaring y as a VAR parameter means that y will stand for the original parameter, +including taking on any values given it:

+
var q: integer;
+
 
+
...
+
 
+
   x(q);
+

Would change q to have the value 1. In order to be compatible with a VAR +the passed parameter must be of identical type as the parameter declaration, +and be a variable reference. Finally, Pascal provides a special mode of parameter +known as a procedure or function parameter which passes a reference to a given +procedure or function:

+
procedure x(procedure y(x, q: integer));
+
 
+
...
+
 
+
procedure z(function y: integer);
+
 
+
...
+

To declare a procedure or function parameter, you must give it's full parameter +list, including a function result if it is a function. A procedure or function +is passed to a procedure or function by just it's name:

+
procedure r(a, b: integer);
+
 
+
begin
+
 
+
   ...
+
 
+
end;
+
 
+
begin
+
 
+
   x(r); { pass procedure r to procedure x }
+
 
+
   ...
+

The parameter list for the procedure or function passed must be "congruent" +with the declared procedure or function parameter declaration. This means that +all it's parameters, and all of the parameters of it's procedure or function +parameters, etc., must match the declared parameter. Once the procedure or function +has been passed, it is then ok for the procedure or function that accepts it +to use it:

+

procedure x(procedure y(x, q: integer));

+
 
+
begin
+
 
+
   y(1, 2);
+
   ...
+

Would call r with parameters 1 and 2.

+

Procedures and functions can be declared in advance of the actual appearance +of the procedure or function block using the forward keyword:

+
procedure x(a, b: integer); forward;
+
 
+
procedure y;
+
 
+
begin
+
 
+
   x(1, 2)
+
   ...
+
 
+
end;
+
 
+
procedure x;
+
 
+
begin
+
 
+
   ...
+

The forward keyword replaces the appearance of the block in the first  appearance +of the declaration. In the second appearance, only the name of the procedure +appears, not it's header parameters. Then the block appears as normal. The advance +declaration allows recursive structuring of procedure and function calls that +would be otherwise not be possible.

+

Predefined procedures and file operations

+

A file is not accessed directly (as an array is). Instead, Pascal automatically +declares one component of the files base type which is accessed by special syntax:

+
f^
+

So that:

+
f^ := 1;
+

Assigns to the file "buffer" component, and:

+
v := f^;
+

Reads the file buffer. Unless the file is empty or you are at the end of +the file, the file buffer component will contain the contents of the component +at the file location you are currently reading or writing. Other than that, +the file buffer behaves as an ordinary variable, and can even be passed as a +parameter to routines. The way to actually read or write through a file is by +using the predeclared procedures:

+
get(f);
+

Loads the buffer variable with the next element in the file, and advances +the file position by one element, and:

+
put(f);
+

Outputs the contents of the buffer variable to the file and advances the +file position by one. These two procedures are really all you need to implement +full reading and writing on a file. It also has the advantage of keeping the +next component in the file as a "lookahead" mechanism. However, it +is much more common to access files via the predefined procedures read and write:

+
read(f, x);
+

Is equivalent to:

+
x := f^; get(f);
+

And:

+
write(f, x);
+

Is equivalent to:

+
f^ := x; put(f);
+

Read and write are special in that any number of parameters can appear:

+
read(f, x, y, z, ...);
+
write(f, x, y, z, ...);
+

The parameters to read must be variable references. The parameters to write +can be expressions of matching type, except for the file parameter (files must +always be VAR references). Writing to a file is special in that you cannot write +to a file unless you are at the end of the file. That is, you may only append +new elements to the end of the file, not modify existing components of the file.

+

Files are said to exist in three "states":

+

1. Inactive.

+

2. Read.

+

3. Write.

+

All files begin life in the inactive state. For a file to be read from, it +must be placed into the read state. For a file to be written, it must be placed +in the write state. The reset and rewrite procedures do this:

+
reset(f);
+

Places the buffer variable at the 1st element of the file (if it exists), +and sets the file mode to "read".

+
rewrite(f);
+

Clears any previous contents of the file, and places the buffer variable +at the start of the file. The file mode is set to "write". A file +can be tested for only one kind of position, that is if it has reached the end:

+
eof(f);
+

Is a function that returns true if the end of the file has been reached. +eof must be true before the file can be written.

+

Predefined procedures and text files

+

As alluded to before, text files are treated specially under Pascal. First, +The ends of lines are treated specially. If the end of a line is reached, a +read call will just return a space. A special function is required to determine +if the end of the line has been reached:

+
eoln(f);
+

Returns true if the current file position is at the end of a line. Pascal +strictly enforces the following structure to text files:

+
line 1<eoln>
+
line 2<eoln>
+
...
+
line N<eoln>
+
<eof>
+

There will always be an eoln terminating each line. If the file being read +does not have an eoln on the last line, it will be added automatically. Besides +the standard read and write calls, two procedures are special to text files:

+
readln(f...);
+
writeln(f...);
+

Readln behaves as a normal read, but after all the items in the list are +read, The rest of the line is skipped until eoln is encountered. Writeln behaves +as a normal write, but after all the items in the list are written, an eoln +is appended to the output. Text files can be treated as simple files of characters, +but it is also possible to read and write other types to a text file. Integers +and reals can be read from a text file, and integers, reals, booleans, +and strings can be written to text files. These types are written or read from +the file by converting them to or from a character based format. The format +for integers on read must be:

+
[+/-]digit[digit]...
+

Examples:

+
 9
+
+56
+
-19384
+

The format for reals on read is:

+
[+/-]digit[digit]...[.digit[digit]...][e[+/-]digit[digit]...]
+

Examples:

+
-1
+
-356.44
+
7e9
+
+22.343e-22
+

All blanks are skipped before reading the number. Since eolns are defined +as blanks, this means that even eoln is skipped to find the number. This can +lead to an interesting situation when a number is read from the console. If +the user presses return without entering a number (on most systems), nothing +will happen until a number is entered, no matter how many times return is hit!

+

Write parameters to textfiles are of the format:

+
write(x[:field[:fraction]]);
+

The field states the number of character positions that you expect the object +to occupy. The fraction is special to reals. The output format that occurs in +each case are:

+

integer: The default field for integers is implementation defined, but is +usually the number of digits in maxint, plus a position for the sign. If a field +is specified, and is larger than the number of positions required to output +the number and sign, then blanks are added to the left side of the output until +the total size equals the field width. If the field width is less than the required +positions, the field width is ignored.

+

real: The default field for reals is implementation defined. There are two +different format modes depending on whether the fraction parameter appears. +

+

If there is no fraction, the format is:

+
-0.0000000e+000
+

Starting from the left, the sign is either a "-" sign if the number +is negative, or blank if the number is positive or zero. Then the first digit +of the number, then the decimal point, then the fraction of the number, then +either 'e' or 'E' (the case is implementation defined), then the sign of the +exponent, then the digits of the exponent. The number of digits in the exponent +are implementation defined, as are the number of digits in a fraction if no +field width is defined. If the field width appears, and it is larger than the +total number of required positions in the number (all the characters in the +above format without the fraction digits), then the fraction is expanded until +the entire number fills the specified field, using right hand zeros if required. +Otherwise, the minimum required positions are always printed.

+

If a fraction appears (which means the field must also appear), the format +used is:

+
[-]00...00.000..00
+

The number is converted to it's whole number equivalent, and all the of whole +number portion of the number printed, regardless of the field size, proceeded +by "-" if the number is negative. Then, a decimal point appears, followed +by the number of fractional digits specified in the fraction parameter. If the +field is greater then the number of required positions and specified fraction +digits, then leading spaces are appended until the total size equals the field +width. The minimum positions and the specified fractional digits are always +printed.

+

Header files

+

The header files feature was originally designed to be the interface of Pascal +to the external files system, and as such is implementation by definition. It +is also (unfortunately) ignored in most implementations. The header files appear +as a simple list of identifiers in the program header:

+

program test(input, output, source, object);

+

Each header file automatically assumes the type text. If the file needs to +be another type, it should be declared again in the variables section of the +program block:

+
program test(intlist);
+
 
+
var intlist: file of integer;
+

Two files are special, and should not be redeclared. These are input and +output. The input files are understood to represent the main input and main +output from the program, and are present in all Pascal programs. In addition, +they are the default files is special forms of these  procedures and functions:

+
This form      is equivalent to      This form
+
--------------------------------------------------------------
+
write(...)                           write(output, ...)
+
writeln(...)                         writeln(output, ...)
+
writeln                              writeln(output)
+
read(...)                            read(input, ...)
+
readln(...)                          readln(input, ...)
+
readln                               readln(input)
+
eof                                  eof(input)
+
eoln                                 eoln(input)
+
page                                 page(output)
+

Packing procedures

+

Because arrays are incompatible with each other even when they are of the +same type if their packing status differs, two procedures allow a packed array +to be copied to a non-packed array and vice versa:

+
unpack(PackedArray, UnpackedArray, Index);
+

Unpacks the packed array and places the contents into the unpacked array. +The index gives the starting index of the unpacked array where the data is to +be placed. Interestingly, the two arrays need not have the same index type or +even be the same size ! The unpacked array must simply have enough elements +after the specified starting index to hold the number of elements in the packed +array.

+
pack(UnpackedArray, Index, PackedArray);
+

Packs part of the unpacked array into the packed array. The index again gives +the starting position to copy data from in the unpacked array. Again, the arrays +need not be of the same index type or size. The unpacked array simply need enough +elements after the index to provide all the values in the packed array.

+

Dynamic allocation

+

In Pascal, pointer variables are limited to the mode of variable they can +index. The objects indexed by pointer types are anonymous, and created or destroyed +by the programmer at will. A pointer variable is undefined when it is first +used, and it is an error to access the variable it points to unless that variable +has been created:

+
var p: ^integer;
+
 
+
...
+
 
+
   new(p); { create a new integer type }
+
   p^ := 1; { place value }
+

Would create a new variable. Variables can also be destroyed:

+
dispose(p);
+

Would release the storage allocated to the variable. It is an error (a very +serious one) to access the contents of a variable that has been disposed. A +special syntax exists for the allocation of variant records:

+
var r: record
+
 
+
          a: integer;
+
          case b: boolean 
+of
+
 
+
             true: 
+(c: integer);
+
             false: 
+(d: char)
+
 
+
          { end }
+
 
+
       end;
+
 
+
...
+
 
+
new(p, true);
+
 
+
...
+
 
+
dispose(p, true);
+

For each of new and dispose, each of the tagfields we want to discriminate +are parameters to the procedure. The appearance of the tagfield values allow +the compiler to allocate a variable with only the amount of space required for +the record with that variant. This can allow considerable storage savings if +used correctly. The appearance of a discriminant in a new procedure does not +also  automatically SET the value of the tagfield. You must do that yourself. +For the entire life of the variable, you must not set the tagfield to any other +value than the value used in the new procedure, nor access any of the  variants +in the record that are not active. The dispose statement should be called with +the exact same tagfield values and number. Note that ALL the tagfields in a +variable need not appear, just all the ones, in order, that we wish to allocate +as fixed.

+
+
+ +
+For more information contact: Scott A. Moore samiam@moorecad.com
+ + + diff --git a/Source/tutor86_python_conversion.png b/Source/tutor86_python_conversion.png new file mode 100644 index 00000000..a934bdd8 Binary files /dev/null and b/Source/tutor86_python_conversion.png differ diff --git a/Source/uCommonFunctions.pas b/Source/uCommonFunctions.pas new file mode 100644 index 00000000..87b131bb --- /dev/null +++ b/Source/uCommonFunctions.pas @@ -0,0 +1,2377 @@ +{----------------------------------------------------------------------------- + Unit Name: uCommonFunctions + Author: Kiriakos Vlahos + Date: 23-Jun-2005 + Purpose: Functions common to many units in PyScripter + History: +-----------------------------------------------------------------------------} + +unit uCommonFunctions; + +interface +Uses + Winapi.Windows, + System.Classes, + System.SysUtils, + System.Diagnostics, + System.RegularExpressionsAPI, + System.RegularExpressionsCore, + System.RegularExpressions, + Vcl.Controls, + Vcl.ComCtrls, + Vcl.Graphics, + Vcl.Forms, + Vcl.Dialogs, + SynEditTypes, + SynUnicode, + SynEdit, + uEditAppIntfs; + +const + UTF8BOMString : RawByteString = AnsiChar($EF) + AnsiChar($BB) + AnsiChar($BF); + IdentChars: TSysCharSet = ['_', '0'..'9', 'A'..'Z', 'a'..'z']; + SFileExpr = '(([a-zA-Z]:)?[^\*\?="<>|:,;\+\^]+)'; // fwd slash (/) is allowed + STracebackFilePosExpr = '"\?", line (\d+)(, in ([\<\>\?\w]+))?'; + SWarningFilePosExpr = '\?:(\d+):'; + WideLF = WideChar(#10); + WideNull = WideChar(#0); + AnsiLineFeed = AnsiChar(#10); + AnsiCarriageReturn = AnsiChar(#13); + AnsiCrLf = AnsiString(#13#10); + WordBreakString = ',.;:"�`�^!?&$@�%#~[](){}<>-=+*/\| '; + +(* returns the System ImageList index of the icon of a given file *) +function GetIconIndexFromFile(const AFileName: string; + const ASmall: boolean): integer; + +(* returns long file name even for nonexisting files *) +function GetLongFileName(const APath: string): string; + +(* from cStrings *) +(* checks if AText starts with ALeft *) +function StrIsLeft(AText, ALeft: PWideChar): Boolean; + +(* checks if AText ends with ARight *) +function StrIsRight(AText, ARight: PChar): Boolean; + +(* returns next token - based on Classes.ExtractStrings *) +function StrGetToken(var Content: PChar; + Separators, WhiteSpace, QuoteChars: TSysCharSet): string; + +(* removes quotes to AText, if needed *) +function StrUnQuote(const AText: string): string; + +(* Lighten a given Color by a certain percentage *) +function LightenColor(Color:TColor; Percentage:integer):TColor; + +(* Darken a given Color by a certain percentage *) +function DarkenColor(Color:TColor; Percentage:integer):TColor; + +(* Get Exe File Version string *) +function ApplicationVersion : string; + +(* Checks whether we are connected to the Internet *) +function ConnectedToInternet : boolean; + +(* Extracts the nth line from a string *) +function GetNthLine(const S : string; LineNo : integer) : string; + +(* Extracts a range of lines from a string *) +function GetLineRange(const S : string; StartLine, EndLine : integer) : string; + +(* Extracts a word from a string *) +function GetWordAtPos(const LineText : string; Start : Integer; WordChars : TSysCharSet; + ScanBackwards : boolean = True; ScanForward : boolean = True; + HandleBrackets : Boolean = False) : string; + +(* Format a doc string by removing left space and blank lines at start and bottom *) +function FormatDocString(const DocString : string) : string; + +(* Calculate the indentation level of a line *) +function CalcIndent(S : string; TabWidth : integer = 4): integer; + +(* check if a directory is a Python Package *) +function DirIsPythonPackage(Dir : string): boolean; + +(* check if a directory is a Python Package *) +function FileIsPythonPackage(FileName : string): boolean; + +(* Get Python Package Root directory *) +function GetPackageRootDir(Dir : string): string; + +(* Python FileName to possibly dotted ModuleName accounting for packages *) +function FileNameToModuleName(const FileName : string): string; + +(* Convert < > to < > *) +function HTMLSafe(const S : string): string; + +(* Parses command line parameters *) +// From Delphi's system.pas unit! Need to rewrite +function GetParamStr(P: PChar; var Param: string): PChar; + +(* Parse a line for a Python encoding spec *) +function ParsePySourceEncoding(Textline : string): string; + +(* Version of InputQuery that can be called from threads and executes in the main thread *) +function SyncWideInputQuery(const ACaption, APrompt: string; var Value: string): Boolean; + +(* Covert all line breaks to #10 *) +function CleanEOLs(S: AnsiString): AnsiString; overload; +function CleanEOLs(S: string): string; overload; + +(* Similar to Delphi's IdentToInt but operating on sorted IdentMapEntries *) +function SortedIdentToInt(const Ident: string; var Int: Longint; + const SortedMap: array of TIdentMapEntry; + CaseSensitive : Boolean = False): Boolean; + +(* Used for sorting Python Identifiers *) +function ComparePythonIdents(const S1, S2 : string): Integer; overload; +function ComparePythonIdents(List: TStringList; Index1, Index2: Integer): Integer; overload; + +(* Used to get Vista and code fonts *) +function DefaultCodeFontName: string; +procedure SetDefaultUIFont(const AFont: TFont); +procedure SetContentFont(const AFont: TFont); + +(* Visual Studio replacement for SynEdits NextWord *) +function VSNextWordPos(SynEdit: TCustomSynEdit; const XY: TBufferCoord): TBufferCoord; + +(* Visual Studio replacement for SynEdits PrevWord *) +function VSPrevWordPos(SynEdit: TCustomSynEdit; const XY: TBufferCoord): TBufferCoord; + +(* Get the text between two Synedit Block coordinates *) +function GetBlockText(Strings : TStrings; BlockBegin, BlockEnd : TBufferCoord) : string; + +(* Extract Error information from a VarPyth variant containing the Python error *) +procedure ExtractPyErrorInfo(E: Variant; var FileName: string; var LineNo: Integer; var Offset: Integer); + +(* Get Encoded Ansi string from WideStrings ttaking into account Python file encodings *) +function WideStringsToEncodedText(const AFileName: string; + Lines : TStrings; var EncodedText: AnsiString; + InformationLossWarning: Boolean = False; + IsPython: Boolean = False) : Boolean; + +(* Load file into WideStrings taking into account Python file encodings *) +function LoadFileIntoWideStrings(const AFileName: string; + Lines : TStrings): boolean; + +(* Save WideStrings to file taking into account Python file encodings *) +function SaveWideStringsToFile(const AFileName: string; + Lines : TStrings; DoBackup : Boolean = True) : boolean; + +(* Read File contents. Allows reading of locked files *) +function FileToAnsiStr(const FileName: string): AnsiString; + +(* Read File contents into encoded string. Takes into account Python encodings *) +function FileToEncodedStr(const AFileName : string) : AnsiString; + +(* Read File contents into Widestring. Takes into account Python encodings *) +function FileToStr(const AFileName : string) : string; + +type + TDirectoryWalkProc = reference to function (const Path: string; + const FileInfo: TSearchRec): Boolean; + +(* + Directory traversal function. Paths and Masks are semi-colon delimited lists. +*) +procedure WalkThroughDirectories(const Paths, Masks: string; + const PreCallback: TDirectoryWalkProc; + const Recursive: Boolean); + +(* + Find files and place them in FileList. Paths and Masks are semi-colon delimited lists. +*) +procedure GetFilesInPaths(Paths, Masks : string; FileList: TStrings; Recursive : Boolean = True); + +(* + Find directories and place them in DirList. Paths and Masks are semi-colon delimited lists. +*) +procedure GetDirectoriesInPaths(Paths, Masks : string; DirList: TStrings; Recursive : Boolean = True); + +(* Check whether is S is likely to be a number *) +//function WideStrConsistsofNumberChars(const S: WideString): Boolean; + +(* Trim certain chars from left of string *) +function StrTrimCharsLeft(const S: string; const Chars: TSysCharSet): string; + +(* Trim certain chars from right of string *) +function StrTrimCharsRight(const S: string; const Chars: TSysCharSet): string; + +(* Extracts a token and returns the remainder of a string *) +function StrToken(var S: string; Separator: Char): string; + +(* Improved CanFocus *) +function CanActuallyFocus(WinControl: TWinControl): Boolean; + +(* Create a PCRE Regular Expression and compile it *) +function CompiledRegEx(Expr : string; Options: TRegExOptions = [roNotEmpty]; + UCP : Boolean = True): TRegEx; + +(* Checks whether S contains digits only *) +function IsDigits(S : string): Boolean; + +(* Remove the white space in front of the first line from all lines *) +function Dedent (const S : string) : string; + +(* Returns true for dark colors *) +function IsColorDark(AColor : TColor) : boolean; + +(* Returns true if the styled clWindows system oolor is dark *) +function IsStyledWindowsColorDark : boolean; + +(* Adds formated text to a Richedit control *) +procedure AddFormatText(RE : TRichEdit; const S: string; FontStyle: TFontStyles = []; + const FontColor: TColor = clDefault; FontSize: Integer = 0); + +(* Resize Bitmap *) +procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, NewHeight: integer); + +(* Returns string with Desktop size *) +function MonitorProfile: string; + +(* Downlads a file from the Interent *) +function DownloadUrlToFile(const URL, Filename: string): Boolean; + +(* ExtracFileName that works with both Windows and Unix file names *) +function XtractFileName(const FileName: string): string; + +(* ExtractFileDir that works with both Windows and Unix file names *) +function XtractFileDir(const FileName: string): string; + +(* Raises a keyword interrupt in another process *) +procedure RaiseKeyboardInterrupt(ProcessId: DWORD); + +(* Terminates a process and all child processes *) +function TerminateProcessTree(ProcessID: DWORD): Boolean; + +(* Executes a Command using CreateProcess and captures output *) +function ExecuteCmd(Command : string; out CmdOutput: string): cardinal; overload; +function ExecuteCmd(Command : string; out CmdOutput, CmdError: string): cardinal; overload; + +(* Checks if a file extension is contained in a file filter *) +function FileExtInFileFilter(FileExt, FileFilter: string): Boolean; + +(* Checks if a file name is indicates a Python source file *) +function FileIsPythonSource(FileName: string): Boolean; + +(* Simple routine to hook/detour a function *) +procedure RedirectFunction(OrgProc, NewProc: Pointer); + +{ Styled MessageDlg (do not use TaskDialog) } +function StyledMessageDlg(const Msg: string; DlgType: TMsgDlgType; + Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer; overload; +function StyledMessageDlg(const Msg: string; DlgType: TMsgDlgType; + Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultButton: TMsgDlgBtn): Integer; overload; + +{Style adjusted svg FixedColor} +function SvgFixedColor(Color: TColor): TColor; + +type + (* Extends System.RegularExperssions.TRegEx *) + TRegExHelper = record helper for TRegEx + public + procedure Study; + procedure SetAdditionalPCREOptions(PCREOptions : Integer); + function PerlRegEx : TPerlRegEx; + end; + + TMatchHelper = record helper for TMatch + public + function GroupIndex(Index: integer): integer; + function GroupLength(Index: integer): integer; + function GroupValue(Index: integer): string; + end; + + (* Helper method for forms *) + TControlHelper = class helper for TControl + public + (* Scale a value according to the FCurrentPPI *) + function PPIScale(ASize: integer): integer; + (* Reverse PPI Scaling *) + function PPIUnScale(ASize: integer): integer; + end; + + (* + TSynStringList is a general purpose TStringList descendent that adds + the following features: + - LoadFromFile followed by SaveToFile results in an identical file + - Detects the LineBreak in the read stream and uses it in SaveToStream + - UseBOM is set when reading a stream depending on whether BOM exists + - When reading a file without a BOM it tries to detect whether the e + encoding is UTF8 + - Event handler for dealing with information loss in Unicode to ANSI + conversion + *) + TXStringList = class(TStringList) + private + fUTF8CheckLen: Integer; + fFileFormat: TSynEditFileFormat; + fOnInfoLoss: TSynInfoLossEvent; + fDetectUTF8: Boolean; + public + constructor Create; overload; + procedure SetTextAndFileFormat(const Value: string); + procedure LoadFromStream(Stream: TStream; Encoding: TEncoding); override; + procedure SaveToStream(Stream: TStream; Encoding: TEncoding); override; + property FileFormat: TSynEditFileFormat read FFileFormat write fFileFormat; + published + property UTF8CheckLen: Integer read fUTF8CheckLen write fUTF8CheckLen default -1; + property DetectUTF8: Boolean read fDetectUTF8 write fDetectUTF8 default True; + property OnInfoLoss: TSynInfoLossEvent read fOnInfoLoss write fOnInfoLoss; + end; + + (* + Multiple Read Exclusive Write lock based on Windows slim reader/writer + (SRW) Locks. Can be also used instead of a critical session. + Limitations: non-reentrant, not "fair" + *) + (* + Interfaced based Timer that can be used with anonymous methods + Developed by : Nuno Picado (https://github.com/nunopicado/Reusable-Objects) + *) + ITimer = interface(IInvokable) + ['{1C06BCF6-1C6D-473E-993F-2B231B17D4F5}'] + function Start(const Action: TProc): ITimer; + function Stop: ITimer; + function Restart: ITimer; + end; + + function NewTimer(Interval: Cardinal): ITimer; + +type +(* + Minimalist SmartPointer implementation based on a blog post by Barry Kelly: + http://blog.barrkel.com/2008/11/reference-counted-pointers-revisited.html, + https://stackoverflow.com/questions/30153682/why-does-this-optimization-of-a-smartpointer-not-work +*) + TObjectHandle = class(TInterfacedObject, TFunc) + // used by TSmartPointer + private + FValue: T; + public + constructor Create(AValue: T); + destructor Destroy; override; + function Invoke: T; + end; + + TSmartPtr = record + class function Make(AValue: T): TFunc; static; + end; + +Var + StopWatch : TStopWatch; + +implementation +Uses + Winapi.UrlMon, + Winapi.CommCtrl, + Winapi.TlHelp32, + Winapi.Wincodec, + System.Types, + System.StrUtils, + System.AnsiStrings, + System.UITypes, + System.IOUtils, + System.Math, + Vcl.ExtCtrls, + Vcl.Themes, + JclFileUtils, + JclBase, + JclStrings, + JclPeImage, + JclSysUtils, + JvJCLUtils, + JvGnugettext, + MPCommonUtilities, + MPCommonObjects, + MPShellUtilities, + SynEditMiscClasses, + SynEditTextBuffer, + VarPyth, + PythonEngine, + cInternalPython, + StringResources, + cPyScripterSettings, + cParameters, + cSSHSupport; + +function GetIconIndexFromFile(const AFileName: string; + const ASmall: boolean): integer; +Var + NameSpace : TNameSpace; + IconSize : TIconSize; +begin + Result:= -1; + // swallow any exceptions (bug report by Colin Williams) + try + if FileExists(AFileName) then begin + if ASmall then + IconSize := icSmall + else + IconSize := icLarge; + NameSpace := TNameSpace.CreateFromFileName(AFileName); + try + Result := NameSpace.GetIconIndex(False, IconSize); + finally + NameSpace.Free; + end; + end; + except + end; +end; + +function GetLongFileName(const APath: string): string; +(* returns long file name even for nonexisting files *) +begin + if APath = '' then Result:= '' + else begin + Result:= PathGetLongName(APath); + // if different - function is working + if (Result = '') or + ((Result = APath) and + not (FileExists(ExcludeTrailingPathDelimiter(APath)) or + System.SysUtils.DirectoryExists(ExcludeTrailingPathDelimiter(APath)))) then + begin + Result:= ExtractFilePath(APath); + // we are up to top level + if (Result = '') or (Result[Length(Result)] = ':') then + Result:= APath + else Result:= Concat(GetLongFileName(ExcludeTrailingPathDelimiter(Result)), + PathDelim, ExtractFileName(APath)); + end; + end; +end; + +(* from cStrings *) + +function StrIsLeft(AText, ALeft: PChar): Boolean; +(* checks if AText starts with ALeft *) +begin + while (ALeft^ <> #0) and (AText^ <> #0) and (ALeft^ = AText^) do begin + Inc(ALeft); + Inc(AText); + end; + Result := ALeft^ = #0; +end; + +function StrIsRight(AText, ARight: PChar): Boolean; +(* checks if AText ends with ARight *) +var + LenDiff: Integer; +begin + Result:= ARight = nil; + LenDiff := StrLen(AText) - StrLen(ARight); + if not Result and (LenDiff >= 0) then begin + Inc(AText, LenDiff); + Result := StrIsLeft(AText, ARight); + end; +end; + +function StrGetToken(var Content: PChar; + Separators, WhiteSpace, QuoteChars: TSysCharSet): string; +(* returns next token - based on Classes.ExtractStrings *) +var + Head, Tail: PChar; + InQuote: Boolean; + QuoteChar: Char; +begin + Result:= ''; + if (Content = nil) or (Content^=#0) then Exit; + Tail := Content; + InQuote := False; + QuoteChar := #0; + while CharInSet(Tail^, WhiteSpace) do Inc(Tail); + Head := Tail; + while True do begin + while (InQuote and not CharInSet(Tail^, QuoteChars + [#0])) or + not CharInSet(Tail^, Separators + WhiteSpace + QuoteChars + [#0]) do Inc(Tail); + if CharInSet(Tail^, QuoteChars) then begin + if (QuoteChar <> #0) and (QuoteChar = Tail^) then + QuoteChar := #0 + else QuoteChar := Tail^; + InQuote := QuoteChar <> #0; + Inc(Tail); + end else Break; + end; + if (Head <> Tail) and (Head^ <> #0) then begin + SetString(Result, Head, Tail - Head); + Content:= Tail; + end; +end; + +function StrUnQuote(const AText: string): string; +(* removes quotes to AText, if needed *) +var + PText: PChar; +begin + if CharInSet(PChar(AText)^, ['"', '''']) then begin + PText:= PChar(AText); + Result:= AnsiExtractQuotedStr(PText, PText^); + end + else Result:= AText; +end; + +(* from cStrings end *) + +function LightenColor(Color:TColor; Percentage:integer):TColor; +var + wRGB, wR, wG, wB : longint; +begin + wRGB := ColorToRGB(Color); + wR := Min(round(GetRValue(wRGB) * (1+(percentage / 100))), 255); + wG := Min(round(GetGValue(wRGB) * (1+(percentage / 100))), 255); + wB := Min(round(GetBValue(wRGB) * (1+(percentage / 100))), 255); + result := RGB(wR, wG, wB); +end; + +function DarkenColor(Color:TColor; Percentage:integer):TColor; +var + wRGB, wR, wG, wB : longint; +begin + wRGB := ColorToRGB(Color); + wR := round(GetRValue(wRGB) / (1+(percentage / 100))); + wG := round(GetGValue(wRGB) / (1+(percentage / 100))); + wB := round(GetBValue(wRGB) / (1+(percentage / 100))); + result := RGB(wR, wG, wB); +end; + +function ApplicationVersion : string; +var + ExeFile : string; +begin + ExeFile := Application.ExeName; + if VersionResourceAvailable(ExeFile) then begin + with TJclFileVersionInfo.Create(ExeFile) do begin + Result := BinFileVersion; + Free; + end; + end else + Result := '1.0.0'; +end; + +function ConnectedToInternet : boolean; +{ +Call SHELL32.DLL for Win < Win98 +otherwise call URL.dll +} +{button code:} +const + WininetDLL = 'wininet.dll'; + URLDLL = 'url.dll'; + INTERNET_CONNECTION_MODEM = 1; + INTERNET_CONNECTION_LAN = 2; + INTERNET_CONNECTION_PROXY = 4; + INTERNET_CONNECTION_MODEM_BUSY = 8; +var + hURLDLL: THandle; + hWininetDLL: THandle; + dwReserved: DWORD; + dwConnectionTypes: DWORD; + fn_InternetGetConnectedState: function(lpdwFlags: LPDWORD; dwReserved: DWORD): BOOL; stdcall; + InetIsOffline : function(dwFlags: DWORD): BOOL; stdcall; +begin + Result := False; + hURLDLL := SafeLoadLibrary(URLDLL); + if hURLDLL > 0 then + begin + @InetIsOffline := GetProcAddress(hURLDLL,'InetIsOffline'); + if Assigned(InetIsOffline) then begin + if InetIsOffLine(0) then + Result := False + else + Result := True; + end; + FreeLibrary(hURLDLL); + end; + + // Double checking + if Result then begin + hWininetDLL := SafeLoadLibrary(WininetDLL); + if hWininetDLL > 0 then + begin + @fn_InternetGetConnectedState := GetProcAddress(hWininetDLL,'InternetGetConnectedState'); + if Assigned(fn_InternetGetConnectedState) then + begin + dwReserved := 0; + dwConnectionTypes := INTERNET_CONNECTION_MODEM or INTERNET_CONNECTION_LAN + or INTERNET_CONNECTION_PROXY or INTERNET_CONNECTION_MODEM_BUSY; + Result := fn_InternetGetConnectedState(@dwConnectionTypes, dwReserved); + end; + FreeLibrary(hWininetDLL); + end; + end; +end; + +function GetNthLine(const S : string; LineNo : integer) : string; +var + SL : TStringList; +begin + SL := TStringList.Create; + try + SL.Text := S; + if LineNo <= SL.Count then + Result := SL[LineNo-1] + else + Result := ''; + finally + SL.Free; + end; +end; + +function GetLineRange(const S : string; StartLine, EndLine : integer) : string; +var + SL : TStringList; + i, LastLine : integer; +begin + Result := ''; + SL := TStringList.Create; + try + SL.Text := S; + LastLine := Min(EndLine-1, SL.Count -1); + for i := Max(0, StartLine-1) to LastLine do + if i = LastLine then + Result := Result + SL[i] + else + Result := Result + SL[i] + sLineBreak; + finally + SL.Free; + end; +end; + +function GetWordAtPos(const LineText : string; Start : Integer; WordChars : TSysCharSet; + ScanBackwards : boolean = True; ScanForward : boolean = True; + HandleBrackets : Boolean = False) : string; +{ TODO : Replace WordChars with IsLetterOrDigit to properly deal with Unicode } +Var + i : integer; + L, WordStart, WordEnd, ParenCounter, NewStart : integer; + Bracket, MatchingBracket : WideChar; +Const + AllBrackets = '()[]{}'; + CloseBrackets = [')', ']', '}']; + OpenBrackets = ['(', '[', '{']; +begin + L := Length(LineText); + WordStart := Start; + WordEnd := Start; + if (Start <= 0) or (Start > L) then + Exit('') + else if not CharInSet(LineText[Start], WordChars) then + Result := '' + else begin + if ScanBackwards then begin + i := Start; + while (i > 1) and CharInSet(LineText[i-1], WordChars) do + Dec(i); + WordStart := i; + end; + if ScanForward then begin + i := Start; + while (i < L) and CharInSet(LineText[i+1], WordChars) do + Inc(i); + WordEnd := i; + end; + Result := Copy(LineText, WordStart, WordEnd - WordStart + 1); + end; + + if HandleBrackets and ScanBackwards then begin + if (Result = '') then + NewStart := Start + else + NewStart := WordStart - 1; + + if (NewStart > 0) and CharInSet(LineText[NewStart], CloseBrackets) then begin + //We found a close, go till it's opening paren + + Bracket := LineText[NewStart]; + MatchingBracket := AllBrackets[AllBrackets.IndexOf(Bracket)]; // IndexOf is zero based! + + ParenCounter := 1; + i := NewStart - 1; + while (i > 0) and (ParenCounter > 0) do + begin + if Linetext[i] = Bracket then inc(ParenCounter) + else if Linetext[i] = MatchingBracket then dec(ParenCounter); + Dec(i); + end; + WordStart := i+1; + Result := Copy(LineText, WordStart, NewStart - WordStart + 1) + Result; + if WordStart > 1 then + // Recursive call + Result := GetWordAtPos(LineText, WordStart - 1, WordChars, + ScanBackWards, False, True) + Result; + end; + end; +end; + +function FormatDocString(const DocString : string) : string; +var + SL : TStringList; + i, Margin : integer; +begin + Result := DocString; + if Result = '' then Exit; + + // Expand Tabs + Result := StringReplace(Result, #9, ' ', [rfReplaceAll]); + + //Find minimum indentation of any non-blank lines after first line. + Margin := MaxInt; + SL := TStringList.Create; + try + SL.Text := Result; + // Trim First Line + if SL.Count > 0 then + SL[0] := Trim(SL[0]); + + // Remove left margin and clear empty lines + for i := 1 to SL.Count - 1 do + if Trim(SL[i]) = '' then + SL[i] := '' + else + Margin := Min(Margin, CalcIndent(SL[i])); + if (Margin > 0) and (Margin < MaxInt) then + for i := 1 to SL.Count - 1 do + if SL[i] <> '' then + SL[i] := Copy(SL[i], Margin+1, Length(SL[i]) - Margin); + Result := SL.Text; + // Remove any trailing or leading blank lines. + Result := StrTrimCharsRight(Result, [#10, #13]); + Result := StrTrimCharsLeft(Result, [#10, #13]); + finally + SL.Free; + end; +end; + +function CalcIndent(S : string; TabWidth : integer = 4): integer; +Var + i : integer; +begin + Result := 0; + for i := 1 to Length(S) do + if S[i] = WideChar(#9) then + Inc(Result, TabWidth) + else if S[i] = ' ' then + Inc(Result) + else + break; +end; + +function DirIsPythonPackage(Dir : string): boolean; +begin + Result := System.SysUtils.DirectoryExists(Dir) and + FileExists(IncludeTrailingPathDelimiter(Dir) + '__init__.py'); +end; + +function FileIsPythonPackage(FileName : string): boolean; +begin + Result := (ExtractFileExt(FileName) = '.py') and + (ChangeFileExt(ExtractFileName(FileName), '') = '__init__'); +end; + +function GetPackageRootDir(Dir : string): string; +Var + S : string; +begin + if not DirIsPythonPackage(Dir) then + raise Exception.CreateFmt('"%s" is not a Python package', [Dir]); + S := Dir; + Repeat + Result := S; + S := ExtractFileDir(S); + Until (Result = S) or (not DirIsPythonPackage(S)); +end; + +function FileNameToModuleName(const FileName : string): string; +Var + Path, Dir, Server : string; +begin + Result := ChangeFileExt(XtractFileName(FileName), ''); + if TSSHFileName.Parse(FileName, Server, Path) then Exit; + + Path := ExtractFileDir(FileName); + Dir := ExtractFileName(Path); + + if Path <> '' then begin + while DirIsPythonPackage(Path) and (Dir <> '') do begin + Result := Dir + '.' + Result; + Path := ExtractFileDir(Path); + Dir := ExtractFileName(Path); + end; + if StrIsRight(PChar(Result), '.__init__') then + Delete(Result, Length(Result) - 8, 9); + end; +end; + +function HTMLSafe(const S : string): string; +begin + Result := StringReplace(S, '<', '<', [rfReplaceAll]); + Result := StringReplace(Result, '>', '>', [rfReplaceAll]); + Result := StringReplace(Result, #13#10, '
', [rfReplaceAll]); + Result := StringReplace(Result, #13, '
', [rfReplaceAll]); + Result := StringReplace(Result, #10, '
', [rfReplaceAll]); +end; + +function GetParamStr(P: PChar; var Param: string): PChar; +// From Delphi's system.pas unit! +var + i, Len: Integer; + Start, S, Q: PChar; +begin + while True do + begin + while (P[0] <> #0) and (P[0] <= ' ') do + P := CharNext(P); + {if (P[0] = '"') and (P[1] = '"') then Inc(P, 2) else} Break; // Issue 371 + end; + Len := 0; + Start := P; + while P[0] > ' ' do + begin + if P[0] = '"' then + begin + P := CharNext(P); + while (P[0] <> #0) and (P[0] <> '"') do + begin + Q := CharNext(P); + Inc(Len, Q - P); + P := Q; + end; + if P[0] <> #0 then + P := CharNext(P); + end + else + begin + Q := CharNext(P); + Inc(Len, Q - P); + P := Q; + end; + end; + + SetLength(Param, Len); + + P := Start; + S := Pointer(Param); + i := 0; + while P[0] > ' ' do + begin + if P[0] = '"' then + begin + P := CharNext(P); + while (P[0] <> #0) and (P[0] <> '"') do + begin + Q := CharNext(P); + while P < Q do + begin + S[i] := P^; + Inc(P); + Inc(i); + end; + end; + if P[0] <> #0 then P := CharNext(P); + end + else + begin + Q := CharNext(P); + while P < Q do + begin + S[i] := P^; + Inc(P); + Inc(i); + end; + end; + end; + + Result := P; +end; + +function ParsePySourceEncoding(Textline : string): string; +begin + Result := ''; + with TRegEx.Match(TextLine, 'coding[:=]\s*([-\w.]+)') do + if Success then + Exit(Groups[1].Value); +end; + +function GetAveCharSize(Canvas: TCanvas): TPoint; +var + I: Integer; + Buffer: array[0..51] of WideChar; + tm: TTextMetric; +begin + for I := 0 to 25 do Buffer[I] := WideChar(I + Ord('A')); + for I := 0 to 25 do Buffer[I + 26] := WideChar(I + Ord('a')); + GetTextMetrics(Canvas.Handle, tm); + GetTextExtentPointW(Canvas.Handle, Buffer, 52, TSize(Result)); + Result.X := (Result.X div 26 + 1) div 2; + Result.Y := tm.tmHeight; +end; + +type + TSyncInputQuery = class + public + Caption, Prompt, Value : string; + Res : Boolean; + constructor Create(ACaption, APrompt, AValue : string); + procedure InputQuery; + end; + +{ TSyncInputQuery } + +constructor TSyncInputQuery.Create(ACaption, APrompt, AValue: string); +begin + Caption := ACaption; + Prompt := APrompt; + Value := AValue; +end; + +procedure TSyncInputQuery.InputQuery; +begin + Res := Vcl.Dialogs.InputQuery(Caption, Prompt, Value); +end; + +function SyncWideInputQuery(const ACaption, APrompt: string; var Value: string): Boolean; +var + SyncInputQuery : TSyncInputQuery; + SaveThreadState: PPyThreadState; +begin + if GetCurrentThreadId = MainThreadId then + Result := InputQuery(ACaption, APrompt, Value) + else begin + SyncInputQuery := TSyncInputQuery.Create(ACaption, APrompt, Value); + try + with GetPythonEngine do begin + SaveThreadState := PyEval_SaveThread(); + try + TThread.Synchronize(nil, SyncInputQuery.InputQuery); + finally + PyEval_RestoreThread(SaveThreadState); + end; + end; + Result := SyncInputQuery.Res; + Value := SyncInputQuery.Value; + finally + SyncInputQuery.Free; + end; + end; +end; + +function CleanEOLs(S: AnsiString): AnsiString; +begin + Result := System.AnsiStrings.AdjustLineBreaks(S, System.tlbsLF) +end; + +function CleanEOLs(S: string): string; +begin + Result := System.SysUtils.AdjustLineBreaks(S, System.tlbsLF) +end; + +function SortedIdentToInt(const Ident: string; var Int: Longint; + const SortedMap: array of TIdentMapEntry; + CaseSensitive : Boolean = False): Boolean; +var + m, n, k, I: Integer; +begin + m := Low(SortedMap); n := High(SortedMap); + while m<=n do + begin + k := m+(n-m) div 2; + if CaseSensitive then + I := CompareStr(Ident, SortedMap[k].Name) + else + I := CompareText(Ident, SortedMap[k].Name); + if I = 0 then begin + Result := true; + Int := SortedMap[k].Value; + exit; + end else if I > 0 then + m := k+1 + else + n := k-1; + end; + Result := false +end; + +function ComparePythonIdents(const S1, S2 : string): Integer; overload; +Var + L1, L2 : integer; +begin + L1 := Length(S1); + L2 := Length(S2); + if (L1 > 0) and (S1[1] = Char('_')) and (L2>0) and (S2[1] = Char('_')) then + Result := CompareText(S1, S2) + else if (L1 > 0) and (S1[1] = Char('_')) then + Result := 1 + else if (L2>0) and (S2[1] = Char('_')) then + Result := -1 + else + Result := CompareText(S1, S2) +end; + +function ComparePythonIdents(List: TStringList; Index1, Index2: Integer): Integer; overload; +Var + S1, S2 : string; +begin + S1 := List[Index1]; + S2 := List[Index2]; + Result := ComparePythonIdents(S1, S2); +end; + +function DefaultCodeFontName: string; +begin + if CheckWin32Version(6) then + Result := 'Consolas' + else + Result := 'Courier New'; +end; + +procedure SetDefaultUIFont(const AFont: TFont); +Const + UIFont = 'Segoe UI'; +begin + if CheckWin32Version(6) + and not SameText(AFont.Name, UIFont) + and (Screen.Fonts.IndexOf(UIFont) >= 0) then + begin + AFont.Size := 9; + AFont.Name := UIFont; + end; +end; + +procedure SetContentFont(const AFont: TFont); +Const + VistaContentFont = 'Calibri'; +begin + if CheckWin32Version(6) + and not SameText(AFont.Name, VistaContentFont) + and (Screen.Fonts.IndexOf(VistaContentFont) >= 0) then + begin + AFont.Size := 9; + AFont.Name := VistaContentFont; + end; +end; + +function GetBlockText(Strings : TStrings; BlockBegin, BlockEnd : TBufferCoord) : string; +Var + Line : integer; +begin + // preconditions start + Assert(BlockBegin.Line <= Strings.Count); + Assert(BlockEnd.Line <= Strings.Count); + Assert(BlockBegin.Line <= BlockEnd.Line); + if BlockBegin.Line <= 0 then Exit; + if BlockEnd.Line <= 0 then Exit; + // preconditions end + + // work backwards + Line := BlockEnd.Line; + Result := System.StrUtils.LeftStr(Strings[Line-1], BlockEnd.Char - 1); + While (Line > BlockBegin.Line) and (Line > 1) do begin + Dec(Line); + Result := Strings[Line-1] + WideCRLF + Result; + end; + if Line = BlockBegin.Line then + Delete(Result, 1, BlockBegin.Char -1); +end; + +function VSNextWordPos(SynEdit: TCustomSynEdit; const XY: TBufferCoord): TBufferCoord; +var + CX, CY, LineLen: Integer; + Line: UnicodeString; +begin + CX := XY.Char; + CY := XY.Line; + + // valid line? + if (CY >= 1) and (CY <= SynEdit.Lines.Count) then + with SynEdit do begin + Line := Lines[CY - 1]; + + LineLen := Length(Line); + if CX > LineLen then + begin + // invalid char + // find first char in the next line + if CY < Lines.Count then + begin + Line := Lines[CY]; + LineLen := Length(Line); + Inc(CY); + CX := 1; + while (CX <= LineLen) and IsWhiteChar(Line[CX]) do + Inc(CX); + end; + end + else + begin + if CX = 0 then + CX := 1; + // valid char + if IsIdentChar(Line[CX]) then begin + while (CX <= LineLen) and IsIdentChar(Line[CX]) do + Inc(CX); + while (CX <= LineLen) and IsWhiteChar(Line[CX]) do + Inc(CX); + end else if IsWhiteChar(Line[CX]) then begin + while (CX <= LineLen) and IsWhiteChar(Line[CX]) do + Inc(CX); + end else begin + // breakchar and not whitechar + while (CX <= LineLen) and (IsWordBreakChar(Line[CX]) and not IsWhiteChar(Line[CX])) do + Inc(CX); + while (CX <= LineLen) and IsWhiteChar(Line[CX]) do + Inc(CX); + end; + end; + end; + Result.Char := CX; + Result.Line := CY; +end; + +function VSPrevWordPos(SynEdit: TCustomSynEdit; const XY: TBufferCoord): TBufferCoord; +var + CX, CY: Integer; + Line: UnicodeString; +begin + CX := XY.Char; + CY := XY.Line; + + // valid line? + if (CY >= 1) and (CY <= SynEdit.Lines.Count) then + with SynEdit do begin + Line := Lines[CY - 1]; + CX := Min(CX, Length(Line) + 1); + + if CX <= 1 then + begin + // find last IdentChar in the previous line + if CY > 1 then + begin + Dec(CY); + Line := Lines[CY - 1]; + CX := Length(Line) + 1; + while (CX > 1) and IsWhiteChar(Line[CX-1]) do + Dec(CX); + end; + end + else + begin + // CX > 1 and <= LineLenght + 1 + if IsIdentChar(Line[CX-1]) then begin + while (CX > 1) and IsIdentChar(Line[CX-1]) do + Dec(CX); + end else if IsWhiteChar(Line[CX-1]) then begin + while (CX > 1) and IsWhiteChar(Line[CX-1]) do + Dec(CX); + if CX <= 1 then begin + // find last IdentChar in the previous line + if CY > 1 then + begin + Dec(CY); + Line := Lines[CY - 1]; + CX := Length(Line) + 1; + while (CX > 1) and IsWhiteChar(Line[CX-1]) do + Dec(CX); + end; + end else if IsIdentChar(Line[CX-1]) then begin + while (CX > 1) and IsIdentChar(Line[CX-1]) do + Dec(CX); + end else begin + // breakchar and not whitechar + while (CX > 1) and (IsWordBreakChar(Line[CX-1]) and not IsWhiteChar(Line[CX-1])) do + Dec(CX); + end; + end else begin + // breakchar and not whitechar + while (CX > 1) and (IsWordBreakChar(Line[CX-1]) and not IsWhiteChar(Line[CX-1])) do + Dec(CX); + end; + end; + end; + Result.Char := CX; + Result.Line := CY; +end; + +procedure ExtractPyErrorInfo(E: Variant; var FileName: string; var LineNo: Integer; var Offset: Integer); +begin + try + FileName := E.filename; + except + FileName := ''; + end; + try + LineNo := E.lineno; + except + LineNo := 0; + end; + try + Offset := E.offset; + except + Offset := 0; + end; +end; + +function WideStringsToEncodedText(const AFileName: string; + Lines : TStrings; var EncodedText: AnsiString; + InformationLossWarning: Boolean = False; + IsPython: Boolean = False) : Boolean; +// AFileName is passed just for the warning +var + PyEncoding : string; + UniPy, EncodedString : PPyObject; + wStr: string; + SuppressOutput : IInterface; + OldLineBreak : string; +begin + Result := True; + + // Encoded strings cannot contain WideLineSeparator + OldLineBreak := Lines.LineBreak; + if Lines.LineBreak = WideLineSeparator then + Lines.LineBreak := sLineBreak; + + wStr := Lines.Text; + Lines.LineBreak := OldLineBreak; + + if GI_PyControl.PythonLoaded and + (IsPython or FileIsPythonSource(AFileName)) then + begin + PyEncoding := ''; + if Lines.Count > 0 then + PyEncoding := ParsePySourceEncoding(Lines[0]); + if (PyEncoding = '') and (Lines.Count > 1) then + PyEncoding := ParsePySourceEncoding(Lines[1]); + + with SafePyEngine.PythonEngine do begin + if PyEncoding = '' then + PyEncoding := SysModule.getdefaultencoding(); + SuppressOutput := GI_PyInterpreter.OutputSuppressor; // Do not show errors + UniPy := nil; + EncodedString := nil; + try + try + UniPy := PyUnicode_FromWideChar(PWideChar(wStr), Length(wStr)); + CheckError; + if InformationLossWarning then begin + try + EncodedString := PyUnicode_AsEncodedString(UniPy, PAnsiChar(AnsiString(PyEncoding)), 'strict'); + CheckError; + EncodedText := PyBytesAsAnsiString(EncodedString); + CheckError; + except + on UnicodeEncodeError do begin + Result := + StyledMessageDlg(Format(_(SFileEncodingWarning), + [AFileName, PyEncoding]), mtWarning, [mbYes, mbCancel], 0)= mrYes; + if Result then begin + EncodedString := PyUnicode_AsEncodedString(UniPy, + PAnsiChar(AnsiString(PyEncoding)), PAnsiChar(AnsiString('replace'))); + CheckError; + EncodedText := PyBytesAsAnsiString(EncodedString); + CheckError; + end; + end; + end; + end else begin + EncodedString := PyUnicode_AsEncodedString(UniPy, PAnsiChar(AnsiString(PyEncoding)), 'replace'); + CheckError; + EncodedText := PyBytesAsAnsiString(EncodedString); + CheckError; + end; + finally + Py_XDECREF(UniPy); + Py_XDECREF(EncodedString); + end; + except + PyErr_Clear; + EncodedText := AnsiString(wStr); + if InformationLossWarning then + Result := + StyledMessageDlg(Format(_(SFileEncodingWarning), + [AFileName, PyEncoding]), mtWarning, [mbYes, mbCancel], 0)= mrYes ; + end; + end; + end else begin + EncodedText := AnsiString(wStr); + if InformationLossWarning and not IsAnsiOnly(wStr) then begin + Result := + StyledMessageDlg(Format(_(SFileEncodingWarning), + [AFileName, 'ANSI']), mtWarning, [mbYes, mbCancel], 0)= mrYes ; + end; + end; +end; + +function LoadFileIntoWideStrings(const AFileName: string; Lines : TStrings): boolean; + + procedure LoadFromString(S: string); + begin + if Lines is TSynEditStringList then begin + TSynEditStringList(Lines).SetTextAndFileFormat(S); + TSynEditStringList(Lines).SetEncoding(TEncoding.ANSI); + end else if Lines is TXStringList then begin + TXStringList(Lines).SetTextAndFileFormat(S); + TXStringList(Lines).SetEncoding(TEncoding.ANSI); + end else + Lines.Text := S; + end; + +Var + Reader : TStreamReader; + FileStream: TFileStream; + FileText, PyEncoding : AnsiString; + S: String; + Len : integer; + PyWstr : PPyObject; +begin + Result := True; + if (AFileName = '') or not FileExists(AFileName) then Exit(False); + + try + if not FileIsPythonSource(AFileName) then + begin + Lines.LoadFromFile(AFileName); + Exit(True); + end; + + // Special processing for python files + // Try to use an encoding comment if present + Reader := TStreamReader.Create(AFileName, TEncoding.Default, True, 128); + try + // Reads the first Line - Also sets the CurrentEncoding + S := Reader.ReadLine; + if Reader.CurrentEncoding <> TEncoding.ANSI then + begin + // BOM found + Lines.LoadFromFile(AFileName); + Exit(True); + end; + + // Detect an encoding spec + PyEncoding := AnsiString(ParsePySourceEncoding(S)); + if PyEncoding = '' then begin + S := Reader.ReadLine; + PyEncoding := AnsiString(ParsePySourceEncoding(S)); + end; + finally + Reader.Free; + end; + + // if there is no encoding line or Python is not loaded use default encoding UTF8 + if not GI_PyControl.PythonLoaded or (PyEncoding = '') or + (LowerCase(PyEncoding) = 'utf-8') or (LowerCase(PyEncoding) = 'utf8') + then + begin + Lines.LoadFromFile(AFileName, TEncoding.UTF8); + Exit(True); + end; + + // we have an encoding we can use with python + FileStream := TFileStream.Create(AFileName, fmOpenRead or fmShareDenyNone); + // Read the file into FileText + try + Len := FileStream.Size; + SetLength(FileText, Len); + FileStream.ReadBuffer(FileText[1], Len); + finally + FileStream.Free; + end; + + PyWstr := nil; + try + var Py := SafePyEngine; + with Py.PythonEngine do begin + try + PyWstr := PyUnicode_Decode(PAnsiChar(FileText), + Length(FileText), + PAnsiChar(PyEncoding), 'replace'); + CheckError; + LoadFromString(PyUnicodeAsString(PyWstr)); + finally + Py_XDECREF(PyWstr); + end; + end; + except + StyledMessageDlg(Format(_(SDecodingError), + [AFileName, PyEncoding]), mtWarning, [mbOK], 0); + LoadFromString(string(FileText)); + end + + except + on E: Exception do begin + StyledMessageDlg(Format(_(SFileOpenError), [AFileName, E.Message]), mtError, [mbOK], 0); + Result := False; + end; + end; +end; + +type + TSynEditStringListAccess = class(TSynEditStringList); + +(* Save WideStrings to file taking into account Python file encodings *) +function SaveWideStringsToFile(const AFileName: string; + Lines : TStrings; DoBackup : Boolean = True) : boolean; +Var + FileStream : TFileStream; + S : AnsiString; + OldLineBreak: string; +begin + try + // Create Backup + if DoBackup and + FileExists(AFileName) then + begin + try + FileBackup(AFileName); + except + StyledMessageDlg(Format(_(SFailedToBackupFile), [AFileName]), + mtWarning, [mbOK], 0); + end; + end; + + if not FileIsPythonSource(AFileName) or (Lines.Encoding <> TEncoding.Ansi) then + begin + Lines.SaveToFile(AFileName); + Exit(True); + end; + + // For Ansi encoded Python files you have deal with coding comments + OldLineBreak := Lines.LineBreak; + if Lines is TSynEditStringList then + Lines.LineBreak := LineBreakFromFileFormat(TSynEditStringListAccess(Lines).FileFormat) + else if Lines is TXStringList then + Lines.LineBreak := LineBreakFromFileFormat(TXStringList(Lines).FileFormat); + + Result := WideStringsToEncodedText(AFileName, Lines, S, True); + + Lines.LineBreak := OldLineBreak; + + if Result then begin + FileStream := TFileStream.Create(AFileName, fmCreate); + try + FileStream.WriteBuffer(S[1], Length(S)) + finally + FileStream.Free; + end; + end; + except + on E: Exception do begin + StyledMessageDlg(Format(_(SFileSaveError), [AFileName, E.Message]), mtError, [mbOK], 0); + Result := False; + end; + end; +end; + +function FileToAnsiStr(const FileName: string): AnsiString; +(* allows reading of locked files *) +var + fs: TFileStream; + len: Integer; +begin + fs := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone); + try + len := fs.Size; + SetLength(Result, len); + if len > 0 then + fs.ReadBuffer(Result[1], len); + finally + fs.Free; + end; +end; + +function FileToEncodedStr(const AFileName : string) : AnsiString; +Var + SL : TStrings; + Server, FName, TempFileName, ErrorMsg : string; +begin + if TSSHFileName.Parse(AFileName, Server, FName) then + begin + TempFileName := ChangeFileExt(FileGetTempName('PyScripter'), ExtractFileExt(AFileName)); + if not ScpDownload(Server, FName, TempFileName, ErrorMsg) then + begin + StyledMessageDlg(Format(_(SFileSaveError), [FName, ErrorMsg]), mtError, [mbOK], 0); + Abort; + end; + end + else + TempFileName := AFileName; + + SL := TStringList.Create; + try + if not LoadFileIntoWideStrings(TempFileName, SL) then Abort; + WideStringsToEncodedText(AFileName, SL, Result, False); + finally + SL.Free; + end; + if Server <> '' then DeleteFile(TempFileName); +end; + + +function FileToStr(const AFileName : string) : string; +Var + SL : TStrings; + Server, FName, TempFileName, ErrorMsg : string; +begin + if TSSHFileName.Parse(AFileName, Server, FName) then + begin + TempFileName := ChangeFileExt(FileGetTempName('PyScripter'), ExtractFileExt(AFileName)); + if not ScpDownload(Server, FName, TempFileName, ErrorMsg) then + begin + StyledMessageDlg(Format(_(SFileSaveError), [FName, ErrorMsg]), mtError, [mbOK], 0); + Abort; + end; + end + else + TempFileName := AFileName; + + SL := TStringList.Create; + try + if not LoadFileIntoWideStrings(TempFileName, SL) then Abort; + Result := SL.Text; + finally + SL.Free; + end; + if Server <> '' then DeleteFile(TempFileName); +end; + +(* + Single directory traversal function used in WalkThroughDirectories +*) +procedure WalkThroughDirectory(const Path: string; Masks : TStringDynArray; + const PreCallback: TDirectoryWalkProc; + const Recursive: Boolean); +var + SearchRec: TSearchRec; + Match: Boolean; + Stop: Boolean; + PathWithSep, Mask : string; +begin + PathWithSep := IncludeTrailingPathDelimiter(Path); + if FindFirst(PathWithSep + '*', faAnyFile, SearchRec) = 0 then + try + Stop := False; + + repeat + Match := Length(Masks) = 0; + for Mask in Masks do begin + Match := TPath.MatchesPattern(SearchRec.Name, Mask, False); + if Match then Break; + end; + + // call the preorder callback method + if Match and Assigned(PreCallback) then + Stop := not PreCallback(PathWithSep, SearchRec); + + if not Stop then + begin + // go recursive in subdirectories + if Recursive and (SearchRec.Attr and System.SysUtils.faDirectory <> 0) and + (SearchRec.Attr and System.SysUtils.faHidden = 0) and + (SearchRec.Name <> '.') and + (SearchRec.Name <> '..') then + WalkThroughDirectory(PathWithSep + SearchRec.Name, + Masks, PreCallback, Recursive); + + end; + until Stop or (FindNext(SearchRec) <> 0); + finally + FindClose(SearchRec); + end; +end; + +procedure WalkThroughDirectories(const Paths, Masks: string; + const PreCallback: TDirectoryWalkProc; + const Recursive: Boolean); +Var + Path, PathName : string; + PathList, MaskList : TStringDynArray; +begin + PathList := SplitString(Paths, ';'); + MaskList := SplitString(Masks, ';'); + for Path in PathList do + begin + PathName := Parameters.ReplaceInText(Path); + if System.SysUtils.DirectoryExists(PathName) then + WalkThroughDirectory(PathName, MaskList, PreCallback, Recursive); + end; +end; + +procedure GetFilesInPaths(Paths, Masks : string; FileList: TStrings; Recursive : Boolean = True); +Var + PreCallback: TDirectoryWalkProc; +begin + PreCallback := + function (const Path: string; const FileInfo: TSearchRec): Boolean + begin + Result := True; + + if FileInfo.Attr and System.SysUtils.faDirectory = 0 then + FileList.Add(Path+FileInfo.Name); + end; + + WalkThroughDirectories(Paths, Masks, PreCallback, Recursive); +end; + +procedure GetDirectoriesInPaths(Paths, Masks : string; DirList: TStrings; Recursive : Boolean = True); +Var + PreCallback: TDirectoryWalkProc; +begin + PreCallback := + function (const Path: string; const FileInfo: TSearchRec): Boolean + begin + Result := True; + + if (FileInfo.Attr and System.SysUtils.faDirectory <> 0) and + (FileInfo.Name <> '.') and (FileInfo.Name <> '..') then + DirList.Add(Path+FileInfo.Name); + end; + + WalkThroughDirectories(Paths, Masks, PreCallback, Recursive); +end; + +function StrTrimCharsLeft(const S: string; const Chars: TSysCharSet): string; +var + I, L: Integer; +begin + I := 1; + L := Length(S); + while (I <= L) and CharInSet(S[I], Chars) do Inc(I); + Result := Copy(S, I, L - I + 1); +end; + +function StrTrimCharsRight(const S: string; const Chars: TSysCharSet): string; +var + I: Integer; +begin + I := Length(S); + while (I >= 1) and CharInSet(S[I], Chars) do Dec(I); + Result := Copy(S, 1, I); +end; + +function StrToken(var S: string; Separator: WideChar): string; +var + I: Integer; +begin + I := CharPos(S, Separator); + if I <> 0 then + begin + Result := Copy(S, 1, I - 1); + Delete(S, 1, I); + end + else + begin + Result := S; + S := ''; + end; +end; + +//function WideStrReplaceChars(const S: WideString; const Chars: TSysCharSet; Replace: WideChar): WideString; +//var +// I: Integer; +//begin +// Result := S; +// for I := 1 to Length(S) do +// if CharInSet(Result[I], Chars) then +// Result[I] := Replace; +//end; + +function CanActuallyFocus(WinControl: TWinControl): Boolean; +var + Form: TCustomForm; +begin + Result := False; + if Assigned(WinControl) and not WinControl.Focused then begin + Form := GetParentForm(WinControl); + if Assigned(Form) and Form.Enabled and Form.Visible then + Result := WinControl.CanFocus; + end; +end; + +function IsDigits(S : string): Boolean; +Var + i : integer; +begin + Result := True; + for I := 1 to Length(S) do + if not CharInSet(S[I], ['0'..'9']) then begin + Result := False; + break; + end; +end; + +function Dedent(const S : string) : string; +begin + with TRegEx.Match(S, '^\s+') do + if Success then + // to avoid repeated replacements of initial space + Exit(TRegEx.Replace(TRegEx.Replace(S, + '^'+Groups[0].Value , '!', [roNotEmpty, roMultiLine]), + '^!' , '', [roNotEmpty, roMultiLine])) + else + Exit(S) +end; + +function CompiledRegEx(Expr : string; Options: TRegExOptions = [roNotEmpty]; + UCP : Boolean = True): TRegEx; +begin + try + Result.Create(Expr, Options); + if UCP then + Result.SetAdditionalPCREOptions(PCRE_UCP); + Result.Study + except + on E: ERegularExpressionError do + begin + StyledMessageDlg(Format(_(SInvalidRegularExpression), [E.Message]), + mtError, [mbOK], 0); + Abort; + end + else + raise; + end; +end; + +function IsColorDark(AColor : TColor) : boolean; +var + ACol: Longint; +begin + ACol := ColorToRGB(AColor) and $00FFFFFF; + Result := ((2.99 * GetRValue(ACol) + 5.87 * GetGValue(ACol) + + 1.14 * GetBValue(ACol)) < $400); +end; + +function IsStyledWindowsColorDark : boolean; +begin + Result := IsColorDark(StyleServices.GetSystemColor(clWindow)); +end; + +{ TXStringList } + +constructor TXStringList.Create; +begin + inherited Create; + fUTF8CheckLen := -1; + Options := Options - [soWriteBOM, soTrailingLineBreak]; + fDetectUTF8 := True; + fFileFormat := sffDos; +end; + +procedure TXStringList.LoadFromStream(Stream: TStream; Encoding: TEncoding); +var + Size: Integer; + Buffer: TBytes; +begin + BeginUpdate; + try + Size := Stream.Size - Stream.Position; + SetLength(Buffer, Size); + Stream.Read(Buffer, 0, Size); + Size := TEncoding.GetBufferEncoding(Buffer, Encoding, DefaultEncoding); + WriteBOM := Size > 0; // Keep WriteBom in case the stream is saved + // If the encoding is ANSI and DetectUtf8 is True try to Detect UTF8 + if (Encoding = TEncoding.ANSI) and DetectUTF8 and IsUTF8(Buffer, Size) then + Encoding := TEncoding.UTF8; + SetEncoding(Encoding); // Keep Encoding in case the stream is saved + SetTextAndFileFormat(Encoding.GetString(Buffer, Size, Length(Buffer) - Size)); + finally + EndUpdate; + end; +end; + +procedure TXStringList.SaveToStream(Stream: TStream; Encoding: TEncoding); +Var + Cancel: Boolean; + OldLineBreak: string; + S: string; + Buffer, Preamble: TBytes; +begin + if Encoding = nil then + Encoding := DefaultEncoding; + + OldLineBreak := LineBreak; + try + LineBreak := LineBreakFromFileFormat(fFileFormat); + S := GetTextStr; + finally + LineBreak := OldLineBreak; + end; + + Cancel := False; + if (Encoding = TEncoding.ANSI) and Assigned(fOnInfoLoss) and not IsAnsiOnly(S) then + begin + fOnInfoLoss(Encoding, Cancel); + if Cancel then + Exit; + if Encoding <> TEncoding.ANSI then + SetEncoding(Encoding); + end; + + Buffer := Encoding.GetBytes(S); + if WriteBOM then + begin + Preamble := Encoding.GetPreamble; + if Length(Preamble) > 0 then + Stream.WriteBuffer(Preamble, Length(Preamble)); + end; + Stream.WriteBuffer(Buffer, Length(Buffer)); +end; + +procedure TXStringList.SetTextAndFileFormat(const Value: string); +var + S: string; + Size: Integer; + P, Start, Pmax: PWideChar; + fCR, fLF, fLINESEPARATOR: Boolean; +begin + fLINESEPARATOR := False; + fCR := False; + fLF := False; + BeginUpdate; + try + Clear; + P := Pointer(Value); + if P <> nil then + begin + Size := Length(Value); + Pmax := @Value[Size]; + while (P <= Pmax) do + begin + Start := P; + while not (Ord(P^) in [0, $A, $D]) and (P^ <> WideLineSeparator) do + begin + Inc(P); + end; + if P<>Start then + begin + SetString(S, Start, P - Start); + Insert(Count, S); + end else Insert(Count, ''); + if P^ = WideLineSeparator then + begin + fLINESEPARATOR := True; + Inc(P); + end; + if P^ = WideCR then + begin + fCR := True; + Inc(P); + end; + if P^ = WideLF then + begin + fLF := True; + Inc(P); + end; + end; + // keep the old format of the file + if not TrailingLineBreak and + (CharInSet(Value[Size], [#10, #13]) or (Value[Size] = WideLineSeparator)) + then + Insert(Count, ''); + end; + finally + EndUpdate; + end; + if fLINESEPARATOR then + FileFormat := sffUnicode + else if fCR and not fLF then + FileFormat := sffMac + else if fLF and not fCR then + FileFormat := sffUnix + else + FileFormat := sffDos; +end; + +procedure AddFormatText(RE : TRichEdit; const S: string; FontStyle: TFontStyles = []; + const FontColor: TColor = clDefault; FontSize: Integer = 0); +begin + with RE do + begin + //move caret to end + SelStart := GetTextLen; + SelAttributes.Style := FontStyle; + if FontSize <> 0 then + SelAttributes.Size := FontSize + else + SelAttributes.Size := DefAttributes.Size; + if FontColor <> clDefault then + SelAttributes.Color := FontColor + else + SelAttributes.Color := DefAttributes.Color; + + SelText := S; + end; +end; + +//procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, NewHeight: integer); +//var +// buffer: TBitmap; +//begin +// buffer := TBitmap.Create; +// try +// buffer.SetSize(NewWidth, NewHeight); +// buffer.AlphaFormat := afDefined; +// buffer.Canvas.StretchDraw(Rect(0, 0, NewWidth, NewHeight), Bitmap); +// Bitmap.SetSize(NewWidth, NewHeight); +// Bitmap.Canvas.Draw(0, 0, buffer); +// finally +// buffer.Free; +// end; +//end; + +procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, NewHeight: integer); +var + Factory: IWICImagingFactory; + Scaler: IWICBitmapScaler; + Source : TWICImage; +begin + //Bitmap.AlphaFormat := afDefined; + Source := TWICImage.Create; + try + Source.Assign(Bitmap); + Factory := TWICImage.ImagingFactory; + Factory.CreateBitmapScaler(Scaler); + try + Scaler.Initialize(Source.Handle, NewWidth, NewHeight, + WICBitmapInterpolationModeHighQualityCubic); + Source.Handle := IWICBitmap(Scaler); + finally + Scaler := nil; + Factory := nil; + end; + Bitmap.Assign(Source); + finally + Source.Free; + end; +end; + +function MonitorProfile: string; + + function DesktopSizeString: string; + begin + Result := Format('(%dx%d)', [Screen.DesktopWidth, Screen.DesktopHeight]); + end; +Const + strMask = '%d:%dDPI(%s,%d,%d,%d,%d)'; +Var + iMonitor: Integer; + M: TMonitor; +Begin + Result := DesktopSizeString; + for iMonitor := 0 To Screen.MonitorCount - 1 Do + begin + M := Screen.Monitors[iMonitor]; + Result := Result + Format(strMask, [ + M.MonitorNum, + M.PixelsPerInch, + BoolToStr(M.Primary, True), + M.Left, + M.Top, + M.Width, + M.Height + ]); + end; +End; + +function DownloadUrlToFile(const URL, Filename: string): Boolean; +begin + Result := Succeeded(URLDownloadToFile(nil, PWideChar(URL), PWideChar(Filename), 0, nil)); +end; + +{ ITimer implementation } +type + TTimer = class(TInterfacedObject, ITimer) + private var + FTimer: VCL.ExtCtrls.TTimer; + FAction: TProc; + private + procedure RunAction(Sender: TObject); + public + constructor Create(const Interval: Cardinal); + destructor Destroy; override; + class function New(const Interval: Cardinal): ITimer; + function Start(const Action: TProc): ITimer; + function Stop: ITimer; + function Restart: ITimer; + end; + +{ TTimer } + +constructor TTimer.Create(const Interval: Cardinal); +begin + FTimer := VCL.ExtCtrls.TTimer.Create(nil); + FTimer.Enabled := False; + FTimer.Interval := Interval; + FTimer.OnTimer := RunAction; +end; + +destructor TTimer.Destroy; +begin + FTimer.Free; + inherited; +end; + +class function TTimer.New(const Interval: Cardinal): ITimer; +begin + Result := Create(Interval); +end; + +procedure TTimer.RunAction(Sender: TObject); +begin + FAction; +end; + +function TTimer.Start(const Action: TProc): ITimer; +begin + Result := Self; + FAction := Action; + FTimer.Enabled := True; +end; + +function TTimer.Stop: ITimer; +begin + Result := Self; + FTimer.Enabled := False; +end; + +function TTimer.ReStart: ITimer; +begin + Result := Self; + FTimer.Enabled := True; +end; + +function NewTimer(Interval: Cardinal): ITimer; +begin + Result := TTimer.Create(Interval); +end; + +function XtractFileName(const FileName: string): string; +var + I: Integer; +begin + I := FileName.LastDelimiter(PathDelim + DriveDelim + '/'); + Result := FileName.SubString(I + 1); +end; + +function XtractFileDir(const FileName: string): string; +var + I: Integer; +begin + I := FileName.LastDelimiter(PathDelim + DriveDelim + '/'); + if (I > 0) and ((FileName.Chars[I] = PathDelim) or (FileName.Chars[I] = '/')) and + (not FileName.IsDelimiter(PathDelim + DriveDelim + '/', I-1)) then Dec(I); + Result := FileName.SubString(0, I + 1); +end; + +function CtrlHandler( fdwCtrlType : DWORD): LongBool; stdcall; +begin + Result := True; +end; + +procedure RaiseKeyboardInterrupt(ProcessId: DWORD); +Var + AttachConsole: Function (dwProcessId: DWORD): LongBool; stdCall; +begin + AttachConsole := GetProcAddress (GetModuleHandle ('kernel32.dll'), 'AttachConsole'); + if Assigned(AttachConsole) then + try + OSCheck(AttachConsole(ProcessId)); + OSCheck(SetConsoleCtrlHandler(@CtrlHandler, True)); + try + OSCheck(GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0)); + Sleep(100); + finally + OSCheck(SetConsoleCtrlHandler(@CtrlHandler, False)); + OSCheck(FreeConsole); + end; + except + end; +end; + +type + TProcessArray = array of DWORD; + + function TerminateProcessTree(ProcessID: DWORD): Boolean; + + function GetChildrenProcesses(const Process: DWORD; const IncludeParent: Boolean): TProcessArray; + var + Snapshot: Cardinal; + ProcessList: PROCESSENTRY32; + Current: Integer; + begin + Current := 0; + SetLength(Result, 1); + Result[0] := Process; + repeat + ProcessList.dwSize := SizeOf(PROCESSENTRY32); + Snapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (Snapshot = INVALID_HANDLE_VALUE) or not Process32First(Snapshot, ProcessList) then + Continue; + repeat + if ProcessList.th32ParentProcessID = Result[Current] then + begin + SetLength(Result, Length(Result) + 1); + Result[Length(Result) - 1] := ProcessList.th32ProcessID; + end; + until Process32Next(Snapshot, ProcessList) = False; + Inc(Current); + until Current >= Length(Result); + if not IncludeParent then + Result := Copy(Result, 2, Length(Result)); + end; + +var + Handle: THandle; + List: TProcessArray; + I: Integer; +begin + Result := True; + List := GetChildrenProcesses(ProcessID, True); + for I := Length(List) - 1 downto 0 do + if Result then + begin + Handle := OpenProcess(PROCESS_TERMINATE, false, List[I]); + Result := (Handle <> 0) and TerminateProcess(Handle, 0) and CloseHandle(Handle); + end; +end; + +function ExecuteCmd(Command : string; out CmdOutput, CmdError: string): cardinal; overload; +Var + ProcessOptions : TJclExecuteCmdProcessOptions; +begin + ProcessOptions := TJclExecuteCmdProcessOptions.Create(Command); + try + ProcessOptions.MergeError := False; + ProcessOptions.RawOutput := True; + ProcessOptions.RawError := True; + ProcessOptions.AutoConvertOEM := False; + ProcessOptions.CreateProcessFlags := + ProcessOptions.CreateProcessFlags or + CREATE_UNICODE_ENVIRONMENT or CREATE_NEW_CONSOLE; + ExecuteCmdProcess(ProcessOptions); + Result := ProcessOptions.ExitCode; + CmdOutput := ProcessOptions.Output; + CmdError := ProcessOptions.Error; + finally + ProcessOptions.Free; + end; +end; + +function ExecuteCmd(Command : string; out CmdOutput: string): cardinal; overload; +Var + CmdError: string; +begin + Result := ExecuteCmd(Command, CmdOutput, CmdError); +end; + +function FileExtInFileFilter(FileExt, FileFilter: string): Boolean; +var + j, ExtLen: Integer; +begin + Result := False; + ExtLen := FileExt.Length; + if ExtLen = 0 then + Exit; + FileExt := LowerCase(FileExt); + FileFilter := LowerCase(FileFilter); + j := Pos('|', FileFilter); + if j > 0 then begin + Delete(FileFilter, 1, j); + j := Pos(FileExt, FileFilter); + if (j > 0) and + ((j + ExtLen > Length(FileFilter)) or (FileFilter[j + ExtLen] = ';')) + then + Exit(True); + end; +end; + +function FileIsPythonSource(FileName: string): Boolean; +Var + Ext: string; +begin + Ext := ExtractFileExt(FileName); + if Ext = '' then + Exit(False); + Result := FileExtInFileFilter(Ext, PyIDEOptions.PythonFileFilter); +end; + +function StyledMessageDlg(const Msg: string; DlgType: TMsgDlgType; + Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer; +begin + UseLatestCommonDialogs := False; + Result := Vcl.Dialogs.MessageDlg(Msg, DlgType, Buttons, HelpCtx); + UseLatestCommonDialogs := True; +end; + +function StyledMessageDlg(const Msg: string; DlgType: TMsgDlgType; + Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultButton: TMsgDlgBtn): Integer; +begin + UseLatestCommonDialogs := False; + Result := Vcl.Dialogs.MessageDlg(Msg, DlgType, Buttons, HelpCtx, DefaultButton); + UseLatestCommonDialogs := True; +end; + +function SvgFixedColor(Color: TColor): TColor; +begin + Result := StyleServices.GetSystemColor(Color); + if Result = clBlack then + Result := $191919 + else if Result = clWhite then + Result := $E6E6E6; +end; + +// Regular Expressions Start +type + { TPerlRegExHelper } + TPerlRegExHelper = class helper for TPerlRegEx + procedure SetAdditionalPCREOptions(PCREOptions : Integer); + end; + +procedure TPerlRegExHelper.SetAdditionalPCREOptions(PCREOptions: Integer); +begin + with Self do FPCREOptions := FPCREOptions or PCREOptions; +end; + +{ TRegExHelper } +procedure TRegExHelper.Study; +begin + with Self do FRegEx.Study; +end; + +function TRegExHelper.PerlRegEx: TPerlRegEx; +begin + with Self do + Result := FregEx; +end; + +procedure TRegExHelper.SetAdditionalPCREOptions(PCREOptions: Integer); +begin + with Self do FRegEx.SetAdditionalPCREOptions(PCREOptions); +end; + +{ TMatchHelper } + +function TMatchHelper.GroupIndex(Index: integer): integer; +begin + if Index < Groups.Count then + Result := Groups[Index].Index + else + Result := -1; +end; + +function TMatchHelper.GroupLength(Index: integer): integer; +begin + if Index < Groups.Count then + Result := Groups[Index].Length + else + Result := 0; +end; + +function TMatchHelper.GroupValue(Index: integer): string; +begin + if Index < Groups.Count then + Result := Groups[Index].Value + else + Result := ''; +end; +// Regular Expressions End + +procedure RedirectFunction(OrgProc, NewProc: Pointer); +{ + From spring4d + See https://devblogs.microsoft.com/oldnewthing/20181206-00/?p=100415 + in relation to the use of WriteProcessMemory +} +type + TJmpBuffer = packed record + Jmp: Byte; + Offset: Integer; + end; +var + n: NativeUInt; + JmpBuffer: TJmpBuffer; +begin + JmpBuffer.Jmp := $E9; + JmpBuffer.Offset := PByte(NewProc) - (PByte(OrgProc) + 5); + if not WriteProcessMemory(GetCurrentProcess, OrgProc, @JmpBuffer, SizeOf(JmpBuffer), n) then + RaiseLastOSError; + FlushInstructionCache(GetCurrentProcess, OrgProc, SizeOf(JmpBuffer)) +end; + + +{https://stackoverflow.com/questions/20142166/explain-errors-from-getkeystate-getcursorpos} + +function PatchedGetCursorPos(var lpPoint: TPoint): BOOL; stdcall; +(* The GetCursorPos API in user32 fails if it is passed a memory address >2GB + which breaks LARGEADDRESSAWARE apps. We counter this by calling GetCursorInfo + instead which does not suffer from the same problem. + + In addition we have had problems with GetCursorPos failing when called + immediately after a password protected screensaver or a locked workstation + re-authenticates. This problem initially appeared with XP SP1 and is brought + about because TMouse.GetCursorPos checks the return value of the GetCursorPos + API call and raises an OS exception if the API has failed. +*) +var + CursorInfo: TCursorInfo; +begin + CursorInfo.cbSize := SizeOf(CursorInfo); + Result := GetCursorInfo(CursorInfo); + if Result then begin + lpPoint := CursorInfo.ptScreenPos; + end else begin + lpPoint := Point(0, 0); + end; +end; + +var + OldGetCursorPos: function(var lpPoint: TPoint): BOOL; stdcall = nil; + +{ TFormHelper } + +function TControlHelper.PPIScale(ASize: integer): integer; +begin + Result := MulDiv(ASize, FCurrentPPI, 96); +end; + +function TControlHelper.PPIUnScale(ASize: integer): integer; +begin + Result := MulDiv(ASize, 96, FCurrentPPI); +end; + +{ TObjectHandle } + +constructor TObjectHandle.Create(AValue: T); +begin + FValue := AValue; +end; + +destructor TObjectHandle.Destroy; +begin + FValue.Free; +end; + +function TObjectHandle.Invoke: T; +begin + Result := FValue; +end; + + +{ TSmartPointer } + +class function TSmartPtr.Make(AValue: T): TFunc; +begin + Result := TObjectHandle.Create(AValue); +end; + + +initialization + StopWatch := TStopWatch.StartNew; + + @OldGetCursorPos := GetProcAddress(GetModuleHandle(user32), 'GetCursorPos'); + with TJclPeMapImgHooks do + ReplaceImport(SystemBase, user32, @OldGetCursorPos, @PatchedGetCursorPos); + +finalization + with TJclPeMapImgHooks do + ReplaceImport(SystemBase, user32, @PatchedGetCursorPos, @OldGetCursorPos); +end. diff --git a/Source/uPSI_PythonAction.pas b/Source/uPSI_PythonAction.pas new file mode 100644 index 00000000..b0ecc0c0 --- /dev/null +++ b/Source/uPSI_PythonAction.pas @@ -0,0 +1,196 @@ +unit uPSI_PythonAction; +{ +This file has been generated by UnitParser v0.7, written by M. Knight +and updated by NP. v/d Spek and George Birbilis. +Source Code from Carlo Kok has been used to implement various sections of +UnitParser. Components of ROPS are used in the construction of UnitParser, +code implementing the class wrapper is taken from Carlo Kok's conv utility + +} +interface + + + +uses + SysUtils + ,Classes + ,uPSComponent + ,uPSRuntime + ,uPSCompiler + ; + +type +(*----------------------------------------------------------------------------*) + TPSImport_PythonAction = class(TPSPlugin) + public + procedure CompileImport1(CompExec: TPSScript); override; + procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + end; + + +{ compile-time registration functions } +procedure SIRegister_TPythonAction(CL: TPSPascalCompiler); +procedure SIRegister_PythonAction(CL: TPSPascalCompiler); + +{ run-time registration functions } +procedure RIRegister_PythonAction_Routines(S: TPSExec); +procedure RIRegister_TPythonAction(CL: TPSRuntimeClassImporter); +procedure RIRegister_PythonAction(CL: TPSRuntimeClassImporter); + +procedure Register; + +implementation + + +uses + Windows + ,Messages + ,Graphics + ,Controls + ,Forms + ,Dialogs + ,ActnList + ,PythonEngine + ,PythonAction + ; + + +procedure Register; +begin + RegisterComponents('Pascal Script', [TPSImport_PythonAction]); +end; + +(* === compile-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonAction(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TAction', 'TPythonAction') do + with CL.AddClassN(CL.FindClass('TAction'),'TPythonAction') do + begin + RegisterProperty('fRegisteredMethods', 'TList', iptrw); + RegisterProperty('fPythonModule', 'TPythonModule', iptrw); + RegisterProperty('fClearname', 'string', iptrw); + RegisterProperty('fRegistername', 'string', iptrw); + RegisterProperty('fUnregistername', 'string', iptrw); + RegisterMethod('Procedure ClearMethods'); + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Function HandlesTarget( Target : TObject) : Boolean'); + RegisterMethod('Function Execute : Boolean'); + RegisterMethod('Procedure UpdateTarget( Target : TObject)'); + RegisterMethod('Procedure InitializeAction'); + RegisterProperty('RegisteredMethods', 'TList', iptr); + RegisterProperty('PythonModule', 'TPythonModule', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_PythonAction(CL: TPSPascalCompiler); +begin + SIRegister_TPythonAction(CL); + CL.AddDelphiFunction('Procedure Register'); +end; + +(* === run-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure TPythonActionPythonModule_W(Self: TPythonAction; const T: TPythonModule); +begin Self.PythonModule := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionPythonModule_R(Self: TPythonAction; var T: TPythonModule); +begin T := Self.PythonModule; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionRegisteredMethods_R(Self: TPythonAction; var T: TList); +begin T := Self.RegisteredMethods; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionfUnregistername_W(Self: TPythonAction; const T: string); +Begin Self.fUnregistername := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionfUnregistername_R(Self: TPythonAction; var T: string); +Begin T := Self.fUnregistername; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionfRegistername_W(Self: TPythonAction; const T: string); +Begin Self.fRegistername := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionfRegistername_R(Self: TPythonAction; var T: string); +Begin T := Self.fRegistername; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionfClearname_W(Self: TPythonAction; const T: string); +Begin Self.fClearname := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionfClearname_R(Self: TPythonAction; var T: string); +Begin T := Self.fClearname; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionfPythonModule_W(Self: TPythonAction; const T: TPythonModule); +Begin Self.fPythonModule := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionfPythonModule_R(Self: TPythonAction; var T: TPythonModule); +Begin T := Self.fPythonModule; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionfRegisteredMethods_W(Self: TPythonAction; const T: TList); +Begin Self.fRegisteredMethods := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonActionfRegisteredMethods_R(Self: TPythonAction; var T: TList); +Begin T := Self.fRegisteredMethods; end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_PythonAction_Routines(S: TPSExec); +begin + S.RegisterDelphiFunction(@Register, 'Register', cdRegister); +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonAction(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonAction) do + begin + RegisterPropertyHelper(@TPythonActionfRegisteredMethods_R,@TPythonActionfRegisteredMethods_W,'fRegisteredMethods'); + RegisterPropertyHelper(@TPythonActionfPythonModule_R,@TPythonActionfPythonModule_W,'fPythonModule'); + RegisterPropertyHelper(@TPythonActionfClearname_R,@TPythonActionfClearname_W,'fClearname'); + RegisterPropertyHelper(@TPythonActionfRegistername_R,@TPythonActionfRegistername_W,'fRegistername'); + RegisterPropertyHelper(@TPythonActionfUnregistername_R,@TPythonActionfUnregistername_W,'fUnregistername'); + RegisterMethod(@TPythonAction.ClearMethods, 'ClearMethods'); + RegisterConstructor(@TPythonAction.Create, 'Create'); + RegisterMethod(@TPythonAction.HandlesTarget, 'HandlesTarget'); + RegisterMethod(@TPythonAction.Execute, 'Execute'); + RegisterMethod(@TPythonAction.UpdateTarget, 'UpdateTarget'); + RegisterMethod(@TPythonAction.InitializeAction, 'InitializeAction'); + RegisterPropertyHelper(@TPythonActionRegisteredMethods_R,nil,'RegisteredMethods'); + RegisterPropertyHelper(@TPythonActionPythonModule_R,@TPythonActionPythonModule_W,'PythonModule'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_PythonAction(CL: TPSRuntimeClassImporter); +begin + RIRegister_TPythonAction(CL); +end; + + + +{ TPSImport_PythonAction } +(*----------------------------------------------------------------------------*) +procedure TPSImport_PythonAction.CompileImport1(CompExec: TPSScript); +begin + SIRegister_PythonAction(CompExec.Comp); +end; +(*----------------------------------------------------------------------------*) +procedure TPSImport_PythonAction.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); +begin + RIRegister_PythonAction(ri); + RIRegister_PythonAction_Routines(CompExec.Exec); // comment it if no routines +end; +(*----------------------------------------------------------------------------*) + + +end. diff --git a/Source/uPSI_PythonEngine.pas b/Source/uPSI_PythonEngine.pas new file mode 100644 index 00000000..ad32c544 --- /dev/null +++ b/Source/uPSI_PythonEngine.pas @@ -0,0 +1,6476 @@ +unit uPSI_PythonEngine; +{ +a monster template for P4D Tester + TError as the same on TError = procedure (const Msg: string) of object; in namedpipesimpl + TError = procedure (const Msg: string) of object; fix dll bug - alias execStr() + add PythonPath: UnicodeString V5.0.2.40 init to V5.0.2.60 add TPathInitializationEvent = procedure ( Sender : TObject; var Path : string ) of Object; + +} +interface + + + +uses + SysUtils + ,Classes + ,uPSComponent + ,uPSRuntime + ,uPSCompiler + ; + +type +(*----------------------------------------------------------------------------*) + TPSImport_PythonEngine = class(TPSPlugin) + public + procedure CompileImport1(CompExec: TPSScript); override; + procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + end; + + +{ compile-time registration functions } +procedure SIRegister_TPythonThread(CL: TPSPascalCompiler); +procedure SIRegister_TPyVar(CL: TPSPascalCompiler); +procedure SIRegister_TPythonDelphiVar(CL: TPSPascalCompiler); +procedure SIRegister_TPythonType(CL: TPSPascalCompiler); +procedure SIRegister_TTypeServices(CL: TPSPascalCompiler); +procedure SIRegister_TPyObject(CL: TPSPascalCompiler); +procedure SIRegister_TPythonModule(CL: TPSPascalCompiler); +procedure SIRegister_TErrors(CL: TPSPascalCompiler); +procedure SIRegister_TError(CL: TPSPascalCompiler); +procedure SIRegister_TParentClassError(CL: TPSPascalCompiler); +procedure SIRegister_TGetSetContainer(CL: TPSPascalCompiler); +procedure SIRegister_TMembersContainer(CL: TPSPascalCompiler); +procedure SIRegister_TMethodsContainer(CL: TPSPascalCompiler); +procedure SIRegister_TEventDefs(CL: TPSPascalCompiler); +procedure SIRegister_TEventDef(CL: TPSPascalCompiler); +procedure SIRegister_TEngineClient(CL: TPSPascalCompiler); +procedure SIRegister_TPythonEngine(CL: TPSPascalCompiler); +procedure SIRegister_TPythonTraceback(CL: TPSPascalCompiler); +procedure SIRegister_TTracebackItem(CL: TPSPascalCompiler); +procedure SIRegister_TPythonInterface(CL: TPSPascalCompiler); +procedure SIRegister_TDynamicDll(CL: TPSPascalCompiler); +procedure SIRegister_TPythonInputOutput(CL: TPSPascalCompiler); +procedure SIRegister_EPySyntaxError(CL: TPSPascalCompiler); +procedure SIRegister_EPythonError(CL: TPSPascalCompiler); +procedure SIRegister_EDLLImportError(CL: TPSPascalCompiler); +procedure SIRegister_PythonEngine(CL: TPSPascalCompiler); + +{ run-time registration functions } +procedure RIRegister_PythonEngine_Routines(S: TPSExec); +procedure RIRegister_TPythonThread(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPyVar(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPythonDelphiVar(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPythonType(CL: TPSRuntimeClassImporter); +procedure RIRegister_TTypeServices(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPyObject(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPythonModule(CL: TPSRuntimeClassImporter); +procedure RIRegister_TErrors(CL: TPSRuntimeClassImporter); +procedure RIRegister_TError(CL: TPSRuntimeClassImporter); +procedure RIRegister_TParentClassError(CL: TPSRuntimeClassImporter); +procedure RIRegister_TGetSetContainer(CL: TPSRuntimeClassImporter); +procedure RIRegister_TMembersContainer(CL: TPSRuntimeClassImporter); +procedure RIRegister_TMethodsContainer(CL: TPSRuntimeClassImporter); +procedure RIRegister_TEventDefs(CL: TPSRuntimeClassImporter); +procedure RIRegister_TEventDef(CL: TPSRuntimeClassImporter); +procedure RIRegister_TEngineClient(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPythonEngine(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPythonTraceback(CL: TPSRuntimeClassImporter); +procedure RIRegister_TTracebackItem(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPythonInterface(CL: TPSRuntimeClassImporter); +procedure RIRegister_TDynamicDll(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPythonInputOutput(CL: TPSRuntimeClassImporter); +procedure RIRegister_EPySyntaxError(CL: TPSRuntimeClassImporter); +procedure RIRegister_EPythonError(CL: TPSRuntimeClassImporter); +procedure RIRegister_EDLLImportError(CL: TPSRuntimeClassImporter); +procedure RIRegister_PythonEngine(CL: TPSRuntimeClassImporter); + +procedure Register; + +implementation + + +uses + Types + ,Windows + //,Dl + //,DynLibs + ,SyncObjs + ,Variants + ,MethodCallBack + ,PythonEngine + ; + +//type TPyObject = PPyObject; +//type PPyObject = TPyObject; + + +procedure Register; +begin + RegisterComponents('Pascal Script', [TPSImport_PythonEngine]); +end; + + + { +procedure setgPythonEngine(mypyengine: TPythonEngine); +begin + gPythonEngine := mypyengine; +end; + +function getgPythonEngine: TPythonEngine; +begin + result:= gPythonEngine; +end; } + +(* === compile-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonThread(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TThread', 'TPythonThread') do + with CL.AddClassN(CL.FindClass('TThread'),'TPythonThread') do + begin + RegisterMethod('Procedure Py_Begin_Allow_Threads'); + RegisterMethod('Procedure Py_End_Allow_Threads'); + RegisterMethod('Procedure Py_Begin_Block_Threads'); + RegisterMethod('Procedure Py_Begin_Unblock_Threads'); + RegisterProperty('ThreadState', 'PPyThreadState', iptr); + RegisterProperty('ThreadExecMode', 'TThreadExecMode', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyVar(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPyObject', 'TPyVar') do + with CL.AddClassN(CL.FindClass('TPyObject'),'TPyVar') do begin + RegisterProperty('dv_var', 'Variant', iptrw); + RegisterProperty('dv_component', 'TPythonDelphiVar', iptrw); + RegisterProperty('dv_object', 'PPyObject', iptrw); + //RegisterMethod('Constructor Create'); + RegisterMethod('Constructor Create( APythonType : TPythonType)'); + RegisterMethod('Procedure Free;'); + //constructor Create( APythonType : TPythonType ); override; + RegisterMethod('Function GetValue : PPyObject'); + RegisterMethod('Function GetValueAsVariant : Variant'); + RegisterMethod('Procedure SetValue( value : PPyObject)'); + RegisterMethod('Procedure SetValueFromVariant( const value : Variant)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonDelphiVar(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TEngineClient', 'TPythonDelphiVar') do + with CL.AddClassN(CL.FindClass('TEngineClient'),'TPythonDelphiVar') do begin + RegisterMethod('Function IsVariantOk( const v : Variant) : Boolean'); + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterProperty('Value', 'Variant', iptrw); + RegisterProperty('ValueObject', 'PPyObject', iptrw); + RegisterProperty('ValueAsString', 'string', iptr); + RegisterProperty('VarObject', 'PPyObject', iptrw); + RegisterProperty('Module', 'AnsiString', iptrw); + RegisterProperty('VarName', 'AnsiString', iptrw); + RegisterProperty('OnGetData', 'TGetDataEvent', iptrw); + RegisterProperty('OnSetData', 'TSetDataEvent', iptrw); + RegisterProperty('OnExtGetData', 'TExtGetDataEvent', iptrw); + RegisterProperty('OnExtSetData', 'TExtSetDataEvent', iptrw); + RegisterProperty('OnChange', 'TNotifyEvent', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonType(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TGetSetContainer', 'TPythonType') do + with CL.AddClassN(CL.FindClass('TGetSetContainer'),'TPythonType') do + begin + RegisterMethod('Function CreateInstance : PPyObject'); + RegisterMethod('Function CreateInstanceWith( args : PPyObject) : PPyObject'); + RegisterMethod('Procedure AddTypeVar'); + RegisterMethod('Constructor Create'); + RegisterMethod('Procedure Free;'); + RegisterProperty('TheType', 'PyTypeObject', iptrw); + RegisterProperty('TheTypePtr', 'PPyTypeObject', iptr); + RegisterProperty('PyObjectClass', 'TPyObjectClass', iptrw); + RegisterProperty('InstanceCount', 'Integer', iptr); + RegisterProperty('CreateHits', 'Integer', iptr); + RegisterProperty('DeleteHits', 'Integer', iptr); + RegisterProperty('DocString', 'TStringList', iptrw); + RegisterProperty('TypeName', 'AnsiString', iptrw); + RegisterProperty('TypeFlags', 'TPFlags', iptrw); + RegisterProperty('Prefix', 'AnsiString', iptrw); + RegisterProperty('Module', 'TPythonModule', iptrw); + RegisterProperty('Services', 'TTypeServices', iptrw); + RegisterProperty('GenerateCreateFunction', 'Boolean', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TTypeServices(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPersistent', 'TTypeServices') do + with CL.AddClassN(CL.FindClass('TPersistent'),'TTypeServices') do + begin + RegisterMethod('Constructor Create'); + RegisterProperty('Basic', 'TBasicServices', iptrw); + RegisterProperty('InplaceNumber', 'TInplaceNumberServices', iptrw); + RegisterProperty('Number', 'TNumberServices', iptrw); + RegisterProperty('Sequence', 'TSequenceServices', iptrw); + RegisterProperty('Mapping', 'TMappingServices', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyObject(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TOBJECT', 'TPyObject') do + with CL.AddClassN(CL.FindClass('TOBJECT'),'TPyObject') do + begin + RegisterProperty('PythonType', 'TPythonType', iptrw); + RegisterProperty('IsSubtype', 'Boolean', iptrw); + RegisterProperty('PythonAlloc', 'Boolean', iptrw); + RegisterMethod('Constructor Create( APythonType : TPythonType)'); + RegisterMethod('Constructor CreateWith( APythonType : TPythonType; args : PPyObject)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Function GetSelf : PPyObject'); + RegisterMethod('Procedure IncRef'); + RegisterMethod('Procedure Adjust( PyPointer : Pointer)'); + RegisterMethod('Function GetModule : TPythonModule'); + RegisterProperty('ob_refcnt', 'NativeInt', iptrw); + RegisterProperty('ob_type', 'PPyTypeObject', iptrw); + RegisterMethod('Function Print( var f : file; i : integer) : Integer'); + RegisterMethod('Function GetAttr( key : PAnsiChar) : PPyObject'); + RegisterMethod('Function SetAttr( key : PAnsiChar; value : PPyObject) : Integer'); + RegisterMethod('Function Repr : PPyObject'); + RegisterMethod('Function Compare( obj : PPyObject) : Integer'); + RegisterMethod('Function Hash : NativeInt'); + RegisterMethod('Function Str : PPyObject'); + RegisterMethod('Function GetAttrO( key : PPyObject) : PPyObject'); + RegisterMethod('Function SetAttrO( key, value : PPyObject) : Integer'); + RegisterMethod('Function Call( ob1, ob2 : PPyObject) : PPyObject'); + RegisterMethod('Function Traverse( proc : visitproc; ptr : Pointer) : integer'); + RegisterMethod('Function Clear : integer'); + RegisterMethod('Function RichCompare( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject'); + RegisterMethod('Function Iter : PPyObject'); + RegisterMethod('Function IterNext : PPyObject'); + RegisterMethod('Function Init( args, kwds : PPyObject) : Integer'); + RegisterMethod('Function NbAdd( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbSubtract( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbMultiply( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbFloorDivide( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbTrueDivide( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbMatrixMultiply( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbRemainder( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbDivmod( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbPower( ob1, ob2 : PPyObject) : PPyObject'); + RegisterMethod('Function NbNegative : PPyObject'); + RegisterMethod('Function NbPositive : PPyObject'); + RegisterMethod('Function NbAbsolute : PPyObject'); + RegisterMethod('Function NbBool : Integer'); + RegisterMethod('Function NbInvert : PPyObject'); + RegisterMethod('Function NbLShift( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbRShift( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbAnd( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbXor( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbOr( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInt : PPyObject'); + RegisterMethod('Function NbFloat : PPyObject'); + RegisterMethod('Function NbInplaceAdd( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceSubtract( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceMultiply( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceDivide( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceFloorDivide( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceTrueDivide( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceRemainder( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplacePower( ob1, ob2 : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceLshift( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceRshift( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceAnd( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceXor( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceOr( obj : PPyObject) : PPyObject'); + RegisterMethod('Function NbInplaceMatrixMultiply( obj : PPyObject) : PPyObject'); + RegisterMethod('Function SqLength : NativeInt'); + RegisterMethod('Function SqConcat( obj : PPyObject) : PPyObject'); + RegisterMethod('Function SqRepeat( val : NativeInt) : PPyObject'); + RegisterMethod('Function SqItem( idx : NativeInt) : PPyObject'); + RegisterMethod('Function SqAssItem( idx : NativeInt; obj : PPyObject) : Integer'); + RegisterMethod('Function SqContains( obj : PPyObject) : integer'); + RegisterMethod('Function SqInplaceConcat( obj : PPyObject) : PPyObject'); + RegisterMethod('Function SqInplaceRepeat( i : NativeInt) : PPyObject'); + RegisterMethod('Function MpLength : NativeInt'); + RegisterMethod('Function MpSubscript( obj : PPyObject) : PPyObject'); + RegisterMethod('Function MpAssSubscript( obj1, obj2 : PPyObject) : Integer'); + RegisterMethod('Procedure RegisterMethods( APythonType : TPythonType)'); + RegisterMethod('Procedure RegisterMembers( APythonType : TPythonType)'); + RegisterMethod('Procedure RegisterGetSets( APythonType : TPythonType)'); + RegisterMethod('Procedure SetupType( APythonType : TPythonType)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonModule(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TMethodsContainer', 'TPythonModule') do + with CL.AddClassN(CL.FindClass('TMethodsContainer'),'TPythonModule') do begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure MakeModule'); + RegisterMethod('Procedure DefineDocString'); + RegisterMethod('Procedure Initialize'); + RegisterMethod('Procedure InitializeForNewInterpreter'); + RegisterMethod('Procedure AddClient( client : TEngineClient)'); + RegisterMethod('Function ErrorByName( const AName : AnsiString) : TError'); + RegisterMethod('Procedure RaiseError( const error, msg : AnsiString)'); + RegisterMethod('Procedure RaiseErrorFmt( const error, format : AnsiString; const Args : array of const)'); + RegisterMethod('Procedure RaiseErrorObj( const error, msg : AnsiString; obj : PPyObject)'); + RegisterMethod('Procedure BuildErrors'); + RegisterMethod('Procedure SetVar( const varName : AnsiString; value : PPyObject)'); + RegisterMethod('Function GetVar( const varName : AnsiString) : PPyObject'); + RegisterMethod('Procedure DeleteVar( const varName : AnsiString)'); + RegisterMethod('Procedure ClearVars'); + RegisterMethod('Procedure SetVarFromVariant( const varName : AnsiString; const value : Variant)'); + RegisterMethod('Function GetVarAsVariant( const varName : AnsiString) : Variant'); + RegisterProperty('Module', 'PPyObject', iptr); + RegisterProperty('Clients', 'TEngineClient Integer', iptr); + RegisterProperty('ClientCount', 'Integer', iptr); + RegisterProperty('DocString', 'TStringList', iptrw); + RegisterProperty('ModuleName', 'AnsiString', iptrw); + RegisterProperty('Errors', 'TErrors', iptrw); + RegisterProperty('OnAfterInitialization', 'TNotifyEvent', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TErrors(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TCollection', 'TErrors') do + with CL.AddClassN(CL.FindClass('TCollection'),'TErrors') do begin + RegisterMethod('Constructor Create( Module : TPythonModule)'); + RegisterMethod('Function Add : TError'); + RegisterMethod('Function Owner : TPythonModule'); + RegisterProperty('Items', 'TError Integer', iptrw); + SetDefaultPropery('Items'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TError(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TCollectionItem', 'TError') do + with CL.AddClassN(CL.FindClass('TCollectionItem'),'TError') do begin + RegisterMethod('Constructor Create( ACollection : TCollection)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure Assign( Source : TPersistent)'); + RegisterMethod('Procedure BuildError( const ModuleName : AnsiString)'); + RegisterMethod('Procedure RaiseError( const msg : AnsiString)'); + RegisterMethod('Procedure RaiseErrorObj( const msg : AnsiString; obj : PPyObject)'); + RegisterMethod('Function Owner : TErrors'); + RegisterProperty('Error', 'PPyObject', iptrw); + RegisterProperty('Name', 'AnsiString', iptrw); + RegisterProperty('Text', 'AnsiString', iptrw); + RegisterProperty('ErrorType', 'TErrorType', iptrw); + RegisterProperty('ParentClass', 'TParentClassError', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TParentClassError(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPersistent', 'TParentClassError') do + with CL.AddClassN(CL.FindClass('TPersistent'),'TParentClassError') do + begin + RegisterMethod('Procedure AssignTo( Dest : TPersistent)'); + RegisterProperty('Module', 'AnsiString', iptrw); + RegisterProperty('Name', 'AnsiString', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TGetSetContainer(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TMembersContainer', 'TGetSetContainer') do + with CL.AddClassN(CL.FindClass('TMembersContainer'),'TGetSetContainer') do begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure AddGetSet( AName : PAnsiChar; AGet : getter; ASet : setter; ADoc : PAnsiChar; AClosure : Pointer)'); + RegisterMethod('Procedure ClearGetSets'); + RegisterProperty('GetSetCount', 'Integer', iptr); + RegisterProperty('GetSet', 'PPyGetSetDef Integer', iptr); + RegisterProperty('GetSetData', 'PPyGetSetDef', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TMembersContainer(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TMethodsContainer', 'TMembersContainer') do + with CL.AddClassN(CL.FindClass('TMethodsContainer'),'TMembersContainer') do begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure AddMember( MemberName : PAnsiChar; MemberType : TPyMemberType; MemberOffset : NativeInt; MemberFlags : TPyMemberFlag; MemberDoc : PAnsiChar)'); + RegisterMethod('Procedure ClearMembers'); + RegisterProperty('MemberCount', 'Integer', iptr); + RegisterProperty('Members', 'PPyMemberDef Integer', iptr); + RegisterProperty('MembersData', 'PPyMemberDef', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TMethodsContainer(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TEngineClient', 'TMethodsContainer') do + with CL.AddClassN(CL.FindClass('TEngineClient'),'TMethodsContainer') do begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure Initialize'); + RegisterMethod('Procedure Finalize'); + RegisterMethod('Function AddMethod( AMethodName : PAnsiChar; AMethod : PyCFunction; ADocString : PAnsiChar) : PPyMethodDef'); + RegisterMethod('Function AddMethodWithKeywords( AMethodName : PAnsiChar; AMethod : PyCFunctionWithKW; ADocString : PAnsiChar) : PPyMethodDef'); + RegisterMethod('Function AddDelphiMethod( AMethodName : PAnsiChar; ADelphiMethod : TDelphiMethod; ADocString : PAnsiChar) : PPyMethodDef'); + RegisterMethod('Function AddDelphiMethodWithKeywords( AMethodName : PAnsiChar; ADelphiMethod : TDelphiMethodWithKW; ADocString : PAnsiChar) : PPyMethodDef'); + RegisterMethod('Procedure ClearMethods'); + RegisterProperty('MethodCount', 'Integer', iptr); + RegisterProperty('Methods', 'PPyMethodDef Integer', iptr); + RegisterProperty('MethodsData', 'PPyMethodDef', iptr); + RegisterProperty('ModuleDef', 'PyModuleDef', iptr); + RegisterProperty('Events', 'TEventDefs', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TEventDefs(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TCollection', 'TEventDefs') do + with CL.AddClassN(CL.FindClass('TCollection'),'TEventDefs') do + begin + RegisterMethod('Constructor Create( AMethodsContainer : TMethodsContainer)'); + RegisterMethod('Function Add : TEventDef'); + RegisterMethod('Procedure RegisterEvents'); + RegisterProperty('Items', 'TEventDef Integer', iptr); + RegisterProperty('Container', 'TMethodsContainer', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TEventDef(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TCollectionItem', 'TEventDef') do + with CL.AddClassN(CL.FindClass('TCollectionItem'),'TEventDef') do begin + RegisterMethod('Constructor Create( ACollection : TCollection)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Function GetDocString : AnsiString'); + RegisterMethod('Function PythonEvent( pself, args : PPyObject) : PPyObject'); + RegisterMethod('Function Owner : TEventDefs'); + RegisterProperty('Name', 'string', iptrw); + RegisterProperty('OnExecute', 'TPythonEvent', iptrw); + RegisterProperty('DocString', 'TStringList', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TEngineClient(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TComponent', 'TEngineClient') do + with CL.AddClassN(CL.FindClass('TComponent'),'TEngineClient') do begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure Initialize'); + RegisterMethod('Procedure Finalize'); + RegisterMethod('Procedure ClearEngine'); + RegisterMethod('Procedure CheckEngine'); + RegisterProperty('Initialized', 'Boolean', iptr); + RegisterProperty('Engine', 'TPythonEngine', iptrw); + RegisterProperty('OnCreate', 'TNotifyEvent', iptrw); + RegisterProperty('OnDestroy', 'TNotifyEvent', iptrw); + RegisterProperty('OnFinalization', 'TNotifyEvent', iptrw); + RegisterProperty('OnInitialization', 'TNotifyEvent', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonEngine(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPythonInterface', 'TPythonEngine') do + with CL.AddClassN(CL.FindClass('TPythonInterface'),'TPythonEngine') do + begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure SetPythonHome( const PythonHome : UnicodeString)'); + RegisterMethod('Procedure SetPythonPath( const Value: UnicodeString)'); + RegisterMethod('Procedure SetProgramName( const ProgramName : UnicodeString)'); + RegisterMethod('function GetPythonPath: UnicodeString'); + RegisterMethod('Function IsType( ob : PPyObject; obt : PPyTypeObject) : Boolean'); + RegisterMethod('Function Run_CommandAsString( const command : AnsiString; mode : Integer) : string'); + RegisterMethod('Function Run_CommandAsObject( const command : AnsiString; mode : Integer) : PPyObject'); + RegisterMethod('Function Run_CommandAsObjectWithDict( const command : AnsiString; mode : Integer; locals, globals : PPyObject) : PPyObject'); + RegisterMethod('Function EncodeString1( const str : UnicodeString) : AnsiString;'); + RegisterMethod('Function EncodeString( const str : UnicodeString) : AnsiString;'); + RegisterMethod('Function EncodeString2( const str : AnsiString) : AnsiString;'); + RegisterMethod('Function EncodeWindowsFilePath( const str : string) : AnsiString'); + RegisterMethod('Procedure Initialize2;'); + RegisterMethod('procedure DoOpenDll2(const aDllName : string);'); + RegisterMethod('procedure SetProgramArgs2;'); + RegisterMethod('procedure CheckRegistry;'); //get from mX4 version to on OnPathInitialization + + RegisterMethod('Procedure ExecString3( const command : AnsiString);'); + RegisterMethod('Procedure ExecString( const command : AnsiString);'); + RegisterMethod('Procedure ExecStr( const command : AnsiString);'); //alias + RegisterMethod('Procedure ExecStrings4( strings : TStrings);'); + RegisterMethod('Procedure ExecStrings( strings : TStrings);'); + RegisterMethod('Function EvalString5( const command : AnsiString) : PPyObject;'); + RegisterMethod('Function EvalStringAsStr( const command : AnsiString) : string'); + RegisterMethod('Function EvalStr( const command : AnsiString) : string'); + RegisterMethod('Function EvalStrings6( strings : TStrings) : PPyObject;'); + RegisterMethod('Procedure ExecString7( const command : AnsiString; locals, globals : PPyObject);'); + RegisterMethod('Procedure ExecStrings8( strings : TStrings; locals, globals : PPyObject);'); + RegisterMethod('Function EvalString9( const command : AnsiString; locals, globals : PPyObject) : PPyObject;'); + RegisterMethod('Function EvalStrings10( strings : TStrings; locals, globals : PPyObject) : PPyObject;'); + RegisterMethod('Function EvalStringsAsStr( strings : TStrings) : string'); + RegisterMethod('Function EvalPyFunction( pyfunc, pyargs : PPyObject) : Variant'); + RegisterMethod('Function EvalFunction( pyfunc : PPyObject; const args : array of const) : Variant'); + RegisterMethod('Function EvalFunctionNoArgs( pyfunc : PPyObject) : Variant'); + RegisterMethod('Function CheckEvalSyntax( const str : AnsiString) : Boolean'); + RegisterMethod('Function CheckExecSyntax( const str : AnsiString) : Boolean'); + RegisterMethod('Function CheckSyntax( const str : AnsiString; mode : Integer) : Boolean'); + RegisterMethod('Procedure RaiseError'); + RegisterMethod('Function PyObjectAsString( obj : PPyObject) : string'); + RegisterMethod('Procedure DoRedirectIO'); + RegisterMethod('Procedure AddClient( client : TEngineClient)'); + RegisterMethod('Procedure RemoveClient( client : TEngineClient)'); + RegisterMethod('Function FindClient( const aName : string) : TEngineClient'); + RegisterMethod('Function TypeByName( const aTypeName : AnsiString) : PPyTypeObject'); + RegisterMethod('Function ModuleByName( const aModuleName : AnsiString) : PPyObject'); + RegisterMethod('Function MethodsByName( const aMethodsContainer : string) : PPyMethodDef'); + RegisterMethod('Function VariantAsPyObject( const V : Variant) : PPyObject'); + RegisterMethod('Function PyObjectAsVariant( obj : PPyObject) : Variant'); + RegisterMethod('Function VarRecAsPyObject( const v : TVarRec) : PPyObject'); + RegisterMethod('Function MakePyTuple( const objects : array of PPyObject) : PPyObject'); + RegisterMethod('Function MakePyList( const objects : array of PPyObject) : PPyObject'); + RegisterMethod('Function ArrayToPyTuple( const items : array of const) : PPyObject'); + RegisterMethod('Function ArrayToPyList( const items : array of const) : PPyObject'); + RegisterMethod('Function ArrayToPyDict( const items : array of const) : PPyObject'); + RegisterMethod('Function StringsToPyList( strings : TStrings) : PPyObject'); + RegisterMethod('Function StringsToPyTuple( strings : TStrings) : PPyObject'); + RegisterMethod('Procedure PyListToStrings( list : PPyObject; strings : TStrings)'); + RegisterMethod('Procedure PyTupleToStrings( tuple : PPyObject; strings : TStrings)'); + RegisterMethod('Function ReturnNone : PPyObject'); + RegisterMethod('Function ReturnTrue : PPyObject'); + RegisterMethod('Function ReturnFalse : PPyObject'); + RegisterMethod('Function FindModule( const ModuleName : AnsiString) : PPyObject'); + RegisterMethod('Function FindFunction( const ModuleName, FuncName : AnsiString) : PPyObject'); + RegisterMethod('Function SetToList( data : Pointer; size : Integer) : PPyObject'); + RegisterMethod('Procedure ListToSet( List : PPyObject; data : Pointer; size : Integer)'); + RegisterMethod('Procedure CheckError( ACatchStopEx : Boolean)'); + RegisterMethod('Function GetMainModule : PPyObject'); + RegisterMethod('Function PyTimeStruct_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyDate_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyDate_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyDateTime_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyDateTime_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyTime_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyTime_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyDelta_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyDelta_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyTZInfo_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyTZInfo_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyUnicodeFromString11( const AString : UnicodeString) : PPyObject;'); + RegisterMethod('Function PyUnicodeFromString12( const AString : AnsiString) : PPyObject;'); + RegisterMethod('Function PyUnicodeAsString( obj : PPyObject) : UnicodeString'); + RegisterMethod('Function PyUnicodeAsUTF8String( obj : PPyObject) : RawByteString'); + RegisterMethod('Function PyBytesAsAnsiString( obj : PPyObject) : AnsiString'); + RegisterProperty('ClientCount', 'Integer', iptr); + RegisterProperty('Clients', 'TEngineClient Integer', iptr); + RegisterProperty('ExecModule', 'AnsiString', iptrw); + RegisterProperty('ThreadState', 'PPyThreadState', iptr); + RegisterProperty('Traceback', 'TPythonTraceback', iptr); + RegisterProperty('LocalVars', 'PPyObject', iptrw); + RegisterProperty('GlobalVars', 'PPyObject', iptrw); + RegisterProperty('IOPythonModule', 'TObject', iptr); + RegisterProperty('PythonHome', 'UnicodeString', iptrw); + RegisterProperty('PythonPath', 'UnicodeString', iptrw); + RegisterProperty('ProgramName', 'UnicodeString', iptrw); + RegisterProperty('AutoFinalize', 'Boolean', iptrw); + RegisterProperty('VenvPythonExe', 'string', iptrw); + RegisterProperty('DatetimeConversionMode', 'TDatetimeConversionMode', iptrw); + RegisterProperty('InitScript', 'TStrings', iptrw); + RegisterProperty('InitThreads', 'Boolean', iptrw); + RegisterProperty('IO', 'TPythonInputOutput', iptrw); + RegisterProperty('PyFlags', 'TPythonFlags', iptrw); + RegisterProperty('RedirectIO', 'Boolean', iptrw); + RegisterProperty('UseWindowsConsole', 'Boolean', iptrw); + RegisterProperty('OnAfterInit', 'TNotifyEvent', iptrw); + RegisterProperty('OnPathInitialization', 'TPathInitializationEvent', iptrw); + RegisterProperty('OnSysPathInit', 'TSysPathInitEvent', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonTraceback(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TOBJECT', 'TPythonTraceback') do + with CL.AddClassN(CL.FindClass('TOBJECT'),'TPythonTraceback') do + begin + RegisterMethod('Constructor Create'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure Clear'); + RegisterMethod('Procedure Refresh( pytraceback : PPyObject)'); + RegisterMethod('Procedure AddItem( const Context, FileName : string; LineNo : Integer)'); + RegisterProperty('ItemCount', 'Integer', iptr); + RegisterProperty('Items', 'TTracebackItem Integer', iptr); + RegisterProperty('Limit', 'Integer', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TTracebackItem(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TOBJECT', 'TTracebackItem') do + with CL.AddClassN(CL.FindClass('TOBJECT'),'TTracebackItem') do + begin + RegisterProperty('FileName', 'string', iptrw); + RegisterProperty('LineNo', 'Integer', iptrw); + RegisterProperty('Context', 'string', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonInterface(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TDynamicDll', 'TPythonInterface') do + with CL.AddClassN(CL.FindClass('TDynamicDll'),'TPythonInterface') do + begin + RegisterProperty('Py_DebugFlag', 'PInteger', iptrw); + RegisterProperty('Py_VerboseFlag', 'PInteger', iptrw); + RegisterProperty('Py_InteractiveFlag', 'PInteger', iptrw); + RegisterProperty('Py_OptimizeFlag', 'PInteger', iptrw); + RegisterProperty('Py_NoSiteFlag', 'PInteger', iptrw); + RegisterProperty('Py_FrozenFlag', 'PInteger', iptrw); + RegisterProperty('Py_IgnoreEnvironmentFlag', 'PInteger', iptrw); + RegisterProperty('PyImport_FrozenModules', 'PP_frozen', iptrw); + RegisterProperty('Py_None', 'PPyObject', iptrw); + RegisterProperty('Py_Ellipsis', 'PPyObject', iptrw); + RegisterProperty('Py_False', 'PPyObject', iptrw); + RegisterProperty('Py_True', 'PPyObject', iptrw); + RegisterProperty('Py_NotImplemented', 'PPyObject', iptrw); + RegisterProperty('PyExc_AttributeError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_EOFError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_IOError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_ImportError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_IndexError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_KeyError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_KeyboardInterrupt', 'PPPyObject', iptrw); + RegisterProperty('PyExc_MemoryError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_NameError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_OverflowError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_RuntimeError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_SyntaxError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_SystemError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_SystemExit', 'PPPyObject', iptrw); + RegisterProperty('PyExc_TypeError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_ValueError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_ZeroDivisionError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_ArithmeticError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_Exception', 'PPPyObject', iptrw); + RegisterProperty('PyExc_FloatingPointError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_LookupError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_AssertionError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_EnvironmentError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_IndentationError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_NotImplementedError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_OSError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_TabError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_UnboundLocalError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_UnicodeError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_WindowsError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_Warning', 'PPPyObject', iptrw); + RegisterProperty('PyExc_DeprecationWarning', 'PPPyObject', iptrw); + RegisterProperty('PyExc_RuntimeWarning', 'PPPyObject', iptrw); + RegisterProperty('PyExc_SyntaxWarning', 'PPPyObject', iptrw); + RegisterProperty('PyExc_UserWarning', 'PPPyObject', iptrw); + RegisterProperty('PyExc_ReferenceError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_StopIteration', 'PPPyObject', iptrw); + RegisterProperty('PyExc_FutureWarning', 'PPPyObject', iptrw); + RegisterProperty('PyExc_PendingDeprecationWarning', 'PPPyObject', iptrw); + RegisterProperty('PyExc_UnicodeDecodeError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_UnicodeEncodeError', 'PPPyObject', iptrw); + RegisterProperty('PyExc_UnicodeTranslateError', 'PPPyObject', iptrw); + RegisterProperty('PyCode_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyType_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyCFunction_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyComplex_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyDict_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyFloat_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyFrame_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyFunction_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyList_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyLong_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyMethod_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyModule_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyObject_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyRange_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PySlice_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyBytes_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyTuple_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyBaseObject_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyCallIter_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyCell_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyClassMethod_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyProperty_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PySeqIter_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyStaticMethod_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PySuper_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyTraceBack_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyUnicode_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyWrapperDescr_Type', 'PPyTypeObject', iptrw); + RegisterProperty('_PyWeakref_RefType', 'PPyTypeObject', iptrw); + RegisterProperty('_PyWeakref_ProxyType', 'PPyTypeObject', iptrw); + RegisterProperty('_PyWeakref_CallableProxyType', 'PPyTypeObject', iptrw); + RegisterProperty('PyBool_Type', 'PPyTypeObject', iptrw); + RegisterProperty('PyEnum_Type', 'PPyTypeObject', iptrw); + RegisterProperty('Py_GetBuildInfo', '', iptrw); + RegisterProperty('PyImport_ExecCodeModule', '', iptrw); + RegisterProperty('PyComplex_FromCComplex', '', iptrw); + RegisterProperty('PyComplex_FromDoubles', '', iptrw); + RegisterProperty('PyComplex_RealAsDouble', '', iptrw); + RegisterProperty('PyComplex_ImagAsDouble', '', iptrw); + RegisterProperty('PyComplex_AsCComplex', '', iptrw); + RegisterProperty('PyCFunction_GetFunction', '', iptrw); + RegisterProperty('PyCFunction_GetSelf', '', iptrw); + RegisterProperty('PyCallable_Check', '', iptrw); + RegisterProperty('PyModule_Create2', '', iptrw); + RegisterProperty('PyErr_BadArgument', '', iptrw); + RegisterProperty('PyErr_BadInternalCall', '', iptrw); + RegisterProperty('PyErr_CheckSignals', '', iptrw); + RegisterProperty('PyErr_Clear', '', iptrw); + RegisterProperty('PyErr_Fetch', '', iptrw); + RegisterProperty('PyErr_NoMemory', '', iptrw); + RegisterProperty('PyErr_Occurred', '', iptrw); + RegisterProperty('PyErr_Print', '', iptrw); + RegisterProperty('PyErr_Restore', '', iptrw); + RegisterProperty('PyErr_SetFromErrno', '', iptrw); + RegisterProperty('PyErr_SetNone', '', iptrw); + RegisterProperty('PyErr_SetObject', '', iptrw); + RegisterProperty('PyErr_SetString', '', iptrw); + RegisterProperty('PyErr_WarnEx', '', iptrw); + RegisterProperty('PyErr_WarnExplicit', '', iptrw); + RegisterProperty('PyImport_GetModuleDict', '', iptrw); + RegisterProperty('PyArg_Parse', 'TPyArg_Parse', iptrw); + RegisterProperty('PyArg_ParseTuple', 'TPyArg_Parse', iptrw); + RegisterProperty('PyArg_ParseTupleAndKeywords', 'TPyArg_ParseTupleAndKeywords', iptrw); + RegisterProperty('Py_BuildValue', 'TPy_BuildValue', iptrw); + RegisterProperty('Py_Initialize', '', iptrw); + RegisterProperty('Py_Exit', '', iptrw); + RegisterProperty('PyEval_GetBuiltins', '', iptrw); + RegisterProperty('PyDict_Copy', '', iptrw); + RegisterProperty('PyDict_GetItem', '', iptrw); + RegisterProperty('PyDict_SetItem', '', iptrw); + RegisterProperty('PyDict_DelItem', '', iptrw); + RegisterProperty('PyDict_Clear', '', iptrw); + RegisterProperty('PyDict_Next', '', iptrw); + RegisterProperty('PyDict_Keys', '', iptrw); + RegisterProperty('PyDict_Values', '', iptrw); + RegisterProperty('PyDict_Items', '', iptrw); + RegisterProperty('PyDict_Size', '', iptrw); + RegisterProperty('PyDict_Update', '', iptrw); + RegisterProperty('PyDict_DelItemString', '', iptrw); + RegisterProperty('PyDict_New', '', iptrw); + RegisterProperty('PyDict_GetItemString', '', iptrw); + RegisterProperty('PyDict_SetItemString', '', iptrw); + RegisterProperty('PyDictProxy_New', '', iptrw); + RegisterProperty('PyModule_GetDict', '', iptrw); + RegisterProperty('PyObject_Str', '', iptrw); + RegisterProperty('PyRun_String', '', iptrw); + RegisterProperty('PyRun_SimpleString', '', iptrw); + RegisterProperty('PyBytes_AsString', '', iptrw); + RegisterProperty('PyBytes_AsStringAndSize', '', iptrw); + RegisterProperty('PySys_SetArgv', '', iptrw); + RegisterProperty('PyCFunction_NewEx', '', iptrw); + RegisterProperty('PyEval_CallObjectWithKeywords', '', iptrw); + RegisterProperty('PyEval_GetFrame', '', iptrw); + RegisterProperty('PyEval_GetGlobals', '', iptrw); + RegisterProperty('PyEval_GetLocals', '', iptrw); + RegisterProperty('PyEval_InitThreads', '', iptrw); + RegisterProperty('PyEval_RestoreThread', '', iptrw); + RegisterProperty('PyEval_SaveThread', '', iptrw); + RegisterProperty('PyFile_GetLine', '', iptrw); + RegisterProperty('PyFile_WriteObject', '', iptrw); + RegisterProperty('PyFile_WriteString', '', iptrw); + RegisterProperty('PyFloat_AsDouble', '', iptrw); + RegisterProperty('PyFloat_FromDouble', '', iptrw); + RegisterProperty('PyFloat_FromString', '', iptrw); + RegisterProperty('PyFunction_GetCode', '', iptrw); + RegisterProperty('PyFunction_GetGlobals', '', iptrw); + RegisterProperty('PyFunction_New', '', iptrw); + RegisterProperty('PyImport_AddModule', '', iptrw); + RegisterProperty('PyImport_GetMagicNumber', '', iptrw); + RegisterProperty('PyImport_ImportFrozenModule', '', iptrw); + RegisterProperty('PyImport_ImportModule', '', iptrw); + RegisterProperty('PyImport_Import', '', iptrw); + RegisterProperty('PyImport_ReloadModule', '', iptrw); + RegisterProperty('PyList_Append', '', iptrw); + RegisterProperty('PyList_AsTuple', '', iptrw); + RegisterProperty('PyList_GetItem', '', iptrw); + RegisterProperty('PyList_GetSlice', '', iptrw); + RegisterProperty('PyList_Insert', '', iptrw); + RegisterProperty('PyList_New', '', iptrw); + RegisterProperty('PyList_Reverse', '', iptrw); + RegisterProperty('PyList_SetItem', '', iptrw); + RegisterProperty('PyList_SetSlice', '', iptrw); + RegisterProperty('PyList_Size', '', iptrw); + RegisterProperty('PyList_Sort', '', iptrw); + RegisterProperty('PyLong_AsDouble', '', iptrw); + RegisterProperty('PyLong_AsLong', '', iptrw); + RegisterProperty('PyLong_FromDouble', '', iptrw); + RegisterProperty('PyLong_FromLong', '', iptrw); + RegisterProperty('PyLong_FromString', '', iptrw); + RegisterProperty('PyLong_FromUnsignedLong', '', iptrw); + RegisterProperty('PyLong_AsUnsignedLong', '', iptrw); + RegisterProperty('PyLong_FromUnicodeObject', '', iptrw); + RegisterProperty('PyLong_FromLongLong', '', iptrw); + RegisterProperty('PyLong_FromUnsignedLongLong', '', iptrw); + RegisterProperty('PyLong_AsLongLong', '', iptrw); + RegisterProperty('PyLong_FromVoidPtr', '', iptrw); + RegisterProperty('PyMapping_Check', '', iptrw); + RegisterProperty('PyMapping_GetItemString', '', iptrw); + RegisterProperty('PyMapping_HasKey', '', iptrw); + RegisterProperty('PyMapping_HasKeyString', '', iptrw); + RegisterProperty('PyMapping_Length', '', iptrw); + RegisterProperty('PyMapping_SetItemString', '', iptrw); + RegisterProperty('PyMethod_Function', '', iptrw); + RegisterProperty('PyMethod_New', '', iptrw); + RegisterProperty('PyMethod_Self', '', iptrw); + RegisterProperty('PyModule_GetName', '', iptrw); + RegisterProperty('PyModule_New', '', iptrw); + RegisterProperty('PyNumber_Absolute', '', iptrw); + RegisterProperty('PyNumber_Add', '', iptrw); + RegisterProperty('PyNumber_And', '', iptrw); + RegisterProperty('PyNumber_Check', '', iptrw); + RegisterProperty('PyNumber_FloorDivide', '', iptrw); + RegisterProperty('PyNumber_TrueDivide', '', iptrw); + RegisterProperty('PyNumber_Divmod', '', iptrw); + RegisterProperty('PyNumber_Float', '', iptrw); + RegisterProperty('PyNumber_Invert', '', iptrw); + RegisterProperty('PyNumber_Long', '', iptrw); + RegisterProperty('PyNumber_Lshift', '', iptrw); + RegisterProperty('PyNumber_Multiply', '', iptrw); + RegisterProperty('PyNumber_Negative', '', iptrw); + RegisterProperty('PyNumber_Or', '', iptrw); + RegisterProperty('PyNumber_Positive', '', iptrw); + RegisterProperty('PyNumber_Power', '', iptrw); + RegisterProperty('PyNumber_Remainder', '', iptrw); + RegisterProperty('PyNumber_Rshift', '', iptrw); + RegisterProperty('PyNumber_Subtract', '', iptrw); + RegisterProperty('PyNumber_Xor', '', iptrw); + RegisterProperty('PyOS_InterruptOccurred', '', iptrw); + RegisterProperty('PyObject_CallObject', '', iptrw); + RegisterProperty('PyObject_RichCompare', '', iptrw); + RegisterProperty('PyObject_RichCompareBool', '', iptrw); + RegisterProperty('PyObject_GetAttr', '', iptrw); + RegisterProperty('PyObject_GetAttrString', '', iptrw); + RegisterProperty('PyObject_GetItem', '', iptrw); + RegisterProperty('PyObject_DelItem', '', iptrw); + RegisterProperty('PyObject_HasAttrString', '', iptrw); + RegisterProperty('PyObject_Hash', '', iptrw); + RegisterProperty('PyObject_IsTrue', '', iptrw); + RegisterProperty('PyObject_Length', '', iptrw); + RegisterProperty('PyObject_Repr', '', iptrw); + RegisterProperty('PyObject_SetAttr', '', iptrw); + RegisterProperty('PyObject_SetAttrString', '', iptrw); + RegisterProperty('PyObject_SetItem', '', iptrw); + RegisterProperty('PyObject_Init', '', iptrw); + RegisterProperty('PyObject_InitVar', '', iptrw); + RegisterProperty('PyObject_New', '', iptrw); + RegisterProperty('PyObject_NewVar', '', iptrw); + RegisterProperty('PyObject_Free', '', iptrw); + RegisterProperty('PyObject_GetIter', '', iptrw); + RegisterProperty('PyIter_Next', '', iptrw); + RegisterProperty('PyObject_IsInstance', '', iptrw); + RegisterProperty('PyObject_IsSubclass', '', iptrw); + RegisterProperty('PyObject_Call', '', iptrw); + RegisterProperty('PyObject_GenericGetAttr', '', iptrw); + RegisterProperty('PyObject_GenericSetAttr', '', iptrw); + RegisterProperty('PyObject_GC_Malloc', '', iptrw); + RegisterProperty('PyObject_GC_New', '', iptrw); + RegisterProperty('PyObject_GC_NewVar', '', iptrw); + RegisterProperty('PyObject_GC_Resize', '', iptrw); + RegisterProperty('PyObject_GC_Del', '', iptrw); + RegisterProperty('PyObject_GC_Track', '', iptrw); + RegisterProperty('PyObject_GC_UnTrack', '', iptrw); + RegisterProperty('PySequence_Check', '', iptrw); + RegisterProperty('PySequence_Concat', '', iptrw); + RegisterProperty('PySequence_Count', '', iptrw); + RegisterProperty('PySequence_GetItem', '', iptrw); + RegisterProperty('PySequence_GetSlice', '', iptrw); + RegisterProperty('PySequence_In', '', iptrw); + RegisterProperty('PySequence_Index', '', iptrw); + RegisterProperty('PySequence_Length', '', iptrw); + RegisterProperty('PySequence_Repeat', '', iptrw); + RegisterProperty('PySequence_SetItem', '', iptrw); + RegisterProperty('PySequence_SetSlice', '', iptrw); + RegisterProperty('PySequence_DelSlice', '', iptrw); + RegisterProperty('PySequence_Tuple', '', iptrw); + RegisterProperty('PySequence_Contains', '', iptrw); + RegisterProperty('PySequence_List', '', iptrw); + RegisterProperty('PySeqIter_New', '', iptrw); + RegisterProperty('PySlice_GetIndices', '', iptrw); + RegisterProperty('PySlice_GetIndicesEx', '', iptrw); + RegisterProperty('PySlice_New', '', iptrw); + RegisterProperty('PyBytes_Concat', '', iptrw); + RegisterProperty('PyBytes_ConcatAndDel', '', iptrw); + RegisterProperty('PyBytes_FromString', '', iptrw); + RegisterProperty('PyBytes_FromStringAndSize', '', iptrw); + RegisterProperty('PyBytes_Size', '', iptrw); + RegisterProperty('PyBytes_DecodeEscape', '', iptrw); + RegisterProperty('PyBytes_Repr', '', iptrw); + RegisterProperty('PySys_GetObject', '', iptrw); + RegisterProperty('PySys_SetObject', '', iptrw); + RegisterProperty('PySys_SetPath', '', iptrw); + RegisterProperty('PyTraceBack_Here', '', iptrw); + RegisterProperty('PyTraceBack_Print', '', iptrw); + RegisterProperty('PyTuple_GetItem', '', iptrw); + RegisterProperty('PyTuple_GetSlice', '', iptrw); + RegisterProperty('PyTuple_New', '', iptrw); + RegisterProperty('PyTuple_SetItem', '', iptrw); + RegisterProperty('PyTuple_Size', '', iptrw); + RegisterProperty('PyType_IsSubtype', '', iptrw); + RegisterProperty('PyType_GenericAlloc', '', iptrw); + RegisterProperty('PyType_GenericNew', '', iptrw); + RegisterProperty('PyType_Ready', '', iptrw); + RegisterProperty('PyUnicode_FromWideChar', '', iptrw); + RegisterProperty('PyUnicode_FromString', '', iptrw); + RegisterProperty('PyUnicode_FromStringAndSize', '', iptrw); + RegisterProperty('PyUnicode_FromKindAndData', '', iptrw); + RegisterProperty('PyUnicode_AsWideChar', '', iptrw); + RegisterProperty('PyUnicode_AsUTF8', '', iptrw); + RegisterProperty('PyUnicode_AsUTF8AndSize', '', iptrw); + RegisterProperty('PyUnicode_Decode', '', iptrw); + RegisterProperty('PyUnicode_DecodeUTF16', '', iptrw); + RegisterProperty('PyUnicode_AsEncodedString', '', iptrw); + RegisterProperty('PyUnicode_FromOrdinal', '', iptrw); + RegisterProperty('PyUnicode_GetSize', '', iptrw); + RegisterProperty('PyWeakref_GetObject', '', iptrw); + RegisterProperty('PyWeakref_NewProxy', '', iptrw); + RegisterProperty('PyWeakref_NewRef', '', iptrw); + RegisterProperty('PyWrapper_New', '', iptrw); + RegisterProperty('PyBool_FromLong', '', iptrw); + RegisterProperty('PyThreadState_SetAsyncExc', '', iptrw); + RegisterProperty('Py_AtExit', '', iptrw); + RegisterProperty('Py_CompileStringExFlags', '', iptrw); + RegisterProperty('Py_FatalError', '', iptrw); + RegisterProperty('_PyObject_New', '', iptrw); + RegisterProperty('_PyBytes_Resize', '', iptrw); + RegisterProperty('Py_Finalize', '', iptrw); + RegisterProperty('PyErr_ExceptionMatches', '', iptrw); + RegisterProperty('PyErr_GivenExceptionMatches', '', iptrw); + RegisterProperty('PyEval_EvalCode', '', iptrw); + RegisterProperty('Py_GetVersion', '', iptrw); + RegisterProperty('Py_GetCopyright', '', iptrw); + RegisterProperty('Py_GetExecPrefix', '', iptrw); + RegisterProperty('Py_GetPath', '', iptrw); + RegisterProperty('Py_SetPythonHome', '', iptrw); + RegisterProperty('Py_GetPythonHome', '', iptrw); + RegisterProperty('Py_GetPrefix', '', iptrw); + RegisterProperty('Py_GetProgramName', '', iptrw); + RegisterProperty('PyParser_SimpleParseStringFlags', '', iptrw); + RegisterProperty('PyNode_Free', '', iptrw); + RegisterProperty('PyErr_NewException', '', iptrw); + RegisterProperty('PyMem_Malloc', '', iptrw); + RegisterProperty('Py_SetProgramName', '', iptrw); + RegisterProperty('Py_IsInitialized', '', iptrw); + RegisterProperty('Py_GetProgramFullPath', '', iptrw); + RegisterProperty('Py_NewInterpreter', '', iptrw); + RegisterProperty('Py_EndInterpreter', '', iptrw); + RegisterProperty('PyEval_AcquireLock', '', iptrw); + RegisterProperty('PyEval_ReleaseLock', '', iptrw); + RegisterProperty('PyEval_AcquireThread', '', iptrw); + RegisterProperty('PyEval_ReleaseThread', '', iptrw); + RegisterProperty('PyInterpreterState_New', '', iptrw); + RegisterProperty('PyInterpreterState_Clear', '', iptrw); + RegisterProperty('PyInterpreterState_Delete', '', iptrw); + RegisterProperty('PyThreadState_New', '', iptrw); + RegisterProperty('PyThreadState_Clear', '', iptrw); + RegisterProperty('PyThreadState_Delete', '', iptrw); + RegisterProperty('PyThreadState_Get', '', iptrw); + RegisterProperty('PyThreadState_Swap', '', iptrw); + RegisterProperty('PyErr_SetInterrupt', '', iptrw); + RegisterProperty('PyGILState_Ensure', '', iptrw); + RegisterProperty('PyGILState_Release', '', iptrw); + RegisterMethod('Function PyParser_SimpleParseString( str : PAnsiChar; start : Integer) : PNode'); + RegisterMethod('Function Py_CompileString( str, filename : PAnsiChar; start : integer) : PPyObject'); + RegisterMethod('Procedure Py_INCREF( op : PPyObject)'); + RegisterMethod('Procedure Py_DECREF( op : PPyObject)'); + RegisterMethod('Procedure Py_XINCREF( op : PPyObject)'); + RegisterMethod('Procedure Py_XDECREF( op : PPyObject)'); + RegisterMethod('Procedure Py_CLEAR( var op : PPyObject)'); + RegisterMethod('Function PyBytes_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyBytes_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyFloat_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyFloat_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyLong_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyLong_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyTuple_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyTuple_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyClass_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyType_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyMethod_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyList_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyList_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyDict_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyDict_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyModule_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyModule_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PySlice_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyFunction_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyIter_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyUnicode_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyUnicode_CheckExact( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyType_IS_GC( t : PPyTypeObject) : Boolean'); + RegisterMethod('Function PyObject_IS_GC( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyWeakref_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyWeakref_CheckRef( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyWeakref_CheckProxy( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyBool_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyEnum_Check( obj : PPyObject) : Boolean'); + RegisterMethod('Function PyObject_TypeCheck( obj : PPyObject; t : PPyTypeObject) : Boolean'); + RegisterMethod('Function Py_InitModule( const md : PyModuleDef) : PPyObject'); + RegisterMethod('Procedure MapDll'); + RegisterProperty('Initialized', 'Boolean', iptr); + RegisterProperty('Finalizing', 'Boolean', iptr); + RegisterProperty('MajorVersion', 'integer', iptr); + RegisterProperty('MinorVersion', 'integer', iptr); + RegisterProperty('BuiltInModuleName', 'string', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TDynamicDll(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TComponent', 'TDynamicDll') do + with CL.AddClassN(CL.FindClass('TComponent'),'TDynamicDll') do begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure OpenDll( const aDllName : string)'); + RegisterMethod('Function IsHandleValid : Boolean'); + RegisterMethod('Procedure LoadDll'); + RegisterMethod('Procedure UnloadDll'); + RegisterMethod('Procedure Quit'); + RegisterProperty('AutoLoad', 'Boolean', iptrw); + RegisterProperty('AutoUnload', 'Boolean', iptrw); + RegisterProperty('DllName', 'string', iptrw); + RegisterProperty('DllPath', 'string', iptrw); + RegisterProperty('APIVersion', 'Integer', iptrw); + RegisterProperty('RegVersion', 'string', iptrw); + RegisterProperty('FatalAbort', 'Boolean', iptrw); + RegisterProperty('FatalMsgDlg', 'Boolean', iptrw); + RegisterProperty('UseLastKnownVersion', 'Boolean', iptrw); + RegisterProperty('OnAfterLoad', 'TNotifyEvent', iptrw); + RegisterProperty('OnBeforeLoad', 'TNotifyEvent', iptrw); + RegisterProperty('OnBeforeUnload', 'TNotifyEvent', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonInputOutput(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TComponent', 'TPythonInputOutput') do + with CL.AddClassN(CL.FindClass('TComponent'),'TPythonInputOutput') do begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure Write( const str : IOString)'); + RegisterMethod('Procedure WriteLine( const str : IOString)'); + RegisterProperty('MaxLines', 'Integer', iptrw); + RegisterProperty('MaxLineLength', 'Integer', iptrw); + RegisterProperty('DelayWrites', 'Boolean', iptrw); + RegisterProperty('OnSendData', 'TSendDataEvent', iptrw); + RegisterProperty('OnReceiveData', 'TReceiveDataEvent', iptrw); + RegisterProperty('OnSendUniData', 'TSendUniDataEvent', iptrw); + RegisterProperty('OnReceiveUniData', 'TReceiveUniDataEvent', iptrw); + RegisterProperty('UnicodeIO', 'Boolean', iptrw); + RegisterProperty('RawOutput', 'Boolean', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_EPySyntaxError(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'EPyStandardError', 'EPySyntaxError') do + with CL.AddClassN(CL.FindClass('EPyStandardError'),'EPySyntaxError') do + begin + RegisterProperty('EFileName', 'UnicodeString', iptrw); + RegisterProperty('ELineStr', 'UnicodeString', iptrw); + RegisterProperty('ELineNumber', 'Integer', iptrw); + RegisterProperty('EOffset', 'Integer', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_EPythonError(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'Exception', 'EPythonError') do + with CL.AddClassN(CL.FindClass('Exception'),'EPythonError') do + begin + RegisterProperty('EName', 'string', iptrw); + RegisterProperty('EValue', 'string', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_EDLLImportError(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'Exception', 'EDLLImportError') do + with CL.AddClassN(CL.FindClass('Exception'),'EDLLImportError') do + begin + RegisterProperty('WrongFunc', 'AnsiString', iptrw); + RegisterProperty('ErrorCode', 'Integer', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_PythonEngine(CL: TPSPascalCompiler); +begin + CL.AddTypeS('TPythonVersionProp', 'record DllName : string; RegVersion : string; APIVersion : Integer; end'); + CL.AddConstantN('PYT_METHOD_BUFFER_INCREASE','LongInt').SetInt( 10); + CL.AddConstantN('PYT_MEMBER_BUFFER_INCREASE','LongInt').SetInt( 10); + CL.AddConstantN('PYT_GETSET_BUFFER_INCREASE','LongInt').SetInt( 10); + CL.AddConstantN('METH_VARARGS','LongWord').SetUInt( $0001); + CL.AddConstantN('METH_KEYWORDS','LongWord').SetUInt( $0002); + CL.AddConstantN('CO_OPTIMIZED','LongWord').SetUInt( $0001); + CL.AddConstantN('CO_NEWLOCALS','LongWord').SetUInt( $0002); + CL.AddConstantN('CO_VARARGS','LongWord').SetUInt( $0004); + CL.AddConstantN('CO_VARKEYWORDS','LongWord').SetUInt( $0008); + CL.AddConstantN('Py_LT','LongInt').SetInt( 0); + CL.AddConstantN('Py_LE','LongInt').SetInt( 1); + CL.AddConstantN('Py_EQ','LongInt').SetInt( 2); + CL.AddConstantN('Py_NE','LongInt').SetInt( 3); + CL.AddConstantN('Py_GT','LongInt').SetInt( 4); + CL.AddConstantN('Py_GE','LongInt').SetInt( 5); + CL.AddTypeS('TRichComparisonOpcode', '( pyLT, pyLE, pyEQ, pyNE, pyGT, pyGE )'); + CL.AddTypeS('C_Long', 'Integer'); + CL.AddTypeS('C_ULong', 'Cardinal'); + CL.AddTypeS('C_Long', 'NativeInt'); + CL.AddTypeS('C_ULong', 'NativeUInt'); + CL.AddTypeS('TPFlag', '( tpfHeapType, tpfBaseType, tpfReady, tpfReadying, tpf' + +'HaveGC, tpVectorCall, tpMethodDescriptor, tpHaveVersionTag, tpValidVersion' + +'Tag, tpIsAbstract, tpLongSubclass, tpListSubClass, tpTupleSubclass, tpByte' + +'sSubclass, tpBaseExcSubclass, tpTypeSubclass )'); + CL.AddTypeS('TPFlags', 'set of TPFlag'); + CL.AddConstantN('TPFLAGS_DEFAULT','LongInt').Value.ts32 := ord(tpfBaseType) or ord(tpHaveVersionTag); + CL.AddConstantN('single_input','LongInt').SetInt( 256); + CL.AddConstantN('file_input','LongInt').SetInt( 257); + CL.AddConstantN('eval_input','LongInt').SetInt( 258); + CL.AddConstantN('PyUnicode_WCHAR_KIND','LongInt').SetInt( 0); + CL.AddConstantN('PyUnicode_1BYTE_KIND','LongInt').SetInt( 1); + CL.AddConstantN('PyUnicode_2BYTE_KIND','LongInt').SetInt( 2); + CL.AddConstantN('PyUnicode_4BYTE_KIND','LongInt').SetInt( 4); + CL.AddConstantN('T_SHORT','LongInt').SetInt( 0); + CL.AddConstantN('T_INT','LongInt').SetInt( 1); + CL.AddConstantN('T_LONG','LongInt').SetInt( 2); + CL.AddConstantN('T_FLOAT','LongInt').SetInt( 3); + CL.AddConstantN('T_DOUBLE','LongInt').SetInt( 4); + CL.AddConstantN('T_STRING','LongInt').SetInt( 5); + CL.AddConstantN('T_OBJECT','LongInt').SetInt( 6); + CL.AddConstantN('T_CHAR','LongInt').SetInt( 7); + CL.AddConstantN('T_BYTE','LongInt').SetInt( 8); + CL.AddConstantN('T_UBYTE','LongInt').SetInt( 9); + CL.AddConstantN('T_USHORT','LongInt').SetInt( 10); + CL.AddConstantN('T_UINT','LongInt').SetInt( 11); + CL.AddConstantN('T_ULONG','LongInt').SetInt( 12); + CL.AddConstantN('T_STRING_INPLACE','LongInt').SetInt( 13); + CL.AddConstantN('T_OBJECT_EX','LongInt').SetInt( 16); + CL.AddConstantN('PY_READONLY','LongInt').SetInt( 1); + //CL.AddConstantN('RO','').SetString( READONLY); + CL.AddConstantN('READ_RESTRICTED','LongInt').SetInt( 2); + CL.AddConstantN('PY_WRITE_RESTRICTED','LongInt').SetInt( 4); + CL.AddTypeS('TPyMemberType', '( mtShort, mtInt, mtLong, mtFloat, mtDouble, mt' + +'String, mtObject, mtChar, mtByte, mtUByte, mtUShort, mtUInt, mtULong, mtStringInplace, mtObjectEx )'); + CL.AddTypeS('TPyMemberFlag', '( mfDefault, mfReadOnly, mfReadRestricted, mfWriteRestricted, mfRestricted )'); + CL.AddConstantN('PY_CR','Char').SetString( #13); + CL.AddConstantN('PY_LF','Char').SetString( #10); + CL.AddConstantN('PY_TAB','Char').SetString( #09); + //CL.AddTypeS('PP_frozen', '^P_frozen // will not work'); + //CL.AddTypeS('P_frozen', '^_frozen // will not work'); + //CL.AddTypeS('PPyObject', '^PyObject // will not work'); + //CL.AddTypeS('PPPyObject', '^PPyObject // will not work'); + //CL.AddTypeS('PPPPyObject', '^PPPyObject // will not work'); + //CL.AddTypeS('PPyTypeObject', '^PyTypeObject // will not work'); + //CL.AddTypeS('PPySliceObject', '^PySliceObject // will not work'); +// CL.AddTypeS('binaryfunc', 'integer// will not work'); + (* + CL.AddTypeS('PyNumberMethods', 'record nb_add : binaryfunc; nb_subtract : bin' + +'aryfunc; nb_multiply : binaryfunc; nb_remainder : binaryfunc; nb_divmod : ' + +'binaryfunc; nb_power : ternaryfunc; nb_negative : unaryfunc; nb_positive :' + +' unaryfunc; nb_absolute : unaryfunc; nb_bool : inquiry; nb_invert : unaryf' + +'unc; nb_lshift : binaryfunc; nb_rshift : binaryfunc; nb_and : binaryfunc; ' + +'nb_xor : binaryfunc; nb_or : binaryfunc; nb_int : unaryfunc; nb_reserved :' + +' Pointer; nb_float : unaryfunc; nb_inplace_add : binaryfunc; nb_inplace_su' + +'btract : binaryfunc; nb_inplace_multiply : binaryfunc; nb_inplace_remainde' + +'r : binaryfunc; nb_inplace_power : ternaryfunc; nb_inplace_lshift : binary' + +'func; nb_inplace_rshift : binaryfunc; nb_inplace_and : binaryfunc; nb_inpl' + +'ace_xor : binaryfunc; nb_inplace_or : binaryfunc; nb_floor_divide : binary' + +'func; nb_true_divide : binaryfunc; nb_inplace_floor_divide : binaryfunc; n' + +'b_inplace_true_divide : binaryfunc; nb_index : unaryfunc; nb_matrix_multip' + +'ly : binaryfunc; nb_inplace_matrix_multiply : binaryfunc; end'); //*) + //CL.AddTypeS('PPyNumberMethods', '^PyNumberMethods // will not work'); + { CL.AddTypeS('PySequenceMethods', 'record sq_length : lenfunc; sq_concat : bin' + +'aryfunc; sq_repeat : ssizeargfunc; sq_item : ssizeargfunc; was_sq_slice : ' + +'Pointer; sq_ass_item : ssizeobjargproc; was_sq_ass_slice : Pointer; sq_con' + +'tains : objobjproc; sq_inplace_concat : binaryfunc; sq_inplace_repeat : ssizeargfunc; end'); } + //CL.AddTypeS('PPySequenceMethods', '^PySequenceMethods // will not work'); + //CL.AddTypeS('PyMappingMethods', 'record mp_length : lenfunc; mp_subscript : b' + // +'inaryfunc; mp_ass_subscript : objobjargproc; end'); + //CL.AddTypeS('PPyMappingMethods', '^PyMappingMethods // will not work'); + CL.AddTypeS('Py_complex', 'record real : double; imag : double; end'); + //CL.AddTypeS('PyObject', 'record ob_refcnt : NativeInt; ob_type : PPyTypeObject; end'); + //CL.AddTypeS('_frozen', 'record name : PAnsiChar; code : Byte; size : Integer; end'); + //CL.AddTypeS('PySliceObject', 'record ob_refcnt : NativeInt; ob_type : PPyType' + // +'Object; start : PPyObject; stop : PPyObject; step : PPyObject; end'); + //CL.AddTypeS('PPyMethodDef', '^PyMethodDef // will not work'); + //CL.AddTypeS('PyMethodDef', 'record ml_name : PAnsiChar; ml_meth : PyCFunction' + //+'; ml_flags : Integer; ml_doc : PAnsiChar; end'); + //CL.AddTypeS('PPyMemberDef', '^PyMemberDef // will not work'); + //CL.AddTypeS('PyMemberDef', 'record name : PAnsiChar; _type : integer; offset ' + //+': NativeInt; flags : integer; doc : PAnsiChar; end'); + //CL.AddTypeS('PPyGetSetDef', '^PyGetSetDef // will not work'); + //CL.AddTypeS('PyGetSetDef', 'record name : PAnsiChar; get : getter; _set : set' + // +'ter; doc : PAnsiChar; closure : Pointer; end'); + //CL.AddTypeS('pwrapperbase', '^wrapperbase // will not work'); + //CL.AddTypeS('wrapperbase', 'record name : PAnsiChar; wrapper : wrapperfunc; doc : PAnsiChar; end'); + //CL.AddTypeS('PPyDescrObject', '^PyDescrObject // will not work'); + //CL.AddTypeS('PyDescrObject', 'record ob_refcnt : NativeInt; ob_type : PPyType' + //+'Object; d_type : PPyTypeObject; d_name : PPyObject; end'); + //CL.AddTypeS('PPyMethodDescrObject', '^PyMethodDescrObject // will not work'); + (* + CL.AddTypeS('PyMethodDescrObject', 'record ob_refcnt : NativeInt; ob_type : P' + +'PyTypeObject; d_type : PPyTypeObject; d_name : PPyObject; d_method : PPyMethodDef; end'); + CL.AddTypeS('PPyMemberDescrObject', '^PyMemberDescrObject // will not work'); + CL.AddTypeS('PyMemberDescrObject', 'record ob_refcnt : NativeInt; ob_type : P' + +'PyTypeObject; d_type : PPyTypeObject; d_name : PPyObject; d_member : PPyMemberDef; end'); + //CL.AddTypeS('PPyGetSetDescrObject', '^PyGetSetDescrObject // will not work'); + CL.AddTypeS('PyGetSetDescrObject', 'record ob_refcnt : NativeInt; ob_type : P' + +'PyTypeObject; d_type : PPyTypeObject; d_name : PPyObject; d_getset : PPyGetSetDef; end'); + //CL.AddTypeS('PPyWrapperDescrObject', '^PyWrapperDescrObject // will not work'); + CL.AddTypeS('PyWrapperDescrObject', 'record ob_refcnt : NativeInt; ob_type : ' + +'PPyTypeObject; d_type : PPyTypeObject; d_name : PPyObject; d_base : pwrapp' + +'erbase; d_wrapped : Pointer; end'); + //CL.AddTypeS('PPyModuleDef_Base', '^PyModuleDef_Base // will not work'); + CL.AddTypeS('PyModuleDef_Base', 'record ob_refcnt : NativeInt; ob_type : PPyT' + +'ypeObject; m_index : NativeInt; m_copy : PPyObject; end'); + //CL.AddTypeS('PPyModuleDef', '^PyModuleDef // will not work'); + CL.AddTypeS('PyModuleDef', 'record m_base : PyModuleDef_Base; m_name : PAnsiC' + +'har; m_doc : PAnsiChar; m_size : NativeInt; m_methods : PPyMethodDef; m_re' + +'load : inquiry; m_traverse : traverseproc; m_clear : inquiry; m_free : inquiry; end'); + CL.AddTypeS('PyTypeObject', 'record ob_refcnt : NativeInt; ob_type : PPyTypeO' + +'bject; ob_size : NativeInt; tp_name : PAnsiChar; tp_basicsize : NativeInt;' + +' tp_itemsize : NativeInt; tp_dealloc : pydestructor; tp_vectorcall_offset ' + +': NativeInt; tp_getattr : getattrfunc; tp_setattr : setattrfunc; tp_as_asy' + +'nc : Pointer; tp_repr : reprfunc; tp_as_number : PPyNumberMethods; tp_as_s' + +'equence : PPySequenceMethods; tp_as_mapping : PPyMappingMethods; tp_hash :' + +' hashfunc; tp_call : ternaryfunc; tp_str : reprfunc; tp_getattro : getattr' + +'ofunc; tp_setattro : setattrofunc; tp_as_buffer : Pointer; tp_flags : C_UL' + +'ong; tp_doc : PAnsiChar; tp_traverse : traverseproc; tp_clear : inquiry; t' + +'p_richcompare : richcmpfunc; tp_weaklistoffset : NativeInt; tp_iter : geti' + +'terfunc; tp_iternext : iternextfunc; tp_methods : PPyMethodDef; tp_members' + +' : PPyMemberDef; tp_getset : PPyGetSetDef; tp_base : PPyTypeObject; tp_dic' + +'t : PPyObject; tp_descr_get : descrgetfunc; tp_descr_set : descrsetfunc; t' + +'p_dictoffset : NativeInt; tp_init : initproc; tp_alloc : allocfunc; tp_new' + +' : newfunc; tp_free : pydestructor; tp_is_gc : inquiry; tp_bases : PPyObje' + +'ct; tp_mro : PPyObject; tp_cache : PPyObject; tp_subclasses : PPyObject; t' + +'p_weaklist : PPyObject; tp_del : PyDestructor; tp_version_tag : Cardinal; ' + +'tp_finalize : PyDestructor; tp_vectorcall : Pointer; tp_xxx1 : NativeInt; ' + +'tp_xxx2 : NativeInt; tp_xxx3 : NativeInt; tp_xxx4 : NativeInt; tp_xxx5 : N' + +'ativeInt; tp_xxx6 : NativeInt; tp_xxx7 : NativeInt; tp_xxx8 : NativeInt; t' + +'p_xxx9 : NativeInt; tp_xxx10 : NativeInt; end'); + CL.AddTypeS('PPyInterpreterState', '__Pointer'); + CL.AddTypeS('PPyThreadState', '__Pointer'); + //CL.AddTypeS('PNode', '^node // will not work'); + CL.AddTypeS('node', 'record n_type : smallint; n_str : PAnsiChar; n_lineno : ' + +'integer; n_col_offset : integer; n_nchildren : integer; n_child : PNode; end'); + *) + //CL.AddTypeS('PPyCompilerFlags', '^PyCompilerFlags // will not work'); + CL.AddTypeS('PyCompilerFlags', 'record flags : integer; cf_feature_version : integer; end'); + CL.AddConstantN('_PyDateTime_DATE_DATASIZE','LongInt').SetInt( 4); + CL.AddConstantN('_PyDateTime_TIME_DATASIZE','LongInt').SetInt( 6); + CL.AddConstantN('_PyDateTime_DATETIME_DATASIZE','LongInt').SetInt( 10); + (* + CL.AddTypeS('PyDateTime_Delta', 'record ob_refcnt : NativeInt; ob_type : PPyT' + +'ypeObject; hashcode : NativeInt; days : Integer; seconds : Integer; microseconds : Integer; end'); + //CL.AddTypeS('PPyDateTime_Delta', '^PyDateTime_Delta // will not work'); + CL.AddTypeS('PyDateTime_TZInfo', 'record ob_refcnt : NativeInt; ob_type : PPyTypeObject; end'); + //CL.AddTypeS('PPyDateTime_TZInfo', '^PyDateTime_TZInfo // will not work'); + CL.AddTypeS('_PyDateTime_BaseTZInfo', 'record ob_refcnt : NativeInt; ob_type ' + +': PPyTypeObject; hashcode : Integer; hastzinfo : Char; end'); + //CL.AddTypeS('_PPyDateTime_BaseTZInfo', '^_PyDateTime_BaseTZInfo // will not work'); + CL.AddTypeS('_PyDateTime_BaseTime', 'record ob_refcnt : NativeInt; ob_type : ' + +'PPyTypeObject; hashcode : Integer; hastzinfo : Char; end'); + //CL.AddTypeS('_PPyDateTime_BaseTime', '^_PyDateTime_BaseTime // will not work'); + CL.AddTypeS('PyDateTime_Time', 'record ob_refcnt : NativeInt; ob_type : PPyTy' + +'peObject; hashcode : Integer; hastzinfo : Char; tzinfo : PPyObject; end'); + //CL.AddTypeS('PPyDateTime_Time', '^PyDateTime_Time // will not work'); + CL.AddTypeS('PyDateTime_Date', 'record ob_refcnt : NativeInt; ob_type : PPyTy' + +'peObject; hashcode : Integer; hastzinfo : Char; end'); + //CL.AddTypeS('PPyDateTime_Date', '^PyDateTime_Date // will not work'); + CL.AddTypeS('_PyDateTime_BaseDateTime', 'record ob_refcnt : NativeInt; ob_typ' + +'e : PPyTypeObject; hashcode : Integer; hastzinfo : Char; end'); + //CL.AddTypeS('_PPyDateTime_BaseDateTime', '^_PyDateTime_BaseDateTime // will not work'); + CL.AddTypeS('PyDateTime_DateTime', 'record ob_refcnt : NativeInt; ob_type : P' + +'PyTypeObject; hashcode : Integer; hastzinfo : Char; tzinfo : PPyObject; end'); + //CL.AddTypeS('PPyDateTime_DateTime', '^PyDateTime_DateTime // will not work'); + *) + CL.AddTypeS('PyGILState_STATE', '( PyGILState_LOCKED, PyGILState_UNLOCKED )'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EDLLLoadError'); + SIRegister_EDLLImportError(CL); + SIRegister_EPythonError(CL); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyExecError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyException'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyStandardError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyArithmeticError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyLookupError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyAssertionError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyAttributeError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyEOFError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyFloatingPointError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyEnvironmentError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyIOError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyOSError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyImportError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyIndexError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyKeyError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyKeyboardInterrupt'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyMemoryError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyNameError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyOverflowError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyRuntimeError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyNotImplementedError'); + SIRegister_EPySyntaxError(CL); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyIndentationError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyTabError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPySystemError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPySystemExit'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyTypeError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyUnboundLocalError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyValueError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyUnicodeError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'UnicodeEncodeError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'UnicodeDecodeError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'UnicodeTranslateError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyZeroDivisionError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyStopIteration'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyWarning'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyUserWarning'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyDeprecationWarning'); + CL.AddClassN(CL.FindClass('TOBJECT'),'PendingDeprecationWarning'); + CL.AddClassN(CL.FindClass('TOBJECT'),'FutureWarning'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPySyntaxWarning'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyRuntimeWarning'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyReferenceError'); + CL.AddClassN(CL.FindClass('TOBJECT'),'EPyWindowsError'); + CL.AddConstantN('kMaxLines','LongInt').SetInt( 1000); + CL.AddConstantN('kMaxLineLength','LongInt').SetInt( 256); + CL.AddTypeS('TSendDataEvent', 'Procedure ( Sender : TObject; const Data : AnsiString)'); + CL.AddTypeS('TReceiveDataEvent', 'Procedure ( Sender : TObject; var Data : AnsiString)'); + CL.AddTypeS('TSendUniDataEvent', 'Procedure ( Sender : TObject; const Data : UnicodeString)'); + CL.AddTypeS('TReceiveUniDataEvent', 'Procedure ( Sender : TObject; var Data : UnicodeString)'); + CL.AddTypeS('IOChar', 'WideChar'); + CL.AddTypeS('IOString', 'UnicodeString'); + CL.AddTypeS('TIOStringList', 'TStringList'); + SIRegister_TPythonInputOutput(CL); + SIRegister_TDynamicDll(CL); + SIRegister_TPythonInterface(CL); + CL.AddTypeS('TDatetimeConversionMode', '( dcmToTuple, dcmToDatetime )'); + //CL.AddConstantN('DEFAULT_DATETIME_CONVERSION_MODE','').SetString( dcmToTuple); + CL.AddClassN(CL.FindClass('TOBJECT'),'TEngineClient'); + CL.AddTypeS('TPathInitializationEvent', 'Procedure ( Sender : TObject; var Path : string)'); + //CL.AddTypeS('TSysPathInitEvent', 'Procedure ( Sender : TObject; PathList : PPyObject)'); + CL.AddTypeS('TSysPathInitEvent', 'Procedure ( Sender : TObject; Path : string)'); + + CL.AddTypeS('TPythonFlag', '( pfDebug, pfInteractive, pfNoSite, pfOptimize, pfVerbose, pfFrozenFlag, pfIgnoreEnvironmentFlag )'); + CL.AddTypeS('TPythonFlags', 'set of TPythonFlag'); + SIRegister_TTracebackItem(CL); + SIRegister_TPythonTraceback(CL); + SIRegister_TPythonEngine(CL); + SIRegister_TEngineClient(CL); + //CL.AddTypeS('TDelphiMethod', 'Function ( self, args : PPyObject) : PPyObject'); + //CL.AddTypeS('TDelphiMethodWithKW', 'Function ( self, args, keywords : PPyObject) : PPyObject'); + //CL.AddTypeS('TPythonEvent', 'Procedure ( Sender : TObject; PSelf, Args : TPyObject; var Result : TPyObject)'); + CL.AddClassN(CL.FindClass('TOBJECT'),'TMethodsContainer'); + CL.AddClassN(CL.FindClass('TOBJECT'),'TEventDefs'); + SIRegister_TEventDef(CL); + SIRegister_TEventDefs(CL); + SIRegister_TMethodsContainer(CL); + SIRegister_TMembersContainer(CL); + SIRegister_TGetSetContainer(CL); + CL.AddClassN(CL.FindClass('TOBJECT'),'TPythonModule'); + CL.AddClassN(CL.FindClass('TOBJECT'),'TErrors'); + CL.AddTypeS('TErrorType', '( etString, etClass )'); + SIRegister_TParentClassError(CL); + SIRegister_TError(CL); + SIRegister_TErrors(CL); + SIRegister_TPythonModule(CL); + CL.AddClassN(CL.FindClass('TOBJECT'),'TPythonType'); + SIRegister_TPyObject(CL); + //CL.AddTypeS('TPyObjectClass', 'class of TPyObject'); + CL.AddTypeS('TPythonEvent', 'Procedure ( Sender : TObject; PSelf, Args : TPyObject; var Result : TPyObject)'); + CL.AddTypeS('TBasicService', '( pbsGetAttr, pbsSetAttr, pbsRepr, pbsCompa' + +'re, pbsHash, pbsStr, pbsGetAttrO, pbsSetAttrO, pbsCall, pbsTraverse, pbsClear, pbs' + +'RichCompare, pbsIter, pbsIterNext )'); + + CL.AddTypeS('TBasicServices', 'set of TBasicService)'); + CL.AddTypeS('TNumberService', '( pnsAdd, pnsSubtract, pnsMultiply, pnsRem' + +'ainder, pnsDivmod, pnsPower, pnsNegative, pnsPositive, pnsAbsolute, pnsInvert, pn' + +'sLShift, pnsRShift, pnsAnd, pnsXor, pnsOr, pnsInt, pnsFloat, pnsFloorDivide, pnsTr' + +'ueDivide, pnsMatrixMultiply, pnsBool )'); + CL.AddTypeS('TNumberServices', 'set of TNumberService'); + CL.AddTypeS('TInplaceNumberService', '( pnsInplaceAdd, pnsInplaceSubtra' + +'ct, pnsInplaceMultiply, pnsInplaceRemainder, pnsInplacePower, pnsInplaceLShift' + +', pnsInplaceRShift, pnsInplaceAnd, pnsInplaceXor, pnsInplaceOr, pnsInplaceFloor' + +'Divide, pnsInplaceTrueDivide, pnsInplaceMatrixMultiply )'); + CL.AddTypeS('TInplaceNumberServices', 'set of TInplaceNumberService'); + + CL.AddTypeS('TSequenceService', '( pssLength, pssConcat, pssRepeat, pssIt' + +'em, pssAssItem, pssContains, pssInplaceConcat, pssInplaceRepeat )'); // *) + CL.AddTypeS('TSequenceServices', 'set of TSequenceService)'); //*) + CL.AddTypeS('TMappingService', '( msLength, msSubscript, msAssSubscript )'); + CL.AddTypeS('TMappingServices', 'set of TMappingService'); + //CL.AddTypeS('TJclEmailReadOptions', 'set of TJclEmailReadOption'); + SIRegister_TTypeServices(CL); + SIRegister_TPythonType(CL); + CL.AddTypeS('TGetDataEvent', 'Procedure ( Sender : TObject; var Data : Variant)'); + CL.AddTypeS('TSetDataEvent', 'Procedure ( Sender : TObject; Data : Variant)'); + //CL.AddTypeS('TExtGetDataEvent', 'Procedure ( Sender : TObject; var Data : PPyObject)'); + //CL.AddTypeS('TExtSetDataEvent', 'Procedure ( Sender : TObject; Data : PPyObject)'); + SIRegister_TPythonDelphiVar(CL); + SIRegister_TPyVar(CL); + CL.AddTypeS('TThreadExecMode', '( emNewState, emNewInterpreter )'); + SIRegister_TPythonThread(CL); + {CL.AddDelphiFunction('Function pyio_write( self, args : PPyObject) : PPyObject'); + CL.AddDelphiFunction('Function pyio_read( self, args : PPyObject) : PPyObject'); + CL.AddDelphiFunction('Function pyio_SetDelayWrites( self, args : PPyObject) : PPyObject'); + CL.AddDelphiFunction('Function pyio_SetMaxLines( self, args : PPyObject) : PPyObject'); + CL.AddDelphiFunction('Function pyio_GetTypesStats( self, args : PPyObject) : PPyObject'); } + CL.AddDelphiFunction('Function GetPythonEngine : TPythonEngine'); + CL.AddDelphiFunction('Function PythonOK : Boolean'); + //CL.AddDelphiFunction('Function PythonToDelphi( obj : PPyObject) : TPyObject'); + //CL.AddDelphiFunction('Function IsDelphiObject( obj : PPyObject) : Boolean'); +// CL.AddDelphiFunction('Procedure PyObjectDestructor( pSelf : PPyObject)'); + //CL.AddDelphiFunction('Procedure FreeSubtypeInst( ob : PPyObject)'); + //CL.AddDelphiFunction('Procedure Register'); + //CL.AddDelphiFunction('Function PyType_HasFeature( AType : PPyTypeObject; AFlag : Integer) : Boolean'); + CL.AddDelphiFunction('Function SysVersionFromDLLName( const DLLFileName : string) : string'); + CL.AddDelphiFunction('Procedure PythonVersionFromDLLName( LibName : string; out MajorVersion, MinorVersion : integer)'); + CL.AddDelphiFunction('Function IsPythonVersionRegistered( PythonVersion : string; out InstallPath : string; out AllUserInstall : Boolean) : Boolean'); + CL.AddDelphiFunction('Procedure MaskFPUExceptions( ExceptionsMasked : boolean; MatchPythonPrecision : Boolean)'); + CL.AddDelphiFunction('Function CleanString13( const s : AnsiString; AppendLF : Boolean) : AnsiString;'); + CL.AddDelphiFunction('Function CleanString14( const s : UnicodeString; AppendLF : Boolean) : UnicodeString;'); + CL.AddDelphiFunction('procedure setgPythonEngine(mypyengine: TPythonEngine);'); + CL.AddDelphiFunction('function getgPythonEngine: TPythonEngine;'); + + // procedure setgPythonEngine(mypyengine: TPythonEngine); + // function getgPythonEngine: TPythonEngine; +end; + +(* === run-time registration functions === *) +(*----------------------------------------------------------------------------*) +Function CleanString14_P( const s : UnicodeString; AppendLF : Boolean) : UnicodeString; +Begin Result := PythonEngine.CleanString(s, AppendLF); END; + +(*----------------------------------------------------------------------------*) +Function CleanString13_P( const s : AnsiString; AppendLF : Boolean) : AnsiString; +Begin Result := PythonEngine.CleanString(s, AppendLF); END; + +(*----------------------------------------------------------------------------*) +procedure TPythonThreadThreadExecMode_W(Self: TPythonThread; const T: TThreadExecMode); +begin Self.ThreadExecMode := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonThreadThreadExecMode_R(Self: TPythonThread; var T: TThreadExecMode); +begin T := Self.ThreadExecMode; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonThreadThreadState_R(Self: TPythonThread; var T: PPyThreadState); +begin T := Self.ThreadState; end; + +(*----------------------------------------------------------------------------*) +procedure TPyVardv_object_W(Self: TPyVar; const T: PPyObject); +Begin Self.dv_object := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyVardv_object_R(Self: TPyVar; var T: PPyObject); +Begin T := Self.dv_object; end; + +(*----------------------------------------------------------------------------*) +procedure TPyVardv_component_W(Self: TPyVar; const T: TPythonDelphiVar); +Begin Self.dv_component := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyVardv_component_R(Self: TPyVar; var T: TPythonDelphiVar); +Begin T := Self.dv_component; end; + +(*----------------------------------------------------------------------------*) +procedure TPyVardv_var_W(Self: TPyVar; const T: Variant); +Begin Self.dv_var := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyVardv_var_R(Self: TPyVar; var T: Variant); +Begin T := Self.dv_var; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarOnChange_W(Self: TPythonDelphiVar; const T: TNotifyEvent); +begin Self.OnChange := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarOnChange_R(Self: TPythonDelphiVar; var T: TNotifyEvent); +begin T := Self.OnChange; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarOnExtSetData_W(Self: TPythonDelphiVar; const T: TExtSetDataEvent); +begin Self.OnExtSetData := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarOnExtSetData_R(Self: TPythonDelphiVar; var T: TExtSetDataEvent); +begin T := Self.OnExtSetData; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarOnExtGetData_W(Self: TPythonDelphiVar; const T: TExtGetDataEvent); +begin Self.OnExtGetData := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarOnExtGetData_R(Self: TPythonDelphiVar; var T: TExtGetDataEvent); +begin T := Self.OnExtGetData; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarOnSetData_W(Self: TPythonDelphiVar; const T: TSetDataEvent); +begin Self.OnSetData := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarOnSetData_R(Self: TPythonDelphiVar; var T: TSetDataEvent); +begin T := Self.OnSetData; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarOnGetData_W(Self: TPythonDelphiVar; const T: TGetDataEvent); +begin Self.OnGetData := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarOnGetData_R(Self: TPythonDelphiVar; var T: TGetDataEvent); +begin T := Self.OnGetData; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarVarName_W(Self: TPythonDelphiVar; const T: AnsiString); +begin Self.VarName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarVarName_R(Self: TPythonDelphiVar; var T: AnsiString); +begin T := Self.VarName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarModule_W(Self: TPythonDelphiVar; const T: AnsiString); +begin Self.Module := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarModule_R(Self: TPythonDelphiVar; var T: AnsiString); +begin T := Self.Module; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarVarObject_W(Self: TPythonDelphiVar; const T: PPyObject); +begin Self.VarObject := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarVarObject_R(Self: TPythonDelphiVar; var T: PPyObject); +begin T := Self.VarObject; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarValueAsString_R(Self: TPythonDelphiVar; var T: string); +begin T := Self.ValueAsString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarValueObject_W(Self: TPythonDelphiVar; const T: PPyObject); +begin Self.ValueObject := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarValueObject_R(Self: TPythonDelphiVar; var T: PPyObject); +begin T := Self.ValueObject; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarValue_W(Self: TPythonDelphiVar; const T: Variant); +begin Self.Value := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonDelphiVarValue_R(Self: TPythonDelphiVar; var T: Variant); +begin T := Self.Value; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeGenerateCreateFunction_W(Self: TPythonType; const T: Boolean); +begin Self.GenerateCreateFunction := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeGenerateCreateFunction_R(Self: TPythonType; var T: Boolean); +begin T := Self.GenerateCreateFunction; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeServices_W(Self: TPythonType; const T: TTypeServices); +begin Self.Services := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeServices_R(Self: TPythonType; var T: TTypeServices); +begin T := Self.Services; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeModule_W(Self: TPythonType; const T: TPythonModule); +begin Self.Module := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeModule_R(Self: TPythonType; var T: TPythonModule); +begin T := Self.Module; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypePrefix_W(Self: TPythonType; const T: AnsiString); +begin Self.Prefix := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypePrefix_R(Self: TPythonType; var T: AnsiString); +begin T := Self.Prefix; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeTypeFlags_W(Self: TPythonType; const T: TPFlags); +begin Self.TypeFlags := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeTypeFlags_R(Self: TPythonType; var T: TPFlags); +begin T := Self.TypeFlags; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeTypeName_W(Self: TPythonType; const T: AnsiString); +begin Self.TypeName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeTypeName_R(Self: TPythonType; var T: AnsiString); +begin T := Self.TypeName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeDocString_W(Self: TPythonType; const T: TStringList); +begin Self.DocString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeDocString_R(Self: TPythonType; var T: TStringList); +begin T := Self.DocString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeDeleteHits_R(Self: TPythonType; var T: Integer); +begin T := Self.DeleteHits; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeCreateHits_R(Self: TPythonType; var T: Integer); +begin T := Self.CreateHits; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeInstanceCount_R(Self: TPythonType; var T: Integer); +begin T := Self.InstanceCount; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypePyObjectClass_W(Self: TPythonType; const T: TPyObjectClass); +begin Self.PyObjectClass := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypePyObjectClass_R(Self: TPythonType; var T: TPyObjectClass); +begin T := Self.PyObjectClass; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeTheTypePtr_R(Self: TPythonType; var T: PPyTypeObject); +begin T := Self.TheTypePtr; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeTheType_W(Self: TPythonType; const T: PyTypeObject); +begin Self.TheType := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTypeTheType_R(Self: TPythonType; var T: PyTypeObject); +begin T := Self.TheType; end; + +(*----------------------------------------------------------------------------*) +procedure TTypeServicesMapping_W(Self: TTypeServices; const T: TMappingServices); +begin Self.Mapping := T; end; + +(*----------------------------------------------------------------------------*) +procedure TTypeServicesMapping_R(Self: TTypeServices; var T: TMappingServices); +begin T := Self.Mapping; end; + +(*----------------------------------------------------------------------------*) +procedure TTypeServicesSequence_W(Self: TTypeServices; const T: TSequenceServices); +begin Self.Sequence := T; end; + +(*----------------------------------------------------------------------------*) +procedure TTypeServicesSequence_R(Self: TTypeServices; var T: TSequenceServices); +begin T := Self.Sequence; end; + +(*----------------------------------------------------------------------------*) +procedure TTypeServicesNumber_W(Self: TTypeServices; const T: TNumberServices); +begin Self.Number := T; end; + +(*----------------------------------------------------------------------------*) +procedure TTypeServicesNumber_R(Self: TTypeServices; var T: TNumberServices); +begin T := Self.Number; end; + +(*----------------------------------------------------------------------------*) +procedure TTypeServicesInplaceNumber_W(Self: TTypeServices; const T: TInplaceNumberServices); +begin Self.InplaceNumber := T; end; + +(*----------------------------------------------------------------------------*) +procedure TTypeServicesInplaceNumber_R(Self: TTypeServices; var T: TInplaceNumberServices); +begin T := Self.InplaceNumber; end; + +(*----------------------------------------------------------------------------*) +procedure TTypeServicesBasic_W(Self: TTypeServices; const T: TBasicServices); +begin Self.Basic := T; end; + +(*----------------------------------------------------------------------------*) +procedure TTypeServicesBasic_R(Self: TTypeServices; var T: TBasicServices); +begin T := Self.Basic; end; + +(*----------------------------------------------------------------------------*) +procedure TPyObjectob_type_W(Self: TPyObject; const T: PPyTypeObject); +begin Self.ob_type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyObjectob_type_R(Self: TPyObject; var T: PPyTypeObject); +begin T := Self.ob_type; end; + +(*----------------------------------------------------------------------------*) +procedure TPyObjectob_refcnt_W(Self: TPyObject; const T: NativeInt); +begin Self.ob_refcnt := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyObjectob_refcnt_R(Self: TPyObject; var T: NativeInt); +begin T := Self.ob_refcnt; end; + +(*----------------------------------------------------------------------------*) +procedure TPyObjectPythonAlloc_W(Self: TPyObject; const T: Boolean); +Begin Self.PythonAlloc := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyObjectPythonAlloc_R(Self: TPyObject; var T: Boolean); +Begin T := Self.PythonAlloc; end; + +(*----------------------------------------------------------------------------*) +procedure TPyObjectIsSubtype_W(Self: TPyObject; const T: Boolean); +Begin Self.IsSubtype := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyObjectIsSubtype_R(Self: TPyObject; var T: Boolean); +Begin T := Self.IsSubtype; end; + +(*----------------------------------------------------------------------------*) +procedure TPyObjectPythonType_W(Self: TPyObject; const T: TPythonType); +Begin Self.PythonType := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyObjectPythonType_R(Self: TPyObject; var T: TPythonType); +Begin T := Self.PythonType; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleOnAfterInitialization_W(Self: TPythonModule; const T: TNotifyEvent); +begin Self.OnAfterInitialization := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleOnAfterInitialization_R(Self: TPythonModule; var T: TNotifyEvent); +begin T := Self.OnAfterInitialization; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleErrors_W(Self: TPythonModule; const T: TErrors); +begin Self.Errors := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleErrors_R(Self: TPythonModule; var T: TErrors); +begin T := Self.Errors; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleModuleName_W(Self: TPythonModule; const T: AnsiString); +begin Self.ModuleName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleModuleName_R(Self: TPythonModule; var T: AnsiString); +begin T := Self.ModuleName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleDocString_W(Self: TPythonModule; const T: TStringList); +begin Self.DocString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleDocString_R(Self: TPythonModule; var T: TStringList); +begin T := Self.DocString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleClientCount_R(Self: TPythonModule; var T: Integer); +begin T := Self.ClientCount; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleClients_R(Self: TPythonModule; var T: TEngineClient; const t1: Integer); +begin T := Self.Clients[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonModuleModule_R(Self: TPythonModule; var T: PPyObject); +begin T := Self.Module; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorsItems_W(Self: TErrors; const T: TError; const t1: Integer); +begin Self.Items[t1] := T; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorsItems_R(Self: TErrors; var T: TError; const t1: Integer); +begin T := Self.Items[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorParentClass_W(Self: TError; const T: TParentClassError); +begin Self.ParentClass := T; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorParentClass_R(Self: TError; var T: TParentClassError); +begin T := Self.ParentClass; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorErrorType_W(Self: TError; const T: TErrorType); +begin Self.ErrorType := T; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorErrorType_R(Self: TError; var T: TErrorType); +begin T := Self.ErrorType; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorText_W(Self: TError; const T: AnsiString); +begin Self.Text := T; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorText_R(Self: TError; var T: AnsiString); +begin T := Self.Text; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorName_W(Self: TError; const T: AnsiString); +begin Self.Name := T; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorName_R(Self: TError; var T: AnsiString); +begin T := Self.Name; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorError_W(Self: TError; const T: PPyObject); +begin Self.Error := T; end; + +(*----------------------------------------------------------------------------*) +procedure TErrorError_R(Self: TError; var T: PPyObject); +begin T := Self.Error; end; + +(*----------------------------------------------------------------------------*) +procedure TParentClassErrorName_W(Self: TParentClassError; const T: AnsiString); +begin Self.Name := T; end; + +(*----------------------------------------------------------------------------*) +procedure TParentClassErrorName_R(Self: TParentClassError; var T: AnsiString); +begin T := Self.Name; end; + +(*----------------------------------------------------------------------------*) +procedure TParentClassErrorModule_W(Self: TParentClassError; const T: AnsiString); +begin Self.Module := T; end; + +(*----------------------------------------------------------------------------*) +procedure TParentClassErrorModule_R(Self: TParentClassError; var T: AnsiString); +begin T := Self.Module; end; + +(*----------------------------------------------------------------------------*) +procedure TGetSetContainerGetSetData_R(Self: TGetSetContainer; var T: PPyGetSetDef); +begin T := Self.GetSetData; end; + +(*----------------------------------------------------------------------------*) +procedure TGetSetContainerGetSet_R(Self: TGetSetContainer; var T: PPyGetSetDef; const t1: Integer); +begin T := Self.GetSet[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TGetSetContainerGetSetCount_R(Self: TGetSetContainer; var T: Integer); +begin T := Self.GetSetCount; end; + +(*----------------------------------------------------------------------------*) +procedure TMembersContainerMembersData_R(Self: TMembersContainer; var T: PPyMemberDef); +begin T := Self.MembersData; end; + +(*----------------------------------------------------------------------------*) +procedure TMembersContainerMembers_R(Self: TMembersContainer; var T: PPyMemberDef; const t1: Integer); +begin T := Self.Members[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TMembersContainerMemberCount_R(Self: TMembersContainer; var T: Integer); +begin T := Self.MemberCount; end; + +(*----------------------------------------------------------------------------*) +procedure TMethodsContainerEvents_W(Self: TMethodsContainer; const T: TEventDefs); +begin Self.Events := T; end; + +(*----------------------------------------------------------------------------*) +procedure TMethodsContainerEvents_R(Self: TMethodsContainer; var T: TEventDefs); +begin T := Self.Events; end; + +(*----------------------------------------------------------------------------*) +procedure TMethodsContainerModuleDef_R(Self: TMethodsContainer; var T: PyModuleDef); +begin T := Self.ModuleDef; end; + +(*----------------------------------------------------------------------------*) +procedure TMethodsContainerMethodsData_R(Self: TMethodsContainer; var T: PPyMethodDef); +begin T := Self.MethodsData; end; + +(*----------------------------------------------------------------------------*) +procedure TMethodsContainerMethods_R(Self: TMethodsContainer; var T: PPyMethodDef; const t1: Integer); +begin T := Self.Methods[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TMethodsContainerMethodCount_R(Self: TMethodsContainer; var T: Integer); +begin T := Self.MethodCount; end; + +(*----------------------------------------------------------------------------*) +procedure TEventDefsContainer_R(Self: TEventDefs; var T: TMethodsContainer); +begin T := Self.Container; end; + +(*----------------------------------------------------------------------------*) +procedure TEventDefsItems_R(Self: TEventDefs; var T: TEventDef; const t1: Integer); +begin T := Self.Items[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TEventDefDocString_W(Self: TEventDef; const T: TStringList); +begin Self.DocString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEventDefDocString_R(Self: TEventDef; var T: TStringList); +begin T := Self.DocString; end; + +(*----------------------------------------------------------------------------*) +procedure TEventDefOnExecute_W(Self: TEventDef; const T: TPythonEvent); +begin Self.OnExecute := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEventDefOnExecute_R(Self: TEventDef; var T: TPythonEvent); +begin T := Self.OnExecute; end; + +(*----------------------------------------------------------------------------*) +procedure TEventDefName_W(Self: TEventDef; const T: string); +begin Self.Name := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEventDefName_R(Self: TEventDef; var T: string); +begin T := Self.Name; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientOnInitialization_W(Self: TEngineClient; const T: TNotifyEvent); +begin Self.OnInitialization := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientOnInitialization_R(Self: TEngineClient; var T: TNotifyEvent); +begin T := Self.OnInitialization; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientOnFinalization_W(Self: TEngineClient; const T: TNotifyEvent); +begin Self.OnFinalization := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientOnFinalization_R(Self: TEngineClient; var T: TNotifyEvent); +begin T := Self.OnFinalization; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientOnDestroy_W(Self: TEngineClient; const T: TNotifyEvent); +begin Self.OnDestroy := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientOnDestroy_R(Self: TEngineClient; var T: TNotifyEvent); +begin T := Self.OnDestroy; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientOnCreate_W(Self: TEngineClient; const T: TNotifyEvent); +begin Self.OnCreate := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientOnCreate_R(Self: TEngineClient; var T: TNotifyEvent); +begin T := Self.OnCreate; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientEngine_W(Self: TEngineClient; const T: TPythonEngine); +begin Self.Engine := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientEngine_R(Self: TEngineClient; var T: TPythonEngine); +begin T := Self.Engine; end; + +(*----------------------------------------------------------------------------*) +procedure TEngineClientInitialized_R(Self: TEngineClient; var T: Boolean); +begin T := Self.Initialized; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineOnSysPathInit_W(Self: TPythonEngine; const T: TSysPathInitEvent); +begin Self.OnSysPathInit := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineOnSysPathInit_R(Self: TPythonEngine; var T: TSysPathInitEvent); +begin T := Self.OnSysPathInit; end; + + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineOnPathInitialization_W(Self: TPythonEngine; const T: TPathInitializationEvent); +begin Self.OnPathInitialization := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineOnPathInitialization_R(Self: TPythonEngine; var T: TPathInitializationEvent); +begin T := Self.OnPathInitialization; end; //} + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineOnAfterInit_W(Self: TPythonEngine; const T: TNotifyEvent); +begin Self.OnAfterInit := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineOnAfterInit_R(Self: TPythonEngine; var T: TNotifyEvent); +begin T := Self.OnAfterInit; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineUseWindowsConsole_W(Self: TPythonEngine; const T: Boolean); +begin Self.UseWindowsConsole := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineUseWindowsConsole_R(Self: TPythonEngine; var T: Boolean); +begin T := Self.UseWindowsConsole; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineRedirectIO_W(Self: TPythonEngine; const T: Boolean); +begin Self.RedirectIO := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineRedirectIO_R(Self: TPythonEngine; var T: Boolean); +begin T := Self.RedirectIO; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEnginePyFlags_W(Self: TPythonEngine; const T: TPythonFlags); +begin Self.PyFlags := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEnginePyFlags_R(Self: TPythonEngine; var T: TPythonFlags); +begin T := Self.PyFlags; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineIO_W(Self: TPythonEngine; const T: TPythonInputOutput); +begin Self.IO := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineIO_R(Self: TPythonEngine; var T: TPythonInputOutput); +begin T := Self.IO; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineInitThreads_W(Self: TPythonEngine; const T: Boolean); +begin //Self.InitThreads := T; +end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineInitThreads_R(Self: TPythonEngine; var T: Boolean); +begin //T := Self.InitThreads; +end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineInitScript_W(Self: TPythonEngine; const T: TStrings); +begin Self.InitScript := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineInitScript_R(Self: TPythonEngine; var T: TStrings); +begin T := Self.InitScript; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineDatetimeConversionMode_W(Self: TPythonEngine; const T: TDatetimeConversionMode); +begin Self.DatetimeConversionMode := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineDatetimeConversionMode_R(Self: TPythonEngine; var T: TDatetimeConversionMode); +begin T := Self.DatetimeConversionMode; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineVenvPythonExe_W(Self: TPythonEngine; const T: string); +begin Self.PythonExecutable := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineVenvPythonExe_R(Self: TPythonEngine; var T: string); +begin T := Self.PythonExecutable; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineAutoFinalize_W(Self: TPythonEngine; const T: Boolean); +begin Self.AutoFinalize := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineAutoFinalize_R(Self: TPythonEngine; var T: Boolean); +begin T := Self.AutoFinalize; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineProgramName_W(Self: TPythonEngine; const T: UnicodeString); +begin Self.ProgramName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineProgramName_R(Self: TPythonEngine; var T: UnicodeString); +begin T := Self.ProgramName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEnginePythonHome_W(Self: TPythonEngine; const T: UnicodeString); +begin Self.PythonHome := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEnginePythonHome_R(Self: TPythonEngine; var T: UnicodeString); +begin T := Self.PythonHome; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEnginePythonPath_W(Self: TPythonEngine; const T: UnicodeString); +begin Self.Pythonpath := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEnginePythonPath_R(Self: TPythonEngine; var T: UnicodeString); +begin T := Self.Pythonpath; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineIOPythonModule_R(Self: TPythonEngine; var T: TObject); +begin T := Self.IOPythonModule; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineGlobalVars_W(Self: TPythonEngine; const T: PPyObject); +begin Self.GlobalVars := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineGlobalVars_R(Self: TPythonEngine; var T: PPyObject); +begin T := Self.GlobalVars; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineLocalVars_W(Self: TPythonEngine; const T: PPyObject); +begin Self.LocalVars := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineLocalVars_R(Self: TPythonEngine; var T: PPyObject); +begin T := Self.LocalVars; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineTraceback_R(Self: TPythonEngine; var T: TPythonTraceback); +begin T := Self.Traceback; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineThreadState_R(Self: TPythonEngine; var T: PPyThreadState); +begin T := Self.ThreadState; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineExecModule_W(Self: TPythonEngine; const T: AnsiString); +begin Self.ExecModule := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineExecModule_R(Self: TPythonEngine; var T: AnsiString); +begin T := Self.ExecModule; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineClients_R(Self: TPythonEngine; var T: TEngineClient; const t1: Integer); +begin T := Self.Clients[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonEngineClientCount_R(Self: TPythonEngine; var T: Integer); +begin T := Self.ClientCount; end; + +(*----------------------------------------------------------------------------*) +Function TPythonEnginePyUnicodeFromString12_P(Self: TPythonEngine; const AString : AnsiString) : PPyObject; +Begin Result := Self.PyUnicodeFromString(AString); END; + +(*----------------------------------------------------------------------------*) +Function TPythonEnginePyUnicodeFromString11_P(Self: TPythonEngine; const AString : UnicodeString) : PPyObject; +Begin Result := Self.PyUnicodeFromString(AString); END; + +(*----------------------------------------------------------------------------*) +Function TPythonEngineEvalStrings10_P(Self: TPythonEngine; strings : TStrings; locals, globals : PPyObject) : PPyObject; +Begin Result := Self.EvalStrings(strings, locals, globals); END; + +(*----------------------------------------------------------------------------*) +Function TPythonEngineEvalString9_P(Self: TPythonEngine; const command : AnsiString; locals, globals : PPyObject) : PPyObject; +Begin Result := Self.EvalString(command, locals, globals); END; + +(*----------------------------------------------------------------------------*) +Procedure TPythonEngineExecStrings8_P(Self: TPythonEngine; strings : TStrings; locals, globals : PPyObject); +Begin Self.ExecStrings(strings, locals, globals); END; + +(*----------------------------------------------------------------------------*) +Procedure TPythonEngineExecString7_P(Self: TPythonEngine; const command : AnsiString; locals, globals : PPyObject); +Begin Self.ExecString(command, locals, globals); END; + +(*----------------------------------------------------------------------------*) +Function TPythonEngineEvalStrings6_P(Self: TPythonEngine; strings : TStrings) : PPyObject; +Begin Result := Self.EvalStrings(strings); END; + +(*----------------------------------------------------------------------------*) +Function TPythonEngineEvalString5_P(Self: TPythonEngine; const command : AnsiString) : PPyObject; +Begin Result := Self.EvalString(command); END; + +(*----------------------------------------------------------------------------*) +Procedure TPythonEngineExecStrings4_P(Self: TPythonEngine; strings : TStrings); +Begin Self.ExecStrings(strings); END; + +(*----------------------------------------------------------------------------*) +Procedure TPythonEngineExecString3_P(Self: TPythonEngine; const command : AnsiString); +Begin Self.ExecString(command); END; + +(*----------------------------------------------------------------------------*) +Function TPythonEngineEncodeString2_P(Self: TPythonEngine; const str : AnsiString) : AnsiString; +Begin Result := Self.EncodeString(str); END; + +(*----------------------------------------------------------------------------*) +Function TPythonEngineEncodeString01_P(Self: TPythonEngine; const str : UnicodeString) : AnsiString; +Begin Result := Self.EncodeString(str); +END; + +(*----------------------------------------------------------------------------*) +Function TPythonEngineEncodeString0_P(Self: TPythonEngine; const str : UnicodeString) : AnsiString; +Begin Result := Self.EncodeString(str); END; + +(*----------------------------------------------------------------------------*) +procedure TPythonTracebackLimit_W(Self: TPythonTraceback; const T: Integer); +begin Self.Limit := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTracebackLimit_R(Self: TPythonTraceback; var T: Integer); +begin T := Self.Limit; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTracebackItems_R(Self: TPythonTraceback; var T: TTracebackItem; const t1: Integer); +begin T := Self.Items[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonTracebackItemCount_R(Self: TPythonTraceback; var T: Integer); +begin T := Self.ItemCount; end; + +(*----------------------------------------------------------------------------*) +procedure TTracebackItemContext_W(Self: TTracebackItem; const T: string); +Begin Self.Context := T; end; + +(*----------------------------------------------------------------------------*) +procedure TTracebackItemContext_R(Self: TTracebackItem; var T: string); +Begin T := Self.Context; end; + +(*----------------------------------------------------------------------------*) +procedure TTracebackItemLineNo_W(Self: TTracebackItem; const T: Integer); +Begin Self.LineNo := T; end; + +(*----------------------------------------------------------------------------*) +procedure TTracebackItemLineNo_R(Self: TTracebackItem; var T: Integer); +Begin T := Self.LineNo; end; + +(*----------------------------------------------------------------------------*) +procedure TTracebackItemFileName_W(Self: TTracebackItem; const T: string); +Begin Self.FileName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TTracebackItemFileName_R(Self: TTracebackItem; var T: string); +Begin T := Self.FileName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfaceBuiltInModuleName_W(Self: TPythonInterface; const T: string); +begin Self.BuiltInModuleName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfaceBuiltInModuleName_R(Self: TPythonInterface; var T: string); +begin T := Self.BuiltInModuleName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfaceMinorVersion_R(Self: TPythonInterface; var T: integer); +begin T := Self.MinorVersion; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfaceMajorVersion_R(Self: TPythonInterface; var T: integer); +begin T := Self.MajorVersion; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfaceFinalizing_R(Self: TPythonInterface; var T: Boolean); +begin T := Self.Finalizing; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfaceInitialized_R(Self: TPythonInterface; var T: Boolean); +begin T := Self.Initialized; end; + +{ +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyGILState_Release_W(Self: TPythonInterface; const T: ); +Begin Self.PyGILState_Release := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyGILState_Release_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyGILState_Release; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyGILState_Ensure_W(Self: TPythonInterface; const T: ); +Begin Self.PyGILState_Ensure := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyGILState_Ensure_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyGILState_Ensure; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_SetInterrupt_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_SetInterrupt := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_SetInterrupt_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_SetInterrupt; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_Swap_W(Self: TPythonInterface; const T: ); +Begin Self.PyThreadState_Swap := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_Swap_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyThreadState_Swap; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_Get_W(Self: TPythonInterface; const T: ); +Begin Self.PyThreadState_Get := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_Get_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyThreadState_Get; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_Delete_W(Self: TPythonInterface; const T: ); +Begin Self.PyThreadState_Delete := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_Delete_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyThreadState_Delete; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_Clear_W(Self: TPythonInterface; const T: ); +Begin Self.PyThreadState_Clear := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_Clear_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyThreadState_Clear; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyThreadState_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyThreadState_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyInterpreterState_Delete_W(Self: TPythonInterface; const T: ); +Begin Self.PyInterpreterState_Delete := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyInterpreterState_Delete_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyInterpreterState_Delete; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyInterpreterState_Clear_W(Self: TPythonInterface; const T: ); +Begin Self.PyInterpreterState_Clear := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyInterpreterState_Clear_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyInterpreterState_Clear; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyInterpreterState_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyInterpreterState_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyInterpreterState_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyInterpreterState_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_ReleaseThread_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_ReleaseThread := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_ReleaseThread_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_ReleaseThread; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_AcquireThread_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_AcquireThread := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_AcquireThread_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_AcquireThread; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_ReleaseLock_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_ReleaseLock := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_ReleaseLock_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_ReleaseLock; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_AcquireLock_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_AcquireLock := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_AcquireLock_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_AcquireLock; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_EndInterpreter_W(Self: TPythonInterface; const T: ); +Begin Self.Py_EndInterpreter := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_EndInterpreter_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_EndInterpreter; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_NewInterpreter_W(Self: TPythonInterface; const T: ); +Begin Self.Py_NewInterpreter := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_NewInterpreter_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_NewInterpreter; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetProgramFullPath_W(Self: TPythonInterface; const T: ); +Begin Self.Py_GetProgramFullPath := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetProgramFullPath_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_GetProgramFullPath; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_IsInitialized_W(Self: TPythonInterface; const T: ); +Begin Self.Py_IsInitialized := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_IsInitialized_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_IsInitialized; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_SetProgramName_W(Self: TPythonInterface; const T: ); +Begin Self.Py_SetProgramName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_SetProgramName_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_SetProgramName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMem_Malloc_W(Self: TPythonInterface; const T: ); +Begin Self.PyMem_Malloc := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMem_Malloc_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyMem_Malloc; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_NewException_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_NewException := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_NewException_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_NewException; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNode_Free_W(Self: TPythonInterface; const T: ); +Begin Self.PyNode_Free := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNode_Free_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNode_Free; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyParser_SimpleParseStringFlags_W(Self: TPythonInterface; const T: ); +Begin Self.PyParser_SimpleParseStringFlags := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyParser_SimpleParseStringFlags_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyParser_SimpleParseStringFlags; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetProgramName_W(Self: TPythonInterface; const T: ); +Begin Self.Py_GetProgramName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetProgramName_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_GetProgramName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetPrefix_W(Self: TPythonInterface; const T: ); +Begin Self.Py_GetPrefix := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetPrefix_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_GetPrefix; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetPythonHome_W(Self: TPythonInterface; const T: ); +Begin Self.Py_GetPythonHome := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetPythonHome_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_GetPythonHome; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_SetPythonHome_W(Self: TPythonInterface; const T: ); +Begin Self.Py_SetPythonHome := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_SetPythonHome_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_SetPythonHome; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetPath_W(Self: TPythonInterface; const T: ); +Begin Self.Py_GetPath := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetPath_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_GetPath; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetExecPrefix_W(Self: TPythonInterface; const T: ); +Begin Self.Py_GetExecPrefix := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetExecPrefix_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_GetExecPrefix; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetCopyright_W(Self: TPythonInterface; const T: ); +Begin Self.Py_GetCopyright := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetCopyright_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_GetCopyright; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetVersion_W(Self: TPythonInterface; const T: ); +Begin Self.Py_GetVersion := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetVersion_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_GetVersion; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_EvalCode_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_EvalCode := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_EvalCode_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_EvalCode; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_GivenExceptionMatches_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_GivenExceptionMatches := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_GivenExceptionMatches_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_GivenExceptionMatches; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_ExceptionMatches_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_ExceptionMatches := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_ExceptionMatches_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_ExceptionMatches; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_Finalize_W(Self: TPythonInterface; const T: ); +Begin Self.Py_Finalize := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_Finalize_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_Finalize; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterface_PyBytes_Resize_W(Self: TPythonInterface; const T: ); +Begin Self._PyBytes_Resize := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterface_PyBytes_Resize_R(Self: TPythonInterface; var T: ); +Begin T := Self._PyBytes_Resize; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterface_PyObject_New_W(Self: TPythonInterface; const T: ); +Begin Self._PyObject_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterface_PyObject_New_R(Self: TPythonInterface; var T: ); +Begin T := Self._PyObject_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_FatalError_W(Self: TPythonInterface; const T: ); +Begin Self.Py_FatalError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_FatalError_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_FatalError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_CompileStringExFlags_W(Self: TPythonInterface; const T: ); +Begin Self.Py_CompileStringExFlags := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_CompileStringExFlags_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_CompileStringExFlags; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_AtExit_W(Self: TPythonInterface; const T: ); +Begin Self.Py_AtExit := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_AtExit_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_AtExit; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_SetAsyncExc_W(Self: TPythonInterface; const T: ); +Begin Self.PyThreadState_SetAsyncExc := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyThreadState_SetAsyncExc_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyThreadState_SetAsyncExc; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBool_FromLong_W(Self: TPythonInterface; const T: ); +Begin Self.PyBool_FromLong := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBool_FromLong_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyBool_FromLong; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyWrapper_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyWrapper_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyWrapper_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyWrapper_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyWeakref_NewRef_W(Self: TPythonInterface; const T: ); +Begin Self.PyWeakref_NewRef := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyWeakref_NewRef_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyWeakref_NewRef; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyWeakref_NewProxy_W(Self: TPythonInterface; const T: ); +Begin Self.PyWeakref_NewProxy := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyWeakref_NewProxy_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyWeakref_NewProxy; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyWeakref_GetObject_W(Self: TPythonInterface; const T: ); +Begin Self.PyWeakref_GetObject := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyWeakref_GetObject_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyWeakref_GetObject; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_GetSize_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_GetSize := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_GetSize_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_GetSize; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_FromOrdinal_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_FromOrdinal := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_FromOrdinal_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_FromOrdinal; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_AsEncodedString_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_AsEncodedString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_AsEncodedString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_AsEncodedString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_DecodeUTF16_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_DecodeUTF16 := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_DecodeUTF16_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_DecodeUTF16; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_Decode_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_Decode := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_Decode_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_Decode; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_AsUTF8AndSize_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_AsUTF8AndSize := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_AsUTF8AndSize_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_AsUTF8AndSize; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_AsUTF8_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_AsUTF8 := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_AsUTF8_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_AsUTF8; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_AsWideChar_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_AsWideChar := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_AsWideChar_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_AsWideChar; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_FromKindAndData_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_FromKindAndData := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_FromKindAndData_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_FromKindAndData; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_FromStringAndSize_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_FromStringAndSize := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_FromStringAndSize_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_FromStringAndSize; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_FromString_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_FromString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_FromString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_FromString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_FromWideChar_W(Self: TPythonInterface; const T: ); +Begin Self.PyUnicode_FromWideChar := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_FromWideChar_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyUnicode_FromWideChar; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyType_Ready_W(Self: TPythonInterface; const T: ); +Begin Self.PyType_Ready := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyType_Ready_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyType_Ready; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyType_GenericNew_W(Self: TPythonInterface; const T: ); +Begin Self.PyType_GenericNew := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyType_GenericNew_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyType_GenericNew; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyType_GenericAlloc_W(Self: TPythonInterface; const T: ); +Begin Self.PyType_GenericAlloc := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyType_GenericAlloc_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyType_GenericAlloc; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyType_IsSubtype_W(Self: TPythonInterface; const T: ); +Begin Self.PyType_IsSubtype := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyType_IsSubtype_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyType_IsSubtype; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_Size_W(Self: TPythonInterface; const T: ); +Begin Self.PyTuple_Size := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_Size_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyTuple_Size; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_SetItem_W(Self: TPythonInterface; const T: ); +Begin Self.PyTuple_SetItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_SetItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyTuple_SetItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyTuple_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyTuple_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_GetSlice_W(Self: TPythonInterface; const T: ); +Begin Self.PyTuple_GetSlice := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_GetSlice_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyTuple_GetSlice; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_GetItem_W(Self: TPythonInterface; const T: ); +Begin Self.PyTuple_GetItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_GetItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyTuple_GetItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTraceBack_Print_W(Self: TPythonInterface; const T: ); +Begin Self.PyTraceBack_Print := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTraceBack_Print_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyTraceBack_Print; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTraceBack_Here_W(Self: TPythonInterface; const T: ); +Begin Self.PyTraceBack_Here := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTraceBack_Here_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyTraceBack_Here; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySys_SetPath_W(Self: TPythonInterface; const T: ); +Begin Self.PySys_SetPath := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySys_SetPath_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySys_SetPath; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySys_SetObject_W(Self: TPythonInterface; const T: ); +Begin Self.PySys_SetObject := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySys_SetObject_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySys_SetObject; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySys_GetObject_W(Self: TPythonInterface; const T: ); +Begin Self.PySys_GetObject := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySys_GetObject_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySys_GetObject; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_Repr_W(Self: TPythonInterface; const T: ); +Begin Self.PyBytes_Repr := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_Repr_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyBytes_Repr; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_DecodeEscape_W(Self: TPythonInterface; const T: ); +Begin Self.PyBytes_DecodeEscape := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_DecodeEscape_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyBytes_DecodeEscape; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_Size_W(Self: TPythonInterface; const T: ); +Begin Self.PyBytes_Size := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_Size_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyBytes_Size; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_FromStringAndSize_W(Self: TPythonInterface; const T: ); +Begin Self.PyBytes_FromStringAndSize := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_FromStringAndSize_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyBytes_FromStringAndSize; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_FromString_W(Self: TPythonInterface; const T: ); +Begin Self.PyBytes_FromString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_FromString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyBytes_FromString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_ConcatAndDel_W(Self: TPythonInterface; const T: ); +Begin Self.PyBytes_ConcatAndDel := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_ConcatAndDel_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyBytes_ConcatAndDel; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_Concat_W(Self: TPythonInterface; const T: ); +Begin Self.PyBytes_Concat := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_Concat_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyBytes_Concat; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySlice_New_W(Self: TPythonInterface; const T: ); +Begin Self.PySlice_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySlice_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySlice_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySlice_GetIndicesEx_W(Self: TPythonInterface; const T: ); +Begin Self.PySlice_GetIndicesEx := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySlice_GetIndicesEx_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySlice_GetIndicesEx; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySlice_GetIndices_W(Self: TPythonInterface; const T: ); +Begin Self.PySlice_GetIndices := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySlice_GetIndices_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySlice_GetIndices; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySeqIter_New_W(Self: TPythonInterface; const T: ); +Begin Self.PySeqIter_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySeqIter_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySeqIter_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_List_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_List := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_List_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_List; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Contains_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_Contains := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Contains_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_Contains; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Tuple_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_Tuple := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Tuple_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_Tuple; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_DelSlice_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_DelSlice := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_DelSlice_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_DelSlice; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_SetSlice_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_SetSlice := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_SetSlice_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_SetSlice; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_SetItem_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_SetItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_SetItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_SetItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Repeat_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_Repeat := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Repeat_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_Repeat; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Length_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_Length := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Length_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_Length; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Index_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_Index := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Index_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_Index; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_In_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_In := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_In_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_In; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_GetSlice_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_GetSlice := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_GetSlice_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_GetSlice; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_GetItem_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_GetItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_GetItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_GetItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Count_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_Count := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Count_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_Count; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Concat_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_Concat := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Concat_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_Concat; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Check_W(Self: TPythonInterface; const T: ); +Begin Self.PySequence_Check := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySequence_Check_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySequence_Check; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_UnTrack_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GC_UnTrack := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_UnTrack_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GC_UnTrack; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_Track_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GC_Track := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_Track_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GC_Track; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_Del_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GC_Del := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_Del_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GC_Del; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_Resize_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GC_Resize := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_Resize_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GC_Resize; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_NewVar_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GC_NewVar := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_NewVar_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GC_NewVar; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GC_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GC_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_Malloc_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GC_Malloc := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GC_Malloc_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GC_Malloc; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GenericSetAttr_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GenericSetAttr := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GenericSetAttr_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GenericSetAttr; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GenericGetAttr_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GenericGetAttr := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GenericGetAttr_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GenericGetAttr; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Call_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_Call := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Call_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_Call; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_IsSubclass_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_IsSubclass := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_IsSubclass_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_IsSubclass; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_IsInstance_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_IsInstance := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_IsInstance_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_IsInstance; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyIter_Next_W(Self: TPythonInterface; const T: ); +Begin Self.PyIter_Next := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyIter_Next_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyIter_Next; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GetIter_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GetIter := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GetIter_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GetIter; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Free_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_Free := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Free_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_Free; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_NewVar_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_NewVar := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_NewVar_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_NewVar; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_InitVar_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_InitVar := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_InitVar_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_InitVar; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Init_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_Init := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Init_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_Init; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_SetItem_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_SetItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_SetItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_SetItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_SetAttrString_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_SetAttrString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_SetAttrString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_SetAttrString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_SetAttr_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_SetAttr := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_SetAttr_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_SetAttr; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Repr_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_Repr := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Repr_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_Repr; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Length_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_Length := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Length_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_Length; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_IsTrue_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_IsTrue := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_IsTrue_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_IsTrue; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Hash_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_Hash := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Hash_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_Hash; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_HasAttrString_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_HasAttrString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_HasAttrString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_HasAttrString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_DelItem_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_DelItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_DelItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_DelItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GetItem_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GetItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GetItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GetItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GetAttrString_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GetAttrString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GetAttrString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GetAttrString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GetAttr_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_GetAttr := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_GetAttr_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_GetAttr; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_RichCompareBool_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_RichCompareBool := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_RichCompareBool_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_RichCompareBool; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_RichCompare_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_RichCompare := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_RichCompare_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_RichCompare; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_CallObject_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_CallObject := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_CallObject_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_CallObject; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyOS_InterruptOccurred_W(Self: TPythonInterface; const T: ); +Begin Self.PyOS_InterruptOccurred := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyOS_InterruptOccurred_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyOS_InterruptOccurred; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Xor_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Xor := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Xor_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Xor; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Subtract_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Subtract := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Subtract_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Subtract; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Rshift_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Rshift := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Rshift_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Rshift; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Remainder_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Remainder := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Remainder_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Remainder; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Power_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Power := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Power_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Power; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Positive_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Positive := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Positive_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Positive; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Or_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Or := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Or_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Or; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Negative_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Negative := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Negative_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Negative; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Multiply_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Multiply := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Multiply_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Multiply; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Lshift_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Lshift := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Lshift_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Lshift; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Long_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Long := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Long_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Long; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Invert_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Invert := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Invert_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Invert; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Float_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Float := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Float_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Float; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Divmod_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Divmod := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Divmod_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Divmod; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_TrueDivide_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_TrueDivide := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_TrueDivide_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_TrueDivide; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_FloorDivide_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_FloorDivide := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_FloorDivide_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_FloorDivide; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Check_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Check := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Check_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Check; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_And_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_And := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_And_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_And; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Add_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Add := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Add_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Add; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Absolute_W(Self: TPythonInterface; const T: ); +Begin Self.PyNumber_Absolute := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyNumber_Absolute_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyNumber_Absolute; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyModule_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyModule_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyModule_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyModule_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyModule_GetName_W(Self: TPythonInterface; const T: ); +Begin Self.PyModule_GetName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyModule_GetName_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyModule_GetName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMethod_Self_W(Self: TPythonInterface; const T: ); +Begin Self.PyMethod_Self := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMethod_Self_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyMethod_Self; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMethod_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyMethod_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMethod_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyMethod_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMethod_Function_W(Self: TPythonInterface; const T: ); +Begin Self.PyMethod_Function := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMethod_Function_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyMethod_Function; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_SetItemString_W(Self: TPythonInterface; const T: ); +Begin Self.PyMapping_SetItemString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_SetItemString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyMapping_SetItemString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_Length_W(Self: TPythonInterface; const T: ); +Begin Self.PyMapping_Length := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_Length_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyMapping_Length; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_HasKeyString_W(Self: TPythonInterface; const T: ); +Begin Self.PyMapping_HasKeyString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_HasKeyString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyMapping_HasKeyString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_HasKey_W(Self: TPythonInterface; const T: ); +Begin Self.PyMapping_HasKey := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_HasKey_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyMapping_HasKey; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_GetItemString_W(Self: TPythonInterface; const T: ); +Begin Self.PyMapping_GetItemString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_GetItemString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyMapping_GetItemString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_Check_W(Self: TPythonInterface; const T: ); +Begin Self.PyMapping_Check := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMapping_Check_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyMapping_Check; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromVoidPtr_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_FromVoidPtr := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromVoidPtr_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_FromVoidPtr; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_AsLongLong_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_AsLongLong := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_AsLongLong_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_AsLongLong; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromUnsignedLongLong_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_FromUnsignedLongLong := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromUnsignedLongLong_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_FromUnsignedLongLong; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromLongLong_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_FromLongLong := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromLongLong_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_FromLongLong; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromUnicodeObject_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_FromUnicodeObject := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromUnicodeObject_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_FromUnicodeObject; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_AsUnsignedLong_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_AsUnsignedLong := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_AsUnsignedLong_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_AsUnsignedLong; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromUnsignedLong_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_FromUnsignedLong := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromUnsignedLong_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_FromUnsignedLong; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromString_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_FromString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_FromString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromLong_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_FromLong := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromLong_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_FromLong; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromDouble_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_FromDouble := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_FromDouble_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_FromDouble; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_AsLong_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_AsLong := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_AsLong_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_AsLong; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_AsDouble_W(Self: TPythonInterface; const T: ); +Begin Self.PyLong_AsDouble := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_AsDouble_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyLong_AsDouble; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Sort_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_Sort := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Sort_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_Sort; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Size_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_Size := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Size_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_Size; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_SetSlice_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_SetSlice := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_SetSlice_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_SetSlice; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_SetItem_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_SetItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_SetItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_SetItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Reverse_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_Reverse := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Reverse_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_Reverse; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Insert_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_Insert := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Insert_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_Insert; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_GetSlice_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_GetSlice := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_GetSlice_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_GetSlice; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_GetItem_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_GetItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_GetItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_GetItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_AsTuple_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_AsTuple := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_AsTuple_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_AsTuple; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Append_W(Self: TPythonInterface; const T: ); +Begin Self.PyList_Append := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Append_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyList_Append; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_ReloadModule_W(Self: TPythonInterface; const T: ); +Begin Self.PyImport_ReloadModule := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_ReloadModule_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyImport_ReloadModule; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_Import_W(Self: TPythonInterface; const T: ); +Begin Self.PyImport_Import := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_Import_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyImport_Import; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_ImportModule_W(Self: TPythonInterface; const T: ); +Begin Self.PyImport_ImportModule := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_ImportModule_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyImport_ImportModule; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_ImportFrozenModule_W(Self: TPythonInterface; const T: ); +Begin Self.PyImport_ImportFrozenModule := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_ImportFrozenModule_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyImport_ImportFrozenModule; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_GetMagicNumber_W(Self: TPythonInterface; const T: ); +Begin Self.PyImport_GetMagicNumber := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_GetMagicNumber_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyImport_GetMagicNumber; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_AddModule_W(Self: TPythonInterface; const T: ); +Begin Self.PyImport_AddModule := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_AddModule_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyImport_AddModule; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFunction_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyFunction_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFunction_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyFunction_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFunction_GetGlobals_W(Self: TPythonInterface; const T: ); +Begin Self.PyFunction_GetGlobals := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFunction_GetGlobals_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyFunction_GetGlobals; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFunction_GetCode_W(Self: TPythonInterface; const T: ); +Begin Self.PyFunction_GetCode := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFunction_GetCode_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyFunction_GetCode; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFloat_FromString_W(Self: TPythonInterface; const T: ); +Begin Self.PyFloat_FromString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFloat_FromString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyFloat_FromString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFloat_FromDouble_W(Self: TPythonInterface; const T: ); +Begin Self.PyFloat_FromDouble := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFloat_FromDouble_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyFloat_FromDouble; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFloat_AsDouble_W(Self: TPythonInterface; const T: ); +Begin Self.PyFloat_AsDouble := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFloat_AsDouble_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyFloat_AsDouble; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFile_WriteString_W(Self: TPythonInterface; const T: ); +Begin Self.PyFile_WriteString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFile_WriteString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyFile_WriteString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFile_WriteObject_W(Self: TPythonInterface; const T: ); +Begin Self.PyFile_WriteObject := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFile_WriteObject_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyFile_WriteObject; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFile_GetLine_W(Self: TPythonInterface; const T: ); +Begin Self.PyFile_GetLine := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFile_GetLine_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyFile_GetLine; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_SaveThread_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_SaveThread := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_SaveThread_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_SaveThread; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_RestoreThread_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_RestoreThread := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_RestoreThread_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_RestoreThread; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_InitThreads_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_InitThreads := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_InitThreads_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_InitThreads; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_GetLocals_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_GetLocals := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_GetLocals_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_GetLocals; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_GetGlobals_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_GetGlobals := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_GetGlobals_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_GetGlobals; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_GetFrame_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_GetFrame := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_GetFrame_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_GetFrame; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_CallObjectWithKeywords_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_CallObjectWithKeywords := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_CallObjectWithKeywords_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_CallObjectWithKeywords; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCFunction_NewEx_W(Self: TPythonInterface; const T: ); +Begin Self.PyCFunction_NewEx := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCFunction_NewEx_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyCFunction_NewEx; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySys_SetArgv_W(Self: TPythonInterface; const T: ); +Begin Self.PySys_SetArgv := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySys_SetArgv_R(Self: TPythonInterface; var T: ); +Begin T := Self.PySys_SetArgv; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_AsStringAndSize_W(Self: TPythonInterface; const T: ); +Begin Self.PyBytes_AsStringAndSize := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_AsStringAndSize_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyBytes_AsStringAndSize; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_AsString_W(Self: TPythonInterface; const T: ); +Begin Self.PyBytes_AsString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_AsString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyBytes_AsString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyRun_SimpleString_W(Self: TPythonInterface; const T: ); +Begin Self.PyRun_SimpleString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyRun_SimpleString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyRun_SimpleString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyRun_String_W(Self: TPythonInterface; const T: ); +Begin Self.PyRun_String := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyRun_String_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyRun_String; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Str_W(Self: TPythonInterface; const T: ); +Begin Self.PyObject_Str := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Str_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyObject_Str; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyModule_GetDict_W(Self: TPythonInterface; const T: ); +Begin Self.PyModule_GetDict := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyModule_GetDict_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyModule_GetDict; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDictProxy_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyDictProxy_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDictProxy_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDictProxy_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_SetItemString_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_SetItemString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_SetItemString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_SetItemString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_GetItemString_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_GetItemString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_GetItemString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_GetItemString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_New_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_New := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_New_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_New; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_DelItemString_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_DelItemString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_DelItemString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_DelItemString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Update_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_Update := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Update_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_Update; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Size_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_Size := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Size_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_Size; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Items_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_Items := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Items_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_Items; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Values_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_Values := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Values_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_Values; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Keys_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_Keys := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Keys_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_Keys; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Next_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_Next := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Next_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_Next; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Clear_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_Clear := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Clear_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_Clear; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_DelItem_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_DelItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_DelItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_DelItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_SetItem_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_SetItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_SetItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_SetItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_GetItem_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_GetItem := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_GetItem_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_GetItem; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Copy_W(Self: TPythonInterface; const T: ); +Begin Self.PyDict_Copy := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Copy_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyDict_Copy; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_GetBuiltins_W(Self: TPythonInterface; const T: ); +Begin Self.PyEval_GetBuiltins := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEval_GetBuiltins_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyEval_GetBuiltins; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_Exit_W(Self: TPythonInterface; const T: ); +Begin Self.Py_Exit := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_Exit_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_Exit; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_Initialize_W(Self: TPythonInterface; const T: ); +Begin Self.Py_Initialize := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_Initialize_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_Initialize; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_BuildValue_W(Self: TPythonInterface; const T: TPy_BuildValue); +Begin Self.Py_BuildValue := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_BuildValue_R(Self: TPythonInterface; var T: TPy_BuildValue); +Begin T := Self.Py_BuildValue; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyArg_ParseTupleAndKeywords_W(Self: TPythonInterface; const T: TPyArg_ParseTupleAndKeywords); +Begin Self.PyArg_ParseTupleAndKeywords := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyArg_ParseTupleAndKeywords_R(Self: TPythonInterface; var T: TPyArg_ParseTupleAndKeywords); +Begin T := Self.PyArg_ParseTupleAndKeywords; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyArg_ParseTuple_W(Self: TPythonInterface; const T: TPyArg_Parse); +Begin Self.PyArg_ParseTuple := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyArg_ParseTuple_R(Self: TPythonInterface; var T: TPyArg_Parse); +Begin T := Self.PyArg_ParseTuple; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyArg_Parse_W(Self: TPythonInterface; const T: TPyArg_Parse); +Begin Self.PyArg_Parse := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyArg_Parse_R(Self: TPythonInterface; var T: TPyArg_Parse); +Begin T := Self.PyArg_Parse; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_GetModuleDict_W(Self: TPythonInterface; const T: ); +Begin Self.PyImport_GetModuleDict := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_GetModuleDict_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyImport_GetModuleDict; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_WarnExplicit_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_WarnExplicit := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_WarnExplicit_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_WarnExplicit; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_WarnEx_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_WarnEx := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_WarnEx_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_WarnEx; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_SetString_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_SetString := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_SetString_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_SetString; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_SetObject_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_SetObject := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_SetObject_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_SetObject; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_SetNone_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_SetNone := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_SetNone_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_SetNone; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_SetFromErrno_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_SetFromErrno := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_SetFromErrno_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_SetFromErrno; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_Restore_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_Restore := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_Restore_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_Restore; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_Print_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_Print := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_Print_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_Print; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_Occurred_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_Occurred := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_Occurred_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_Occurred; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_NoMemory_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_NoMemory := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_NoMemory_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_NoMemory; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_Fetch_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_Fetch := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_Fetch_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_Fetch; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_Clear_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_Clear := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_Clear_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_Clear; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_CheckSignals_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_CheckSignals := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_CheckSignals_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_CheckSignals; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_BadInternalCall_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_BadInternalCall := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_BadInternalCall_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_BadInternalCall; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_BadArgument_W(Self: TPythonInterface; const T: ); +Begin Self.PyErr_BadArgument := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyErr_BadArgument_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyErr_BadArgument; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyModule_Create2_W(Self: TPythonInterface; const T: ); +Begin Self.PyModule_Create2 := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyModule_Create2_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyModule_Create2; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCallable_Check_W(Self: TPythonInterface; const T: ); +Begin Self.PyCallable_Check := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCallable_Check_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyCallable_Check; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCFunction_GetSelf_W(Self: TPythonInterface; const T: ); +Begin Self.PyCFunction_GetSelf := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCFunction_GetSelf_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyCFunction_GetSelf; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCFunction_GetFunction_W(Self: TPythonInterface; const T: ); +Begin Self.PyCFunction_GetFunction := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCFunction_GetFunction_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyCFunction_GetFunction; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_AsCComplex_W(Self: TPythonInterface; const T: ); +Begin Self.PyComplex_AsCComplex := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_AsCComplex_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyComplex_AsCComplex; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_ImagAsDouble_W(Self: TPythonInterface; const T: ); +Begin Self.PyComplex_ImagAsDouble := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_ImagAsDouble_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyComplex_ImagAsDouble; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_RealAsDouble_W(Self: TPythonInterface; const T: ); +Begin Self.PyComplex_RealAsDouble := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_RealAsDouble_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyComplex_RealAsDouble; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_FromDoubles_W(Self: TPythonInterface; const T: ); +Begin Self.PyComplex_FromDoubles := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_FromDoubles_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyComplex_FromDoubles; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_FromCComplex_W(Self: TPythonInterface; const T: ); +Begin Self.PyComplex_FromCComplex := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_FromCComplex_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyComplex_FromCComplex; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_ExecCodeModule_W(Self: TPythonInterface; const T: ); +Begin Self.PyImport_ExecCodeModule := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_ExecCodeModule_R(Self: TPythonInterface; var T: ); +Begin T := Self.PyImport_ExecCodeModule; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetBuildInfo_W(Self: TPythonInterface; const T: ); +Begin Self.Py_GetBuildInfo := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_GetBuildInfo_R(Self: TPythonInterface; var T: ); +Begin T := Self.Py_GetBuildInfo; end; + +} + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEnum_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyEnum_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyEnum_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyEnum_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBool_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyBool_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBool_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyBool_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterface_PyWeakref_CallableProxyType_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self._PyWeakref_CallableProxyType := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterface_PyWeakref_CallableProxyType_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self._PyWeakref_CallableProxyType; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterface_PyWeakref_ProxyType_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self._PyWeakref_ProxyType := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterface_PyWeakref_ProxyType_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self._PyWeakref_ProxyType; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterface_PyWeakref_RefType_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self._PyWeakref_RefType := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterface_PyWeakref_RefType_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self._PyWeakref_RefType; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyWrapperDescr_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyWrapperDescr_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyWrapperDescr_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyWrapperDescr_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyUnicode_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyUnicode_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyUnicode_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTraceBack_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyTraceBack_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTraceBack_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyTraceBack_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySuper_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PySuper_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySuper_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PySuper_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyStaticMethod_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyStaticMethod_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyStaticMethod_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyStaticMethod_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySeqIter_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PySeqIter_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySeqIter_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PySeqIter_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyProperty_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyProperty_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyProperty_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyProperty_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyClassMethod_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyClassMethod_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyClassMethod_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyClassMethod_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCell_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyCell_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCell_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyCell_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCallIter_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyCallIter_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCallIter_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyCallIter_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBaseObject_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyBaseObject_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBaseObject_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyBaseObject_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyTuple_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyTuple_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyTuple_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyBytes_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyBytes_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyBytes_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySlice_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PySlice_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePySlice_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PySlice_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyRange_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyRange_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyRange_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyRange_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyObject_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyObject_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyObject_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyModule_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyModule_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyModule_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyModule_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMethod_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyMethod_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyMethod_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyMethod_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyLong_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyLong_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyLong_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyList_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyList_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyList_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFunction_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyFunction_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFunction_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyFunction_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFrame_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyFrame_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFrame_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyFrame_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFloat_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyFloat_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyFloat_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyFloat_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyDict_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyDict_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyDict_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyComplex_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyComplex_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyComplex_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCFunction_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyCFunction_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCFunction_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyCFunction_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyType_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyType_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyType_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyType_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCode_Type_W(Self: TPythonInterface; const T: PPyTypeObject); +Begin Self.PyCode_Type := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyCode_Type_R(Self: TPythonInterface; var T: PPyTypeObject); +Begin T := Self.PyCode_Type; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UnicodeTranslateError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_UnicodeTranslateError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UnicodeTranslateError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_UnicodeTranslateError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UnicodeEncodeError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_UnicodeEncodeError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UnicodeEncodeError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_UnicodeEncodeError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UnicodeDecodeError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_UnicodeDecodeError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UnicodeDecodeError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_UnicodeDecodeError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_PendingDeprecationWarning_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_PendingDeprecationWarning := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_PendingDeprecationWarning_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_PendingDeprecationWarning; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_FutureWarning_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_FutureWarning := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_FutureWarning_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_FutureWarning; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_StopIteration_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_StopIteration := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_StopIteration_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_StopIteration; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_ReferenceError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_ReferenceError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_ReferenceError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_ReferenceError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UserWarning_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_UserWarning := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UserWarning_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_UserWarning; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_SyntaxWarning_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_SyntaxWarning := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_SyntaxWarning_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_SyntaxWarning; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_RuntimeWarning_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_RuntimeWarning := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_RuntimeWarning_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_RuntimeWarning; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_DeprecationWarning_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_DeprecationWarning := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_DeprecationWarning_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_DeprecationWarning; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_Warning_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_Warning := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_Warning_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_Warning; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_WindowsError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_WindowsError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_WindowsError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_WindowsError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UnicodeError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_UnicodeError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UnicodeError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_UnicodeError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UnboundLocalError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_UnboundLocalError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_UnboundLocalError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_UnboundLocalError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_TabError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_TabError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_TabError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_TabError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_OSError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_OSError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_OSError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_OSError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_NotImplementedError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_NotImplementedError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_NotImplementedError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_NotImplementedError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_IndentationError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_IndentationError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_IndentationError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_IndentationError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_EnvironmentError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_EnvironmentError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_EnvironmentError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_EnvironmentError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_AssertionError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_AssertionError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_AssertionError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_AssertionError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_LookupError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_LookupError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_LookupError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_LookupError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_FloatingPointError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_FloatingPointError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_FloatingPointError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_FloatingPointError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_Exception_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_Exception := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_Exception_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_Exception; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_ArithmeticError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_ArithmeticError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_ArithmeticError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_ArithmeticError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_ZeroDivisionError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_ZeroDivisionError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_ZeroDivisionError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_ZeroDivisionError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_ValueError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_ValueError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_ValueError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_ValueError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_TypeError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_TypeError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_TypeError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_TypeError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_SystemExit_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_SystemExit := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_SystemExit_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_SystemExit; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_SystemError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_SystemError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_SystemError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_SystemError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_SyntaxError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_SyntaxError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_SyntaxError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_SyntaxError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_RuntimeError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_RuntimeError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_RuntimeError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_RuntimeError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_OverflowError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_OverflowError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_OverflowError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_OverflowError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_NameError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_NameError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_NameError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_NameError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_MemoryError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_MemoryError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_MemoryError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_MemoryError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_KeyboardInterrupt_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_KeyboardInterrupt := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_KeyboardInterrupt_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_KeyboardInterrupt; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_KeyError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_KeyError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_KeyError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_KeyError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_IndexError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_IndexError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_IndexError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_IndexError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_ImportError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_ImportError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_ImportError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_ImportError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_IOError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_IOError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_IOError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_IOError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_EOFError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_EOFError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_EOFError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_EOFError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_AttributeError_W(Self: TPythonInterface; const T: PPPyObject); +Begin Self.PyExc_AttributeError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyExc_AttributeError_R(Self: TPythonInterface; var T: PPPyObject); +Begin T := Self.PyExc_AttributeError; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_NotImplemented_W(Self: TPythonInterface; const T: PPyObject); +Begin Self.Py_NotImplemented := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_NotImplemented_R(Self: TPythonInterface; var T: PPyObject); +Begin T := Self.Py_NotImplemented; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_True_W(Self: TPythonInterface; const T: PPyObject); +Begin Self.Py_True := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_True_R(Self: TPythonInterface; var T: PPyObject); +Begin T := Self.Py_True; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_False_W(Self: TPythonInterface; const T: PPyObject); +Begin Self.Py_False := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_False_R(Self: TPythonInterface; var T: PPyObject); +Begin T := Self.Py_False; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_Ellipsis_W(Self: TPythonInterface; const T: PPyObject); +Begin Self.Py_Ellipsis := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_Ellipsis_R(Self: TPythonInterface; var T: PPyObject); +Begin T := Self.Py_Ellipsis; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_None_W(Self: TPythonInterface; const T: PPyObject); +Begin Self.Py_None := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_None_R(Self: TPythonInterface; var T: PPyObject); +Begin T := Self.Py_None; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_FrozenModules_W(Self: TPythonInterface; const T: PP_frozen); +Begin Self.PyImport_FrozenModules := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePyImport_FrozenModules_R(Self: TPythonInterface; var T: PP_frozen); +Begin T := Self.PyImport_FrozenModules; end; + { +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_IgnoreEnvironmentFlag_W(Self: TPythonInterface; const T: PInteger); +Begin Self.Py_IgnoreEnvironmentFlag := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_IgnoreEnvironmentFlag_R(Self: TPythonInterface; var T: PInteger); +Begin T := Self.Py_IgnoreEnvironmentFlag; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_FrozenFlag_W(Self: TPythonInterface; const T: PInteger); +Begin Self.Py_FrozenFlag := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_FrozenFlag_R(Self: TPythonInterface; var T: PInteger); +Begin T := Self.Py_FrozenFlag; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_NoSiteFlag_W(Self: TPythonInterface; const T: PInteger); +Begin Self.Py_NoSiteFlag := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_NoSiteFlag_R(Self: TPythonInterface; var T: PInteger); +Begin T := Self.Py_NoSiteFlag; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_OptimizeFlag_W(Self: TPythonInterface; const T: PInteger); +Begin Self.Py_OptimizeFlag := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_OptimizeFlag_R(Self: TPythonInterface; var T: PInteger); +Begin T := Self.Py_OptimizeFlag; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_InteractiveFlag_W(Self: TPythonInterface; const T: PInteger); +Begin Self.Py_InteractiveFlag := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_InteractiveFlag_R(Self: TPythonInterface; var T: PInteger); +Begin T := Self.Py_InteractiveFlag; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_VerboseFlag_W(Self: TPythonInterface; const T: PInteger); +Begin Self.Py_VerboseFlag := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_VerboseFlag_R(Self: TPythonInterface; var T: PInteger); +Begin T := Self.Py_VerboseFlag; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_DebugFlag_W(Self: TPythonInterface; const T: PInteger); +Begin Self.Py_DebugFlag := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInterfacePy_DebugFlag_R(Self: TPythonInterface; var T: PInteger); +Begin T := Self.Py_DebugFlag; end; } + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllOnBeforeUnload_W(Self: TDynamicDll; const T: TNotifyEvent); +begin Self.OnBeforeUnload := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllOnBeforeUnload_R(Self: TDynamicDll; var T: TNotifyEvent); +begin T := Self.OnBeforeUnload; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllOnBeforeLoad_W(Self: TDynamicDll; const T: TNotifyEvent); +begin Self.OnBeforeLoad := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllOnBeforeLoad_R(Self: TDynamicDll; var T: TNotifyEvent); +begin T := Self.OnBeforeLoad; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllOnAfterLoad_W(Self: TDynamicDll; const T: TNotifyEvent); +begin Self.OnAfterLoad := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllOnAfterLoad_R(Self: TDynamicDll; var T: TNotifyEvent); +begin T := Self.OnAfterLoad; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllUseLastKnownVersion_W(Self: TDynamicDll; const T: Boolean); +begin Self.UseLastKnownVersion := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllUseLastKnownVersion_R(Self: TDynamicDll; var T: Boolean); +begin T := Self.UseLastKnownVersion; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllFatalMsgDlg_W(Self: TDynamicDll; const T: Boolean); +begin Self.FatalMsgDlg := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllFatalMsgDlg_R(Self: TDynamicDll; var T: Boolean); +begin T := Self.FatalMsgDlg; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllFatalAbort_W(Self: TDynamicDll; const T: Boolean); +begin Self.FatalAbort := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllFatalAbort_R(Self: TDynamicDll; var T: Boolean); +begin T := Self.FatalAbort; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllRegVersion_W(Self: TDynamicDll; const T: string); +begin Self.RegVersion := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllRegVersion_R(Self: TDynamicDll; var T: string); +begin T := Self.RegVersion; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllAPIVersion_W(Self: TDynamicDll; const T: Integer); +begin Self.APIVersion := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllAPIVersion_R(Self: TDynamicDll; var T: Integer); +begin T := Self.APIVersion; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllDllPath_W(Self: TDynamicDll; const T: string); +begin Self.DllPath := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllDllPath_R(Self: TDynamicDll; var T: string); +begin T := Self.DllPath; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllDllName_W(Self: TDynamicDll; const T: string); +begin Self.DllName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllDllName_R(Self: TDynamicDll; var T: string); +begin T := Self.DllName; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllAutoUnload_W(Self: TDynamicDll; const T: Boolean); +begin Self.AutoUnload := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllAutoUnload_R(Self: TDynamicDll; var T: Boolean); +begin T := Self.AutoUnload; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllAutoLoad_W(Self: TDynamicDll; const T: Boolean); +begin Self.AutoLoad := T; end; + +(*----------------------------------------------------------------------------*) +procedure TDynamicDllAutoLoad_R(Self: TDynamicDll; var T: Boolean); +begin T := Self.AutoLoad; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputRawOutput_W(Self: TPythonInputOutput; const T: Boolean); +begin Self.RawOutput := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputRawOutput_R(Self: TPythonInputOutput; var T: Boolean); +begin T := Self.RawOutput; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputUnicodeIO_W(Self: TPythonInputOutput; const T: Boolean); +begin Self.UnicodeIO := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputUnicodeIO_R(Self: TPythonInputOutput; var T: Boolean); +begin T := Self.UnicodeIO; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputOnReceiveUniData_W(Self: TPythonInputOutput; const T: TReceiveUniDataEvent); +begin Self.OnReceiveUniData := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputOnReceiveUniData_R(Self: TPythonInputOutput; var T: TReceiveUniDataEvent); +begin T := Self.OnReceiveUniData; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputOnSendUniData_W(Self: TPythonInputOutput; const T: TSendUniDataEvent); +begin Self.OnSendUniData := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputOnSendUniData_R(Self: TPythonInputOutput; var T: TSendUniDataEvent); +begin T := Self.OnSendUniData; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputOnReceiveData_W(Self: TPythonInputOutput; const T: TReceiveDataEvent); +begin Self.OnReceiveData := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputOnReceiveData_R(Self: TPythonInputOutput; var T: TReceiveDataEvent); +begin T := Self.OnReceiveData; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputOnSendData_W(Self: TPythonInputOutput; const T: TSendDataEvent); +begin Self.OnSendData := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputOnSendData_R(Self: TPythonInputOutput; var T: TSendDataEvent); +begin T := Self.OnSendData; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputDelayWrites_W(Self: TPythonInputOutput; const T: Boolean); +begin Self.DelayWrites := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputDelayWrites_R(Self: TPythonInputOutput; var T: Boolean); +begin T := Self.DelayWrites; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputMaxLineLength_W(Self: TPythonInputOutput; const T: Integer); +begin Self.MaxLineLength := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputMaxLineLength_R(Self: TPythonInputOutput; var T: Integer); +begin T := Self.MaxLineLength; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputMaxLines_W(Self: TPythonInputOutput; const T: Integer); +begin Self.MaxLines := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonInputOutputMaxLines_R(Self: TPythonInputOutput; var T: Integer); +begin T := Self.MaxLines; end; + +(*----------------------------------------------------------------------------*) +procedure EPySyntaxErrorEOffset_W(Self: EPySyntaxError; const T: Integer); +Begin Self.EOffset := T; end; + +(*----------------------------------------------------------------------------*) +procedure EPySyntaxErrorEOffset_R(Self: EPySyntaxError; var T: Integer); +Begin T := Self.EOffset; end; + +(*----------------------------------------------------------------------------*) +procedure EPySyntaxErrorELineNumber_W(Self: EPySyntaxError; const T: Integer); +Begin Self.ELineNumber := T; end; + +(*----------------------------------------------------------------------------*) +procedure EPySyntaxErrorELineNumber_R(Self: EPySyntaxError; var T: Integer); +Begin T := Self.ELineNumber; end; + +(*----------------------------------------------------------------------------*) +procedure EPySyntaxErrorELineStr_W(Self: EPySyntaxError; const T: UnicodeString); +Begin Self.ELineStr := T; end; + +(*----------------------------------------------------------------------------*) +procedure EPySyntaxErrorELineStr_R(Self: EPySyntaxError; var T: UnicodeString); +Begin T := Self.ELineStr; end; + +(*----------------------------------------------------------------------------*) +procedure EPySyntaxErrorEFileName_W(Self: EPySyntaxError; const T: UnicodeString); +Begin Self.EFileName := T; end; + +(*----------------------------------------------------------------------------*) +procedure EPySyntaxErrorEFileName_R(Self: EPySyntaxError; var T: UnicodeString); +Begin T := Self.EFileName; end; + +(*----------------------------------------------------------------------------*) +procedure EPythonErrorEValue_W(Self: EPythonError; const T: string); +Begin Self.EValue := T; end; + +(*----------------------------------------------------------------------------*) +procedure EPythonErrorEValue_R(Self: EPythonError; var T: string); +Begin T := Self.EValue; end; + +(*----------------------------------------------------------------------------*) +procedure EPythonErrorEName_W(Self: EPythonError; const T: string); +Begin Self.EName := T; end; + +(*----------------------------------------------------------------------------*) +procedure EPythonErrorEName_R(Self: EPythonError; var T: string); +Begin T := Self.EName; end; + +(*----------------------------------------------------------------------------*) +procedure EDLLImportErrorErrorCode_W(Self: EDLLImportError; const T: Integer); +Begin Self.ErrorCode := T; end; + +(*----------------------------------------------------------------------------*) +procedure EDLLImportErrorErrorCode_R(Self: EDLLImportError; var T: Integer); +Begin T := Self.ErrorCode; end; + +(*----------------------------------------------------------------------------*) +procedure EDLLImportErrorWrongFunc_W(Self: EDLLImportError; const T: AnsiString); +Begin Self.WrongFunc := T; end; + +(*----------------------------------------------------------------------------*) +procedure EDLLImportErrorWrongFunc_R(Self: EDLLImportError; var T: AnsiString); +Begin T := Self.WrongFunc; end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_PythonEngine_Routines(S: TPSExec); +begin + S.RegisterDelphiFunction(@pyio_write, 'pyio_write', CdCdecl); + S.RegisterDelphiFunction(@pyio_read, 'pyio_read', CdCdecl); + S.RegisterDelphiFunction(@pyio_SetDelayWrites, 'pyio_SetDelayWrites', CdCdecl); + S.RegisterDelphiFunction(@pyio_SetMaxLines, 'pyio_SetMaxLines', CdCdecl); + S.RegisterDelphiFunction(@pyio_GetTypesStats, 'pyio_GetTypesStats', CdCdecl); + S.RegisterDelphiFunction(@GetPythonEngine, 'GetPythonEngine', cdRegister); + S.RegisterDelphiFunction(@PythonOK, 'PythonOK', cdRegister); + S.RegisterDelphiFunction(@PythonToDelphi, 'PythonToDelphi', cdRegister); + S.RegisterDelphiFunction(@IsDelphiObject, 'IsDelphiObject', cdRegister); + S.RegisterDelphiFunction(@PyObjectDestructor, 'PyObjectDestructor', CdCdecl); + //S.RegisterDelphiFunction(@FreeSubtypeInst, 'FreeSubtypeInst', CdCdecl); + S.RegisterDelphiFunction(@Register, 'Register', cdRegister); + S.RegisterDelphiFunction(@PyType_HasFeature, 'PyType_HasFeature', cdRegister); + S.RegisterDelphiFunction(@SysVersionFromDLLName, 'SysVersionFromDLLName', cdRegister); + S.RegisterDelphiFunction(@PythonVersionFromDLLName, 'PythonVersionFromDLLName', cdRegister); + S.RegisterDelphiFunction(@IsPythonVersionRegistered, 'IsPythonVersionRegistered', cdRegister); + S.RegisterDelphiFunction(@MaskFPUExceptions, 'MaskFPUExceptions', cdRegister); + S.RegisterDelphiFunction(@CleanString13_P, 'CleanString13', cdRegister); + S.RegisterDelphiFunction(@CleanString14_P, 'CleanString14', cdRegister); + //S.RegisterDelphiFunction(@setgPythonEngine, 'setgPythonEngine', cdRegister); + //S.RegisterDelphiFunction(@getgPythonEngine, 'getgPythonEngine', cdRegister); + +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonThread(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonThread) do + begin + RegisterMethod(@TPythonThread.Py_Begin_Allow_Threads, 'Py_Begin_Allow_Threads'); + RegisterMethod(@TPythonThread.Py_End_Allow_Threads, 'Py_End_Allow_Threads'); + RegisterMethod(@TPythonThread.Py_Begin_Block_Threads, 'Py_Begin_Block_Threads'); + RegisterMethod(@TPythonThread.Py_Begin_Unblock_Threads, 'Py_Begin_Unblock_Threads'); + RegisterPropertyHelper(@TPythonThreadThreadState_R,nil,'ThreadState'); + RegisterPropertyHelper(@TPythonThreadThreadExecMode_R,@TPythonThreadThreadExecMode_W,'ThreadExecMode'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyVar(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyVar) do begin + RegisterConstructor(@TPyVar.Create, 'Create'); + RegisterPropertyHelper(@TPyVardv_var_R,@TPyVardv_var_W,'dv_var'); + RegisterPropertyHelper(@TPyVardv_component_R,@TPyVardv_component_W,'dv_component'); + RegisterPropertyHelper(@TPyVardv_object_R,@TPyVardv_object_W,'dv_object'); + RegisterMethod(@TPyVar.GetValue, 'GetValue'); + RegisterMethod(@TPyVar.GetValueAsVariant, 'GetValueAsVariant'); + RegisterMethod(@TPyVar.SetValue, 'SetValue'); + RegisterMethod(@TPyVar.SetValueFromVariant, 'SetValueFromVariant'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonDelphiVar(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonDelphiVar) do + begin + RegisterMethod(@TPythonDelphiVar.IsVariantOk, 'IsVariantOk'); + RegisterPropertyHelper(@TPythonDelphiVarValue_R,@TPythonDelphiVarValue_W,'Value'); + RegisterPropertyHelper(@TPythonDelphiVarValueObject_R,@TPythonDelphiVarValueObject_W,'ValueObject'); + RegisterPropertyHelper(@TPythonDelphiVarValueAsString_R,nil,'ValueAsString'); + RegisterPropertyHelper(@TPythonDelphiVarVarObject_R,@TPythonDelphiVarVarObject_W,'VarObject'); + RegisterPropertyHelper(@TPythonDelphiVarModule_R,@TPythonDelphiVarModule_W,'Module'); + RegisterPropertyHelper(@TPythonDelphiVarVarName_R,@TPythonDelphiVarVarName_W,'VarName'); + RegisterPropertyHelper(@TPythonDelphiVarOnGetData_R,@TPythonDelphiVarOnGetData_W,'OnGetData'); + RegisterPropertyHelper(@TPythonDelphiVarOnSetData_R,@TPythonDelphiVarOnSetData_W,'OnSetData'); + RegisterPropertyHelper(@TPythonDelphiVarOnExtGetData_R,@TPythonDelphiVarOnExtGetData_W,'OnExtGetData'); + RegisterPropertyHelper(@TPythonDelphiVarOnExtSetData_R,@TPythonDelphiVarOnExtSetData_W,'OnExtSetData'); + RegisterPropertyHelper(@TPythonDelphiVarOnChange_R,@TPythonDelphiVarOnChange_W,'OnChange'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonType(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonType) do begin + RegisterConstructor(@TPythonType.Create, 'Create'); + RegisterMethod(@TPythonType.Destroy, 'Free'); + RegisterMethod(@TPythonType.CreateInstance, 'CreateInstance'); + RegisterMethod(@TPythonType.CreateInstanceWith, 'CreateInstanceWith'); + RegisterMethod(@TPythonType.AddTypeVar, 'AddTypeVar'); + RegisterPropertyHelper(@TPythonTypeTheType_R,@TPythonTypeTheType_W,'TheType'); + RegisterPropertyHelper(@TPythonTypeTheTypePtr_R,nil,'TheTypePtr'); + RegisterPropertyHelper(@TPythonTypePyObjectClass_R,@TPythonTypePyObjectClass_W,'PyObjectClass'); + RegisterPropertyHelper(@TPythonTypeInstanceCount_R,nil,'InstanceCount'); + RegisterPropertyHelper(@TPythonTypeCreateHits_R,nil,'CreateHits'); + RegisterPropertyHelper(@TPythonTypeDeleteHits_R,nil,'DeleteHits'); + RegisterPropertyHelper(@TPythonTypeDocString_R,@TPythonTypeDocString_W,'DocString'); + RegisterPropertyHelper(@TPythonTypeTypeName_R,@TPythonTypeTypeName_W,'TypeName'); + RegisterPropertyHelper(@TPythonTypeTypeFlags_R,@TPythonTypeTypeFlags_W,'TypeFlags'); + RegisterPropertyHelper(@TPythonTypePrefix_R,@TPythonTypePrefix_W,'Prefix'); + RegisterPropertyHelper(@TPythonTypeModule_R,@TPythonTypeModule_W,'Module'); + RegisterPropertyHelper(@TPythonTypeServices_R,@TPythonTypeServices_W,'Services'); + RegisterPropertyHelper(@TPythonTypeGenerateCreateFunction_R,@TPythonTypeGenerateCreateFunction_W,'GenerateCreateFunction'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TTypeServices(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TTypeServices) do + begin + RegisterConstructor(@TTypeServices.Create, 'Create'); + RegisterPropertyHelper(@TTypeServicesBasic_R,@TTypeServicesBasic_W,'Basic'); + RegisterPropertyHelper(@TTypeServicesInplaceNumber_R,@TTypeServicesInplaceNumber_W,'InplaceNumber'); + RegisterPropertyHelper(@TTypeServicesNumber_R,@TTypeServicesNumber_W,'Number'); + RegisterPropertyHelper(@TTypeServicesSequence_R,@TTypeServicesSequence_W,'Sequence'); + RegisterPropertyHelper(@TTypeServicesMapping_R,@TTypeServicesMapping_W,'Mapping'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyObject(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyObject) do + begin + RegisterPropertyHelper(@TPyObjectPythonType_R,@TPyObjectPythonType_W,'PythonType'); + RegisterPropertyHelper(@TPyObjectIsSubtype_R,@TPyObjectIsSubtype_W,'IsSubtype'); + RegisterPropertyHelper(@TPyObjectPythonAlloc_R,@TPyObjectPythonAlloc_W,'PythonAlloc'); + RegisterVirtualConstructor(@TPyObject.Create, 'Create'); + RegisterVirtualConstructor(@TPyObject.CreateWith, 'CreateWith'); + RegisterMethod(@TPyObject.Destroy, 'Free'); + RegisterMethod(@TPyObject.GetSelf, 'GetSelf'); + RegisterMethod(@TPyObject.IncRef, 'IncRef'); + RegisterMethod(@TPyObject.Adjust, 'Adjust'); + RegisterMethod(@TPyObject.GetModule, 'GetModule'); + RegisterPropertyHelper(@TPyObjectob_refcnt_R,@TPyObjectob_refcnt_W,'ob_refcnt'); + RegisterPropertyHelper(@TPyObjectob_type_R,@TPyObjectob_type_W,'ob_type'); + RegisterVirtualMethod(@TPyObject.Print, 'Print'); + RegisterVirtualMethod(@TPyObject.GetAttr, 'GetAttr'); + RegisterVirtualMethod(@TPyObject.SetAttr, 'SetAttr'); + RegisterVirtualMethod(@TPyObject.Repr, 'Repr'); + RegisterVirtualMethod(@TPyObject.Compare, 'Compare'); + RegisterVirtualMethod(@TPyObject.Hash, 'Hash'); + RegisterVirtualMethod(@TPyObject.Str, 'Str'); + RegisterVirtualMethod(@TPyObject.GetAttrO, 'GetAttrO'); + RegisterVirtualMethod(@TPyObject.SetAttrO, 'SetAttrO'); + RegisterVirtualMethod(@TPyObject.Call, 'Call'); + RegisterVirtualMethod(@TPyObject.Traverse, 'Traverse'); + RegisterVirtualMethod(@TPyObject.Clear, 'Clear'); + RegisterVirtualMethod(@TPyObject.RichCompare, 'RichCompare'); + RegisterVirtualMethod(@TPyObject.Iter, 'Iter'); + RegisterVirtualMethod(@TPyObject.IterNext, 'IterNext'); + RegisterVirtualMethod(@TPyObject.Init, 'Init'); + RegisterVirtualMethod(@TPyObject.NbAdd, 'NbAdd'); + RegisterVirtualMethod(@TPyObject.NbSubtract, 'NbSubtract'); + RegisterVirtualMethod(@TPyObject.NbMultiply, 'NbMultiply'); + RegisterVirtualMethod(@TPyObject.NbFloorDivide, 'NbFloorDivide'); + RegisterVirtualMethod(@TPyObject.NbTrueDivide, 'NbTrueDivide'); + RegisterVirtualMethod(@TPyObject.NbMatrixMultiply, 'NbMatrixMultiply'); + RegisterVirtualMethod(@TPyObject.NbRemainder, 'NbRemainder'); + RegisterVirtualMethod(@TPyObject.NbDivmod, 'NbDivmod'); + RegisterVirtualMethod(@TPyObject.NbPower, 'NbPower'); + RegisterVirtualMethod(@TPyObject.NbNegative, 'NbNegative'); + RegisterVirtualMethod(@TPyObject.NbPositive, 'NbPositive'); + RegisterVirtualMethod(@TPyObject.NbAbsolute, 'NbAbsolute'); + RegisterVirtualMethod(@TPyObject.NbBool, 'NbBool'); + RegisterVirtualMethod(@TPyObject.NbInvert, 'NbInvert'); + RegisterVirtualMethod(@TPyObject.NbLShift, 'NbLShift'); + RegisterVirtualMethod(@TPyObject.NbRShift, 'NbRShift'); + RegisterVirtualMethod(@TPyObject.NbAnd, 'NbAnd'); + RegisterVirtualMethod(@TPyObject.NbXor, 'NbXor'); + RegisterVirtualMethod(@TPyObject.NbOr, 'NbOr'); + RegisterVirtualMethod(@TPyObject.NbInt, 'NbInt'); + RegisterVirtualMethod(@TPyObject.NbFloat, 'NbFloat'); + RegisterVirtualMethod(@TPyObject.NbInplaceAdd, 'NbInplaceAdd'); + RegisterVirtualMethod(@TPyObject.NbInplaceSubtract, 'NbInplaceSubtract'); + RegisterVirtualMethod(@TPyObject.NbInplaceMultiply, 'NbInplaceMultiply'); + RegisterVirtualMethod(@TPyObject.NbInplaceDivide, 'NbInplaceDivide'); + RegisterVirtualMethod(@TPyObject.NbInplaceFloorDivide, 'NbInplaceFloorDivide'); + RegisterVirtualMethod(@TPyObject.NbInplaceTrueDivide, 'NbInplaceTrueDivide'); + RegisterVirtualMethod(@TPyObject.NbInplaceRemainder, 'NbInplaceRemainder'); + RegisterVirtualMethod(@TPyObject.NbInplacePower, 'NbInplacePower'); + RegisterVirtualMethod(@TPyObject.NbInplaceLshift, 'NbInplaceLshift'); + RegisterVirtualMethod(@TPyObject.NbInplaceRshift, 'NbInplaceRshift'); + RegisterVirtualMethod(@TPyObject.NbInplaceAnd, 'NbInplaceAnd'); + RegisterVirtualMethod(@TPyObject.NbInplaceXor, 'NbInplaceXor'); + RegisterVirtualMethod(@TPyObject.NbInplaceOr, 'NbInplaceOr'); + RegisterVirtualMethod(@TPyObject.NbInplaceMatrixMultiply, 'NbInplaceMatrixMultiply'); + RegisterVirtualMethod(@TPyObject.SqLength, 'SqLength'); + RegisterVirtualMethod(@TPyObject.SqConcat, 'SqConcat'); + RegisterVirtualMethod(@TPyObject.SqRepeat, 'SqRepeat'); + RegisterVirtualMethod(@TPyObject.SqItem, 'SqItem'); + RegisterVirtualMethod(@TPyObject.SqAssItem, 'SqAssItem'); + RegisterVirtualMethod(@TPyObject.SqContains, 'SqContains'); + RegisterVirtualMethod(@TPyObject.SqInplaceConcat, 'SqInplaceConcat'); + RegisterVirtualMethod(@TPyObject.SqInplaceRepeat, 'SqInplaceRepeat'); + RegisterVirtualMethod(@TPyObject.MpLength, 'MpLength'); + RegisterVirtualMethod(@TPyObject.MpSubscript, 'MpSubscript'); + RegisterVirtualMethod(@TPyObject.MpAssSubscript, 'MpAssSubscript'); + RegisterVirtualMethod(@TPyObject.RegisterMethods, 'RegisterMethods'); + RegisterVirtualMethod(@TPyObject.RegisterMembers, 'RegisterMembers'); + RegisterVirtualMethod(@TPyObject.RegisterGetSets, 'RegisterGetSets'); + RegisterVirtualMethod(@TPyObject.SetupType, 'SetupType'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonModule(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonModule) do + begin + RegisterConstructor(@TPythonModule.Create, 'Create'); + RegisterMethod(@TPythonModule.Destroy, 'Free'); + RegisterMethod(@TPythonModule.MakeModule, 'MakeModule'); + RegisterMethod(@TPythonModule.DefineDocString, 'DefineDocString'); + RegisterMethod(@TPythonModule.Initialize, 'Initialize'); + RegisterMethod(@TPythonModule.InitializeForNewInterpreter, 'InitializeForNewInterpreter'); + RegisterMethod(@TPythonModule.AddClient, 'AddClient'); + RegisterMethod(@TPythonModule.ErrorByName, 'ErrorByName'); + RegisterMethod(@TPythonModule.RaiseError, 'RaiseError'); + RegisterMethod(@TPythonModule.RaiseErrorFmt, 'RaiseErrorFmt'); + RegisterMethod(@TPythonModule.RaiseErrorObj, 'RaiseErrorObj'); + RegisterMethod(@TPythonModule.BuildErrors, 'BuildErrors'); + RegisterMethod(@TPythonModule.SetVar, 'SetVar'); + RegisterMethod(@TPythonModule.GetVar, 'GetVar'); + RegisterMethod(@TPythonModule.DeleteVar, 'DeleteVar'); + RegisterMethod(@TPythonModule.ClearVars, 'ClearVars'); + RegisterMethod(@TPythonModule.SetVarFromVariant, 'SetVarFromVariant'); + RegisterMethod(@TPythonModule.GetVarAsVariant, 'GetVarAsVariant'); + RegisterPropertyHelper(@TPythonModuleModule_R,nil,'Module'); + RegisterPropertyHelper(@TPythonModuleClients_R,nil,'Clients'); + RegisterPropertyHelper(@TPythonModuleClientCount_R,nil,'ClientCount'); + RegisterPropertyHelper(@TPythonModuleDocString_R,@TPythonModuleDocString_W,'DocString'); + RegisterPropertyHelper(@TPythonModuleModuleName_R,@TPythonModuleModuleName_W,'ModuleName'); + RegisterPropertyHelper(@TPythonModuleErrors_R,@TPythonModuleErrors_W,'Errors'); + RegisterPropertyHelper(@TPythonModuleOnAfterInitialization_R,@TPythonModuleOnAfterInitialization_W,'OnAfterInitialization'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TErrors(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TErrors) do + begin + RegisterConstructor(@TErrors.Create, 'Create'); + RegisterMethod(@TErrors.Add, 'Add'); + RegisterMethod(@TErrors.Owner, 'Owner'); + RegisterPropertyHelper(@TErrorsItems_R,@TErrorsItems_W,'Items'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TError(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TError) do + begin + RegisterConstructor(@TError.Create, 'Create'); + RegisterMethod(@TError.Destroy, 'Free'); + RegisterMethod(@TError.Assign, 'Assign'); + RegisterMethod(@TError.BuildError, 'BuildError'); + RegisterMethod(@TError.RaiseError, 'RaiseError'); + RegisterMethod(@TError.RaiseErrorObj, 'RaiseErrorObj'); + RegisterMethod(@TError.Owner, 'Owner'); + RegisterPropertyHelper(@TErrorError_R,@TErrorError_W,'Error'); + RegisterPropertyHelper(@TErrorName_R,@TErrorName_W,'Name'); + RegisterPropertyHelper(@TErrorText_R,@TErrorText_W,'Text'); + RegisterPropertyHelper(@TErrorErrorType_R,@TErrorErrorType_W,'ErrorType'); + RegisterPropertyHelper(@TErrorParentClass_R,@TErrorParentClass_W,'ParentClass'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TParentClassError(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TParentClassError) do + begin + RegisterMethod(@TParentClassError.AssignTo, 'AssignTo'); + RegisterPropertyHelper(@TParentClassErrorModule_R,@TParentClassErrorModule_W,'Module'); + RegisterPropertyHelper(@TParentClassErrorName_R,@TParentClassErrorName_W,'Name'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TGetSetContainer(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TGetSetContainer) do + begin + RegisterConstructor(@TGetSetContainer.Create, 'Create'); + RegisterMethod(@TGetSetContainer.Destroy, 'Free'); + RegisterMethod(@TGetSetContainer.AddGetSet, 'AddGetSet'); + RegisterMethod(@TGetSetContainer.ClearGetSets, 'ClearGetSets'); + RegisterPropertyHelper(@TGetSetContainerGetSetCount_R,nil,'GetSetCount'); + RegisterPropertyHelper(@TGetSetContainerGetSet_R,nil,'GetSet'); + RegisterPropertyHelper(@TGetSetContainerGetSetData_R,nil,'GetSetData'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TMembersContainer(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TMembersContainer) do + begin + RegisterConstructor(@TMembersContainer.Create, 'Create'); + RegisterMethod(@Tmemberscontainer.Destroy, 'Free'); + RegisterMethod(@TMembersContainer.AddMember, 'AddMember'); + RegisterMethod(@TMembersContainer.ClearMembers, 'ClearMembers'); + RegisterPropertyHelper(@TMembersContainerMemberCount_R,nil,'MemberCount'); + RegisterPropertyHelper(@TMembersContainerMembers_R,nil,'Members'); + RegisterPropertyHelper(@TMembersContainerMembersData_R,nil,'MembersData'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TMethodsContainer(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TMethodsContainer) do + begin + RegisterConstructor(@TMethodsContainer.Create, 'Create'); + RegisterMethod(@TMethodsContainer.Destroy, 'Free'); + RegisterMethod(@TMethodsContainer.Initialize, 'Initialize'); + RegisterMethod(@TMethodsContainer.Finalize, 'Finalize'); + RegisterMethod(@TMethodsContainer.AddMethod, 'AddMethod'); + RegisterMethod(@TMethodsContainer.AddMethodWithKeywords, 'AddMethodWithKeywords'); + RegisterMethod(@TMethodsContainer.AddDelphiMethod, 'AddDelphiMethod'); + RegisterMethod(@TMethodsContainer.AddDelphiMethodWithKeywords, 'AddDelphiMethodWithKeywords'); + RegisterMethod(@TMethodsContainer.ClearMethods, 'ClearMethods'); + RegisterPropertyHelper(@TMethodsContainerMethodCount_R,nil,'MethodCount'); + RegisterPropertyHelper(@TMethodsContainerMethods_R,nil,'Methods'); + RegisterPropertyHelper(@TMethodsContainerMethodsData_R,nil,'MethodsData'); + RegisterPropertyHelper(@TMethodsContainerModuleDef_R,nil,'ModuleDef'); + RegisterPropertyHelper(@TMethodsContainerEvents_R,@TMethodsContainerEvents_W,'Events'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TEventDefs(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TEventDefs) do + begin + RegisterConstructor(@TEventDefs.Create, 'Create'); + RegisterMethod(@TEventDefs.Add, 'Add'); + RegisterMethod(@TEventDefs.RegisterEvents, 'RegisterEvents'); + RegisterPropertyHelper(@TEventDefsItems_R,nil,'Items'); + RegisterPropertyHelper(@TEventDefsContainer_R,nil,'Container'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TEventDef(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TEventDef) do + begin + RegisterConstructor(@TEventDef.Create, 'Create'); + RegisterMethod(@TEventDef.Destroy, 'Free'); + RegisterMethod(@TEventDef.GetDocString, 'GetDocString'); + RegisterMethod(@TEventDef.PythonEvent, 'PythonEvent'); + RegisterMethod(@TEventDef.Owner, 'Owner'); + RegisterPropertyHelper(@TEventDefName_R,@TEventDefName_W,'Name'); + RegisterPropertyHelper(@TEventDefOnExecute_R,@TEventDefOnExecute_W,'OnExecute'); + RegisterPropertyHelper(@TEventDefDocString_R,@TEventDefDocString_W,'DocString'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TEngineClient(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TEngineClient) do + begin + RegisterConstructor(@TEngineClient.Create, 'Create'); + RegisterMethod(@TEngineClient.Destroy, 'Free'); + RegisterVirtualMethod(@TEngineClient.Initialize, 'Initialize'); + RegisterVirtualMethod(@TEngineClient.Finalize, 'Finalize'); + RegisterMethod(@TEngineClient.ClearEngine, 'ClearEngine'); + RegisterMethod(@TEngineClient.CheckEngine, 'CheckEngine'); + RegisterPropertyHelper(@TEngineClientInitialized_R,nil,'Initialized'); + RegisterPropertyHelper(@TEngineClientEngine_R,@TEngineClientEngine_W,'Engine'); + RegisterPropertyHelper(@TEngineClientOnCreate_R,@TEngineClientOnCreate_W,'OnCreate'); + RegisterPropertyHelper(@TEngineClientOnDestroy_R,@TEngineClientOnDestroy_W,'OnDestroy'); + RegisterPropertyHelper(@TEngineClientOnFinalization_R,@TEngineClientOnFinalization_W,'OnFinalization'); + RegisterPropertyHelper(@TEngineClientOnInitialization_R,@TEngineClientOnInitialization_W,'OnInitialization'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonEngine(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonEngine) do begin + RegisterConstructor(@TPythonEngine.Create, 'Create'); + RegisterMethod(@TPythonEngine.Destroy, 'Free'); + RegisterMethod(@TPythonEngine.Initialize2, 'Initialize2'); + RegisterMethod(@TPythonEngine.DoOpenDll2, 'DoOpenDll2'); + RegisterMethod(@TPythonEngine.SetProgramArgs2, 'SetProgramArgs2'); + + RegisterMethod(@TPythonEngine.CheckRegistry, 'CheckRegistry'); + + RegisterMethod(@TPythonEngine.SetPythonHome, 'SetPythonHome'); + RegisterMethod(@TPythonEngine.SetProgramName, 'SetProgramName'); + RegisterMethod(@TPythonEngine.IsType, 'IsType'); + RegisterMethod(@TPythonEngine.Run_CommandAsString, 'Run_CommandAsString'); + RegisterMethod(@TPythonEngine.Run_CommandAsObject, 'Run_CommandAsObject'); + RegisterMethod(@TPythonEngine.Run_CommandAsObjectWithDict, 'Run_CommandAsObjectWithDict'); + RegisterMethod(@TPythonEngineEncodeString01_P, 'EncodeString1'); + RegisterMethod(@TPythonEngineEncodeString01_P, 'EncodeString'); + RegisterMethod(@TPythonEngineEncodeString2_P, 'EncodeString2'); + RegisterMethod(@TPythonEngine.EncodeWindowsFilePath, 'EncodeWindowsFilePath'); + RegisterMethod(@TPythonEngineExecString3_P, 'ExecString3'); + RegisterMethod(@TPythonEngineExecString3_P, 'ExecString'); + RegisterMethod(@TPythonEngineExecString3_P, 'ExecStr'); //alias + + RegisterMethod(@TPythonEngineExecStrings4_P, 'ExecStrings4'); + RegisterMethod(@TPythonEngineExecStrings4_P, 'ExecStrings'); //alias + RegisterMethod(@TPythonEngineEvalString5_P, 'EvalString5'); + RegisterMethod(@TPythonEngine.EvalStringAsStr, 'EvalStringAsStr'); + RegisterMethod(@TPythonEngine.EvalStringAsStr, 'EvalStr'); //alias + RegisterMethod(@TPythonEngineEvalStrings6_P, 'EvalStrings6'); + RegisterMethod(@TPythonEngineExecString7_P, 'ExecString7'); + RegisterMethod(@TPythonEngineExecStrings8_P, 'ExecStrings8'); + RegisterMethod(@TPythonEngineEvalString9_P, 'EvalString9'); + RegisterMethod(@TPythonEngineEvalStrings10_P, 'EvalStrings10'); + RegisterMethod(@TPythonEngine.EvalStringsAsStr, 'EvalStringsAsStr'); + RegisterMethod(@TPythonEngine.EvalPyFunction, 'EvalPyFunction'); + RegisterMethod(@TPythonEngine.EvalFunction, 'EvalFunction'); + RegisterMethod(@TPythonEngine.EvalFunctionNoArgs, 'EvalFunctionNoArgs'); + RegisterMethod(@TPythonEngine.CheckEvalSyntax, 'CheckEvalSyntax'); + RegisterMethod(@TPythonEngine.CheckExecSyntax, 'CheckExecSyntax'); + RegisterMethod(@TPythonEngine.CheckSyntax, 'CheckSyntax'); + RegisterMethod(@TPythonEngine.RaiseError, 'RaiseError'); + RegisterMethod(@TPythonEngine.PyObjectAsString, 'PyObjectAsString'); + RegisterMethod(@TPythonEngine.DoRedirectIO, 'DoRedirectIO'); + RegisterMethod(@TPythonEngine.AddClient, 'AddClient'); + RegisterMethod(@TPythonEngine.RemoveClient, 'RemoveClient'); + RegisterMethod(@TPythonEngine.FindClient, 'FindClient'); + RegisterMethod(@TPythonEngine.TypeByName, 'TypeByName'); + RegisterMethod(@TPythonEngine.ModuleByName, 'ModuleByName'); + RegisterMethod(@TPythonEngine.MethodsByName, 'MethodsByName'); + RegisterVirtualMethod(@TPythonEngine.VariantAsPyObject, 'VariantAsPyObject'); + RegisterVirtualMethod(@TPythonEngine.PyObjectAsVariant, 'PyObjectAsVariant'); + RegisterMethod(@TPythonEngine.VarRecAsPyObject, 'VarRecAsPyObject'); + RegisterMethod(@TPythonEngine.MakePyTuple, 'MakePyTuple'); + RegisterMethod(@TPythonEngine.MakePyList, 'MakePyList'); + RegisterMethod(@TPythonEngine.ArrayToPyTuple, 'ArrayToPyTuple'); + RegisterMethod(@TPythonEngine.ArrayToPyList, 'ArrayToPyList'); + RegisterMethod(@TPythonEngine.ArrayToPyDict, 'ArrayToPyDict'); + RegisterMethod(@TPythonEngine.StringsToPyList, 'StringsToPyList'); + RegisterMethod(@TPythonEngine.StringsToPyTuple, 'StringsToPyTuple'); + RegisterMethod(@TPythonEngine.PyListToStrings, 'PyListToStrings'); + RegisterMethod(@TPythonEngine.PyTupleToStrings, 'PyTupleToStrings'); + RegisterMethod(@TPythonEngine.ReturnNone, 'ReturnNone'); + RegisterMethod(@TPythonEngine.ReturnTrue, 'ReturnTrue'); + RegisterMethod(@TPythonEngine.ReturnFalse, 'ReturnFalse'); + RegisterMethod(@TPythonEngine.FindModule, 'FindModule'); + RegisterMethod(@TPythonEngine.FindFunction, 'FindFunction'); + RegisterMethod(@TPythonEngine.SetToList, 'SetToList'); + RegisterMethod(@TPythonEngine.ListToSet, 'ListToSet'); + RegisterMethod(@TPythonEngine.CheckError, 'CheckError'); + RegisterMethod(@TPythonEngine.GetMainModule, 'GetMainModule'); + RegisterMethod(@TPythonEngine.PyTimeStruct_Check, 'PyTimeStruct_Check'); + RegisterMethod(@TPythonEngine.PyDate_Check, 'PyDate_Check'); + RegisterMethod(@TPythonEngine.PyDate_CheckExact, 'PyDate_CheckExact'); + RegisterMethod(@TPythonEngine.PyDateTime_Check, 'PyDateTime_Check'); + RegisterMethod(@TPythonEngine.PyDateTime_CheckExact, 'PyDateTime_CheckExact'); + RegisterMethod(@TPythonEngine.PyTime_Check, 'PyTime_Check'); + RegisterMethod(@TPythonEngine.PyTime_CheckExact, 'PyTime_CheckExact'); + RegisterMethod(@TPythonEngine.PyDelta_Check, 'PyDelta_Check'); + RegisterMethod(@TPythonEngine.PyDelta_CheckExact, 'PyDelta_CheckExact'); + RegisterMethod(@TPythonEngine.PyTZInfo_Check, 'PyTZInfo_Check'); + RegisterMethod(@TPythonEngine.PyTZInfo_CheckExact, 'PyTZInfo_CheckExact'); + RegisterMethod(@TPythonEnginePyUnicodeFromString11_P, 'PyUnicodeFromString11'); + RegisterMethod(@TPythonEnginePyUnicodeFromString12_P, 'PyUnicodeFromString12'); + RegisterMethod(@TPythonEngine.PyUnicodeAsString, 'PyUnicodeAsString'); + RegisterMethod(@TPythonEngine.PyUnicodeAsUTF8String, 'PyUnicodeAsUTF8String'); + RegisterMethod(@TPythonEngine.PyBytesAsAnsiString, 'PyBytesAsAnsiString'); + RegisterPropertyHelper(@TPythonEngineClientCount_R,nil,'ClientCount'); + RegisterPropertyHelper(@TPythonEngineClients_R,nil,'Clients'); + RegisterPropertyHelper(@TPythonEngineExecModule_R,@TPythonEngineExecModule_W,'ExecModule'); + RegisterPropertyHelper(@TPythonEngineThreadState_R,nil,'ThreadState'); + RegisterPropertyHelper(@TPythonEngineTraceback_R,nil,'Traceback'); + RegisterPropertyHelper(@TPythonEngineLocalVars_R,@TPythonEngineLocalVars_W,'LocalVars'); + RegisterPropertyHelper(@TPythonEngineGlobalVars_R,@TPythonEngineGlobalVars_W,'GlobalVars'); + RegisterPropertyHelper(@TPythonEngineIOPythonModule_R,nil,'IOPythonModule'); + RegisterPropertyHelper(@TPythonEnginePythonHome_R,@TPythonEnginePythonHome_W,'PythonHome'); + RegisterPropertyHelper(@TPythonEnginePythonPath_R,@TPythonEnginePythonPath_W,'PythonPath'); + RegisterPropertyHelper(@TPythonEngineProgramName_R,@TPythonEngineProgramName_W,'ProgramName'); + RegisterPropertyHelper(@TPythonEngineAutoFinalize_R,@TPythonEngineAutoFinalize_W,'AutoFinalize'); + RegisterPropertyHelper(@TPythonEngineVenvPythonExe_R,@TPythonEngineVenvPythonExe_W,'VenvPythonExe'); + RegisterPropertyHelper(@TPythonEngineDatetimeConversionMode_R,@TPythonEngineDatetimeConversionMode_W,'DatetimeConversionMode'); + RegisterPropertyHelper(@TPythonEngineInitScript_R,@TPythonEngineInitScript_W,'InitScript'); + RegisterPropertyHelper(@TPythonEngineInitThreads_R,@TPythonEngineInitThreads_W,'InitThreads'); + RegisterPropertyHelper(@TPythonEngineIO_R,@TPythonEngineIO_W,'IO'); + RegisterPropertyHelper(@TPythonEnginePyFlags_R,@TPythonEnginePyFlags_W,'PyFlags'); + RegisterPropertyHelper(@TPythonEngineRedirectIO_R,@TPythonEngineRedirectIO_W,'RedirectIO'); + RegisterPropertyHelper(@TPythonEngineUseWindowsConsole_R,@TPythonEngineUseWindowsConsole_W,'UseWindowsConsole'); + RegisterPropertyHelper(@TPythonEngineOnAfterInit_R,@TPythonEngineOnAfterInit_W,'OnAfterInit'); + RegisterPropertyHelper(@TPythonEngineOnPathInitialization_R,@TPythonEngineOnPathInitialization_W,'OnPathInitialization'); + RegisterPropertyHelper(@TPythonEngineOnSysPathInit_R,@TPythonEngineOnSysPathInit_W,'OnSysPathInit'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonTraceback(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonTraceback) do + begin + RegisterConstructor(@TPythonTraceback.Create, 'Create'); + RegisterMethod(@TPythonTraceback.Destroy, 'Free'); + RegisterMethod(@TPythonTraceback.Clear, 'Clear'); + RegisterMethod(@TPythonTraceback.Refresh, 'Refresh'); + RegisterMethod(@TPythonTraceback.AddItem, 'AddItem'); + RegisterPropertyHelper(@TPythonTracebackItemCount_R,nil,'ItemCount'); + RegisterPropertyHelper(@TPythonTracebackItems_R,nil,'Items'); + RegisterPropertyHelper(@TPythonTracebackLimit_R,@TPythonTracebackLimit_W,'Limit'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TTracebackItem(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TTracebackItem) do + begin + RegisterPropertyHelper(@TTracebackItemFileName_R,@TTracebackItemFileName_W,'FileName'); + RegisterPropertyHelper(@TTracebackItemLineNo_R,@TTracebackItemLineNo_W,'LineNo'); + RegisterPropertyHelper(@TTracebackItemContext_R,@TTracebackItemContext_W,'Context'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonInterface(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonInterface) do + begin + { RegisterPropertyHelper(@TPythonInterfacePy_DebugFlag_R,@TPythonInterfacePy_DebugFlag_W,'Py_DebugFlag'); + RegisterPropertyHelper(@TPythonInterfacePy_VerboseFlag_R,@TPythonInterfacePy_VerboseFlag_W,'Py_VerboseFlag'); + RegisterPropertyHelper(@TPythonInterfacePy_InteractiveFlag_R,@TPythonInterfacePy_InteractiveFlag_W,'Py_InteractiveFlag'); + RegisterPropertyHelper(@TPythonInterfacePy_OptimizeFlag_R,@TPythonInterfacePy_OptimizeFlag_W,'Py_OptimizeFlag'); + RegisterPropertyHelper(@TPythonInterfacePy_NoSiteFlag_R,@TPythonInterfacePy_NoSiteFlag_W,'Py_NoSiteFlag'); + RegisterPropertyHelper(@TPythonInterfacePy_FrozenFlag_R,@TPythonInterfacePy_FrozenFlag_W,'Py_FrozenFlag'); + RegisterPropertyHelper(@TPythonInterfacePy_IgnoreEnvironmentFlag_R,@TPythonInterfacePy_IgnoreEnvironmentFlag_W,'Py_IgnoreEnvironmentFlag'); + } + RegisterPropertyHelper(@TPythonInterfacePyImport_FrozenModules_R,@TPythonInterfacePyImport_FrozenModules_W,'PyImport_FrozenModules'); + RegisterPropertyHelper(@TPythonInterfacePy_None_R,@TPythonInterfacePy_None_W,'Py_None'); + RegisterPropertyHelper(@TPythonInterfacePy_Ellipsis_R,@TPythonInterfacePy_Ellipsis_W,'Py_Ellipsis'); + RegisterPropertyHelper(@TPythonInterfacePy_False_R,@TPythonInterfacePy_False_W,'Py_False'); + RegisterPropertyHelper(@TPythonInterfacePy_True_R,@TPythonInterfacePy_True_W,'Py_True'); + RegisterPropertyHelper(@TPythonInterfacePy_NotImplemented_R,@TPythonInterfacePy_NotImplemented_W,'Py_NotImplemented'); + RegisterPropertyHelper(@TPythonInterfacePyExc_AttributeError_R,@TPythonInterfacePyExc_AttributeError_W,'PyExc_AttributeError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_EOFError_R,@TPythonInterfacePyExc_EOFError_W,'PyExc_EOFError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_IOError_R,@TPythonInterfacePyExc_IOError_W,'PyExc_IOError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_ImportError_R,@TPythonInterfacePyExc_ImportError_W,'PyExc_ImportError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_IndexError_R,@TPythonInterfacePyExc_IndexError_W,'PyExc_IndexError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_KeyError_R,@TPythonInterfacePyExc_KeyError_W,'PyExc_KeyError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_KeyboardInterrupt_R,@TPythonInterfacePyExc_KeyboardInterrupt_W,'PyExc_KeyboardInterrupt'); + RegisterPropertyHelper(@TPythonInterfacePyExc_MemoryError_R,@TPythonInterfacePyExc_MemoryError_W,'PyExc_MemoryError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_NameError_R,@TPythonInterfacePyExc_NameError_W,'PyExc_NameError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_OverflowError_R,@TPythonInterfacePyExc_OverflowError_W,'PyExc_OverflowError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_RuntimeError_R,@TPythonInterfacePyExc_RuntimeError_W,'PyExc_RuntimeError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_SyntaxError_R,@TPythonInterfacePyExc_SyntaxError_W,'PyExc_SyntaxError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_SystemError_R,@TPythonInterfacePyExc_SystemError_W,'PyExc_SystemError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_SystemExit_R,@TPythonInterfacePyExc_SystemExit_W,'PyExc_SystemExit'); + RegisterPropertyHelper(@TPythonInterfacePyExc_TypeError_R,@TPythonInterfacePyExc_TypeError_W,'PyExc_TypeError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_ValueError_R,@TPythonInterfacePyExc_ValueError_W,'PyExc_ValueError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_ZeroDivisionError_R,@TPythonInterfacePyExc_ZeroDivisionError_W,'PyExc_ZeroDivisionError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_ArithmeticError_R,@TPythonInterfacePyExc_ArithmeticError_W,'PyExc_ArithmeticError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_Exception_R,@TPythonInterfacePyExc_Exception_W,'PyExc_Exception'); + RegisterPropertyHelper(@TPythonInterfacePyExc_FloatingPointError_R,@TPythonInterfacePyExc_FloatingPointError_W,'PyExc_FloatingPointError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_LookupError_R,@TPythonInterfacePyExc_LookupError_W,'PyExc_LookupError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_AssertionError_R,@TPythonInterfacePyExc_AssertionError_W,'PyExc_AssertionError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_EnvironmentError_R,@TPythonInterfacePyExc_EnvironmentError_W,'PyExc_EnvironmentError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_IndentationError_R,@TPythonInterfacePyExc_IndentationError_W,'PyExc_IndentationError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_NotImplementedError_R,@TPythonInterfacePyExc_NotImplementedError_W,'PyExc_NotImplementedError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_OSError_R,@TPythonInterfacePyExc_OSError_W,'PyExc_OSError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_TabError_R,@TPythonInterfacePyExc_TabError_W,'PyExc_TabError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_UnboundLocalError_R,@TPythonInterfacePyExc_UnboundLocalError_W,'PyExc_UnboundLocalError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_UnicodeError_R,@TPythonInterfacePyExc_UnicodeError_W,'PyExc_UnicodeError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_WindowsError_R,@TPythonInterfacePyExc_WindowsError_W,'PyExc_WindowsError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_Warning_R,@TPythonInterfacePyExc_Warning_W,'PyExc_Warning'); + RegisterPropertyHelper(@TPythonInterfacePyExc_DeprecationWarning_R,@TPythonInterfacePyExc_DeprecationWarning_W,'PyExc_DeprecationWarning'); + RegisterPropertyHelper(@TPythonInterfacePyExc_RuntimeWarning_R,@TPythonInterfacePyExc_RuntimeWarning_W,'PyExc_RuntimeWarning'); + RegisterPropertyHelper(@TPythonInterfacePyExc_SyntaxWarning_R,@TPythonInterfacePyExc_SyntaxWarning_W,'PyExc_SyntaxWarning'); + RegisterPropertyHelper(@TPythonInterfacePyExc_UserWarning_R,@TPythonInterfacePyExc_UserWarning_W,'PyExc_UserWarning'); + RegisterPropertyHelper(@TPythonInterfacePyExc_ReferenceError_R,@TPythonInterfacePyExc_ReferenceError_W,'PyExc_ReferenceError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_StopIteration_R,@TPythonInterfacePyExc_StopIteration_W,'PyExc_StopIteration'); + RegisterPropertyHelper(@TPythonInterfacePyExc_FutureWarning_R,@TPythonInterfacePyExc_FutureWarning_W,'PyExc_FutureWarning'); + RegisterPropertyHelper(@TPythonInterfacePyExc_PendingDeprecationWarning_R,@TPythonInterfacePyExc_PendingDeprecationWarning_W,'PyExc_PendingDeprecationWarning'); + RegisterPropertyHelper(@TPythonInterfacePyExc_UnicodeDecodeError_R,@TPythonInterfacePyExc_UnicodeDecodeError_W,'PyExc_UnicodeDecodeError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_UnicodeEncodeError_R,@TPythonInterfacePyExc_UnicodeEncodeError_W,'PyExc_UnicodeEncodeError'); + RegisterPropertyHelper(@TPythonInterfacePyExc_UnicodeTranslateError_R,@TPythonInterfacePyExc_UnicodeTranslateError_W,'PyExc_UnicodeTranslateError'); + RegisterPropertyHelper(@TPythonInterfacePyCode_Type_R,@TPythonInterfacePyCode_Type_W,'PyCode_Type'); + RegisterPropertyHelper(@TPythonInterfacePyType_Type_R,@TPythonInterfacePyType_Type_W,'PyType_Type'); + RegisterPropertyHelper(@TPythonInterfacePyCFunction_Type_R,@TPythonInterfacePyCFunction_Type_W,'PyCFunction_Type'); + RegisterPropertyHelper(@TPythonInterfacePyComplex_Type_R,@TPythonInterfacePyComplex_Type_W,'PyComplex_Type'); + RegisterPropertyHelper(@TPythonInterfacePyDict_Type_R,@TPythonInterfacePyDict_Type_W,'PyDict_Type'); + RegisterPropertyHelper(@TPythonInterfacePyFloat_Type_R,@TPythonInterfacePyFloat_Type_W,'PyFloat_Type'); + RegisterPropertyHelper(@TPythonInterfacePyFrame_Type_R,@TPythonInterfacePyFrame_Type_W,'PyFrame_Type'); + RegisterPropertyHelper(@TPythonInterfacePyFunction_Type_R,@TPythonInterfacePyFunction_Type_W,'PyFunction_Type'); + RegisterPropertyHelper(@TPythonInterfacePyList_Type_R,@TPythonInterfacePyList_Type_W,'PyList_Type'); + RegisterPropertyHelper(@TPythonInterfacePyLong_Type_R,@TPythonInterfacePyLong_Type_W,'PyLong_Type'); + RegisterPropertyHelper(@TPythonInterfacePyMethod_Type_R,@TPythonInterfacePyMethod_Type_W,'PyMethod_Type'); + RegisterPropertyHelper(@TPythonInterfacePyModule_Type_R,@TPythonInterfacePyModule_Type_W,'PyModule_Type'); + RegisterPropertyHelper(@TPythonInterfacePyObject_Type_R,@TPythonInterfacePyObject_Type_W,'PyObject_Type'); + RegisterPropertyHelper(@TPythonInterfacePyRange_Type_R,@TPythonInterfacePyRange_Type_W,'PyRange_Type'); + RegisterPropertyHelper(@TPythonInterfacePySlice_Type_R,@TPythonInterfacePySlice_Type_W,'PySlice_Type'); + RegisterPropertyHelper(@TPythonInterfacePyBytes_Type_R,@TPythonInterfacePyBytes_Type_W,'PyBytes_Type'); + RegisterPropertyHelper(@TPythonInterfacePyTuple_Type_R,@TPythonInterfacePyTuple_Type_W,'PyTuple_Type'); + RegisterPropertyHelper(@TPythonInterfacePyBaseObject_Type_R,@TPythonInterfacePyBaseObject_Type_W,'PyBaseObject_Type'); + RegisterPropertyHelper(@TPythonInterfacePyCallIter_Type_R,@TPythonInterfacePyCallIter_Type_W,'PyCallIter_Type'); + RegisterPropertyHelper(@TPythonInterfacePyCell_Type_R,@TPythonInterfacePyCell_Type_W,'PyCell_Type'); + RegisterPropertyHelper(@TPythonInterfacePyClassMethod_Type_R,@TPythonInterfacePyClassMethod_Type_W,'PyClassMethod_Type'); + RegisterPropertyHelper(@TPythonInterfacePyProperty_Type_R,@TPythonInterfacePyProperty_Type_W,'PyProperty_Type'); + RegisterPropertyHelper(@TPythonInterfacePySeqIter_Type_R,@TPythonInterfacePySeqIter_Type_W,'PySeqIter_Type'); + RegisterPropertyHelper(@TPythonInterfacePyStaticMethod_Type_R,@TPythonInterfacePyStaticMethod_Type_W,'PyStaticMethod_Type'); + RegisterPropertyHelper(@TPythonInterfacePySuper_Type_R,@TPythonInterfacePySuper_Type_W,'PySuper_Type'); + RegisterPropertyHelper(@TPythonInterfacePyTraceBack_Type_R,@TPythonInterfacePyTraceBack_Type_W,'PyTraceBack_Type'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_Type_R,@TPythonInterfacePyUnicode_Type_W,'PyUnicode_Type'); + RegisterPropertyHelper(@TPythonInterfacePyWrapperDescr_Type_R,@TPythonInterfacePyWrapperDescr_Type_W,'PyWrapperDescr_Type'); + RegisterPropertyHelper(@TPythonInterface_PyWeakref_RefType_R,@TPythonInterface_PyWeakref_RefType_W,'_PyWeakref_RefType'); + RegisterPropertyHelper(@TPythonInterface_PyWeakref_ProxyType_R,@TPythonInterface_PyWeakref_ProxyType_W,'_PyWeakref_ProxyType'); + RegisterPropertyHelper(@TPythonInterface_PyWeakref_CallableProxyType_R,@TPythonInterface_PyWeakref_CallableProxyType_W,'_PyWeakref_CallableProxyType'); + RegisterPropertyHelper(@TPythonInterfacePyBool_Type_R,@TPythonInterfacePyBool_Type_W,'PyBool_Type'); + RegisterPropertyHelper(@TPythonInterfacePyEnum_Type_R,@TPythonInterfacePyEnum_Type_W,'PyEnum_Type'); + //RegisterPropertyHelper(@TPythonInterfacePy_GetBuildInfo_R,@TPythonInterfacePy_GetBuildInfo_W,'Py_GetBuildInfo'); + //RegisterPropertyHelper(@TPythonInterfacePyImport_ExecCodeModule_R,@TPythonInterfacePyImport_ExecCodeModule_W,'PyImport_ExecCodeModule'); + { RegisterPropertyHelper(@TPythonInterfacePyComplex_FromCComplex_R,@TPythonInterfacePyComplex_FromCComplex_W,'PyComplex_FromCComplex'); + RegisterPropertyHelper(@TPythonInterfacePyComplex_FromDoubles_R,@TPythonInterfacePyComplex_FromDoubles_W,'PyComplex_FromDoubles'); + RegisterPropertyHelper(@TPythonInterfacePyComplex_RealAsDouble_R,@TPythonInterfacePyComplex_RealAsDouble_W,'PyComplex_RealAsDouble'); + RegisterPropertyHelper(@TPythonInterfacePyComplex_ImagAsDouble_R,@TPythonInterfacePyComplex_ImagAsDouble_W,'PyComplex_ImagAsDouble'); + RegisterPropertyHelper(@TPythonInterfacePyComplex_AsCComplex_R,@TPythonInterfacePyComplex_AsCComplex_W,'PyComplex_AsCComplex'); + RegisterPropertyHelper(@TPythonInterfacePyCFunction_GetFunction_R,@TPythonInterfacePyCFunction_GetFunction_W,'PyCFunction_GetFunction'); + RegisterPropertyHelper(@TPythonInterfacePyCFunction_GetSelf_R,@TPythonInterfacePyCFunction_GetSelf_W,'PyCFunction_GetSelf'); + RegisterPropertyHelper(@TPythonInterfacePyCallable_Check_R,@TPythonInterfacePyCallable_Check_W,'PyCallable_Check'); + RegisterPropertyHelper(@TPythonInterfacePyModule_Create2_R,@TPythonInterfacePyModule_Create2_W,'PyModule_Create2'); + RegisterPropertyHelper(@TPythonInterfacePyErr_BadArgument_R,@TPythonInterfacePyErr_BadArgument_W,'PyErr_BadArgument'); + RegisterPropertyHelper(@TPythonInterfacePyErr_BadInternalCall_R,@TPythonInterfacePyErr_BadInternalCall_W,'PyErr_BadInternalCall'); + RegisterPropertyHelper(@TPythonInterfacePyErr_CheckSignals_R,@TPythonInterfacePyErr_CheckSignals_W,'PyErr_CheckSignals'); + RegisterPropertyHelper(@TPythonInterfacePyErr_Clear_R,@TPythonInterfacePyErr_Clear_W,'PyErr_Clear'); + RegisterPropertyHelper(@TPythonInterfacePyErr_Fetch_R,@TPythonInterfacePyErr_Fetch_W,'PyErr_Fetch'); + RegisterPropertyHelper(@TPythonInterfacePyErr_NoMemory_R,@TPythonInterfacePyErr_NoMemory_W,'PyErr_NoMemory'); + RegisterPropertyHelper(@TPythonInterfacePyErr_Occurred_R,@TPythonInterfacePyErr_Occurred_W,'PyErr_Occurred'); + RegisterPropertyHelper(@TPythonInterfacePyErr_Print_R,@TPythonInterfacePyErr_Print_W,'PyErr_Print'); + RegisterPropertyHelper(@TPythonInterfacePyErr_Restore_R,@TPythonInterfacePyErr_Restore_W,'PyErr_Restore'); + RegisterPropertyHelper(@TPythonInterfacePyErr_SetFromErrno_R,@TPythonInterfacePyErr_SetFromErrno_W,'PyErr_SetFromErrno'); + RegisterPropertyHelper(@TPythonInterfacePyErr_SetNone_R,@TPythonInterfacePyErr_SetNone_W,'PyErr_SetNone'); + RegisterPropertyHelper(@TPythonInterfacePyErr_SetObject_R,@TPythonInterfacePyErr_SetObject_W,'PyErr_SetObject'); + RegisterPropertyHelper(@TPythonInterfacePyErr_SetString_R,@TPythonInterfacePyErr_SetString_W,'PyErr_SetString'); + RegisterPropertyHelper(@TPythonInterfacePyErr_WarnEx_R,@TPythonInterfacePyErr_WarnEx_W,'PyErr_WarnEx'); + RegisterPropertyHelper(@TPythonInterfacePyErr_WarnExplicit_R,@TPythonInterfacePyErr_WarnExplicit_W,'PyErr_WarnExplicit'); + RegisterPropertyHelper(@TPythonInterfacePyImport_GetModuleDict_R,@TPythonInterfacePyImport_GetModuleDict_W,'PyImport_GetModuleDict'); + RegisterPropertyHelper(@TPythonInterfacePyArg_Parse_R,@TPythonInterfacePyArg_Parse_W,'PyArg_Parse'); + RegisterPropertyHelper(@TPythonInterfacePyArg_ParseTuple_R,@TPythonInterfacePyArg_ParseTuple_W,'PyArg_ParseTuple'); + RegisterPropertyHelper(@TPythonInterfacePyArg_ParseTupleAndKeywords_R,@TPythonInterfacePyArg_ParseTupleAndKeywords_W,'PyArg_ParseTupleAndKeywords'); + RegisterPropertyHelper(@TPythonInterfacePy_BuildValue_R,@TPythonInterfacePy_BuildValue_W,'Py_BuildValue'); + RegisterPropertyHelper(@TPythonInterfacePy_Initialize_R,@TPythonInterfacePy_Initialize_W,'Py_Initialize'); + RegisterPropertyHelper(@TPythonInterfacePy_Exit_R,@TPythonInterfacePy_Exit_W,'Py_Exit'); + RegisterPropertyHelper(@TPythonInterfacePyEval_GetBuiltins_R,@TPythonInterfacePyEval_GetBuiltins_W,'PyEval_GetBuiltins'); + RegisterPropertyHelper(@TPythonInterfacePyDict_Copy_R,@TPythonInterfacePyDict_Copy_W,'PyDict_Copy'); + RegisterPropertyHelper(@TPythonInterfacePyDict_GetItem_R,@TPythonInterfacePyDict_GetItem_W,'PyDict_GetItem'); + RegisterPropertyHelper(@TPythonInterfacePyDict_SetItem_R,@TPythonInterfacePyDict_SetItem_W,'PyDict_SetItem'); + RegisterPropertyHelper(@TPythonInterfacePyDict_DelItem_R,@TPythonInterfacePyDict_DelItem_W,'PyDict_DelItem'); + RegisterPropertyHelper(@TPythonInterfacePyDict_Clear_R,@TPythonInterfacePyDict_Clear_W,'PyDict_Clear'); + RegisterPropertyHelper(@TPythonInterfacePyDict_Next_R,@TPythonInterfacePyDict_Next_W,'PyDict_Next'); + RegisterPropertyHelper(@TPythonInterfacePyDict_Keys_R,@TPythonInterfacePyDict_Keys_W,'PyDict_Keys'); + RegisterPropertyHelper(@TPythonInterfacePyDict_Values_R,@TPythonInterfacePyDict_Values_W,'PyDict_Values'); + RegisterPropertyHelper(@TPythonInterfacePyDict_Items_R,@TPythonInterfacePyDict_Items_W,'PyDict_Items'); + RegisterPropertyHelper(@TPythonInterfacePyDict_Size_R,@TPythonInterfacePyDict_Size_W,'PyDict_Size'); + RegisterPropertyHelper(@TPythonInterfacePyDict_Update_R,@TPythonInterfacePyDict_Update_W,'PyDict_Update'); + RegisterPropertyHelper(@TPythonInterfacePyDict_DelItemString_R,@TPythonInterfacePyDict_DelItemString_W,'PyDict_DelItemString'); + RegisterPropertyHelper(@TPythonInterfacePyDict_New_R,@TPythonInterfacePyDict_New_W,'PyDict_New'); + RegisterPropertyHelper(@TPythonInterfacePyDict_GetItemString_R,@TPythonInterfacePyDict_GetItemString_W,'PyDict_GetItemString'); + RegisterPropertyHelper(@TPythonInterfacePyDict_SetItemString_R,@TPythonInterfacePyDict_SetItemString_W,'PyDict_SetItemString'); + RegisterPropertyHelper(@TPythonInterfacePyDictProxy_New_R,@TPythonInterfacePyDictProxy_New_W,'PyDictProxy_New'); + } + {RegisterPropertyHelper(@TPythonInterfacePyModule_GetDict_R,@TPythonInterfacePyModule_GetDict_W,'PyModule_GetDict'); + RegisterPropertyHelper(@TPythonInterfacePyObject_Str_R,@TPythonInterfacePyObject_Str_W,'PyObject_Str'); + RegisterPropertyHelper(@TPythonInterfacePyRun_String_R,@TPythonInterfacePyRun_String_W,'PyRun_String'); + RegisterPropertyHelper(@TPythonInterfacePyRun_SimpleString_R,@TPythonInterfacePyRun_SimpleString_W,'PyRun_SimpleString'); + RegisterPropertyHelper(@TPythonInterfacePyBytes_AsString_R,@TPythonInterfacePyBytes_AsString_W,'PyBytes_AsString'); + RegisterPropertyHelper(@TPythonInterfacePyBytes_AsStringAndSize_R,@TPythonInterfacePyBytes_AsStringAndSize_W,'PyBytes_AsStringAndSize'); + RegisterPropertyHelper(@TPythonInterfacePySys_SetArgv_R,@TPythonInterfacePySys_SetArgv_W,'PySys_SetArgv'); + RegisterPropertyHelper(@TPythonInterfacePyCFunction_NewEx_R,@TPythonInterfacePyCFunction_NewEx_W,'PyCFunction_NewEx'); + RegisterPropertyHelper(@TPythonInterfacePyEval_CallObjectWithKeywords_R,@TPythonInterfacePyEval_CallObjectWithKeywords_W,'PyEval_CallObjectWithKeywords'); + RegisterPropertyHelper(@TPythonInterfacePyEval_GetFrame_R,@TPythonInterfacePyEval_GetFrame_W,'PyEval_GetFrame'); + RegisterPropertyHelper(@TPythonInterfacePyEval_GetGlobals_R,@TPythonInterfacePyEval_GetGlobals_W,'PyEval_GetGlobals'); + RegisterPropertyHelper(@TPythonInterfacePyEval_GetLocals_R,@TPythonInterfacePyEval_GetLocals_W,'PyEval_GetLocals'); + RegisterPropertyHelper(@TPythonInterfacePyEval_InitThreads_R,@TPythonInterfacePyEval_InitThreads_W,'PyEval_InitThreads'); + RegisterPropertyHelper(@TPythonInterfacePyEval_RestoreThread_R,@TPythonInterfacePyEval_RestoreThread_W,'PyEval_RestoreThread'); + RegisterPropertyHelper(@TPythonInterfacePyEval_SaveThread_R,@TPythonInterfacePyEval_SaveThread_W,'PyEval_SaveThread'); + RegisterPropertyHelper(@TPythonInterfacePyFile_GetLine_R,@TPythonInterfacePyFile_GetLine_W,'PyFile_GetLine'); + RegisterPropertyHelper(@TPythonInterfacePyFile_WriteObject_R,@TPythonInterfacePyFile_WriteObject_W,'PyFile_WriteObject'); + RegisterPropertyHelper(@TPythonInterfacePyFile_WriteString_R,@TPythonInterfacePyFile_WriteString_W,'PyFile_WriteString'); + RegisterPropertyHelper(@TPythonInterfacePyFloat_AsDouble_R,@TPythonInterfacePyFloat_AsDouble_W,'PyFloat_AsDouble'); + RegisterPropertyHelper(@TPythonInterfacePyFloat_FromDouble_R,@TPythonInterfacePyFloat_FromDouble_W,'PyFloat_FromDouble'); + RegisterPropertyHelper(@TPythonInterfacePyFloat_FromString_R,@TPythonInterfacePyFloat_FromString_W,'PyFloat_FromString'); + RegisterPropertyHelper(@TPythonInterfacePyFunction_GetCode_R,@TPythonInterfacePyFunction_GetCode_W,'PyFunction_GetCode'); + RegisterPropertyHelper(@TPythonInterfacePyFunction_GetGlobals_R,@TPythonInterfacePyFunction_GetGlobals_W,'PyFunction_GetGlobals'); + RegisterPropertyHelper(@TPythonInterfacePyFunction_New_R,@TPythonInterfacePyFunction_New_W,'PyFunction_New'); + RegisterPropertyHelper(@TPythonInterfacePyImport_AddModule_R,@TPythonInterfacePyImport_AddModule_W,'PyImport_AddModule'); + RegisterPropertyHelper(@TPythonInterfacePyImport_GetMagicNumber_R,@TPythonInterfacePyImport_GetMagicNumber_W,'PyImport_GetMagicNumber'); + RegisterPropertyHelper(@TPythonInterfacePyImport_ImportFrozenModule_R,@TPythonInterfacePyImport_ImportFrozenModule_W,'PyImport_ImportFrozenModule'); + RegisterPropertyHelper(@TPythonInterfacePyImport_ImportModule_R,@TPythonInterfacePyImport_ImportModule_W,'PyImport_ImportModule'); + RegisterPropertyHelper(@TPythonInterfacePyImport_Import_R,@TPythonInterfacePyImport_Import_W,'PyImport_Import'); + RegisterPropertyHelper(@TPythonInterfacePyImport_ReloadModule_R,@TPythonInterfacePyImport_ReloadModule_W,'PyImport_ReloadModule'); + RegisterPropertyHelper(@TPythonInterfacePyList_Append_R,@TPythonInterfacePyList_Append_W,'PyList_Append'); + RegisterPropertyHelper(@TPythonInterfacePyList_AsTuple_R,@TPythonInterfacePyList_AsTuple_W,'PyList_AsTuple'); + RegisterPropertyHelper(@TPythonInterfacePyList_GetItem_R,@TPythonInterfacePyList_GetItem_W,'PyList_GetItem'); + RegisterPropertyHelper(@TPythonInterfacePyList_GetSlice_R,@TPythonInterfacePyList_GetSlice_W,'PyList_GetSlice'); + RegisterPropertyHelper(@TPythonInterfacePyList_Insert_R,@TPythonInterfacePyList_Insert_W,'PyList_Insert'); + RegisterPropertyHelper(@TPythonInterfacePyList_New_R,@TPythonInterfacePyList_New_W,'PyList_New'); + RegisterPropertyHelper(@TPythonInterfacePyList_Reverse_R,@TPythonInterfacePyList_Reverse_W,'PyList_Reverse'); + RegisterPropertyHelper(@TPythonInterfacePyList_SetItem_R,@TPythonInterfacePyList_SetItem_W,'PyList_SetItem'); + RegisterPropertyHelper(@TPythonInterfacePyList_SetSlice_R,@TPythonInterfacePyList_SetSlice_W,'PyList_SetSlice'); + RegisterPropertyHelper(@TPythonInterfacePyList_Size_R,@TPythonInterfacePyList_Size_W,'PyList_Size'); + RegisterPropertyHelper(@TPythonInterfacePyList_Sort_R,@TPythonInterfacePyList_Sort_W,'PyList_Sort'); + RegisterPropertyHelper(@TPythonInterfacePyLong_AsDouble_R,@TPythonInterfacePyLong_AsDouble_W,'PyLong_AsDouble'); + RegisterPropertyHelper(@TPythonInterfacePyLong_AsLong_R,@TPythonInterfacePyLong_AsLong_W,'PyLong_AsLong'); + RegisterPropertyHelper(@TPythonInterfacePyLong_FromDouble_R,@TPythonInterfacePyLong_FromDouble_W,'PyLong_FromDouble'); + RegisterPropertyHelper(@TPythonInterfacePyLong_FromLong_R,@TPythonInterfacePyLong_FromLong_W,'PyLong_FromLong'); + RegisterPropertyHelper(@TPythonInterfacePyLong_FromString_R,@TPythonInterfacePyLong_FromString_W,'PyLong_FromString'); + RegisterPropertyHelper(@TPythonInterfacePyLong_FromUnsignedLong_R,@TPythonInterfacePyLong_FromUnsignedLong_W,'PyLong_FromUnsignedLong'); + RegisterPropertyHelper(@TPythonInterfacePyLong_AsUnsignedLong_R,@TPythonInterfacePyLong_AsUnsignedLong_W,'PyLong_AsUnsignedLong'); + RegisterPropertyHelper(@TPythonInterfacePyLong_FromUnicodeObject_R,@TPythonInterfacePyLong_FromUnicodeObject_W,'PyLong_FromUnicodeObject'); + RegisterPropertyHelper(@TPythonInterfacePyLong_FromLongLong_R,@TPythonInterfacePyLong_FromLongLong_W,'PyLong_FromLongLong'); + RegisterPropertyHelper(@TPythonInterfacePyLong_FromUnsignedLongLong_R,@TPythonInterfacePyLong_FromUnsignedLongLong_W,'PyLong_FromUnsignedLongLong'); + RegisterPropertyHelper(@TPythonInterfacePyLong_AsLongLong_R,@TPythonInterfacePyLong_AsLongLong_W,'PyLong_AsLongLong'); + RegisterPropertyHelper(@TPythonInterfacePyLong_FromVoidPtr_R,@TPythonInterfacePyLong_FromVoidPtr_W,'PyLong_FromVoidPtr'); + RegisterPropertyHelper(@TPythonInterfacePyMapping_Check_R,@TPythonInterfacePyMapping_Check_W,'PyMapping_Check'); + RegisterPropertyHelper(@TPythonInterfacePyMapping_GetItemString_R,@TPythonInterfacePyMapping_GetItemString_W,'PyMapping_GetItemString'); + RegisterPropertyHelper(@TPythonInterfacePyMapping_HasKey_R,@TPythonInterfacePyMapping_HasKey_W,'PyMapping_HasKey'); + RegisterPropertyHelper(@TPythonInterfacePyMapping_HasKeyString_R,@TPythonInterfacePyMapping_HasKeyString_W,'PyMapping_HasKeyString'); + RegisterPropertyHelper(@TPythonInterfacePyMapping_Length_R,@TPythonInterfacePyMapping_Length_W,'PyMapping_Length'); + RegisterPropertyHelper(@TPythonInterfacePyMapping_SetItemString_R,@TPythonInterfacePyMapping_SetItemString_W,'PyMapping_SetItemString'); + RegisterPropertyHelper(@TPythonInterfacePyMethod_Function_R,@TPythonInterfacePyMethod_Function_W,'PyMethod_Function'); + RegisterPropertyHelper(@TPythonInterfacePyMethod_New_R,@TPythonInterfacePyMethod_New_W,'PyMethod_New'); + RegisterPropertyHelper(@TPythonInterfacePyMethod_Self_R,@TPythonInterfacePyMethod_Self_W,'PyMethod_Self'); + RegisterPropertyHelper(@TPythonInterfacePyModule_GetName_R,@TPythonInterfacePyModule_GetName_W,'PyModule_GetName'); + RegisterPropertyHelper(@TPythonInterfacePyModule_New_R,@TPythonInterfacePyModule_New_W,'PyModule_New'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Absolute_R,@TPythonInterfacePyNumber_Absolute_W,'PyNumber_Absolute'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Add_R,@TPythonInterfacePyNumber_Add_W,'PyNumber_Add'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_And_R,@TPythonInterfacePyNumber_And_W,'PyNumber_And'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Check_R,@TPythonInterfacePyNumber_Check_W,'PyNumber_Check'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_FloorDivide_R,@TPythonInterfacePyNumber_FloorDivide_W,'PyNumber_FloorDivide'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_TrueDivide_R,@TPythonInterfacePyNumber_TrueDivide_W,'PyNumber_TrueDivide'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Divmod_R,@TPythonInterfacePyNumber_Divmod_W,'PyNumber_Divmod'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Float_R,@TPythonInterfacePyNumber_Float_W,'PyNumber_Float'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Invert_R,@TPythonInterfacePyNumber_Invert_W,'PyNumber_Invert'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Long_R,@TPythonInterfacePyNumber_Long_W,'PyNumber_Long'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Lshift_R,@TPythonInterfacePyNumber_Lshift_W,'PyNumber_Lshift'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Multiply_R,@TPythonInterfacePyNumber_Multiply_W,'PyNumber_Multiply'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Negative_R,@TPythonInterfacePyNumber_Negative_W,'PyNumber_Negative'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Or_R,@TPythonInterfacePyNumber_Or_W,'PyNumber_Or'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Positive_R,@TPythonInterfacePyNumber_Positive_W,'PyNumber_Positive'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Power_R,@TPythonInterfacePyNumber_Power_W,'PyNumber_Power'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Remainder_R,@TPythonInterfacePyNumber_Remainder_W,'PyNumber_Remainder'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Rshift_R,@TPythonInterfacePyNumber_Rshift_W,'PyNumber_Rshift'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Subtract_R,@TPythonInterfacePyNumber_Subtract_W,'PyNumber_Subtract'); + RegisterPropertyHelper(@TPythonInterfacePyNumber_Xor_R,@TPythonInterfacePyNumber_Xor_W,'PyNumber_Xor'); + RegisterPropertyHelper(@TPythonInterfacePyOS_InterruptOccurred_R,@TPythonInterfacePyOS_InterruptOccurred_W,'PyOS_InterruptOccurred'); + RegisterPropertyHelper(@TPythonInterfacePyObject_CallObject_R,@TPythonInterfacePyObject_CallObject_W,'PyObject_CallObject'); + RegisterPropertyHelper(@TPythonInterfacePyObject_RichCompare_R,@TPythonInterfacePyObject_RichCompare_W,'PyObject_RichCompare'); + RegisterPropertyHelper(@TPythonInterfacePyObject_RichCompareBool_R,@TPythonInterfacePyObject_RichCompareBool_W,'PyObject_RichCompareBool'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GetAttr_R,@TPythonInterfacePyObject_GetAttr_W,'PyObject_GetAttr'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GetAttrString_R,@TPythonInterfacePyObject_GetAttrString_W,'PyObject_GetAttrString'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GetItem_R,@TPythonInterfacePyObject_GetItem_W,'PyObject_GetItem'); + RegisterPropertyHelper(@TPythonInterfacePyObject_DelItem_R,@TPythonInterfacePyObject_DelItem_W,'PyObject_DelItem'); + RegisterPropertyHelper(@TPythonInterfacePyObject_HasAttrString_R,@TPythonInterfacePyObject_HasAttrString_W,'PyObject_HasAttrString'); + RegisterPropertyHelper(@TPythonInterfacePyObject_Hash_R,@TPythonInterfacePyObject_Hash_W,'PyObject_Hash'); + RegisterPropertyHelper(@TPythonInterfacePyObject_IsTrue_R,@TPythonInterfacePyObject_IsTrue_W,'PyObject_IsTrue'); + RegisterPropertyHelper(@TPythonInterfacePyObject_Length_R,@TPythonInterfacePyObject_Length_W,'PyObject_Length'); + RegisterPropertyHelper(@TPythonInterfacePyObject_Repr_R,@TPythonInterfacePyObject_Repr_W,'PyObject_Repr'); + RegisterPropertyHelper(@TPythonInterfacePyObject_SetAttr_R,@TPythonInterfacePyObject_SetAttr_W,'PyObject_SetAttr'); + RegisterPropertyHelper(@TPythonInterfacePyObject_SetAttrString_R,@TPythonInterfacePyObject_SetAttrString_W,'PyObject_SetAttrString'); + RegisterPropertyHelper(@TPythonInterfacePyObject_SetItem_R,@TPythonInterfacePyObject_SetItem_W,'PyObject_SetItem'); + RegisterPropertyHelper(@TPythonInterfacePyObject_Init_R,@TPythonInterfacePyObject_Init_W,'PyObject_Init'); + RegisterPropertyHelper(@TPythonInterfacePyObject_InitVar_R,@TPythonInterfacePyObject_InitVar_W,'PyObject_InitVar'); + RegisterPropertyHelper(@TPythonInterfacePyObject_New_R,@TPythonInterfacePyObject_New_W,'PyObject_New'); + RegisterPropertyHelper(@TPythonInterfacePyObject_NewVar_R,@TPythonInterfacePyObject_NewVar_W,'PyObject_NewVar'); + RegisterPropertyHelper(@TPythonInterfacePyObject_Free_R,@TPythonInterfacePyObject_Free_W,'PyObject_Free'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GetIter_R,@TPythonInterfacePyObject_GetIter_W,'PyObject_GetIter'); + RegisterPropertyHelper(@TPythonInterfacePyIter_Next_R,@TPythonInterfacePyIter_Next_W,'PyIter_Next'); + RegisterPropertyHelper(@TPythonInterfacePyObject_IsInstance_R,@TPythonInterfacePyObject_IsInstance_W,'PyObject_IsInstance'); + RegisterPropertyHelper(@TPythonInterfacePyObject_IsSubclass_R,@TPythonInterfacePyObject_IsSubclass_W,'PyObject_IsSubclass'); + RegisterPropertyHelper(@TPythonInterfacePyObject_Call_R,@TPythonInterfacePyObject_Call_W,'PyObject_Call'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GenericGetAttr_R,@TPythonInterfacePyObject_GenericGetAttr_W,'PyObject_GenericGetAttr'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GenericSetAttr_R,@TPythonInterfacePyObject_GenericSetAttr_W,'PyObject_GenericSetAttr'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GC_Malloc_R,@TPythonInterfacePyObject_GC_Malloc_W,'PyObject_GC_Malloc'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GC_New_R,@TPythonInterfacePyObject_GC_New_W,'PyObject_GC_New'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GC_NewVar_R,@TPythonInterfacePyObject_GC_NewVar_W,'PyObject_GC_NewVar'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GC_Resize_R,@TPythonInterfacePyObject_GC_Resize_W,'PyObject_GC_Resize'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GC_Del_R,@TPythonInterfacePyObject_GC_Del_W,'PyObject_GC_Del'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GC_Track_R,@TPythonInterfacePyObject_GC_Track_W,'PyObject_GC_Track'); + RegisterPropertyHelper(@TPythonInterfacePyObject_GC_UnTrack_R,@TPythonInterfacePyObject_GC_UnTrack_W,'PyObject_GC_UnTrack'); + RegisterPropertyHelper(@TPythonInterfacePySequence_Check_R,@TPythonInterfacePySequence_Check_W,'PySequence_Check'); + RegisterPropertyHelper(@TPythonInterfacePySequence_Concat_R,@TPythonInterfacePySequence_Concat_W,'PySequence_Concat'); + RegisterPropertyHelper(@TPythonInterfacePySequence_Count_R,@TPythonInterfacePySequence_Count_W,'PySequence_Count'); + RegisterPropertyHelper(@TPythonInterfacePySequence_GetItem_R,@TPythonInterfacePySequence_GetItem_W,'PySequence_GetItem'); + RegisterPropertyHelper(@TPythonInterfacePySequence_GetSlice_R,@TPythonInterfacePySequence_GetSlice_W,'PySequence_GetSlice'); + RegisterPropertyHelper(@TPythonInterfacePySequence_In_R,@TPythonInterfacePySequence_In_W,'PySequence_In'); + RegisterPropertyHelper(@TPythonInterfacePySequence_Index_R,@TPythonInterfacePySequence_Index_W,'PySequence_Index'); + RegisterPropertyHelper(@TPythonInterfacePySequence_Length_R,@TPythonInterfacePySequence_Length_W,'PySequence_Length'); + RegisterPropertyHelper(@TPythonInterfacePySequence_Repeat_R,@TPythonInterfacePySequence_Repeat_W,'PySequence_Repeat'); + RegisterPropertyHelper(@TPythonInterfacePySequence_SetItem_R,@TPythonInterfacePySequence_SetItem_W,'PySequence_SetItem'); + RegisterPropertyHelper(@TPythonInterfacePySequence_SetSlice_R,@TPythonInterfacePySequence_SetSlice_W,'PySequence_SetSlice'); + RegisterPropertyHelper(@TPythonInterfacePySequence_DelSlice_R,@TPythonInterfacePySequence_DelSlice_W,'PySequence_DelSlice'); + RegisterPropertyHelper(@TPythonInterfacePySequence_Tuple_R,@TPythonInterfacePySequence_Tuple_W,'PySequence_Tuple'); + RegisterPropertyHelper(@TPythonInterfacePySequence_Contains_R,@TPythonInterfacePySequence_Contains_W,'PySequence_Contains'); + RegisterPropertyHelper(@TPythonInterfacePySequence_List_R,@TPythonInterfacePySequence_List_W,'PySequence_List'); + RegisterPropertyHelper(@TPythonInterfacePySeqIter_New_R,@TPythonInterfacePySeqIter_New_W,'PySeqIter_New'); + RegisterPropertyHelper(@TPythonInterfacePySlice_GetIndices_R,@TPythonInterfacePySlice_GetIndices_W,'PySlice_GetIndices'); + RegisterPropertyHelper(@TPythonInterfacePySlice_GetIndicesEx_R,@TPythonInterfacePySlice_GetIndicesEx_W,'PySlice_GetIndicesEx'); + RegisterPropertyHelper(@TPythonInterfacePySlice_New_R,@TPythonInterfacePySlice_New_W,'PySlice_New'); + RegisterPropertyHelper(@TPythonInterfacePyBytes_Concat_R,@TPythonInterfacePyBytes_Concat_W,'PyBytes_Concat'); + RegisterPropertyHelper(@TPythonInterfacePyBytes_ConcatAndDel_R,@TPythonInterfacePyBytes_ConcatAndDel_W,'PyBytes_ConcatAndDel'); + RegisterPropertyHelper(@TPythonInterfacePyBytes_FromString_R,@TPythonInterfacePyBytes_FromString_W,'PyBytes_FromString'); + RegisterPropertyHelper(@TPythonInterfacePyBytes_FromStringAndSize_R,@TPythonInterfacePyBytes_FromStringAndSize_W,'PyBytes_FromStringAndSize'); + RegisterPropertyHelper(@TPythonInterfacePyBytes_Size_R,@TPythonInterfacePyBytes_Size_W,'PyBytes_Size'); + RegisterPropertyHelper(@TPythonInterfacePyBytes_DecodeEscape_R,@TPythonInterfacePyBytes_DecodeEscape_W,'PyBytes_DecodeEscape'); + RegisterPropertyHelper(@TPythonInterfacePyBytes_Repr_R,@TPythonInterfacePyBytes_Repr_W,'PyBytes_Repr'); + RegisterPropertyHelper(@TPythonInterfacePySys_GetObject_R,@TPythonInterfacePySys_GetObject_W,'PySys_GetObject'); + RegisterPropertyHelper(@TPythonInterfacePySys_SetObject_R,@TPythonInterfacePySys_SetObject_W,'PySys_SetObject'); + RegisterPropertyHelper(@TPythonInterfacePySys_SetPath_R,@TPythonInterfacePySys_SetPath_W,'PySys_SetPath'); + RegisterPropertyHelper(@TPythonInterfacePyTraceBack_Here_R,@TPythonInterfacePyTraceBack_Here_W,'PyTraceBack_Here'); + RegisterPropertyHelper(@TPythonInterfacePyTraceBack_Print_R,@TPythonInterfacePyTraceBack_Print_W,'PyTraceBack_Print'); + RegisterPropertyHelper(@TPythonInterfacePyTuple_GetItem_R,@TPythonInterfacePyTuple_GetItem_W,'PyTuple_GetItem'); + RegisterPropertyHelper(@TPythonInterfacePyTuple_GetSlice_R,@TPythonInterfacePyTuple_GetSlice_W,'PyTuple_GetSlice'); + RegisterPropertyHelper(@TPythonInterfacePyTuple_New_R,@TPythonInterfacePyTuple_New_W,'PyTuple_New'); + RegisterPropertyHelper(@TPythonInterfacePyTuple_SetItem_R,@TPythonInterfacePyTuple_SetItem_W,'PyTuple_SetItem'); + RegisterPropertyHelper(@TPythonInterfacePyTuple_Size_R,@TPythonInterfacePyTuple_Size_W,'PyTuple_Size'); + RegisterPropertyHelper(@TPythonInterfacePyType_IsSubtype_R,@TPythonInterfacePyType_IsSubtype_W,'PyType_IsSubtype'); + RegisterPropertyHelper(@TPythonInterfacePyType_GenericAlloc_R,@TPythonInterfacePyType_GenericAlloc_W,'PyType_GenericAlloc'); + RegisterPropertyHelper(@TPythonInterfacePyType_GenericNew_R,@TPythonInterfacePyType_GenericNew_W,'PyType_GenericNew'); + RegisterPropertyHelper(@TPythonInterfacePyType_Ready_R,@TPythonInterfacePyType_Ready_W,'PyType_Ready'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_FromWideChar_R,@TPythonInterfacePyUnicode_FromWideChar_W,'PyUnicode_FromWideChar'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_FromString_R,@TPythonInterfacePyUnicode_FromString_W,'PyUnicode_FromString'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_FromStringAndSize_R,@TPythonInterfacePyUnicode_FromStringAndSize_W,'PyUnicode_FromStringAndSize'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_FromKindAndData_R,@TPythonInterfacePyUnicode_FromKindAndData_W,'PyUnicode_FromKindAndData'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_AsWideChar_R,@TPythonInterfacePyUnicode_AsWideChar_W,'PyUnicode_AsWideChar'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_AsUTF8_R,@TPythonInterfacePyUnicode_AsUTF8_W,'PyUnicode_AsUTF8'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_AsUTF8AndSize_R,@TPythonInterfacePyUnicode_AsUTF8AndSize_W,'PyUnicode_AsUTF8AndSize'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_Decode_R,@TPythonInterfacePyUnicode_Decode_W,'PyUnicode_Decode'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_DecodeUTF16_R,@TPythonInterfacePyUnicode_DecodeUTF16_W,'PyUnicode_DecodeUTF16'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_AsEncodedString_R,@TPythonInterfacePyUnicode_AsEncodedString_W,'PyUnicode_AsEncodedString'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_FromOrdinal_R,@TPythonInterfacePyUnicode_FromOrdinal_W,'PyUnicode_FromOrdinal'); + RegisterPropertyHelper(@TPythonInterfacePyUnicode_GetSize_R,@TPythonInterfacePyUnicode_GetSize_W,'PyUnicode_GetSize'); + RegisterPropertyHelper(@TPythonInterfacePyWeakref_GetObject_R,@TPythonInterfacePyWeakref_GetObject_W,'PyWeakref_GetObject'); + RegisterPropertyHelper(@TPythonInterfacePyWeakref_NewProxy_R,@TPythonInterfacePyWeakref_NewProxy_W,'PyWeakref_NewProxy'); + RegisterPropertyHelper(@TPythonInterfacePyWeakref_NewRef_R,@TPythonInterfacePyWeakref_NewRef_W,'PyWeakref_NewRef'); + RegisterPropertyHelper(@TPythonInterfacePyWrapper_New_R,@TPythonInterfacePyWrapper_New_W,'PyWrapper_New'); + RegisterPropertyHelper(@TPythonInterfacePyBool_FromLong_R,@TPythonInterfacePyBool_FromLong_W,'PyBool_FromLong'); + RegisterPropertyHelper(@TPythonInterfacePyThreadState_SetAsyncExc_R,@TPythonInterfacePyThreadState_SetAsyncExc_W,'PyThreadState_SetAsyncExc'); + RegisterPropertyHelper(@TPythonInterfacePy_AtExit_R,@TPythonInterfacePy_AtExit_W,'Py_AtExit'); + RegisterPropertyHelper(@TPythonInterfacePy_CompileStringExFlags_R,@TPythonInterfacePy_CompileStringExFlags_W,'Py_CompileStringExFlags'); + RegisterPropertyHelper(@TPythonInterfacePy_FatalError_R,@TPythonInterfacePy_FatalError_W,'Py_FatalError'); + RegisterPropertyHelper(@TPythonInterface_PyObject_New_R,@TPythonInterface_PyObject_New_W,'_PyObject_New'); + RegisterPropertyHelper(@TPythonInterface_PyBytes_Resize_R,@TPythonInterface_PyBytes_Resize_W,'_PyBytes_Resize'); + RegisterPropertyHelper(@TPythonInterfacePy_Finalize_R,@TPythonInterfacePy_Finalize_W,'Py_Finalize'); + RegisterPropertyHelper(@TPythonInterfacePyErr_ExceptionMatches_R,@TPythonInterfacePyErr_ExceptionMatches_W,'PyErr_ExceptionMatches'); + RegisterPropertyHelper(@TPythonInterfacePyErr_GivenExceptionMatches_R,@TPythonInterfacePyErr_GivenExceptionMatches_W,'PyErr_GivenExceptionMatches'); + RegisterPropertyHelper(@TPythonInterfacePyEval_EvalCode_R,@TPythonInterfacePyEval_EvalCode_W,'PyEval_EvalCode'); + RegisterPropertyHelper(@TPythonInterfacePy_GetVersion_R,@TPythonInterfacePy_GetVersion_W,'Py_GetVersion'); + RegisterPropertyHelper(@TPythonInterfacePy_GetCopyright_R,@TPythonInterfacePy_GetCopyright_W,'Py_GetCopyright'); + RegisterPropertyHelper(@TPythonInterfacePy_GetExecPrefix_R,@TPythonInterfacePy_GetExecPrefix_W,'Py_GetExecPrefix'); + RegisterPropertyHelper(@TPythonInterfacePy_GetPath_R,@TPythonInterfacePy_GetPath_W,'Py_GetPath'); + RegisterPropertyHelper(@TPythonInterfacePy_SetPythonHome_R,@TPythonInterfacePy_SetPythonHome_W,'Py_SetPythonHome'); + RegisterPropertyHelper(@TPythonInterfacePy_GetPythonHome_R,@TPythonInterfacePy_GetPythonHome_W,'Py_GetPythonHome'); + RegisterPropertyHelper(@TPythonInterfacePy_GetPrefix_R,@TPythonInterfacePy_GetPrefix_W,'Py_GetPrefix'); + RegisterPropertyHelper(@TPythonInterfacePy_GetProgramName_R,@TPythonInterfacePy_GetProgramName_W,'Py_GetProgramName'); + RegisterPropertyHelper(@TPythonInterfacePyParser_SimpleParseStringFlags_R,@TPythonInterfacePyParser_SimpleParseStringFlags_W,'PyParser_SimpleParseStringFlags'); + RegisterPropertyHelper(@TPythonInterfacePyNode_Free_R,@TPythonInterfacePyNode_Free_W,'PyNode_Free'); + RegisterPropertyHelper(@TPythonInterfacePyErr_NewException_R,@TPythonInterfacePyErr_NewException_W,'PyErr_NewException'); + RegisterPropertyHelper(@TPythonInterfacePyMem_Malloc_R,@TPythonInterfacePyMem_Malloc_W,'PyMem_Malloc'); + RegisterPropertyHelper(@TPythonInterfacePy_SetProgramName_R,@TPythonInterfacePy_SetProgramName_W,'Py_SetProgramName'); + RegisterPropertyHelper(@TPythonInterfacePy_IsInitialized_R,@TPythonInterfacePy_IsInitialized_W,'Py_IsInitialized'); + RegisterPropertyHelper(@TPythonInterfacePy_GetProgramFullPath_R,@TPythonInterfacePy_GetProgramFullPath_W,'Py_GetProgramFullPath'); + RegisterPropertyHelper(@TPythonInterfacePy_NewInterpreter_R,@TPythonInterfacePy_NewInterpreter_W,'Py_NewInterpreter'); + RegisterPropertyHelper(@TPythonInterfacePy_EndInterpreter_R,@TPythonInterfacePy_EndInterpreter_W,'Py_EndInterpreter'); + RegisterPropertyHelper(@TPythonInterfacePyEval_AcquireLock_R,@TPythonInterfacePyEval_AcquireLock_W,'PyEval_AcquireLock'); + RegisterPropertyHelper(@TPythonInterfacePyEval_ReleaseLock_R,@TPythonInterfacePyEval_ReleaseLock_W,'PyEval_ReleaseLock'); + RegisterPropertyHelper(@TPythonInterfacePyEval_AcquireThread_R,@TPythonInterfacePyEval_AcquireThread_W,'PyEval_AcquireThread'); + RegisterPropertyHelper(@TPythonInterfacePyEval_ReleaseThread_R,@TPythonInterfacePyEval_ReleaseThread_W,'PyEval_ReleaseThread'); + RegisterPropertyHelper(@TPythonInterfacePyInterpreterState_New_R,@TPythonInterfacePyInterpreterState_New_W,'PyInterpreterState_New'); + RegisterPropertyHelper(@TPythonInterfacePyInterpreterState_Clear_R,@TPythonInterfacePyInterpreterState_Clear_W,'PyInterpreterState_Clear'); + RegisterPropertyHelper(@TPythonInterfacePyInterpreterState_Delete_R,@TPythonInterfacePyInterpreterState_Delete_W,'PyInterpreterState_Delete'); + RegisterPropertyHelper(@TPythonInterfacePyThreadState_New_R,@TPythonInterfacePyThreadState_New_W,'PyThreadState_New'); + RegisterPropertyHelper(@TPythonInterfacePyThreadState_Clear_R,@TPythonInterfacePyThreadState_Clear_W,'PyThreadState_Clear'); + RegisterPropertyHelper(@TPythonInterfacePyThreadState_Delete_R,@TPythonInterfacePyThreadState_Delete_W,'PyThreadState_Delete'); + RegisterPropertyHelper(@TPythonInterfacePyThreadState_Get_R,@TPythonInterfacePyThreadState_Get_W,'PyThreadState_Get'); + RegisterPropertyHelper(@TPythonInterfacePyThreadState_Swap_R,@TPythonInterfacePyThreadState_Swap_W,'PyThreadState_Swap'); + RegisterPropertyHelper(@TPythonInterfacePyErr_SetInterrupt_R,@TPythonInterfacePyErr_SetInterrupt_W,'PyErr_SetInterrupt'); + } + //RegisterPropertyHelper(@TPythonInterfacePyGILState_Ensure_R,@TPythonInterfacePyGILState_Ensure_W,'PyGILState_Ensure'); + //RegisterPropertyHelper(@TPythonInterfacePyGILState_Release_R,@TPythonInterfacePyGILState_Release_W,'PyGILState_Release'); + + + //RegisterMethod(@TPythonInterface.PyParser_SimpleParseString, 'PyParser_SimpleParseString'); + RegisterMethod(@TPythonInterface.Py_CompileString, 'Py_CompileString'); + RegisterMethod(@TPythonInterface.Py_INCREF, 'Py_INCREF'); + RegisterMethod(@TPythonInterface.Py_DECREF, 'Py_DECREF'); + RegisterMethod(@TPythonInterface.Py_XINCREF, 'Py_XINCREF'); + RegisterMethod(@TPythonInterface.Py_XDECREF, 'Py_XDECREF'); + RegisterMethod(@TPythonInterface.Py_CLEAR, 'Py_CLEAR'); + RegisterMethod(@TPythonInterface.PyBytes_Check, 'PyBytes_Check'); + RegisterMethod(@TPythonInterface.PyBytes_CheckExact, 'PyBytes_CheckExact'); + RegisterMethod(@TPythonInterface.PyFloat_Check, 'PyFloat_Check'); + RegisterMethod(@TPythonInterface.PyFloat_CheckExact, 'PyFloat_CheckExact'); + RegisterMethod(@TPythonInterface.PyLong_Check, 'PyLong_Check'); + RegisterMethod(@TPythonInterface.PyLong_CheckExact, 'PyLong_CheckExact'); + RegisterMethod(@TPythonInterface.PyTuple_Check, 'PyTuple_Check'); + RegisterMethod(@TPythonInterface.PyTuple_CheckExact, 'PyTuple_CheckExact'); + RegisterMethod(@TPythonInterface.PyClass_Check, 'PyClass_Check'); + RegisterMethod(@TPythonInterface.PyType_CheckExact, 'PyType_CheckExact'); + RegisterMethod(@TPythonInterface.PyMethod_Check, 'PyMethod_Check'); + RegisterMethod(@TPythonInterface.PyList_Check, 'PyList_Check'); + RegisterMethod(@TPythonInterface.PyList_CheckExact, 'PyList_CheckExact'); + RegisterMethod(@TPythonInterface.PyDict_Check, 'PyDict_Check'); + RegisterMethod(@TPythonInterface.PyDict_CheckExact, 'PyDict_CheckExact'); + RegisterMethod(@TPythonInterface.PyModule_Check, 'PyModule_Check'); + RegisterMethod(@TPythonInterface.PyModule_CheckExact, 'PyModule_CheckExact'); + RegisterMethod(@TPythonInterface.PySlice_Check, 'PySlice_Check'); + RegisterMethod(@TPythonInterface.PyFunction_Check, 'PyFunction_Check'); + RegisterMethod(@TPythonInterface.PyIter_Check, 'PyIter_Check'); + RegisterMethod(@TPythonInterface.PyUnicode_Check, 'PyUnicode_Check'); + RegisterMethod(@TPythonInterface.PyUnicode_CheckExact, 'PyUnicode_CheckExact'); + RegisterMethod(@TPythonInterface.PyType_IS_GC, 'PyType_IS_GC'); + RegisterMethod(@TPythonInterface.PyObject_IS_GC, 'PyObject_IS_GC'); + RegisterMethod(@TPythonInterface.PyWeakref_Check, 'PyWeakref_Check'); + RegisterMethod(@TPythonInterface.PyWeakref_CheckRef, 'PyWeakref_CheckRef'); + RegisterMethod(@TPythonInterface.PyWeakref_CheckProxy, 'PyWeakref_CheckProxy'); + RegisterMethod(@TPythonInterface.PyBool_Check, 'PyBool_Check'); + RegisterMethod(@TPythonInterface.PyEnum_Check, 'PyEnum_Check'); + RegisterMethod(@TPythonInterface.PyObject_TypeCheck, 'PyObject_TypeCheck'); + RegisterMethod(@TPythonInterface.Py_InitModule, 'Py_InitModule'); + RegisterMethod(@TPythonInterface.MapDll, 'MapDll'); + RegisterPropertyHelper(@TPythonInterfaceInitialized_R,nil,'Initialized'); + RegisterPropertyHelper(@TPythonInterfaceFinalizing_R,nil,'Finalizing'); + RegisterPropertyHelper(@TPythonInterfaceMajorVersion_R,nil,'MajorVersion'); + RegisterPropertyHelper(@TPythonInterfaceMinorVersion_R,nil,'MinorVersion'); + RegisterPropertyHelper(@TPythonInterfaceBuiltInModuleName_R,@TPythonInterfaceBuiltInModuleName_W,'BuiltInModuleName'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TDynamicDll(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TDynamicDll) do + begin + RegisterConstructor(@TDynamicDll.Create, 'Create'); + RegisterMethod(@TDynamicDll.Destroy, 'Free'); + RegisterMethod(@TDynamicDll.OpenDll, 'OpenDll'); + RegisterMethod(@TDynamicDll.IsHandleValid, 'IsHandleValid'); + RegisterMethod(@TDynamicDll.LoadDll, 'LoadDll'); + RegisterMethod(@TDynamicDll.UnloadDll, 'UnloadDll'); + RegisterMethod(@TDynamicDll.Quit, 'Quit'); + RegisterPropertyHelper(@TDynamicDllAutoLoad_R,@TDynamicDllAutoLoad_W,'AutoLoad'); + RegisterPropertyHelper(@TDynamicDllAutoUnload_R,@TDynamicDllAutoUnload_W,'AutoUnload'); + RegisterPropertyHelper(@TDynamicDllDllName_R,@TDynamicDllDllName_W,'DllName'); + RegisterPropertyHelper(@TDynamicDllDllPath_R,@TDynamicDllDllPath_W,'DllPath'); + RegisterPropertyHelper(@TDynamicDllAPIVersion_R,@TDynamicDllAPIVersion_W,'APIVersion'); + RegisterPropertyHelper(@TDynamicDllRegVersion_R,@TDynamicDllRegVersion_W,'RegVersion'); + RegisterPropertyHelper(@TDynamicDllFatalAbort_R,@TDynamicDllFatalAbort_W,'FatalAbort'); + RegisterPropertyHelper(@TDynamicDllFatalMsgDlg_R,@TDynamicDllFatalMsgDlg_W,'FatalMsgDlg'); + RegisterPropertyHelper(@TDynamicDllUseLastKnownVersion_R,@TDynamicDllUseLastKnownVersion_W,'UseLastKnownVersion'); + RegisterPropertyHelper(@TDynamicDllOnAfterLoad_R,@TDynamicDllOnAfterLoad_W,'OnAfterLoad'); + RegisterPropertyHelper(@TDynamicDllOnBeforeLoad_R,@TDynamicDllOnBeforeLoad_W,'OnBeforeLoad'); + RegisterPropertyHelper(@TDynamicDllOnBeforeUnload_R,@TDynamicDllOnBeforeUnload_W,'OnBeforeUnload'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonInputOutput(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonInputOutput) do + begin + RegisterConstructor(@TPythonInputOutput.Create, 'Create'); + RegisterMethod(@TPythonInputOutput.Destroy, 'Free'); + RegisterMethod(@TPythonInputOutput.Write, 'Write'); + RegisterMethod(@TPythonInputOutput.WriteLine, 'WriteLine'); + RegisterPropertyHelper(@TPythonInputOutputMaxLines_R,@TPythonInputOutputMaxLines_W,'MaxLines'); + RegisterPropertyHelper(@TPythonInputOutputMaxLineLength_R,@TPythonInputOutputMaxLineLength_W,'MaxLineLength'); + RegisterPropertyHelper(@TPythonInputOutputDelayWrites_R,@TPythonInputOutputDelayWrites_W,'DelayWrites'); + RegisterPropertyHelper(@TPythonInputOutputOnSendData_R,@TPythonInputOutputOnSendData_W,'OnSendData'); + RegisterPropertyHelper(@TPythonInputOutputOnReceiveData_R,@TPythonInputOutputOnReceiveData_W,'OnReceiveData'); + RegisterPropertyHelper(@TPythonInputOutputOnSendUniData_R,@TPythonInputOutputOnSendUniData_W,'OnSendUniData'); + RegisterPropertyHelper(@TPythonInputOutputOnReceiveUniData_R,@TPythonInputOutputOnReceiveUniData_W,'OnReceiveUniData'); + RegisterPropertyHelper(@TPythonInputOutputUnicodeIO_R,@TPythonInputOutputUnicodeIO_W,'UnicodeIO'); + RegisterPropertyHelper(@TPythonInputOutputRawOutput_R,@TPythonInputOutputRawOutput_W,'RawOutput'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_EPySyntaxError(CL: TPSRuntimeClassImporter); +begin + with CL.Add(EPySyntaxError) do + begin + RegisterPropertyHelper(@EPySyntaxErrorEFileName_R,@EPySyntaxErrorEFileName_W,'EFileName'); + RegisterPropertyHelper(@EPySyntaxErrorELineStr_R,@EPySyntaxErrorELineStr_W,'ELineStr'); + RegisterPropertyHelper(@EPySyntaxErrorELineNumber_R,@EPySyntaxErrorELineNumber_W,'ELineNumber'); + RegisterPropertyHelper(@EPySyntaxErrorEOffset_R,@EPySyntaxErrorEOffset_W,'EOffset'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_EPythonError(CL: TPSRuntimeClassImporter); +begin + with CL.Add(EPythonError) do + begin + RegisterPropertyHelper(@EPythonErrorEName_R,@EPythonErrorEName_W,'EName'); + RegisterPropertyHelper(@EPythonErrorEValue_R,@EPythonErrorEValue_W,'EValue'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_EDLLImportError(CL: TPSRuntimeClassImporter); +begin + with CL.Add(EDLLImportError) do + begin + RegisterPropertyHelper(@EDLLImportErrorWrongFunc_R,@EDLLImportErrorWrongFunc_W,'WrongFunc'); + RegisterPropertyHelper(@EDLLImportErrorErrorCode_R,@EDLLImportErrorErrorCode_W,'ErrorCode'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_PythonEngine(CL: TPSRuntimeClassImporter); +begin + with CL.Add(EDLLLoadError) do + RIRegister_EDLLImportError(CL); + RIRegister_EPythonError(CL); + with CL.Add(EPyExecError) do + with CL.Add(EPyException) do + with CL.Add(EPyStandardError) do + with CL.Add(EPyArithmeticError) do + with CL.Add(EPyLookupError) do + with CL.Add(EPyAssertionError) do + with CL.Add(EPyAttributeError) do + with CL.Add(EPyEOFError) do + with CL.Add(EPyFloatingPointError) do + with CL.Add(EPyEnvironmentError) do + with CL.Add(EPyIOError) do + with CL.Add(EPyOSError) do + with CL.Add(EPyImportError) do + with CL.Add(EPyIndexError) do + with CL.Add(EPyKeyError) do + with CL.Add(EPyKeyboardInterrupt) do + with CL.Add(EPyMemoryError) do + with CL.Add(EPyNameError) do + with CL.Add(EPyOverflowError) do + with CL.Add(EPyRuntimeError) do + with CL.Add(EPyNotImplementedError) do + RIRegister_EPySyntaxError(CL); + with CL.Add(EPyIndentationError) do + with CL.Add(EPyTabError) do + with CL.Add(EPySystemError) do + with CL.Add(EPySystemExit) do + with CL.Add(EPyTypeError) do + with CL.Add(EPyUnboundLocalError) do + with CL.Add(EPyValueError) do + with CL.Add(EPyUnicodeError) do + with CL.Add(UnicodeEncodeError) do + with CL.Add(UnicodeDecodeError) do + with CL.Add(UnicodeTranslateError) do + with CL.Add(EPyZeroDivisionError) do + with CL.Add(EPyStopIteration) do + with CL.Add(EPyWarning) do + with CL.Add(EPyUserWarning) do + with CL.Add(EPyDeprecationWarning) do + with CL.Add(PendingDeprecationWarning) do + with CL.Add(FutureWarning) do + with CL.Add(EPySyntaxWarning) do + with CL.Add(EPyRuntimeWarning) do + with CL.Add(EPyReferenceError) do + with CL.Add(EPyWindowsError) do + RIRegister_TPythonInputOutput(CL); + RIRegister_TDynamicDll(CL); + RIRegister_TPythonInterface(CL); + with CL.Add(TEngineClient) do + RIRegister_TTracebackItem(CL); + RIRegister_TPythonTraceback(CL); + RIRegister_TPythonEngine(CL); + RIRegister_TEngineClient(CL); + with CL.Add(TMethodsContainer) do + with CL.Add(TEventDefs) do + RIRegister_TEventDef(CL); + RIRegister_TEventDefs(CL); + RIRegister_TMethodsContainer(CL); + RIRegister_TMembersContainer(CL); + RIRegister_TGetSetContainer(CL); + with CL.Add(TPythonModule) do + with CL.Add(TErrors) do + RIRegister_TParentClassError(CL); + RIRegister_TError(CL); + RIRegister_TErrors(CL); + RIRegister_TPythonModule(CL); + with CL.Add(TPythonType) do + RIRegister_TPyObject(CL); + RIRegister_TTypeServices(CL); + RIRegister_TPythonType(CL); + RIRegister_TPythonDelphiVar(CL); + RIRegister_TPyVar(CL); + RIRegister_TPythonThread(CL); +end; + + + +{ TPSImport_PythonEngine } +(*----------------------------------------------------------------------------*) +procedure TPSImport_PythonEngine.CompileImport1(CompExec: TPSScript); +begin + SIRegister_PythonEngine(CompExec.Comp); +end; +(*----------------------------------------------------------------------------*) +procedure TPSImport_PythonEngine.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); +begin + RIRegister_PythonEngine(ri); + RIRegister_PythonEngine_Routines(CompExec.Exec); // comment it if no routines +end; +(*----------------------------------------------------------------------------*) + + +end. diff --git a/Source/uPSI_PythonGUIInputOutput.pas b/Source/uPSI_PythonGUIInputOutput.pas new file mode 100644 index 00000000..0be1abd0 --- /dev/null +++ b/Source/uPSI_PythonGUIInputOutput.pas @@ -0,0 +1,133 @@ +unit uPSI_PythonGUIInputOutput; +{ +This file has been generated by UnitParser v0.7, written by M. Knight +and updated by NP. v/d Spek and George Birbilis. +Source Code from Carlo Kok has been used to implement various sections of +UnitParser. Components of ROPS are used in the construction of UnitParser, +code implementing the class wrapper is taken from Carlo Kok's conv utility + +} +interface + + + +uses + SysUtils + ,Classes + ,uPSComponent + ,uPSRuntime + ,uPSCompiler + ; + +type +(*----------------------------------------------------------------------------*) + TPSImport_PythonGUIInputOutput = class(TPSPlugin) + public + procedure CompileImport1(CompExec: TPSScript); override; + procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + end; + + +{ compile-time registration functions } +procedure SIRegister_TPythonGUIInputOutput(CL: TPSPascalCompiler); +procedure SIRegister_PythonGUIInputOutput(CL: TPSPascalCompiler); + +{ run-time registration functions } +procedure RIRegister_PythonGUIInputOutput_Routines(S: TPSExec); +procedure RIRegister_TPythonGUIInputOutput(CL: TPSRuntimeClassImporter); +procedure RIRegister_PythonGUIInputOutput(CL: TPSRuntimeClassImporter); + +procedure Register; + +implementation + + +uses + Windows + ,Messages + ,Graphics + ,Controls + ,Forms + ,Dialogs + ,StdCtrls + ,PythonEngine + ,PythonGUIInputOutput + ; + + +procedure Register; +begin + RegisterComponents('Pascal Script', [TPSImport_PythonGUIInputOutput]); +end; + +(* === compile-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonGUIInputOutput(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPythonInputOutput', 'TPythonGUIInputOutput') do + with CL.AddClassN(CL.FindClass('TPythonInputOutput'),'TPythonGUIInputOutput') do + begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure DisplayString( const str : string)'); + RegisterProperty('Output', 'TCustomMemo', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_PythonGUIInputOutput(CL: TPSPascalCompiler); +begin + CL.AddConstantN('WM_WriteOutput','LongInt').SetInt( WM_USER + 1); + SIRegister_TPythonGUIInputOutput(CL); + CL.AddDelphiFunction('Procedure Register'); +end; + +(* === run-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure TPythonGUIInputOutputOutput_W(Self: TPythonGUIInputOutput; const T: TCustomMemo); +begin Self.Output := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonGUIInputOutputOutput_R(Self: TPythonGUIInputOutput; var T: TCustomMemo); +begin T := Self.Output; end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_PythonGUIInputOutput_Routines(S: TPSExec); +begin + S.RegisterDelphiFunction(@Register, 'Register', cdRegister); +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonGUIInputOutput(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonGUIInputOutput) do + begin + RegisterConstructor(@TPythonGUIInputOutput.Create, 'Create'); + RegisterMethod(@TPythonGUIInputOutput.DisplayString, 'DisplayString'); + RegisterPropertyHelper(@TPythonGUIInputOutputOutput_R,@TPythonGUIInputOutputOutput_W,'Output'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_PythonGUIInputOutput(CL: TPSRuntimeClassImporter); +begin + RIRegister_TPythonGUIInputOutput(CL); +end; + + + +{ TPSImport_PythonGUIInputOutput } +(*----------------------------------------------------------------------------*) +procedure TPSImport_PythonGUIInputOutput.CompileImport1(CompExec: TPSScript); +begin + SIRegister_PythonGUIInputOutput(CompExec.Comp); +end; +(*----------------------------------------------------------------------------*) +procedure TPSImport_PythonGUIInputOutput.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); +begin + RIRegister_PythonGUIInputOutput(ri); + RIRegister_PythonGUIInputOutput_Routines(CompExec.Exec); // comment it if no routines +end; +(*----------------------------------------------------------------------------*) + + +end. diff --git a/Source/uPSI_PythonVersions.dcu b/Source/uPSI_PythonVersions.dcu new file mode 100644 index 00000000..e09f7f38 Binary files /dev/null and b/Source/uPSI_PythonVersions.dcu differ diff --git a/Source/uPSI_PythonVersions.pas b/Source/uPSI_PythonVersions.pas new file mode 100644 index 00000000..0c41f99e --- /dev/null +++ b/Source/uPSI_PythonVersions.pas @@ -0,0 +1,276 @@ +unit uPSI_PythonVersions; +{ +Tinherit from tobject convert from record to class +https://github.com/magicmonty/delphi-code-coverage/blob/master/3rdParty/JWAPI/jwapi2.2a/Win32API/JwaWinBase.pas +https://github.com/maxkleiner/python4delphi/blob/master/Source/PythonVersions.pas + use of rerecord to class - new py version + +} +interface + + + +uses + SysUtils + ,Classes + ,uPSComponent + ,uPSRuntime + ,uPSCompiler + ; + +type +(*----------------------------------------------------------------------------*) + TPSImport_PythonVersions = class(TPSPlugin) + public + procedure CompileImport1(CompExec: TPSScript); override; + procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + end; + + +{ compile-time registration functions } +procedure SIRegister_TPythonVersion(CL: TPSPascalCompiler); +procedure SIRegister_PythonVersions(CL: TPSPascalCompiler); + +{ run-time registration functions } +procedure RIRegister_PythonVersions_Routines(S: TPSExec); +procedure RIRegister_TPythonVersion(CL: TPSRuntimeClassImporter); +procedure RIRegister_PythonVersions(CL: TPSRuntimeClassImporter); + +procedure Register; + +implementation + + +uses + PythonVersions_class //, pythonversions + ; + + +procedure Register; +begin + RegisterComponents('Pascal Script', [TPSImport_PythonVersions]); +end; + +(* === compile-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonVersion(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TOBJECT', 'TPythonVersion') do + with CL.AddClassN(CL.FindClass('TOBJECT'),'TPythonVersion') do + begin + RegisterMethod('Constructor Create'); + RegisterMethod('Procedure Free;'); + RegisterProperty('IsRegistered', 'Boolean', iptrw); + RegisterProperty('IsAllUsers', 'Boolean', iptrw); + RegisterProperty('SysVersion', 'string', iptrw); + RegisterProperty('Version', 'string', iptrw); + RegisterProperty('DLLPath', 'string', iptrw); + RegisterProperty('InstallPath', 'string', iptrw); + RegisterProperty('PythonPath', 'string', iptrw); + RegisterMethod('Function Is_venv : Boolean'); + RegisterMethod('Function Is_virtualenv : Boolean'); + RegisterMethod('Function Is_conda : Boolean'); + RegisterMethod('Procedure AssignTo( PythonEngine : TPersistent)'); + RegisterProperty('PythonExecutable', 'string', iptr); + RegisterProperty('DLLName', 'string', iptr); + RegisterProperty('SysArchitecture', 'string', iptr); + RegisterProperty('IsPython3K', 'Boolean', iptr); + RegisterProperty('HelpFile', 'string', iptrw); + RegisterProperty('HelpFile2', 'string', iptrw); + RegisterProperty('DisplayName', 'string', iptrw); + RegisterProperty('ApiVersion', 'integer', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_PythonVersions(CL: TPSPascalCompiler); +begin + SIRegister_TPythonVersion(CL); + CL.AddTypeS('TPythonVersions', 'array of TPythonVersion'); + CL.AddDelphiFunction('Function CompareVersions( A, B : string) : Integer'); + CL.AddDelphiFunction('Function IsEXEx64( const EXEName : string) : Boolean'); + CL.AddDelphiFunction('Function Isx64( const FileName : string) : Boolean'); + CL.AddDelphiFunction('Function GetRegisteredPythonVersion( SysVersion : string; out PythonVersion : TPythonVersion) : Boolean'); + CL.AddDelphiFunction('Function GetRegisteredPythonVersions : TPythonVersions'); + CL.AddDelphiFunction('Function GetLatestRegisteredPythonVersion( out PythonVersion : TPythonVersion) : Boolean'); + CL.AddDelphiFunction('Function PythonVersionFromPath( const Path : string; out PythonVersion : TPythonVersion; AcceptVirtualEnvs : Boolean) : Boolean'); + CL.AddDelphiFunction('function GetRegisteredPythonVersion2(SysVersion: string;out PythonVersion: TPythonVersion): Boolean;'); + CL.AddDelphiFunction('function GetRegisteredPythonVersions2(const MinVersion:string;const MaxVersion:string): TPythonVersions;'); + CL.AddDelphiFunction('function GetPythonVersions :string;'); + CL.AddDelphiFunction('function GetPyVers: string;'); //alias + CL.AddDelphiFunction('function GetServices:string;'); + + //function GetRegisteredPythonVersions2(const MinVersion:string;const MaxVersion:string): TPythonVersions; + //function GetRegisteredPythonVersion2(SysVersion: string;out PythonVersion: TPythonVersion): Boolean; + end; + +(* === run-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure TPythonVersionApiVersion_R(Self: TPythonVersion; var T: integer); +begin T := Self.ApiVersion; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionDisplayName_W(Self: TPythonVersion; const T: string); +begin Self.DisplayName := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionDisplayName_R(Self: TPythonVersion; var T: string); +begin T := Self.DisplayName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionHelpFile_W(Self: TPythonVersion; const T: string); +begin Self.HelpFile := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionHelpFile_R(Self: TPythonVersion; var T: string); +begin T := Self.HelpFile; end; + +procedure TPythonVersionHelpFile_W2(Self: TPythonVersion; const T: string); +begin Self.HelpFile2 := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionHelpFile_R2(Self: TPythonVersion; var T: string); +begin T := Self.HelpFile2; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionIsPython3K_R(Self: TPythonVersion; var T: Boolean); +begin T := Self.IsPython3K; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionSysArchitecture_R(Self: TPythonVersion; var T: string); +begin T := Self.SysArchitecture; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionDLLName_R(Self: TPythonVersion; var T: string); +begin T := Self.DLLName; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionPythonExecutable_R(Self: TPythonVersion; var T: string); +begin T := Self.PythonExecutable; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionPythonPath_W(Self: TPythonVersion; const T: string); +Begin Self.PythonPath := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionPythonPath_R(Self: TPythonVersion; var T: string); +Begin T := Self.PythonPath; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionInstallPath_W(Self: TPythonVersion; const T: string); +Begin Self.InstallPath := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionInstallPath_R(Self: TPythonVersion; var T: string); +Begin T := Self.InstallPath; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionDLLPath_W(Self: TPythonVersion; const T: string); +Begin Self.DLLPath := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionDLLPath_R(Self: TPythonVersion; var T: string); +Begin T := Self.DLLPath; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionVersion_W(Self: TPythonVersion; const T: string); +Begin Self.Version := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionVersion_R(Self: TPythonVersion; var T: string); +Begin T := Self.Version; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionSysVersion_W(Self: TPythonVersion; const T: string); +Begin Self.SysVersion := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionSysVersion_R(Self: TPythonVersion; var T: string); +Begin T := Self.SysVersion; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionIsAllUsers_W(Self: TPythonVersion; const T: Boolean); +Begin Self.IsAllUsers := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionIsAllUsers_R(Self: TPythonVersion; var T: Boolean); +Begin T := Self.IsAllUsers; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionIsRegistered_W(Self: TPythonVersion; const T: Boolean); +Begin Self.IsRegistered := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonVersionIsRegistered_R(Self: TPythonVersion; var T: Boolean); +Begin T := Self.IsRegistered; end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_PythonVersions_Routines(S: TPSExec); +begin + S.RegisterDelphiFunction(@CompareVersions, 'CompareVersions', cdRegister); + S.RegisterDelphiFunction(@IsEXEx64, 'IsEXEx64', cdRegister); + S.RegisterDelphiFunction(@Isx64, 'Isx64', cdRegister); + S.RegisterDelphiFunction(@GetRegisteredPythonVersion, 'GetRegisteredPythonVersion', cdRegister); + S.RegisterDelphiFunction(@GetRegisteredPythonVersions, 'GetRegisteredPythonVersions', cdRegister); + S.RegisterDelphiFunction(@GetLatestRegisteredPythonVersion, 'GetLatestRegisteredPythonVersion', cdRegister); + S.RegisterDelphiFunction(@PythonVersionFromPath, 'PythonVersionFromPath', cdRegister); + S.RegisterDelphiFunction(@GetRegisteredPythonVersion2, 'GetRegisteredPythonVersion2', cdRegister); + S.RegisterDelphiFunction(@GetRegisteredPythonVersions2, 'GetRegisteredPythonVersions2', cdRegister); + S.RegisterDelphiFunction(@GetPythonVersions, 'GetPythonVersions', cdRegister); + S.RegisterDelphiFunction(@GetPythonVersions, 'GetPyVers', cdRegister); //alias + S.RegisterDelphiFunction(@Getservices, 'GetServices', cdRegister); +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonVersion(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonVersion) do begin + RegisterConstructor(@TPythonVersion.Create, 'Create'); + RegisterMethod(@TPythonVersion.Free, 'Free'); + RegisterPropertyHelper(@TPythonVersionIsRegistered_R,@TPythonVersionIsRegistered_W,'IsRegistered'); + RegisterPropertyHelper(@TPythonVersionIsAllUsers_R,@TPythonVersionIsAllUsers_W,'IsAllUsers'); + RegisterPropertyHelper(@TPythonVersionSysVersion_R,@TPythonVersionSysVersion_W,'SysVersion'); + RegisterPropertyHelper(@TPythonVersionVersion_R,@TPythonVersionVersion_W,'Version'); + RegisterPropertyHelper(@TPythonVersionDLLPath_R,@TPythonVersionDLLPath_W,'DLLPath'); + RegisterPropertyHelper(@TPythonVersionInstallPath_R,@TPythonVersionInstallPath_W,'InstallPath'); + RegisterPropertyHelper(@TPythonVersionPythonPath_R,@TPythonVersionPythonPath_W,'PythonPath'); + RegisterMethod(@TPythonVersion.Is_venv, 'Is_venv'); + RegisterMethod(@TPythonVersion.Is_virtualenv, 'Is_virtualenv'); + RegisterMethod(@TPythonVersion.Is_conda, 'Is_conda'); + RegisterMethod(@TPythonVersion.AssignTo, 'AssignTo'); + RegisterPropertyHelper(@TPythonVersionPythonExecutable_R,nil,'PythonExecutable'); + RegisterPropertyHelper(@TPythonVersionDLLName_R,nil,'DLLName'); + RegisterPropertyHelper(@TPythonVersionSysArchitecture_R,nil,'SysArchitecture'); + RegisterPropertyHelper(@TPythonVersionIsPython3K_R,nil,'IsPython3K'); + RegisterPropertyHelper(@TPythonVersionHelpFile_R,@TPythonVersionHelpFile_W,'HelpFile'); + RegisterPropertyHelper(@TPythonVersionHelpFile_R2,@TPythonVersionHelpFile_W2,'HelpFile2'); + + RegisterPropertyHelper(@TPythonVersionDisplayName_R,@TPythonVersionDisplayName_W,'DisplayName'); + RegisterPropertyHelper(@TPythonVersionApiVersion_R,nil,'ApiVersion'); + end; //} +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_PythonVersions(CL: TPSRuntimeClassImporter); +begin + RIRegister_TPythonVersion(CL); +end; + + + +{ TPSImport_PythonVersions } +(*----------------------------------------------------------------------------*) +procedure TPSImport_PythonVersions.CompileImport1(CompExec: TPSScript); +begin + SIRegister_PythonVersions(CompExec.Comp); +end; +(*----------------------------------------------------------------------------*) +procedure TPSImport_PythonVersions.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); +begin + RIRegister_PythonVersions(ri); + RIRegister_PythonVersions_Routines(CompExec.Exec); // comment it if no routines +end; +(*----------------------------------------------------------------------------*) + + +end. diff --git a/Source/uPSI_PythonVersions.xml b/Source/uPSI_PythonVersions.xml new file mode 100644 index 00000000..e102215f --- /dev/null +++ b/Source/uPSI_PythonVersions.xml @@ -0,0 +1,283 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/uPSI_VarPyth.pas b/Source/uPSI_VarPyth.pas new file mode 100644 index 00000000..7e0d5c0c --- /dev/null +++ b/Source/uPSI_VarPyth.pas @@ -0,0 +1,208 @@ +unit uPSI_VarPyth; +{ +This file has been generated by UnitParser v0.7, written by M. Knight +and updated by NP. v/d Spek and George Birbilis. +Source Code from Carlo Kok has been used to implement various sections of +UnitParser. Components of ROPS are used in the construction of UnitParser, +code implementing the class wrapper is taken from Carlo Kok's conv utility + +} +interface + + + +uses + SysUtils + ,Classes + ,uPSComponent + ,uPSRuntime + ,uPSCompiler + ; + +type +(*----------------------------------------------------------------------------*) + TPSImport_VarPyth = class(TPSPlugin) + public + procedure CompileImport1(CompExec: TPSScript); override; + procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + end; + + +{ compile-time registration functions } +procedure SIRegister_VarPyth(CL: TPSPascalCompiler); + +{ run-time registration functions } +procedure RIRegister_VarPyth_Routines(S: TPSExec); + +procedure Register; + +implementation + + +uses + Variants + ,PythonEngine + ,VarPyth + ; + + +procedure Register; +begin + RegisterComponents('Pascal Script', [TPSImport_VarPyth]); +end; + +(* === compile-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure SIRegister_VarPyth(CL: TPSPascalCompiler); +begin + CL.AddTypeS('TSequenceType', '( stTuple, stList )'); + CL.AddDelphiFunction('Function VarPythonCreate0( AObject : PPyObject) : Variant;'); + CL.AddDelphiFunction('Function VarPythonCreate1( const AValue : Variant) : Variant;'); + CL.AddDelphiFunction('Function VarPythonCreate2( const AValues : array of const; ASequenceType : TSequenceType) : Variant;'); + CL.AddDelphiFunction('Function VarPythonEval( const APythonExpression : AnsiString) : Variant'); + CL.AddDelphiFunction('Function VarPython : TVarType'); + CL.AddDelphiFunction('Function VarIsPython( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarAsPython( const AValue : Variant) : Variant'); + CL.AddDelphiFunction('Function ExtractPythonObjectFrom( const AValue : Variant) : PPyObject'); + CL.AddDelphiFunction('Function VarIsSame( const A, B : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsSameType( const A, B : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonSequence( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonMapping( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonNumber( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonString( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonInteger( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonFloat( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonTuple( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonList( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonDict( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonClass( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonMethod( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonFunction( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonModule( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonCallable( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonIterator( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonUnicode( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonDateTime( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonDate( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonTime( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonDateTimeDelta( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsPythonTZInfo( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsBool( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsEnum( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsInstanceOf( const AInstance, AClass : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsSubclassOf( const ADerived, AClass : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsSubtypeOf( const ADerived, AType : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsNone( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarIsTrue( const AValue : Variant) : Boolean'); + CL.AddDelphiFunction('Function VarModuleHasObject( const AModule : Variant; aObj : AnsiString) : Boolean'); + CL.AddDelphiFunction('Function NewPythonList( const ASize : Integer) : Variant'); + CL.AddDelphiFunction('Function NewPythonTuple( const ASize : Integer) : Variant'); + CL.AddDelphiFunction('Function NewPythonDict : Variant'); + CL.AddDelphiFunction('Function VarPythonAsString( AValue : Variant) : string'); + CL.AddDelphiFunction('Function VarPythonToVariant( AValue : Variant) : Variant'); + CL.AddDelphiFunction('Function None : Variant'); + CL.AddDelphiFunction('Function Ellipsis : Variant'); + CL.AddDelphiFunction('Function MainModule : Variant'); + CL.AddDelphiFunction('Function BuiltinModule : Variant'); + CL.AddDelphiFunction('Function SysModule : Variant'); + CL.AddDelphiFunction('Function DatetimeModule : Variant'); + CL.AddDelphiFunction('Function Import( const AModule : AnsiString) : Variant'); + CL.AddDelphiFunction('Function len( const AValue : Variant) : NativeInt'); + CL.AddDelphiFunction('Function _type( const AValue : Variant) : Variant'); + CL.AddDelphiFunction('Function iter( const AValue : Variant) : Variant'); + CL.AddTypeS('TVarPyEnumerator', 'record FIterator : Variant; FCurrent : Varia' + +'nt; end'); + CL.AddTypeS('TVarPyEnumerateHelper', 'record FIterable : Variant; end'); + CL.AddDelphiFunction('Function VarPyIterate( const AValue : Variant) : TVarPyEnumerateHelper'); +end; + +(* === run-time registration functions === *) +(*----------------------------------------------------------------------------*) +Function VarPythonCreate2_P( const AValues : array of const; ASequenceType : TSequenceType) : Variant; +Begin Result := VarPyth.VarPythonCreate(AValues, ASequenceType); END; + +(*----------------------------------------------------------------------------*) +Function VarPythonCreate1_P( const AValue : Variant) : Variant; +Begin Result := VarPyth.VarPythonCreate(AValue); END; + +(*----------------------------------------------------------------------------*) +Function VarPythonCreate0_P( AObject : PPyObject) : Variant; +Begin Result := VarPyth.VarPythonCreate(AObject); END; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_VarPyth_Routines(S: TPSExec); +begin + S.RegisterDelphiFunction(@VarPythonCreate0, 'VarPythonCreate0', cdRegister); + S.RegisterDelphiFunction(@VarPythonCreate1, 'VarPythonCreate1', cdRegister); + S.RegisterDelphiFunction(@VarPythonCreate2, 'VarPythonCreate2', cdRegister); + S.RegisterDelphiFunction(@VarPythonEval, 'VarPythonEval', cdRegister); + S.RegisterDelphiFunction(@VarPython, 'VarPython', cdRegister); + S.RegisterDelphiFunction(@VarIsPython, 'VarIsPython', cdRegister); + S.RegisterDelphiFunction(@VarAsPython, 'VarAsPython', cdRegister); + S.RegisterDelphiFunction(@ExtractPythonObjectFrom, 'ExtractPythonObjectFrom', cdRegister); + S.RegisterDelphiFunction(@VarIsSame, 'VarIsSame', cdRegister); + S.RegisterDelphiFunction(@VarIsSameType, 'VarIsSameType', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonSequence, 'VarIsPythonSequence', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonMapping, 'VarIsPythonMapping', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonNumber, 'VarIsPythonNumber', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonString, 'VarIsPythonString', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonInteger, 'VarIsPythonInteger', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonFloat, 'VarIsPythonFloat', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonTuple, 'VarIsPythonTuple', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonList, 'VarIsPythonList', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonDict, 'VarIsPythonDict', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonClass, 'VarIsPythonClass', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonMethod, 'VarIsPythonMethod', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonFunction, 'VarIsPythonFunction', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonModule, 'VarIsPythonModule', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonCallable, 'VarIsPythonCallable', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonIterator, 'VarIsPythonIterator', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonUnicode, 'VarIsPythonUnicode', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonDateTime, 'VarIsPythonDateTime', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonDate, 'VarIsPythonDate', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonTime, 'VarIsPythonTime', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonDateTimeDelta, 'VarIsPythonDateTimeDelta', cdRegister); + S.RegisterDelphiFunction(@VarIsPythonTZInfo, 'VarIsPythonTZInfo', cdRegister); + S.RegisterDelphiFunction(@VarIsBool, 'VarIsBool', cdRegister); + S.RegisterDelphiFunction(@VarIsEnum, 'VarIsEnum', cdRegister); + S.RegisterDelphiFunction(@VarIsInstanceOf, 'VarIsInstanceOf', cdRegister); + S.RegisterDelphiFunction(@VarIsSubclassOf, 'VarIsSubclassOf', cdRegister); + S.RegisterDelphiFunction(@VarIsSubtypeOf, 'VarIsSubtypeOf', cdRegister); + S.RegisterDelphiFunction(@VarIsNone, 'VarIsNone', cdRegister); + S.RegisterDelphiFunction(@VarIsTrue, 'VarIsTrue', cdRegister); + S.RegisterDelphiFunction(@VarModuleHasObject, 'VarModuleHasObject', cdRegister); + S.RegisterDelphiFunction(@NewPythonList, 'NewPythonList', cdRegister); + S.RegisterDelphiFunction(@NewPythonTuple, 'NewPythonTuple', cdRegister); + S.RegisterDelphiFunction(@NewPythonDict, 'NewPythonDict', cdRegister); + S.RegisterDelphiFunction(@VarPythonAsString, 'VarPythonAsString', cdRegister); + S.RegisterDelphiFunction(@VarPythonToVariant, 'VarPythonToVariant', cdRegister); + S.RegisterDelphiFunction(@None, 'None', cdRegister); + S.RegisterDelphiFunction(@Ellipsis, 'Ellipsis', cdRegister); + S.RegisterDelphiFunction(@MainModule, 'MainModule', cdRegister); + S.RegisterDelphiFunction(@BuiltinModule, 'BuiltinModule', cdRegister); + S.RegisterDelphiFunction(@SysModule, 'SysModule', cdRegister); + S.RegisterDelphiFunction(@DatetimeModule, 'DatetimeModule', cdRegister); + S.RegisterDelphiFunction(@Import, 'Import', cdRegister); + S.RegisterDelphiFunction(@len, 'len', cdRegister); + S.RegisterDelphiFunction(@_type, '_type', cdRegister); + S.RegisterDelphiFunction(@iter, 'iter', cdRegister); + S.RegisterDelphiFunction(@VarPyIterate, 'VarPyIterate', cdRegister); +end; + + + +{ TPSImport_VarPyth } +(*----------------------------------------------------------------------------*) +procedure TPSImport_VarPyth.CompileImport1(CompExec: TPSScript); +begin + SIRegister_VarPyth(CompExec.Comp); +end; +(*----------------------------------------------------------------------------*) +procedure TPSImport_VarPyth.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); +begin + RIRegister_VarPyth_Routines(CompExec.Exec); // comment it if no routines +end; +(*----------------------------------------------------------------------------*) + + +end. diff --git a/Source/uPSI_VclPythonGUIInputOutput.dcu b/Source/uPSI_VclPythonGUIInputOutput.dcu new file mode 100644 index 00000000..34e6d57e Binary files /dev/null and b/Source/uPSI_VclPythonGUIInputOutput.dcu differ diff --git a/Source/uPSI_VclPythonGUIInputOutput.pas b/Source/uPSI_VclPythonGUIInputOutput.pas new file mode 100644 index 00000000..06f7a334 --- /dev/null +++ b/Source/uPSI_VclPythonGUIInputOutput.pas @@ -0,0 +1,130 @@ +unit uPSI_VclPythonGUIInputOutput; +{ +to get the gui + +} +interface + + + +uses + SysUtils + ,Classes + ,uPSComponent + ,uPSRuntime + ,uPSCompiler + ; + +type +(*----------------------------------------------------------------------------*) + TPSImport_VclPythonGUIInputOutput = class(TPSPlugin) + public + procedure CompileImport1(CompExec: TPSScript); override; + procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + end; + + +{ compile-time registration functions } +procedure SIRegister_TPythonGUIInputOutput(CL: TPSPascalCompiler); +procedure SIRegister_VclPythonGUIInputOutput(CL: TPSPascalCompiler); + +{ run-time registration functions } +procedure RIRegister_VclPythonGUIInputOutput_Routines(S: TPSExec); +procedure RIRegister_TPythonGUIInputOutput(CL: TPSRuntimeClassImporter); +procedure RIRegister_VclPythonGUIInputOutput(CL: TPSRuntimeClassImporter); + +procedure Register; + +implementation + + +uses + Windows + ,Messages + ,Graphics + ,Controls + ,Forms + ,Dialogs + ,StdCtrls + ,PythonEngine + ,VclPythonGUIInputOutput + ; + + +procedure Register; +begin + RegisterComponents('Pascal Script', [TPSImport_VclPythonGUIInputOutput]); +end; + +(* === compile-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPythonGUIInputOutput(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPythonInputOutput', 'TPythonGUIInputOutput') do + with CL.AddClassN(CL.FindClass('TPythonInputOutput'),'TPythonGUIInputOutput') do + begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure Free;'); + RegisterMethod('Procedure DisplayString( const str : string)'); + RegisterProperty('Output', 'TCustomMemo', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_VclPythonGUIInputOutput(CL: TPSPascalCompiler); +begin + CL.AddConstantN('WM_WriteOutput','LongInt').SetInt( WM_USER + 1); + SIRegister_TPythonGUIInputOutput(CL); + CL.AddDelphiFunction('Procedure Register_PythonGUI'); +end; + +(* === run-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure TPythonGUIInputOutputOutput_W(Self: TPythonGUIInputOutput; const T: TCustomMemo); +begin Self.Output := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPythonGUIInputOutputOutput_R(Self: TPythonGUIInputOutput; var T: TCustomMemo); +begin T := Self.Output; end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_VclPythonGUIInputOutput_Routines(S: TPSExec); +begin + S.RegisterDelphiFunction(@Register, 'Register_PythonGUI', cdRegister); +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPythonGUIInputOutput(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPythonGUIInputOutput) do begin + RegisterConstructor(@TPythonGUIInputOutput.Create, 'Create'); + RegisterMethod(@TPythonGUIInputOutput.Destroy, 'Free'); + RegisterMethod(@TPythonGUIInputOutput.DisplayString, 'DisplayString'); + RegisterPropertyHelper(@TPythonGUIInputOutputOutput_R,@TPythonGUIInputOutputOutput_W,'Output'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_VclPythonGUIInputOutput(CL: TPSRuntimeClassImporter); +begin + RIRegister_TPythonGUIInputOutput(CL); +end; + + + +{ TPSImport_VclPythonGUIInputOutput } +(*----------------------------------------------------------------------------*) +procedure TPSImport_VclPythonGUIInputOutput.CompileImport1(CompExec: TPSScript); +begin + SIRegister_VclPythonGUIInputOutput(CompExec.Comp); +end; +(*----------------------------------------------------------------------------*) +procedure TPSImport_VclPythonGUIInputOutput.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); +begin + RIRegister_VclPythonGUIInputOutput(ri); + RIRegister_VclPythonGUIInputOutput_Routines(CompExec.Exec); // comment it if no routines +end; +(*----------------------------------------------------------------------------*) + + +end. diff --git a/Source/uPSI_WrapDelphi.pas b/Source/uPSI_WrapDelphi.pas new file mode 100644 index 00000000..f3d15a66 --- /dev/null +++ b/Source/uPSI_WrapDelphi.pas @@ -0,0 +1,943 @@ +unit uPSI_WrapDelphi; +{ +This file has been generated by UnitParser v0.7, written by M. Knight +and updated by NP. v/d Spek and George Birbilis. +Source Code from Carlo Kok has been used to implement various sections of +UnitParser. Components of ROPS are used in the construction of UnitParser, +code implementing the class wrapper is taken from Carlo Kok's conv utility + +} +interface + + + +uses + SysUtils + ,Classes + ,uPSComponent + ,uPSRuntime + ,uPSCompiler + ; + +type +(*----------------------------------------------------------------------------*) + TPSImport_WrapDelphi = class(TPSPlugin) + public + procedure CompileImport1(CompExec: TPSScript); override; + procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + end; + + +{ compile-time registration functions } +procedure SIRegister_TPyDelphiWrapper(CL: TPSPascalCompiler); +procedure SIRegister_TRegisteredUnits(CL: TPSPascalCompiler); +procedure SIRegister_TRegisteredUnit(CL: TPSPascalCompiler); +procedure SIRegister_TNotifyEventHandler(CL: TPSPascalCompiler); +procedure SIRegister_TEventHandlers(CL: TPSPascalCompiler); +procedure SIRegister_TEventHandler(CL: TPSPascalCompiler); +procedure SIRegister_TPyPascalInterface(CL: TPSPascalCompiler); +procedure SIRegister_TPyPascalRecord(CL: TPSPascalCompiler); +procedure SIRegister_TPyRttiObject(CL: TPSPascalCompiler); +procedure SIRegister_TPyDelphiVarParameter(CL: TPSPascalCompiler); +procedure SIRegister_TPyDelphiObject(CL: TPSPascalCompiler); +procedure SIRegister_TPyInterfacedObject(CL: TPSPascalCompiler); +procedure SIRegister_TPyDelphiIterator(CL: TPSPascalCompiler); +procedure SIRegister_TPyDelphiContainer(CL: TPSPascalCompiler); +procedure SIRegister_TContainerAccess(CL: TPSPascalCompiler); +procedure SIRegister_TFreeNotificationImpl(CL: TPSPascalCompiler); +procedure SIRegister_IFreeNotification(CL: TPSPascalCompiler); +procedure SIRegister_IFreeNotificationSubscriber(CL: TPSPascalCompiler); +procedure SIRegister_WrapDelphi(CL: TPSPascalCompiler); + +{ run-time registration functions } +procedure RIRegister_WrapDelphi_Routines(S: TPSExec); +procedure RIRegister_TPyDelphiWrapper(CL: TPSRuntimeClassImporter); +procedure RIRegister_TRegisteredUnits(CL: TPSRuntimeClassImporter); +procedure RIRegister_TRegisteredUnit(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNotifyEventHandler(CL: TPSRuntimeClassImporter); +procedure RIRegister_TEventHandlers(CL: TPSRuntimeClassImporter); +procedure RIRegister_TEventHandler(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPyPascalInterface(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPyPascalRecord(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPyRttiObject(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPyDelphiVarParameter(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPyDelphiObject(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPyInterfacedObject(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPyDelphiIterator(CL: TPSRuntimeClassImporter); +procedure RIRegister_TPyDelphiContainer(CL: TPSRuntimeClassImporter); +procedure RIRegister_TContainerAccess(CL: TPSRuntimeClassImporter); +procedure RIRegister_TFreeNotificationImpl(CL: TPSRuntimeClassImporter); +procedure RIRegister_WrapDelphi(CL: TPSRuntimeClassImporter); + +procedure Register; + +implementation + + +uses + PythonEngine + ,TypInfo + ,Types + ,Variants + ,Rtti + ,ObjAuto + ,Contnrs + ,WrapDelphi + ; + + +procedure Register; +begin + RegisterComponents('Pascal Script', [TPSImport_WrapDelphi]); +end; + +(* === compile-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyDelphiWrapper(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TEngineClient', 'TPyDelphiWrapper') do + with CL.AddClassN(CL.FindClass('TEngineClient'),'TPyDelphiWrapper') do + begin + RegisterMethod('Constructor Create( AOwner : TComponent)'); + RegisterMethod('Procedure Initialize'); + RegisterMethod('Procedure Finalize'); + RegisterMethod('Procedure DefineVar2( const AName : string; const AValue : Variant);'); + RegisterMethod('Procedure DefineVar3( const AName : string; AValue : TObject);'); + RegisterMethod('Procedure RegisterDelphiWrapper( AWrapperClass : TPyDelphiObjectClass)'); + RegisterMethod('Function RegisterHelperType( APyObjectClass : TPyObjectClass) : TPythonType'); + RegisterMethod('Function RegisterFunction4( AFuncName : PAnsiChar; AFunc : PyCFunction; ADocString : PAnsiChar) : PPyMethodDef;'); + RegisterMethod('Function RegisterFunction5( AFuncName : PAnsiChar; AFunc : TDelphiMethod; ADocString : PAnsiChar) : PPyMethodDef;'); + RegisterMethod('Function GetHelperType( const TypeName : string) : TPythonType'); + RegisterMethod('Function Wrap( AObj : TObject; AOwnership : TObjectOwnership) : PPyObject'); + RegisterMethod('Function WrapRecord( Address : Pointer; Typ : TRttiStructuredType) : PPyObject'); + RegisterMethod('Function WrapInterface( const IValue : TValue) : PPyObject'); + RegisterProperty('EventHandlers', 'TEventHandlers', iptr); + RegisterProperty('DefaultContainerType', 'TPythonType', iptr); + RegisterProperty('DefaultIterType', 'TPythonType', iptr); + RegisterProperty('DelphiMethodType', 'TPythonType', iptr); + RegisterProperty('VarParamType', 'TPythonType', iptr); + RegisterProperty('Module', 'TPythonModule', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TRegisteredUnits(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TOBJECT', 'TRegisteredUnits') do + with CL.AddClassN(CL.FindClass('TOBJECT'),'TRegisteredUnits') do + begin + RegisterMethod('Constructor Create'); + RegisterMethod('Procedure Add( ARegisteredModule : TRegisteredUnit)'); + RegisterProperty('Count', 'Integer', iptr); + RegisterProperty('Items', 'TRegisteredUnit Integer', iptr); + SetDefaultPropery('Items'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TRegisteredUnit(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TOBJECT', 'TRegisteredUnit') do + with CL.AddClassN(CL.FindClass('TOBJECT'),'TRegisteredUnit') do + begin + RegisterMethod('Function Name : string'); + RegisterMethod('Procedure RegisterWrappers( APyDelphiWrapper : TPyDelphiWrapper)'); + RegisterMethod('Procedure DefineVars( APyDelphiWrapper : TPyDelphiWrapper)'); + RegisterMethod('Procedure DefineFunctions( APyDelphiWrapper : TPyDelphiWrapper)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNotifyEventHandler(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TEventHandler', 'TNotifyEventHandler') do + with CL.AddClassN(CL.FindClass('TEventHandler'),'TNotifyEventHandler') do + begin + RegisterMethod('Constructor Create( PyDelphiWrapper : TPyDelphiWrapper; Component : TObject; PropertyInfo : PPropInfo; Callable : PPyObject)'); + RegisterMethod('Function GetTypeInfo : PTypeInfo'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TEventHandlers(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TOBJECT', 'TEventHandlers') do + with CL.AddClassN(CL.FindClass('TOBJECT'),'TEventHandlers') do + begin + RegisterMethod('Constructor Create( APyDelphiWrapper : TPyDelphiWrapper)'); + RegisterMethod('Function Add( AEventHandler : TEventHandler) : Boolean'); + RegisterMethod('Procedure Clear'); + RegisterMethod('Procedure Delete( AIndex : Integer)'); + RegisterMethod('Function GetCallable0( AComponent : TObject; APropInfo : PPropInfo) : PPyObject;'); + RegisterMethod('Function GetCallable1( AComponent : TObject; const APropName : string) : PPyObject;'); + RegisterMethod('Function Link( AComponent : TObject; APropInfo : PPropInfo; ACallable : PPyObject; out ErrMsg : string) : Boolean'); + RegisterMethod('Function IndexOf( AComponent : TObject; APropInfo : PPropInfo) : Integer'); + RegisterMethod('Procedure RegisterHandler( AEventHandlerClass : TEventHandlerClass)'); + RegisterMethod('Function Unlink( AComponent : TObject; APropInfo : PPropInfo) : Boolean'); + RegisterProperty('Count', 'Integer', iptr); + RegisterProperty('Items', 'TEventHandler Integer', iptr); + SetDefaultPropery('Items'); + RegisterProperty('PyDelphiWrapper', 'TPyDelphiWrapper', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TEventHandler(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TOBJECT', 'TEventHandler') do + with CL.AddClassN(CL.FindClass('TOBJECT'),'TEventHandler') do + begin + RegisterProperty('PyDelphiWrapper', 'TPyDelphiWrapper', iptrw); + RegisterProperty('PropertyInfo', 'PPropInfo', iptrw); + RegisterProperty('EventType', 'PTypeInfo', iptrw); + RegisterProperty('Callable', 'PPyObject', iptrw); + RegisterMethod('Constructor Create( PyDelphiWrapper : TPyDelphiWrapper; Component : TObject; PropertyInfo : PPropInfo; Callable : PPyObject)'); + RegisterMethod('Procedure Unsubscribe'); + RegisterMethod('Function GetTypeInfo : PTypeInfo'); + RegisterProperty('Component', 'TObject', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyPascalInterface(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPyRttiObject', 'TPyPascalInterface') do + with CL.AddClassN(CL.FindClass('TPyRttiObject'),'TPyPascalInterface') do + begin + RegisterMethod('Procedure SetupType( PythonType : TPythonType)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyPascalRecord(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPyRttiObject', 'TPyPascalRecord') do + with CL.AddClassN(CL.FindClass('TPyRttiObject'),'TPyPascalRecord') do + begin + RegisterMethod('Procedure SetupType( PythonType : TPythonType)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyRttiObject(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPyObject', 'TPyRttiObject') do + with CL.AddClassN(CL.FindClass('TPyObject'),'TPyRttiObject') do + begin + RegisterProperty('PyDelphiWrapper', 'TPyDelphiWrapper', iptrw); + RegisterMethod('Constructor Create( APythonType : TPythonType)'); + RegisterMethod('Procedure SetAddrAndType( Address : Pointer; Typ : TRttiStructuredType)'); + RegisterMethod('Function GetAttrO( key : PPyObject) : PPyObject'); + RegisterMethod('Function SetAttrO( key, value : PPyObject) : Integer'); + RegisterMethod('Function Repr : PPyObject'); + RegisterProperty('Addr', 'Pointer', iptr); + RegisterProperty('RttiType', 'TRttiStructuredType', iptr); + RegisterProperty('Value', 'TValue', iptr); + RegisterMethod('Procedure RegisterMethods( PythonType : TPythonType)'); + RegisterMethod('Procedure SetupType( PythonType : TPythonType)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyDelphiVarParameter(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPyObject', 'TPyDelphiVarParameter') do + with CL.AddClassN(CL.FindClass('TPyObject'),'TPyDelphiVarParameter') do + begin + RegisterMethod('Function RichCompare( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject'); + RegisterMethod('Function Repr : PPyObject'); + RegisterMethod('Procedure RegisterGetSets( PythonType : TPythonType)'); + RegisterMethod('Procedure SetupType( PythonType : TPythonType)'); + RegisterProperty('Value', 'PPyObject', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyDelphiObject(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPyInterfacedObject', 'TPyDelphiObject') do + with CL.AddClassN(CL.FindClass('TPyInterfacedObject'),'TPyDelphiObject') do + begin + RegisterProperty('PyDelphiWrapper', 'TPyDelphiWrapper', iptrw); + RegisterProperty('Owned', 'Boolean', iptrw); + RegisterMethod('Constructor Create( APythonType : TPythonType)'); + RegisterMethod('Function GetAttrO( key : PPyObject) : PPyObject'); + RegisterMethod('Function SetAttrO( key, value : PPyObject) : Integer'); + RegisterMethod('Function Compare( obj : PPyObject) : Integer'); + RegisterMethod('Function Repr : PPyObject'); + RegisterMethod('Function Iter : PPyObject'); + RegisterMethod('Function SqLength : NativeInt'); + RegisterMethod('Function SqItem( idx : NativeInt) : PPyObject'); + RegisterMethod('Function SqContains( obj : PPyObject) : integer'); + RegisterMethod('Function SqAssItem( idx : NativeInt; obj : PPyObject) : Integer'); + RegisterMethod('Function DelphiObjectClass : TClass'); + RegisterMethod('Function GetContainerAccessClass : TContainerAccessClass'); + RegisterMethod('Function CreateContainerAccess : TContainerAccess'); + RegisterMethod('Function Wrap( AObject : TObject; AOwnership : TObjectOwnership) : PPyObject'); + RegisterProperty('DelphiObject', 'TObject', iptrw); + RegisterProperty('ContainerAccess', 'TContainerAccess', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyInterfacedObject(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPyObject', 'TPyInterfacedObject') do + with CL.AddClassN(CL.FindClass('TPyObject'),'TPyInterfacedObject') do + begin + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyDelphiIterator(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPyObject', 'TPyDelphiIterator') do + with CL.AddClassN(CL.FindClass('TPyObject'),'TPyDelphiIterator') do + begin + RegisterMethod('Procedure Setup( AContainerAccess : TContainerAccess)'); + RegisterMethod('Procedure SetupType( PythonType : TPythonType)'); + RegisterMethod('Function Repr : PPyObject'); + RegisterMethod('Function Iter : PPyObject'); + RegisterMethod('Function IterNext : PPyObject'); + RegisterProperty('Position', 'Integer', iptr); + RegisterProperty('ContainerAccess', 'TContainerAccess', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TPyDelphiContainer(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TPyObject', 'TPyDelphiContainer') do + with CL.AddClassN(CL.FindClass('TPyObject'),'TPyDelphiContainer') do + begin + RegisterMethod('Procedure Setup( APyDelphiWrapper : TPyDelphiWrapper; AContainerAccess : TContainerAccess)'); + RegisterMethod('Function Repr : PPyObject'); + RegisterMethod('Function Iter : PPyObject'); + RegisterMethod('Function SqLength : NativeInt'); + RegisterMethod('Function SqItem( idx : NativeInt) : PPyObject'); + RegisterMethod('Function SqAssItem( idx : NativeInt; obj : PPyObject) : Integer'); + RegisterMethod('Function SqContains( obj : PPyObject) : integer'); + RegisterProperty('ContainerAccess', 'TContainerAccess', iptr); + RegisterProperty('PyDelphiWrapper', 'TPyDelphiWrapper', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TContainerAccess(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TOBJECT', 'TContainerAccess') do + with CL.AddClassN(CL.FindClass('TOBJECT'),'TContainerAccess') do + begin + RegisterMethod('Constructor Create( AWrapper : TPyDelphiWrapper; AContainer : TObject)'); + RegisterMethod('Function Clone : TContainerAccess'); + RegisterMethod('Function GetItem( AIndex : Integer) : PPyObject'); + RegisterMethod('Function GetSize : Integer'); + RegisterMethod('Function IndexOf( AValue : PPyObject) : Integer'); + RegisterMethod('Function SetItem( AIndex : Integer; AValue : PPyObject) : Boolean'); + RegisterMethod('Function ExpectedContainerClass : TClass'); + RegisterMethod('Function Name : string'); + RegisterMethod('Function SupportsWrite : Boolean'); + RegisterMethod('Function SupportsIndexOf : Boolean'); + RegisterProperty('Container', 'TObject', iptr); + RegisterProperty('Wrapper', 'TPyDelphiWrapper', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TFreeNotificationImpl(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TInterfacedObject', 'TFreeNotificationImpl') do + with CL.AddClassN(CL.FindClass('TInterfacedObject'),'TFreeNotificationImpl') do + begin + RegisterMethod('Constructor Create( AOwner : TObject)'); + RegisterProperty('Owner', 'TObject', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_IFreeNotification(CL: TPSPascalCompiler); +begin + //with RegInterfaceS(CL,'IUNKNOWN', 'IFreeNotification') do + with CL.AddInterface(CL.FindInterface('IUNKNOWN'),IFreeNotification, 'IFreeNotification') do + begin + RegisterMethod('Procedure Subscribe( const ASubscriber : IFreeNotificationSubscriber)', cdRegister); + RegisterMethod('Procedure UnSubscribe( const ASubscriber : IFreeNotificationSubscriber)', cdRegister); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_IFreeNotificationSubscriber(CL: TPSPascalCompiler); +begin + //with RegInterfaceS(CL,'IUNKNOWN', 'IFreeNotificationSubscriber') do + with CL.AddInterface(CL.FindInterface('IUNKNOWN'),IFreeNotificationSubscriber, 'IFreeNotificationSubscriber') do + begin + RegisterMethod('Procedure Notify( ADeletedObject : TObject)', cdRegister); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_WrapDelphi(CL: TPSPascalCompiler); +begin + CL.AddTypeS('TObjectOwnership', '( soReference, soOwned )'); + CL.AddClassN(CL.FindClass('TOBJECT'),'TPyDelphiWrapper'); + SIRegister_IFreeNotificationSubscriber(CL); + SIRegister_IFreeNotification(CL); + SIRegister_TFreeNotificationImpl(CL); + SIRegister_TContainerAccess(CL); + //CL.AddTypeS('TContainerAccessClass', 'class of TContainerAccess'); + SIRegister_TPyDelphiContainer(CL); + SIRegister_TPyDelphiIterator(CL); + SIRegister_TPyInterfacedObject(CL); + SIRegister_TPyDelphiObject(CL); + //CL.AddTypeS('TPyDelphiObjectClass', 'class of TPyDelphiObject'); + SIRegister_TPyDelphiVarParameter(CL); + SIRegister_TPyRttiObject(CL); + SIRegister_TPyPascalRecord(CL); + SIRegister_TPyPascalInterface(CL); + SIRegister_TEventHandler(CL); + //CL.AddTypeS('TEventHandlerClass', 'class of TEventHandler'); + SIRegister_TEventHandlers(CL); + SIRegister_TNotifyEventHandler(CL); + SIRegister_TRegisteredUnit(CL); + SIRegister_TRegisteredUnits(CL); + SIRegister_TPyDelphiWrapper(CL); + CL.AddDelphiFunction('Function RegisteredUnits : TRegisteredUnits'); + CL.AddDelphiFunction('Function CheckIndex( AIndex, ACount : Integer; const AIndexName : string) : Boolean'); + CL.AddDelphiFunction('Function CheckIntAttribute( AAttribute : PPyObject; const AAttributeName : string; out AValue : Integer) : Boolean'); + CL.AddDelphiFunction('Function CheckFloatAttribute( AAttribute : PPyObject; const AAttributeName : string; out AValue : Double) : Boolean'); + CL.AddDelphiFunction('Function CheckBoolAttribute( AAttribute : PPyObject; const AAttributeName : string; out AValue : Boolean) : Boolean'); + CL.AddDelphiFunction('Function CheckStrAttribute( AAttribute : PPyObject; const AAttributeName : string; out AValue : string) : Boolean'); + CL.AddDelphiFunction('Function CheckObjAttribute( AAttribute : PPyObject; const AAttributeName : string; AExpectedClass : TClass; out AValue : TObject) : Boolean'); + CL.AddDelphiFunction('Function CheckCallableAttribute( AAttribute : PPyObject; const AAttributeName : string) : Boolean'); + CL.AddDelphiFunction('Function CheckEnum( const AEnumName : string; AValue, AMinValue, AMaxValue : Integer) : Boolean'); + CL.AddDelphiFunction('Function CreateVarParam( PyDelphiWrapper : TPyDelphiWrapper; const AValue : Variant) : PPyObject'); + CL.AddDelphiFunction('Function SetToPython6( ATypeInfo : PTypeInfo; AValue : Integer) : PPyObject;'); + CL.AddDelphiFunction('Function SetToPython7( APropInfo : PPropInfo; AValue : Integer) : PPyObject;'); + CL.AddDelphiFunction('Function SetToPython8( AInstance : TObject; APropInfo : PPropInfo) : PPyObject;'); + CL.AddDelphiFunction('Function PythonToSet9( APropInfo : PPropInfo; ASet : PPyObject) : Integer;'); + CL.AddDelphiFunction('Function PythonToSet10( ATypeInfo : PTypeInfo; ASet : PPyObject) : Integer;'); + CL.AddDelphiFunction('Function SupportsFreeNotification( AObject : TObject) : Boolean'); + CL.AddDelphiFunction('Procedure RaiseNotifyEvent( PyDelphiWrapper : TPyDelphiWrapper; ACallable : PPyObject; Sender : TObject)'); + CL.AddDelphiFunction('Function SetProperties( PyObject : PPyObject; keywords : PPyObject) : PPyObject'); +end; + +(* === run-time registration functions === *) +(*----------------------------------------------------------------------------*) +Function PythonToSet10_P( ATypeInfo : PTypeInfo; ASet : PPyObject) : Integer; +Begin Result := WrapDelphi.PythonToSet(ATypeInfo, ASet); END; + +(*----------------------------------------------------------------------------*) +Function PythonToSet9_P( APropInfo : PPropInfo; ASet : PPyObject) : Integer; +Begin Result := WrapDelphi.PythonToSet(APropInfo, ASet); END; + +(*----------------------------------------------------------------------------*) +Function SetToPython8_P( AInstance : TObject; APropInfo : PPropInfo) : PPyObject; +Begin Result := WrapDelphi.SetToPython(AInstance, APropInfo); END; + +(*----------------------------------------------------------------------------*) +Function SetToPython7_P( APropInfo : PPropInfo; AValue : Integer) : PPyObject; +Begin Result := WrapDelphi.SetToPython(APropInfo, AValue); END; + +(*----------------------------------------------------------------------------*) +Function SetToPython6_P( ATypeInfo : PTypeInfo; AValue : Integer) : PPyObject; +Begin Result := WrapDelphi.SetToPython(ATypeInfo, AValue); END; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiWrapperModule_W(Self: TPyDelphiWrapper; const T: TPythonModule); +begin Self.Module := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiWrapperModule_R(Self: TPyDelphiWrapper; var T: TPythonModule); +begin T := Self.Module; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiWrapperVarParamType_R(Self: TPyDelphiWrapper; var T: TPythonType); +begin T := Self.VarParamType; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiWrapperDelphiMethodType_R(Self: TPyDelphiWrapper; var T: TPythonType); +begin T := Self.DelphiMethodType; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiWrapperDefaultIterType_R(Self: TPyDelphiWrapper; var T: TPythonType); +begin T := Self.DefaultIterType; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiWrapperDefaultContainerType_R(Self: TPyDelphiWrapper; var T: TPythonType); +begin T := Self.DefaultContainerType; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiWrapperEventHandlers_R(Self: TPyDelphiWrapper; var T: TEventHandlers); +begin T := Self.EventHandlers; end; + +(*----------------------------------------------------------------------------*) +Function TPyDelphiWrapperRegisterFunction5_P(Self: TPyDelphiWrapper; AFuncName : PAnsiChar; AFunc : TDelphiMethod; ADocString : PAnsiChar) : PPyMethodDef; +Begin Result := Self.RegisterFunction(AFuncName, AFunc, ADocString); END; + +(*----------------------------------------------------------------------------*) +Function TPyDelphiWrapperRegisterFunction4_P(Self: TPyDelphiWrapper; AFuncName : PAnsiChar; AFunc : PyCFunction; ADocString : PAnsiChar) : PPyMethodDef; +Begin Result := Self.RegisterFunction(AFuncName, AFunc, ADocString); END; + +(*----------------------------------------------------------------------------*) +Procedure TPyDelphiWrapperDefineVar3_P(Self: TPyDelphiWrapper; const AName : string; AValue : TObject); +Begin Self.DefineVar(AName, AValue); END; + +(*----------------------------------------------------------------------------*) +Procedure TPyDelphiWrapperDefineVar2_P(Self: TPyDelphiWrapper; const AName : string; const AValue : Variant); +Begin Self.DefineVar(AName, AValue); END; + +(*----------------------------------------------------------------------------*) +procedure TRegisteredUnitsItems_R(Self: TRegisteredUnits; var T: TRegisteredUnit; const t1: Integer); +begin T := Self.Items[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TRegisteredUnitsCount_R(Self: TRegisteredUnits; var T: Integer); +begin T := Self.Count; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlersPyDelphiWrapper_R(Self: TEventHandlers; var T: TPyDelphiWrapper); +begin T := Self.PyDelphiWrapper; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlersItems_R(Self: TEventHandlers; var T: TEventHandler; const t1: Integer); +begin T := Self.Items[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlersCount_R(Self: TEventHandlers; var T: Integer); +begin T := Self.Count; end; + +(*----------------------------------------------------------------------------*) +Function TEventHandlersGetCallable1_P(Self: TEventHandlers; AComponent : TObject; const APropName : string) : PPyObject; +Begin Result := Self.GetCallable(AComponent, APropName); END; + +(*----------------------------------------------------------------------------*) +Function TEventHandlersGetCallable0_P(Self: TEventHandlers; AComponent : TObject; APropInfo : PPropInfo) : PPyObject; +Begin Result := Self.GetCallable(AComponent, APropInfo); END; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlerComponent_R(Self: TEventHandler; var T: TObject); +begin T := Self.Component; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlerCallable_W(Self: TEventHandler; const T: PPyObject); +Begin Self.Callable := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlerCallable_R(Self: TEventHandler; var T: PPyObject); +Begin T := Self.Callable; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlerEventType_W(Self: TEventHandler; const T: PTypeInfo); +Begin Self.EventType := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlerEventType_R(Self: TEventHandler; var T: PTypeInfo); +Begin T := Self.EventType; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlerPropertyInfo_W(Self: TEventHandler; const T: PPropInfo); +Begin Self.PropertyInfo := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlerPropertyInfo_R(Self: TEventHandler; var T: PPropInfo); +Begin T := Self.PropertyInfo; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlerPyDelphiWrapper_W(Self: TEventHandler; const T: TPyDelphiWrapper); +Begin Self.PyDelphiWrapper := T; end; + +(*----------------------------------------------------------------------------*) +procedure TEventHandlerPyDelphiWrapper_R(Self: TEventHandler; var T: TPyDelphiWrapper); +Begin T := Self.PyDelphiWrapper; end; + +(*----------------------------------------------------------------------------*) +procedure TPyRttiObjectValue_R(Self: TPyRttiObject; var T: TValue); +begin T := Self.Value; end; + +(*----------------------------------------------------------------------------*) +procedure TPyRttiObjectRttiType_R(Self: TPyRttiObject; var T: TRttiStructuredType); +begin T := Self.RttiType; end; + +(*----------------------------------------------------------------------------*) +procedure TPyRttiObjectAddr_R(Self: TPyRttiObject; var T: Pointer); +begin T := Self.Addr; end; + +(*----------------------------------------------------------------------------*) +procedure TPyRttiObjectPyDelphiWrapper_W(Self: TPyRttiObject; const T: TPyDelphiWrapper); +Begin Self.PyDelphiWrapper := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyRttiObjectPyDelphiWrapper_R(Self: TPyRttiObject; var T: TPyDelphiWrapper); +Begin T := Self.PyDelphiWrapper; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiVarParameterValue_W(Self: TPyDelphiVarParameter; const T: PPyObject); +begin Self.Value := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiVarParameterValue_R(Self: TPyDelphiVarParameter; var T: PPyObject); +begin T := Self.Value; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiObjectContainerAccess_R(Self: TPyDelphiObject; var T: TContainerAccess); +begin T := Self.ContainerAccess; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiObjectDelphiObject_W(Self: TPyDelphiObject; const T: TObject); +begin Self.DelphiObject := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiObjectDelphiObject_R(Self: TPyDelphiObject; var T: TObject); +begin T := Self.DelphiObject; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiObjectOwned_W(Self: TPyDelphiObject; const T: Boolean); +Begin Self.Owned := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiObjectOwned_R(Self: TPyDelphiObject; var T: Boolean); +Begin T := Self.Owned; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiObjectPyDelphiWrapper_W(Self: TPyDelphiObject; const T: TPyDelphiWrapper); +Begin Self.PyDelphiWrapper := T; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiObjectPyDelphiWrapper_R(Self: TPyDelphiObject; var T: TPyDelphiWrapper); +Begin T := Self.PyDelphiWrapper; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiIteratorContainerAccess_R(Self: TPyDelphiIterator; var T: TContainerAccess); +begin T := Self.ContainerAccess; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiIteratorPosition_R(Self: TPyDelphiIterator; var T: Integer); +begin T := Self.Position; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiContainerPyDelphiWrapper_R(Self: TPyDelphiContainer; var T: TPyDelphiWrapper); +begin T := Self.PyDelphiWrapper; end; + +(*----------------------------------------------------------------------------*) +procedure TPyDelphiContainerContainerAccess_R(Self: TPyDelphiContainer; var T: TContainerAccess); +begin T := Self.ContainerAccess; end; + +(*----------------------------------------------------------------------------*) +procedure TContainerAccessWrapper_R(Self: TContainerAccess; var T: TPyDelphiWrapper); +begin T := Self.Wrapper; end; + +(*----------------------------------------------------------------------------*) +procedure TContainerAccessContainer_R(Self: TContainerAccess; var T: TObject); +begin T := Self.Container; end; + +(*----------------------------------------------------------------------------*) +procedure TFreeNotificationImplOwner_R(Self: TFreeNotificationImpl; var T: TObject); +begin T := Self.Owner; end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_WrapDelphi_Routines(S: TPSExec); +begin + S.RegisterDelphiFunction(@RegisteredUnits, 'RegisteredUnits', cdRegister); + S.RegisterDelphiFunction(@CheckIndex, 'CheckIndex', cdRegister); + S.RegisterDelphiFunction(@CheckIntAttribute, 'CheckIntAttribute', cdRegister); + S.RegisterDelphiFunction(@CheckFloatAttribute, 'CheckFloatAttribute', cdRegister); + S.RegisterDelphiFunction(@CheckBoolAttribute, 'CheckBoolAttribute', cdRegister); + S.RegisterDelphiFunction(@CheckStrAttribute, 'CheckStrAttribute', cdRegister); + S.RegisterDelphiFunction(@CheckObjAttribute, 'CheckObjAttribute', cdRegister); + S.RegisterDelphiFunction(@CheckCallableAttribute, 'CheckCallableAttribute', cdRegister); + S.RegisterDelphiFunction(@CheckEnum, 'CheckEnum', cdRegister); + S.RegisterDelphiFunction(@CreateVarParam, 'CreateVarParam', cdRegister); + S.RegisterDelphiFunction(@SetToPython6, 'SetToPython6', cdRegister); + S.RegisterDelphiFunction(@SetToPython7, 'SetToPython7', cdRegister); + S.RegisterDelphiFunction(@SetToPython8, 'SetToPython8', cdRegister); + S.RegisterDelphiFunction(@PythonToSet9, 'PythonToSet9', cdRegister); + S.RegisterDelphiFunction(@PythonToSet10, 'PythonToSet10', cdRegister); + S.RegisterDelphiFunction(@SupportsFreeNotification, 'SupportsFreeNotification', cdRegister); + S.RegisterDelphiFunction(@RaiseNotifyEvent, 'RaiseNotifyEvent', cdRegister); + S.RegisterDelphiFunction(@SetProperties, 'SetProperties', cdRegister); +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyDelphiWrapper(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyDelphiWrapper) do + begin + RegisterConstructor(@TPyDelphiWrapper.Create, 'Create'); + RegisterMethod(@TPyDelphiWrapper.Initialize, 'Initialize'); + RegisterMethod(@TPyDelphiWrapper.Finalize, 'Finalize'); + RegisterMethod(@TPyDelphiWrapperDefineVar2_P, 'DefineVar2'); + RegisterMethod(@TPyDelphiWrapperDefineVar3_P, 'DefineVar3'); + RegisterMethod(@TPyDelphiWrapper.RegisterDelphiWrapper, 'RegisterDelphiWrapper'); + RegisterMethod(@TPyDelphiWrapper.RegisterHelperType, 'RegisterHelperType'); + RegisterMethod(@TPyDelphiWrapperRegisterFunction4_P, 'RegisterFunction4'); + RegisterMethod(@TPyDelphiWrapperRegisterFunction5_P, 'RegisterFunction5'); + RegisterMethod(@TPyDelphiWrapper.GetHelperType, 'GetHelperType'); + RegisterMethod(@TPyDelphiWrapper.Wrap, 'Wrap'); + RegisterMethod(@TPyDelphiWrapper.WrapRecord, 'WrapRecord'); + RegisterMethod(@TPyDelphiWrapper.WrapInterface, 'WrapInterface'); + RegisterPropertyHelper(@TPyDelphiWrapperEventHandlers_R,nil,'EventHandlers'); + RegisterPropertyHelper(@TPyDelphiWrapperDefaultContainerType_R,nil,'DefaultContainerType'); + RegisterPropertyHelper(@TPyDelphiWrapperDefaultIterType_R,nil,'DefaultIterType'); + RegisterPropertyHelper(@TPyDelphiWrapperDelphiMethodType_R,nil,'DelphiMethodType'); + RegisterPropertyHelper(@TPyDelphiWrapperVarParamType_R,nil,'VarParamType'); + RegisterPropertyHelper(@TPyDelphiWrapperModule_R,@TPyDelphiWrapperModule_W,'Module'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TRegisteredUnits(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TRegisteredUnits) do + begin + RegisterConstructor(@TRegisteredUnits.Create, 'Create'); + RegisterMethod(@TRegisteredUnits.Add, 'Add'); + RegisterPropertyHelper(@TRegisteredUnitsCount_R,nil,'Count'); + RegisterPropertyHelper(@TRegisteredUnitsItems_R,nil,'Items'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TRegisteredUnit(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TRegisteredUnit) do + begin + RegisterVirtualAbstractMethod(@TRegisteredUnit, @!.Name, 'Name'); + RegisterVirtualMethod(@TRegisteredUnit.RegisterWrappers, 'RegisterWrappers'); + RegisterVirtualMethod(@TRegisteredUnit.DefineVars, 'DefineVars'); + RegisterVirtualMethod(@TRegisteredUnit.DefineFunctions, 'DefineFunctions'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNotifyEventHandler(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNotifyEventHandler) do + begin + RegisterConstructor(@TNotifyEventHandler.Create, 'Create'); + RegisterMethod(@TNotifyEventHandler.GetTypeInfo, 'GetTypeInfo'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TEventHandlers(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TEventHandlers) do + begin + RegisterConstructor(@TEventHandlers.Create, 'Create'); + RegisterMethod(@TEventHandlers.Add, 'Add'); + RegisterMethod(@TEventHandlers.Clear, 'Clear'); + RegisterMethod(@TEventHandlers.Delete, 'Delete'); + RegisterMethod(@TEventHandlersGetCallable0_P, 'GetCallable0'); + RegisterMethod(@TEventHandlersGetCallable1_P, 'GetCallable1'); + RegisterMethod(@TEventHandlers.Link, 'Link'); + RegisterMethod(@TEventHandlers.IndexOf, 'IndexOf'); + RegisterMethod(@TEventHandlers.RegisterHandler, 'RegisterHandler'); + RegisterMethod(@TEventHandlers.Unlink, 'Unlink'); + RegisterPropertyHelper(@TEventHandlersCount_R,nil,'Count'); + RegisterPropertyHelper(@TEventHandlersItems_R,nil,'Items'); + RegisterPropertyHelper(@TEventHandlersPyDelphiWrapper_R,nil,'PyDelphiWrapper'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TEventHandler(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TEventHandler) do + begin + RegisterPropertyHelper(@TEventHandlerPyDelphiWrapper_R,@TEventHandlerPyDelphiWrapper_W,'PyDelphiWrapper'); + RegisterPropertyHelper(@TEventHandlerPropertyInfo_R,@TEventHandlerPropertyInfo_W,'PropertyInfo'); + RegisterPropertyHelper(@TEventHandlerEventType_R,@TEventHandlerEventType_W,'EventType'); + RegisterPropertyHelper(@TEventHandlerCallable_R,@TEventHandlerCallable_W,'Callable'); + RegisterVirtualConstructor(@TEventHandler.Create, 'Create'); + RegisterMethod(@TEventHandler.Unsubscribe, 'Unsubscribe'); + RegisterVirtualAbstractMethod(@TEventHandler, @!.GetTypeInfo, 'GetTypeInfo'); + RegisterPropertyHelper(@TEventHandlerComponent_R,nil,'Component'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyPascalInterface(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyPascalInterface) do + begin + RegisterMethod(@TPyPascalInterface.SetupType, 'SetupType'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyPascalRecord(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyPascalRecord) do + begin + RegisterMethod(@TPyPascalRecord.SetupType, 'SetupType'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyRttiObject(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyRttiObject) do + begin + RegisterPropertyHelper(@TPyRttiObjectPyDelphiWrapper_R,@TPyRttiObjectPyDelphiWrapper_W,'PyDelphiWrapper'); + RegisterConstructor(@TPyRttiObject.Create, 'Create'); + RegisterMethod(@TPyRttiObject.SetAddrAndType, 'SetAddrAndType'); + RegisterMethod(@TPyRttiObject.GetAttrO, 'GetAttrO'); + RegisterMethod(@TPyRttiObject.SetAttrO, 'SetAttrO'); + RegisterMethod(@TPyRttiObject.Repr, 'Repr'); + RegisterPropertyHelper(@TPyRttiObjectAddr_R,nil,'Addr'); + RegisterPropertyHelper(@TPyRttiObjectRttiType_R,nil,'RttiType'); + RegisterPropertyHelper(@TPyRttiObjectValue_R,nil,'Value'); + RegisterMethod(@TPyRttiObject.RegisterMethods, 'RegisterMethods'); + RegisterMethod(@TPyRttiObject.SetupType, 'SetupType'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyDelphiVarParameter(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyDelphiVarParameter) do + begin + RegisterMethod(@TPyDelphiVarParameter.RichCompare, 'RichCompare'); + RegisterMethod(@TPyDelphiVarParameter.Repr, 'Repr'); + RegisterMethod(@TPyDelphiVarParameter.RegisterGetSets, 'RegisterGetSets'); + RegisterMethod(@TPyDelphiVarParameter.SetupType, 'SetupType'); + RegisterPropertyHelper(@TPyDelphiVarParameterValue_R,@TPyDelphiVarParameterValue_W,'Value'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyDelphiObject(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyDelphiObject) do + begin + RegisterPropertyHelper(@TPyDelphiObjectPyDelphiWrapper_R,@TPyDelphiObjectPyDelphiWrapper_W,'PyDelphiWrapper'); + RegisterPropertyHelper(@TPyDelphiObjectOwned_R,@TPyDelphiObjectOwned_W,'Owned'); + RegisterConstructor(@TPyDelphiObject.Create, 'Create'); + RegisterMethod(@TPyDelphiObject.GetAttrO, 'GetAttrO'); + RegisterMethod(@TPyDelphiObject.SetAttrO, 'SetAttrO'); + RegisterMethod(@TPyDelphiObject.Compare, 'Compare'); + RegisterMethod(@TPyDelphiObject.Repr, 'Repr'); + RegisterMethod(@TPyDelphiObject.Iter, 'Iter'); + RegisterMethod(@TPyDelphiObject.SqLength, 'SqLength'); + RegisterMethod(@TPyDelphiObject.SqItem, 'SqItem'); + RegisterMethod(@TPyDelphiObject.SqContains, 'SqContains'); + RegisterMethod(@TPyDelphiObject.SqAssItem, 'SqAssItem'); + RegisterVirtualMethod(@TPyDelphiObject.DelphiObjectClass, 'DelphiObjectClass'); + RegisterVirtualMethod(@TPyDelphiObject.GetContainerAccessClass, 'GetContainerAccessClass'); + RegisterVirtualMethod(@TPyDelphiObject.CreateContainerAccess, 'CreateContainerAccess'); + RegisterMethod(@TPyDelphiObject.Wrap, 'Wrap'); + RegisterPropertyHelper(@TPyDelphiObjectDelphiObject_R,@TPyDelphiObjectDelphiObject_W,'DelphiObject'); + RegisterPropertyHelper(@TPyDelphiObjectContainerAccess_R,nil,'ContainerAccess'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyInterfacedObject(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyInterfacedObject) do + begin + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyDelphiIterator(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyDelphiIterator) do + begin + RegisterMethod(@TPyDelphiIterator.Setup, 'Setup'); + RegisterMethod(@TPyDelphiIterator.SetupType, 'SetupType'); + RegisterMethod(@TPyDelphiIterator.Repr, 'Repr'); + RegisterMethod(@TPyDelphiIterator.Iter, 'Iter'); + RegisterMethod(@TPyDelphiIterator.IterNext, 'IterNext'); + RegisterPropertyHelper(@TPyDelphiIteratorPosition_R,nil,'Position'); + RegisterPropertyHelper(@TPyDelphiIteratorContainerAccess_R,nil,'ContainerAccess'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TPyDelphiContainer(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyDelphiContainer) do + begin + RegisterMethod(@TPyDelphiContainer.Setup, 'Setup'); + RegisterMethod(@TPyDelphiContainer.Repr, 'Repr'); + RegisterMethod(@TPyDelphiContainer.Iter, 'Iter'); + RegisterMethod(@TPyDelphiContainer.SqLength, 'SqLength'); + RegisterMethod(@TPyDelphiContainer.SqItem, 'SqItem'); + RegisterMethod(@TPyDelphiContainer.SqAssItem, 'SqAssItem'); + RegisterMethod(@TPyDelphiContainer.SqContains, 'SqContains'); + RegisterPropertyHelper(@TPyDelphiContainerContainerAccess_R,nil,'ContainerAccess'); + RegisterPropertyHelper(@TPyDelphiContainerPyDelphiWrapper_R,nil,'PyDelphiWrapper'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TContainerAccess(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TContainerAccess) do + begin + RegisterVirtualConstructor(@TContainerAccess.Create, 'Create'); + RegisterVirtualMethod(@TContainerAccess.Clone, 'Clone'); + RegisterVirtualAbstractMethod(@TContainerAccess, @!.GetItem, 'GetItem'); + RegisterVirtualAbstractMethod(@TContainerAccess, @!.GetSize, 'GetSize'); + RegisterVirtualMethod(@TContainerAccess.IndexOf, 'IndexOf'); + RegisterVirtualMethod(@TContainerAccess.SetItem, 'SetItem'); + RegisterVirtualAbstractMethod(@TContainerAccess, @!.ExpectedContainerClass, 'ExpectedContainerClass'); + RegisterVirtualMethod(@TContainerAccess.Name, 'Name'); + RegisterVirtualMethod(@TContainerAccess.SupportsWrite, 'SupportsWrite'); + RegisterVirtualMethod(@TContainerAccess.SupportsIndexOf, 'SupportsIndexOf'); + RegisterPropertyHelper(@TContainerAccessContainer_R,nil,'Container'); + RegisterPropertyHelper(@TContainerAccessWrapper_R,nil,'Wrapper'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TFreeNotificationImpl(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TFreeNotificationImpl) do + begin + RegisterConstructor(@TFreeNotificationImpl.Create, 'Create'); + RegisterPropertyHelper(@TFreeNotificationImplOwner_R,nil,'Owner'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_WrapDelphi(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TPyDelphiWrapper) do + RIRegister_TFreeNotificationImpl(CL); + RIRegister_TContainerAccess(CL); + RIRegister_TPyDelphiContainer(CL); + RIRegister_TPyDelphiIterator(CL); + RIRegister_TPyInterfacedObject(CL); + RIRegister_TPyDelphiObject(CL); + RIRegister_TPyDelphiVarParameter(CL); + RIRegister_TPyRttiObject(CL); + RIRegister_TPyPascalRecord(CL); + RIRegister_TPyPascalInterface(CL); + RIRegister_TEventHandler(CL); + RIRegister_TEventHandlers(CL); + RIRegister_TNotifyEventHandler(CL); + RIRegister_TRegisteredUnit(CL); + RIRegister_TRegisteredUnits(CL); + RIRegister_TPyDelphiWrapper(CL); +end; + + + +{ TPSImport_WrapDelphi } +(*----------------------------------------------------------------------------*) +procedure TPSImport_WrapDelphi.CompileImport1(CompExec: TPSScript); +begin + SIRegister_WrapDelphi(CompExec.Comp); +end; +(*----------------------------------------------------------------------------*) +procedure TPSImport_WrapDelphi.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); +begin + RIRegister_WrapDelphi(ri); + RIRegister_WrapDelphi_Routines(CompExec.Exec); // comment it if no routines +end; +(*----------------------------------------------------------------------------*) + + +end. diff --git a/Source/uPSI_neuralnetwork.pas b/Source/uPSI_neuralnetwork.pas new file mode 100644 index 00000000..1fe7ee00 --- /dev/null +++ b/Source/uPSI_neuralnetwork.pas @@ -0,0 +1,2870 @@ +unit uPSI_neuralnetwork; +{ +This file has been generated by UnitParser v0.7, written by M. Knight +and updated by NP. v/d Spek and George Birbilis. +Source Code from Carlo Kok has been used to implement various sections of +UnitParser. Components of ROPS are used in the construction of UnitParser, +code implementing the class wrapper is taken from Carlo Kok's conv utility + +} +interface + + + +uses + SysUtils + ,Classes + ,uPSComponent + ,uPSRuntime + ,uPSCompiler + ; + +type +(*----------------------------------------------------------------------------*) + TPSImport_neuralnetwork = class(TPSPlugin) + public + procedure CompileImport1(CompExec: TPSScript); override; + procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + end; + + +{ compile-time registration functions } +procedure SIRegister_TNNetDataParallelism(CL: TPSPascalCompiler); +procedure SIRegister_THistoricalNets(CL: TPSPascalCompiler); +procedure SIRegister_TNNet(CL: TPSPascalCompiler); +procedure SIRegister_TNNetUpsample(CL: TPSPascalCompiler); +procedure SIRegister_TNNetDeMaxPool(CL: TPSPascalCompiler); +procedure SIRegister_TNNetAvgChannel(CL: TPSPascalCompiler); +procedure SIRegister_TNNetAvgPool(CL: TPSPascalCompiler); +procedure SIRegister_TNNetMinChannel(CL: TPSPascalCompiler); +procedure SIRegister_TNNetMaxChannel(CL: TPSPascalCompiler); +procedure SIRegister_TNNetMinPool(CL: TPSPascalCompiler); +procedure SIRegister_TNNetMaxPoolPortable(CL: TPSPascalCompiler); +procedure SIRegister_TNNetMaxPool(CL: TPSPascalCompiler); +procedure SIRegister_TNNetPoolBase(CL: TPSPascalCompiler); +procedure SIRegister_TNNetDeLocalConnectReLU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetLocalConnectReLU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetDeLocalConnect(CL: TPSPascalCompiler); +procedure SIRegister_TNNetLocalConnect(CL: TPSPascalCompiler); +procedure SIRegister_TNNetDeconvolutionReLU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetPointwiseConvLinear(CL: TPSPascalCompiler); +procedure SIRegister_TNNetConvolutionLinear(CL: TPSPascalCompiler); +procedure SIRegister_TNNetPointwiseConvReLU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetConvolutionReLU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetDeconvolution(CL: TPSPascalCompiler); +procedure SIRegister_TNNetConvolution(CL: TPSPascalCompiler); +procedure SIRegister_TNNetConvolutionBase(CL: TPSPascalCompiler); +procedure SIRegister_TNNetDepthwiseConvReLU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetDepthwiseConvLinear(CL: TPSPascalCompiler); +procedure SIRegister_TNNetDepthwiseConv(CL: TPSPascalCompiler); +procedure SIRegister_TNNetConvolutionAbstract(CL: TPSPascalCompiler); +procedure SIRegister_TNNetSoftMax(CL: TPSPascalCompiler); +procedure SIRegister_TNNetFullConnectDiff(CL: TPSPascalCompiler); +procedure SIRegister_TNNetFullConnectReLU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetFullConnectSigmoid(CL: TPSPascalCompiler); +procedure SIRegister_TNNetFullConnectLinear(CL: TPSPascalCompiler); +procedure SIRegister_TNNetFullConnect(CL: TPSPascalCompiler); +procedure SIRegister_TNNetSplitChannelEvery(CL: TPSPascalCompiler); +procedure SIRegister_TNNetSplitChannels(CL: TPSPascalCompiler); +procedure SIRegister_TNNetSum(CL: TPSPascalCompiler); +procedure SIRegister_TNNetDeepConcat(CL: TPSPascalCompiler); +procedure SIRegister_TNNetConcat(CL: TPSPascalCompiler); +procedure SIRegister_TNNetConcatBase(CL: TPSPascalCompiler); +procedure SIRegister_TNNetReshape(CL: TPSPascalCompiler); +procedure SIRegister_TNNetLocalResponseNormDepth(CL: TPSPascalCompiler); +procedure SIRegister_TNNetLocalResponseNorm2D(CL: TPSPascalCompiler); +procedure SIRegister_TNNetChannelStdNormalization(CL: TPSPascalCompiler); +procedure SIRegister_TNNetChannelZeroCenter(CL: TPSPascalCompiler); +procedure SIRegister_TNNetCellMul(CL: TPSPascalCompiler); +procedure SIRegister_TNNetCellBias(CL: TPSPascalCompiler); +procedure SIRegister_TNNetChannelMul(CL: TPSPascalCompiler); +procedure SIRegister_TNNetChannelBias(CL: TPSPascalCompiler); +procedure SIRegister_TNNetChannelShiftBase(CL: TPSPascalCompiler); +procedure SIRegister_TNNetChannelTransformBase(CL: TPSPascalCompiler); +procedure SIRegister_TNNetMovingStdNormalization(CL: TPSPascalCompiler); +procedure SIRegister_TNNetLayerStdNormalization(CL: TPSPascalCompiler); +procedure SIRegister_TNNetLayerMaxNormalization(CL: TPSPascalCompiler); +procedure SIRegister_TNNetChannelRandomMulAdd(CL: TPSPascalCompiler); +procedure SIRegister_TNNetRandomMulAdd(CL: TPSPascalCompiler); +procedure SIRegister_TNNetDropout(CL: TPSPascalCompiler); +procedure SIRegister_TNNetAddNoiseBase(CL: TPSPascalCompiler); +procedure SIRegister_TNNetAddAndDiv(CL: TPSPascalCompiler); +procedure SIRegister_TNNetMulLearning(CL: TPSPascalCompiler); +procedure SIRegister_TNNetHyperbolicTangent(CL: TPSPascalCompiler); +procedure SIRegister_TNNetSigmoid(CL: TPSPascalCompiler); +procedure SIRegister_TNNetVeryLeakyReLU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetLeakyReLU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetSELU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetReLUL(CL: TPSPascalCompiler); +procedure SIRegister_TNNetReLU(CL: TPSPascalCompiler); +procedure SIRegister_TNNetReLUBase(CL: TPSPascalCompiler); +procedure SIRegister_TNNetIdentityWithoutBackprop(CL: TPSPascalCompiler); +procedure SIRegister_TNNetIdentityWithoutL2(CL: TPSPascalCompiler); +procedure SIRegister_TNNetIdentity(CL: TPSPascalCompiler); +procedure SIRegister_TNNetInput(CL: TPSPascalCompiler); +procedure SIRegister_TNNetInputBase(CL: TPSPascalCompiler); +procedure SIRegister_TNNetLayerList(CL: TPSPascalCompiler); +procedure SIRegister_TNNetLayerConcatedWeights(CL: TPSPascalCompiler); +procedure SIRegister_TNNetLayer(CL: TPSPascalCompiler); +procedure SIRegister_TNNetNeuronList(CL: TPSPascalCompiler); +procedure SIRegister_TNNetNeuron(CL: TPSPascalCompiler); +procedure SIRegister_neuralnetwork(CL: TPSPascalCompiler); + +{ run-time registration functions } +procedure RIRegister_neuralnetwork_Routines(S: TPSExec); +procedure RIRegister_TNNetDataParallelism(CL: TPSRuntimeClassImporter); +procedure RIRegister_THistoricalNets(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNet(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetUpsample(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetDeMaxPool(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetAvgChannel(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetAvgPool(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetMinChannel(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetMaxChannel(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetMinPool(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetMaxPoolPortable(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetMaxPool(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetPoolBase(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetDeLocalConnectReLU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetLocalConnectReLU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetDeLocalConnect(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetLocalConnect(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetDeconvolutionReLU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetPointwiseConvLinear(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetConvolutionLinear(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetPointwiseConvReLU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetConvolutionReLU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetDeconvolution(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetConvolution(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetConvolutionBase(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetDepthwiseConvReLU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetDepthwiseConvLinear(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetDepthwiseConv(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetConvolutionAbstract(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetSoftMax(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetFullConnectDiff(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetFullConnectReLU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetFullConnectSigmoid(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetFullConnectLinear(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetFullConnect(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetSplitChannelEvery(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetSplitChannels(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetSum(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetDeepConcat(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetConcat(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetConcatBase(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetReshape(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetLocalResponseNormDepth(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetLocalResponseNorm2D(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetChannelStdNormalization(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetChannelZeroCenter(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetCellMul(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetCellBias(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetChannelMul(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetChannelBias(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetChannelShiftBase(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetChannelTransformBase(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetMovingStdNormalization(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetLayerStdNormalization(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetLayerMaxNormalization(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetChannelRandomMulAdd(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetRandomMulAdd(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetDropout(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetAddNoiseBase(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetAddAndDiv(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetMulLearning(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetHyperbolicTangent(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetSigmoid(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetVeryLeakyReLU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetLeakyReLU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetSELU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetReLUL(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetReLU(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetReLUBase(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetIdentityWithoutBackprop(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetIdentityWithoutL2(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetIdentity(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetInput(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetInputBase(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetLayerList(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetLayerConcatedWeights(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetLayer(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetNeuronList(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetNeuron(CL: TPSRuntimeClassImporter); +procedure RIRegister_neuralnetwork(CL: TPSRuntimeClassImporter); + +procedure Register; + +implementation + + +uses + cl + ,neuralopencl + ,fgl + ,math + ,syncobjs + ,neuralvolume + ,neuralnetwork + ; + + +procedure Register; +begin + RegisterComponents('Pascal Script', [TPSImport_neuralnetwork]); +end; + +(* === compile-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDataParallelism(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetList', 'TNNetDataParallelism') do + with CL.AddClassN(CL.FindClass('TNNetList'),'TNNetDataParallelism') do + begin + RegisterProperty('Items', 'TNNet Integer', iptrw); + SetDefaultPropery('Items'); + RegisterMethod('Constructor Create40( CloneNN : TNNet; pSize : integer; pFreeObjects : Boolean);'); + RegisterMethod('Constructor Create41( pSize : integer; pFreeObjects : Boolean);'); + RegisterMethod('Procedure SetLearningRate( pLearningRate, pInertia : TNeuralFloat)'); + RegisterMethod('Procedure SetBatchUpdate( pBatchUpdate : boolean)'); + RegisterMethod('Procedure SetL2Decay( pL2Decay : TNeuralFloat)'); + RegisterMethod('Procedure SetL2DecayToConvolutionalLayers( pL2Decay : TNeuralFloat)'); + RegisterMethod('Procedure EnableDropouts( pFlag : boolean)'); + RegisterMethod('Procedure CopyWeights( Origin : TNNet)'); + RegisterMethod('Procedure SumWeights( Destin : TNNet)'); + RegisterMethod('Procedure SumDeltas( Destin : TNNet)'); + RegisterMethod('Procedure AvgWeights( Destin : TNNet)'); + RegisterMethod('Procedure ReplaceAtIdxAndUpdateWeightAvg( Idx : integer; NewNet, AverageNet : TNNet)'); + RegisterMethod('Procedure DisableOpenCL( )'); + RegisterMethod('Procedure EnableOpenCL( platform_id : cl_platform_id; device_id : cl_device_id)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_THistoricalNets(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNet', 'THistoricalNets') do + with CL.AddClassN(CL.FindClass('TNNet'),'THistoricalNets') do + begin + RegisterMethod('Procedure AddLeCunLeNet5( IncludeInput : boolean)'); + RegisterMethod('Procedure AddAlexNet( IncludeInput : boolean)'); + RegisterMethod('Procedure AddVGGNet( IncludeInput : boolean)'); + RegisterMethod('Procedure AddResNetUnit( pNeurons : integer)'); + RegisterMethod('Function AddDenseNetBlock( pUnits, k : integer; BottleNeck : integer; supressBias : integer; DropoutRate : TNeuralFloat) : TNNetLayer'); + RegisterMethod('Function AddDenseNetTransition( Compression : TNeuralFloat; supressBias : integer; HasAvgPool : boolean) : TNNetLayer'); + RegisterMethod('Function AddDenseNetBlockCAI( pUnits, k, supressBias : integer; PointWiseConv : TNNetConvolutionClass; IsSeparable : boolean; HasNorm : boolean; pBefore : TNNetLayerClass; pAfter : TNNetLayerClass; Bo' + + 'ttleNeck : integer; Compression : integer; DropoutRate : TNeuralFloat; RandomBias : integer; RandomAmplifier : integer) : TNNetLayer'); + RegisterMethod('Function AddDenseFullyConnected( pUnits, k, supressBias : integer; PointWiseConv : TNNetConvolutionClass; HasNorm : boolean; HasReLU : boolean; pBefore : TNNetLayerClass; pAfter : TNNetLayerClass; Bot' + + 'tleNeck : integer; Compression : TNeuralFloat) : TNNetLayer'); + RegisterMethod('Function AddSuperResolution( pSizeX, pSizeY, pNeurons, pLayerCnt : integer) : TNNetLayer'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNet(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TMObject', 'TNNet') do + with CL.AddClassN(CL.FindClass('TMObject'),'TNNet') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Function CreateLayer( strData : string) : TNNetLayer'); + RegisterMethod('Function AddLayer28( pLayer : TNNetLayer) : TNNetLayer;'); + RegisterMethod('Function AddLayer29( strData : string) : TNNetLayer;'); + RegisterMethod('Function AddLayer30( pLayers : array of TNNetLayer) : TNNetLayer;'); + RegisterMethod('Function AddSeparableConvReLU( pNumFeatures, pFeatureSize, pInputPadding, pStride : integer; pDepthMultiplier : integer; pSuppressBias : integer; pAfterLayer : TNNetLayer) : TNNetLayer'); + RegisterMethod('Function AddSeparableConvLinear( pNumFeatures, pFeatureSize, pInputPadding, pStride : integer; pDepthMultiplier : integer; pSuppressBias : integer; pAfterLayer : TNNetLayer) : TNNetLayer'); + RegisterMethod('Function AddMovingNorm31( PerCell : boolean; pAfterLayer : TNNetLayer) : TNNetLayer;'); + RegisterMethod('Function AddMovingNorm32( PerCell : boolean; RandomBias, RandomAmplifier : integer; pAfterLayer : TNNetLayer) : TNNetLayer;'); + RegisterMethod('Function AddChannelMovingNorm( PerCell : boolean; RandomBias, RandomAmplifier : integer; pAfterLayer : TNNetLayer) : TNNetLayer'); + RegisterMethod('Function AddConvOrSeparableConv( IsSeparable, HasReLU, HasNorm : boolean; pNumFeatures, pFeatureSize, pInputPadding, pStride : integer; PerCell : boolean; pSuppressBias : integer; RandomBias : integer' + + '; RandomAmplifier : integer; pAfterLayer : TNNetLayer) : TNNetLayer'); + RegisterMethod('Function AddCompression( Compression : TNeuralFloat; supressBias : integer) : TNNetLayer'); + RegisterMethod('Function AddMinMaxPool( pPoolSize : integer; pStride : integer; pPadding : integer) : TNNetLayer'); + RegisterMethod('Function AddAvgMaxPool( pPoolSize : integer; pMaxPoolDropout : TNeuralFloat; pKeepDepth : boolean; pAfterLayer : TNNetLayer) : TNNetLayer'); + RegisterMethod('Function AddMinMaxChannel( pAfterLayer : TNNetLayer) : TNNetLayer'); + RegisterMethod('Function AddAvgMaxChannel( pMaxPoolDropout : TNeuralFloat; pKeepDepth : boolean; pAfterLayer : TNNetLayer) : TNNetLayer'); + RegisterMethod('Procedure AddToExponentialWeightAverage( NewElement : TNNet; Decay : TNeuralFloat)'); + RegisterMethod('Procedure AddToWeightAverage( NewElement : TNNet; CurrentElementCount : integer)'); + RegisterMethod('Function AddLayerAfter33( pLayer, pAfterLayer : TNNetLayer) : TNNetLayer;'); + RegisterMethod('Function AddLayerAfter34( pLayer : TNNetLayer; pAfterLayerIdx : integer) : TNNetLayer;'); + RegisterMethod('Function AddLayerAfter35( strData : string; pAfterLayerIdx : integer) : TNNetLayer;'); + RegisterMethod('Function GetFirstNeuronalLayerIdx( FromLayerIdx : integer) : integer'); + RegisterMethod('Function GetFirstImageNeuronalLayerIdx( FromLayerIdx : integer) : integer'); + RegisterMethod('Function GetFirstNeuronalLayerIdxWithChannels( FromLayerIdx, Channels : integer) : integer'); + RegisterMethod('Function GetLastLayerIdx( ) : integer'); + RegisterMethod('Function GetLastLayer( ) : TNNetLayer'); + RegisterMethod('Procedure Compute36( pInput : TNNetVolume; FromLayerIdx : integer);'); + RegisterMethod('Procedure Compute37( pInput : array of TNeuralFloat; FromLayerIdx : integer);'); + RegisterMethod('Procedure Backpropagate38( pOutput : TNNetVolume);'); + RegisterMethod('Procedure BackpropagateForIdx( pOutput : TNNetVolume; const aIdx : array of integer)'); + RegisterMethod('Procedure BackpropagateFromLayerAndNeuron( LayerIdx, NeuronIdx : integer; Error : TNeuralFloat)'); + RegisterMethod('Procedure Backpropagate39( pOutput : array of TNeuralFloat);'); + RegisterMethod('Procedure GetOutput( pOutput : TNNetVolume)'); + RegisterMethod('Procedure AddOutput( pOutput : TNNetVolume)'); + RegisterMethod('Procedure SetActivationFn( ActFn, ActFnDeriv : TNeuralActivationFunction)'); + RegisterMethod('Procedure SetLearningRate( pLearningRate, pInertia : TNeuralFloat)'); + RegisterMethod('Procedure SetBatchUpdate( pBatchUpdate : boolean)'); + RegisterMethod('Procedure InitWeights( )'); + RegisterMethod('Procedure UpdateWeights( )'); + RegisterMethod('Procedure ClearDeltas( )'); + RegisterMethod('Procedure ResetBackpropCallCurrCnt( )'); + RegisterMethod('Procedure SetL2Decay( pL2Decay : TNeuralFloat)'); + RegisterMethod('Procedure SetL2DecayToConvolutionalLayers( pL2Decay : TNeuralFloat)'); + RegisterMethod('Procedure ComputeL2Decay( )'); + RegisterMethod('Procedure SetSmoothErrorPropagation( p : boolean)'); + RegisterMethod('Procedure ClearTime( )'); + RegisterMethod('Procedure Clear( )'); + RegisterMethod('Procedure IdxsToLayers( aIdx : array of integer; var aL : array of TNNetLayer)'); + RegisterMethod('Procedure EnableDropouts( pFlag : boolean)'); + RegisterMethod('Procedure RefreshDropoutMask( )'); + RegisterMethod('Procedure MulMulAddWeights( Value1, Value2 : TNeuralFloat; Origin : TNNet)'); + RegisterMethod('Procedure MulAddWeights( Value : TNeuralFloat; Origin : TNNet)'); + RegisterMethod('Procedure MulWeights( V : TNeuralFloat)'); + RegisterMethod('Procedure MulDeltas( V : TNeuralFloat)'); + RegisterMethod('Procedure SumWeights( Origin : TNNet)'); + RegisterMethod('Procedure SumDeltas( Origin : TNNet)'); + RegisterMethod('Procedure SumDeltasNoChecks( Origin : TNNet)'); + RegisterMethod('Procedure CopyWeights( Origin : TNNet)'); + RegisterMethod('Function ForceMaxAbsoluteDelta( vMax : TNeuralFloat) : TNeuralFloat'); + RegisterMethod('Function GetMaxAbsoluteDelta( ) : TNeuralFloat'); + RegisterMethod('Function NormalizeMaxAbsoluteDelta( NewMax : TNeuralFloat) : TNeuralFloat'); + RegisterMethod('Procedure ClearInertia( )'); + RegisterMethod('Procedure DisableOpenCL( )'); + RegisterMethod('Procedure EnableOpenCL( platform_id : cl_platform_id; device_id : cl_device_id)'); + RegisterMethod('Procedure DebugWeights( )'); + RegisterMethod('Procedure DebugErrors( )'); + RegisterMethod('Procedure DebugStructure( )'); + RegisterMethod('Function CountLayers( ) : integer'); + RegisterMethod('Function CountNeurons( ) : integer'); + RegisterMethod('Function CountWeights( ) : integer'); + RegisterMethod('Function GetWeightSum( ) : TNeuralFloat'); + RegisterMethod('Function SaveDataToString( ) : string'); + RegisterMethod('Procedure LoadDataFromString( strData : string)'); + RegisterMethod('Procedure LoadDataFromFile( filename : string)'); + RegisterMethod('Function SaveStructureToString( ) : string'); + RegisterMethod('Procedure LoadStructureFromString( strData : string)'); + RegisterMethod('Function SaveToString( ) : string'); + RegisterMethod('Procedure SaveToFile( filename : string)'); + RegisterMethod('Procedure LoadFromString( strData : string)'); + RegisterMethod('Procedure LoadFromFile( filename : string)'); + RegisterMethod('Function Clone( ) : TNNet'); + RegisterMethod('Procedure MulWeightsGlorotBengio( V : TNeuralFloat)'); + RegisterMethod('Procedure MulWeightsHe( V : TNeuralFloat)'); + RegisterProperty('LearningRate', 'TNeuralFloat', iptr); + RegisterProperty('BackwardTime', 'double', iptrw); + RegisterProperty('ForwardTime', 'double', iptrw); + RegisterProperty('Layers', 'TNNetLayerList', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetUpsample(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetDeMaxPool', 'TNNetUpsample') do + with CL.AddClassN(CL.FindClass('TNNetDeMaxPool'),'TNNetUpsample') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure ComputePreviousLayerError( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDeMaxPool(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetMaxPool', 'TNNetDeMaxPool') do + with CL.AddClassN(CL.FindClass('TNNetMaxPool'),'TNNetDeMaxPool') do + begin + RegisterMethod('Constructor Create( pPoolSize : integer)'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure ComputePreviousLayerError( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetAvgChannel(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetAvgPool', 'TNNetAvgChannel') do + with CL.AddClassN(CL.FindClass('TNNetAvgPool'),'TNNetAvgChannel') do + begin + RegisterMethod('Constructor Create( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetAvgPool(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetMaxPool', 'TNNetAvgPool') do + with CL.AddClassN(CL.FindClass('TNNetMaxPool'),'TNNetAvgPool') do + begin + RegisterMethod('Constructor Create( pPoolSize : integer)'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetMinChannel(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetMinPool', 'TNNetMinChannel') do + with CL.AddClassN(CL.FindClass('TNNetMinPool'),'TNNetMinChannel') do + begin + RegisterMethod('Constructor Create( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetMaxChannel(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetMaxPool', 'TNNetMaxChannel') do + with CL.AddClassN(CL.FindClass('TNNetMaxPool'),'TNNetMaxChannel') do + begin + RegisterMethod('Constructor Create( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetMinPool(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetPoolBase', 'TNNetMinPool') do + with CL.AddClassN(CL.FindClass('TNNetPoolBase'),'TNNetMinPool') do + begin + RegisterMethod('Procedure Compute( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetMaxPoolPortable(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetMaxPool', 'TNNetMaxPoolPortable') do + with CL.AddClassN(CL.FindClass('TNNetMaxPool'),'TNNetMaxPoolPortable') do + begin + RegisterMethod('Procedure Compute( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetMaxPool(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetPoolBase', 'TNNetMaxPool') do + with CL.AddClassN(CL.FindClass('TNNetPoolBase'),'TNNetMaxPool') do + begin + RegisterMethod('Procedure Compute( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetPoolBase(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLayer', 'TNNetPoolBase') do + with CL.AddClassN(CL.FindClass('TNNetLayer'),'TNNetPoolBase') do + begin + RegisterMethod('Constructor Create( pPoolSize : integer; pStride : integer; pPadding : integer)'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDeLocalConnectReLU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLocalConnectReLU', 'TNNetDeLocalConnectReLU') do + with CL.AddClassN(CL.FindClass('TNNetLocalConnectReLU'),'TNNetDeLocalConnectReLU') do + begin + RegisterMethod('Constructor Create( pNumFeatures, pFeatureSize : integer; pSuppressBias : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetLocalConnectReLU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLocalConnect', 'TNNetLocalConnectReLU') do + with CL.AddClassN(CL.FindClass('TNNetLocalConnect'),'TNNetLocalConnectReLU') do + begin + RegisterMethod('Constructor Create( pNumFeatures, pFeatureSize, pInputPadding, pStride : integer; pSuppressBias : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDeLocalConnect(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLocalConnect', 'TNNetDeLocalConnect') do + with CL.AddClassN(CL.FindClass('TNNetLocalConnect'),'TNNetDeLocalConnect') do + begin + RegisterMethod('Constructor Create( pNumFeatures, pFeatureSize : integer; pSuppressBias : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetLocalConnect(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConvolutionBase', 'TNNetLocalConnect') do + with CL.AddClassN(CL.FindClass('TNNetConvolutionBase'),'TNNetLocalConnect') do + begin + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure ComputeNTL( index, threadnum : integer)'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure BackpropagateCPU( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDeconvolutionReLU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConvolutionReLU', 'TNNetDeconvolutionReLU') do + with CL.AddClassN(CL.FindClass('TNNetConvolutionReLU'),'TNNetDeconvolutionReLU') do + begin + RegisterMethod('Constructor Create( pNumFeatures, pFeatureSize : integer; pSuppressBias : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetPointwiseConvLinear(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConvolutionLinear', 'TNNetPointwiseConvLinear') do + with CL.AddClassN(CL.FindClass('TNNetConvolutionLinear'),'TNNetPointwiseConvLinear') do + begin + RegisterMethod('Constructor Create( pNumFeatures : integer; pSuppressBias : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetConvolutionLinear(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConvolution', 'TNNetConvolutionLinear') do + with CL.AddClassN(CL.FindClass('TNNetConvolution'),'TNNetConvolutionLinear') do + begin + RegisterMethod('Constructor Create( pNumFeatures, pFeatureSize, pInputPadding, pStride : integer; pSuppressBias : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetPointwiseConvReLU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConvolutionReLU', 'TNNetPointwiseConvReLU') do + with CL.AddClassN(CL.FindClass('TNNetConvolutionReLU'),'TNNetPointwiseConvReLU') do + begin + RegisterMethod('Constructor Create( pNumFeatures : integer; pSuppressBias : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetConvolutionReLU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConvolution', 'TNNetConvolutionReLU') do + with CL.AddClassN(CL.FindClass('TNNetConvolution'),'TNNetConvolutionReLU') do + begin + RegisterMethod('Constructor Create( pNumFeatures, pFeatureSize, pInputPadding, pStride : integer; pSuppressBias : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDeconvolution(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConvolution', 'TNNetDeconvolution') do + with CL.AddClassN(CL.FindClass('TNNetConvolution'),'TNNetDeconvolution') do + begin + RegisterMethod('Constructor Create( pNumFeatures, pFeatureSize : integer; pSuppressBias : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetConvolution(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConvolutionBase', 'TNNetConvolution') do + with CL.AddClassN(CL.FindClass('TNNetConvolutionBase'),'TNNetConvolution') do + begin + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure BackpropagateCPU( )'); + RegisterMethod('Procedure BackpropagateFastCPU( )'); + RegisterMethod('Procedure BackpropagateFastCPUDev( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetConvolutionBase(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConvolutionAbstract', 'TNNetConvolutionBase') do + with CL.AddClassN(CL.FindClass('TNNetConvolutionAbstract'),'TNNetConvolutionBase') do + begin + RegisterMethod('Constructor Create( pNumFeatures, pFeatureSize, pInputPadding, pStride : integer; pSuppressBias : integer)'); + RegisterMethod('Procedure EnableOpenCL( DotProductKernel : TDotProductKernel)'); + RegisterProperty('Pointwise', 'boolean', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDepthwiseConvReLU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetDepthwiseConv', 'TNNetDepthwiseConvReLU') do + with CL.AddClassN(CL.FindClass('TNNetDepthwiseConv'),'TNNetDepthwiseConvReLU') do + begin + RegisterMethod('Constructor Create( pMultiplier, pFeatureSize, pInputPadding, pStride : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDepthwiseConvLinear(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetDepthwiseConv', 'TNNetDepthwiseConvLinear') do + with CL.AddClassN(CL.FindClass('TNNetDepthwiseConv'),'TNNetDepthwiseConvLinear') do + begin + RegisterMethod('Constructor Create( pMultiplier, pFeatureSize, pInputPadding, pStride : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDepthwiseConv(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConvolutionAbstract', 'TNNetDepthwiseConv') do + with CL.AddClassN(CL.FindClass('TNNetConvolutionAbstract'),'TNNetDepthwiseConv') do + begin + RegisterMethod('Constructor Create( pMultiplier, pFeatureSize, pInputPadding, pStride : integer)'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure InitDefault( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetConvolutionAbstract(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLayerConcatedWeights', 'TNNetConvolutionAbstract') do + with CL.AddClassN(CL.FindClass('TNNetLayerConcatedWeights'),'TNNetConvolutionAbstract') do + begin + RegisterMethod('Constructor Create( pFeatureSize, pInputPadding, pStride : integer; pSuppressBias : integer)'); + RegisterMethod('Procedure InitDefault( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetSoftMax(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetSoftMax') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetSoftMax') do + begin + RegisterMethod('Procedure Compute( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetFullConnectDiff(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetFullConnectReLU', 'TNNetFullConnectDiff') do + with CL.AddClassN(CL.FindClass('TNNetFullConnectReLU'),'TNNetFullConnectDiff') do + begin + RegisterMethod('Constructor Create24( pSizeX, pSizeY, pDepth : integer; pSuppressBias : integer);'); + RegisterMethod('Constructor Create25( pSize : integer; pSuppressBias : integer);'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetFullConnectReLU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetFullConnectLinear', 'TNNetFullConnectReLU') do + with CL.AddClassN(CL.FindClass('TNNetFullConnectLinear'),'TNNetFullConnectReLU') do + begin + RegisterMethod('Procedure ComputeCPU( )'); + RegisterMethod('Procedure BackpropagateCPU( )'); + RegisterMethod('Constructor Create22( pSizeX, pSizeY, pDepth : integer; pSuppressBias : integer);'); + RegisterMethod('Constructor Create23( pSize : integer; pSuppressBias : integer);'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetFullConnectSigmoid(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetFullConnect', 'TNNetFullConnectSigmoid') do + with CL.AddClassN(CL.FindClass('TNNetFullConnect'),'TNNetFullConnectSigmoid') do + begin + RegisterMethod('Constructor Create20( pSizeX, pSizeY, pDepth : integer; pSuppressBias : integer);'); + RegisterMethod('Constructor Create21( pSize : integer; pSuppressBias : integer);'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetFullConnectLinear(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetFullConnect', 'TNNetFullConnectLinear') do + with CL.AddClassN(CL.FindClass('TNNetFullConnect'),'TNNetFullConnectLinear') do + begin + RegisterMethod('Procedure ComputeCPU( )'); + RegisterMethod('Procedure BackpropagateCPU( )'); + RegisterMethod('Constructor Create18( pSizeX, pSizeY, pDepth : integer; pSuppressBias : integer);'); + RegisterMethod('Constructor Create19( pSize : integer; pSuppressBias : integer);'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetFullConnect(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLayer', 'TNNetFullConnect') do + with CL.AddClassN(CL.FindClass('TNNetLayer'),'TNNetFullConnect') do + begin + RegisterMethod('Constructor Create16( pSizeX, pSizeY, pDepth : integer; pSuppressBias : integer);'); + RegisterMethod('Constructor Create17( pSize : integer; pSuppressBias : integer);'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure ComputeCPU( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure BackpropagateCPU( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetSplitChannelEvery(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetSplitChannels', 'TNNetSplitChannelEvery') do + with CL.AddClassN(CL.FindClass('TNNetSplitChannels'),'TNNetSplitChannelEvery') do + begin + RegisterMethod('Constructor Create14( GetChannelEvery, ChannelShift : integer);'); + RegisterMethod('Constructor Create15( pChannels : array of integer);'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetSplitChannels(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLayer', 'TNNetSplitChannels') do + with CL.AddClassN(CL.FindClass('TNNetLayer'),'TNNetSplitChannels') do + begin + RegisterMethod('Constructor Create12( ChannelStart, ChannelLen : integer);'); + RegisterMethod('Constructor Create13( pChannels : array of integer);'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Function SaveStructureToString( ) : string'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetSum(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConcatBase', 'TNNetSum') do + with CL.AddClassN(CL.FindClass('TNNetConcatBase'),'TNNetSum') do + begin + RegisterMethod('Constructor Create11( aL : array of TNNetLayer);'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDeepConcat(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConcatBase', 'TNNetDeepConcat') do + with CL.AddClassN(CL.FindClass('TNNetConcatBase'),'TNNetDeepConcat') do + begin + RegisterMethod('Constructor Create10( aL : array of TNNetLayer);'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetConcat(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetConcatBase', 'TNNetConcat') do + with CL.AddClassN(CL.FindClass('TNNetConcatBase'),'TNNetConcat') do + begin + RegisterMethod('Constructor Create8( pSizeX, pSizeY, pDepth : integer; aL : array of TNNetLayer);'); + RegisterMethod('Constructor Create9( aL : array of TNNetLayer);'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetConcatBase(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLayer', 'TNNetConcatBase') do + with CL.AddClassN(CL.FindClass('TNNetLayer'),'TNNetConcatBase') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Function SaveStructureToString( ) : string'); + RegisterMethod('Procedure BackpropagateConcat( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetReshape(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLayer', 'TNNetReshape') do + with CL.AddClassN(CL.FindClass('TNNetLayer'),'TNNetReshape') do + begin + RegisterMethod('Constructor Create7( pSizeX, pSizeY, pDepth : integer);'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetLocalResponseNormDepth(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLocalResponseNorm2D', 'TNNetLocalResponseNormDepth') do + with CL.AddClassN(CL.FindClass('TNNetLocalResponseNorm2D'),'TNNetLocalResponseNormDepth') do + begin + RegisterMethod('Procedure Compute( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetLocalResponseNorm2D(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetLocalResponseNorm2D') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetLocalResponseNorm2D') do + begin + RegisterMethod('Constructor Create( pSize : integer)'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetChannelStdNormalization(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetChannelZeroCenter', 'TNNetChannelStdNormalization') do + with CL.AddClassN(CL.FindClass('TNNetChannelZeroCenter'),'TNNetChannelStdNormalization') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure InitDefault( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetChannelZeroCenter(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetChannelShiftBase', 'TNNetChannelZeroCenter') do + with CL.AddClassN(CL.FindClass('TNNetChannelShiftBase'),'TNNetChannelZeroCenter') do + begin + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure ComputeL2Decay( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetCellMul(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentityWithoutL2', 'TNNetCellMul') do + with CL.AddClassN(CL.FindClass('TNNetIdentityWithoutL2'),'TNNetCellMul') do + begin + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure InitDefault( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetCellBias(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentityWithoutL2', 'TNNetCellBias') do + with CL.AddClassN(CL.FindClass('TNNetIdentityWithoutL2'),'TNNetCellBias') do + begin + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure InitDefault( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetChannelMul(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetChannelTransformBase', 'TNNetChannelMul') do + with CL.AddClassN(CL.FindClass('TNNetChannelTransformBase'),'TNNetChannelMul') do + begin + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure InitDefault( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetChannelBias(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetChannelShiftBase', 'TNNetChannelBias') do + with CL.AddClassN(CL.FindClass('TNNetChannelShiftBase'),'TNNetChannelBias') do + begin + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetChannelShiftBase(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetChannelTransformBase', 'TNNetChannelShiftBase') do + with CL.AddClassN(CL.FindClass('TNNetChannelTransformBase'),'TNNetChannelShiftBase') do + begin + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure InitDefault( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetChannelTransformBase(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentityWithoutL2', 'TNNetChannelTransformBase') do + with CL.AddClassN(CL.FindClass('TNNetIdentityWithoutL2'),'TNNetChannelTransformBase') do + begin + RegisterMethod('Constructor Create( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetMovingStdNormalization(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentityWithoutL2', 'TNNetMovingStdNormalization') do + with CL.AddClassN(CL.FindClass('TNNetIdentityWithoutL2'),'TNNetMovingStdNormalization') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure InitDefault( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetLayerStdNormalization(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetLayerStdNormalization') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetLayerStdNormalization') do + begin + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetLayerMaxNormalization(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetLayerMaxNormalization') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetLayerMaxNormalization') do + begin + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetChannelRandomMulAdd(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetAddNoiseBase', 'TNNetChannelRandomMulAdd') do + with CL.AddClassN(CL.FindClass('TNNetAddNoiseBase'),'TNNetChannelRandomMulAdd') do + begin + RegisterMethod('Constructor Create( AddRate, MulRate : integer)'); + RegisterMethod('Procedure SetPrevLayer( pPrevLayer : TNNetLayer)'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetRandomMulAdd(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetAddNoiseBase', 'TNNetRandomMulAdd') do + with CL.AddClassN(CL.FindClass('TNNetAddNoiseBase'),'TNNetRandomMulAdd') do + begin + RegisterMethod('Constructor Create( AddRate, MulRate : integer)'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDropout(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetAddNoiseBase', 'TNNetDropout') do + with CL.AddClassN(CL.FindClass('TNNetAddNoiseBase'),'TNNetDropout') do + begin + RegisterMethod('Constructor Create( Rate : double; OneMaskPerbatch : integer)'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure CopyWeights( Origin : TNNetLayer)'); + RegisterMethod('Procedure RefreshDropoutMask( )'); + RegisterProperty('DropoutMask', 'TNNetVolume', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetAddNoiseBase(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetAddNoiseBase') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetAddNoiseBase') do + begin + RegisterProperty('Enabled', 'boolean', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetAddAndDiv(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetAddAndDiv') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetAddAndDiv') do + begin + RegisterMethod('Constructor Create6( pAdd, pDiv : integer);'); + RegisterMethod('Procedure Compute( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetMulLearning(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetMulLearning') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetMulLearning') do + begin + RegisterMethod('Constructor Create( pMul : integer)'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetHyperbolicTangent(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetSigmoid', 'TNNetHyperbolicTangent') do + with CL.AddClassN(CL.FindClass('TNNetSigmoid'),'TNNetHyperbolicTangent') do + begin + RegisterMethod('Constructor Create( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetSigmoid(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetSigmoid') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetSigmoid') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetVeryLeakyReLU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLeakyReLU', 'TNNetVeryLeakyReLU') do + with CL.AddClassN(CL.FindClass('TNNetLeakyReLU'),'TNNetVeryLeakyReLU') do + begin + RegisterMethod('Constructor Create( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetLeakyReLU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetReLUBase', 'TNNetLeakyReLU') do + with CL.AddClassN(CL.FindClass('TNNetReLUBase'),'TNNetLeakyReLU') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Procedure Compute( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetSELU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetReLUBase', 'TNNetSELU') do + with CL.AddClassN(CL.FindClass('TNNetReLUBase'),'TNNetSELU') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Procedure Compute( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetReLUL(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetReLUBase', 'TNNetReLUL') do + with CL.AddClassN(CL.FindClass('TNNetReLUBase'),'TNNetReLUL') do + begin + RegisterMethod('Constructor Create( LowLimit, HighLimit : integer)'); + RegisterMethod('Procedure Compute( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetReLU(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetReLUBase', 'TNNetReLU') do + with CL.AddClassN(CL.FindClass('TNNetReLUBase'),'TNNetReLU') do + begin + RegisterMethod('Procedure Compute( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetReLUBase(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetReLUBase') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetReLUBase') do + begin + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetIdentityWithoutBackprop(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetIdentityWithoutBackprop') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetIdentityWithoutBackprop') do + begin + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetIdentityWithoutL2(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetIdentity', 'TNNetIdentityWithoutL2') do + with CL.AddClassN(CL.FindClass('TNNetIdentity'),'TNNetIdentityWithoutL2') do + begin + RegisterMethod('Procedure ComputeL2Decay( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetIdentity(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLayer', 'TNNetIdentity') do + with CL.AddClassN(CL.FindClass('TNNetLayer'),'TNNetIdentity') do + begin + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetInput(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetInputBase', 'TNNetInput') do + with CL.AddClassN(CL.FindClass('TNNetInputBase'),'TNNetInput') do + begin + RegisterMethod('Constructor Create3( pSize : integer);'); + RegisterMethod('Constructor Create4( pSizeX, pSizeY, pDepth : integer);'); + RegisterMethod('Constructor Create5( pSizeX, pSizeY, pDepth, pError : integer);'); + RegisterMethod('Function EnableErrorCollection : TNNetInput'); + RegisterMethod('Function DisableErrorCollection : TNNetInput'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetInputBase(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLayer', 'TNNetInputBase') do + with CL.AddClassN(CL.FindClass('TNNetLayer'),'TNNetInputBase') do + begin + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetLayerList(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetList', 'TNNetLayerList') do + with CL.AddClassN(CL.FindClass('TNNetList'),'TNNetLayerList') do + begin + RegisterProperty('Items', 'TNNetLayer Integer', iptrw); + SetDefaultPropery('Items'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetLayerConcatedWeights(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetLayer', 'TNNetLayerConcatedWeights') do + with CL.AddClassN(CL.FindClass('TNNetLayer'),'TNNetLayerConcatedWeights') do + begin + RegisterMethod('Constructor Create( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetLayer(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TMObject', 'TNNetLayer') do + with CL.AddClassN(CL.FindClass('TMObject'),'TNNetLayer') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Procedure DisableOpenCL( )'); + RegisterMethod('Procedure EnableOpenCL( DotProductKernel : TDotProductKernel)'); + RegisterMethod('Procedure Compute( )'); + RegisterMethod('Procedure Backpropagate( )'); + RegisterMethod('Procedure ComputeOutputErrorForOneNeuron( NeuronIdx : integer; value : TNeuralFloat)'); + RegisterMethod('Procedure ComputeOutputErrorWith( pOutput : TNNetVolume)'); + RegisterMethod('Procedure ComputeOutputErrorForIdx( pOutput : TNNetVolume; const aIdx : array of integer)'); + RegisterMethod('Procedure ComputeErrorDeriv( )'); + RegisterMethod('Procedure Fill( value : TNeuralFloat)'); + RegisterMethod('Procedure ClearDeltas( )'); + RegisterMethod('Procedure AddNeurons( NeuronNum : integer)'); + RegisterMethod('Procedure AddMissingNeurons( NeuronNum : integer)'); + RegisterMethod('Procedure SetNumWeightsForAllNeurons0( NumWeights : integer);'); + RegisterMethod('Procedure SetNumWeightsForAllNeurons1( x, y, d : integer);'); + RegisterMethod('Procedure SetNumWeightsForAllNeurons2( Origin : TNNetVolume);'); + RegisterMethod('Function GetMaxWeight( ) : TNeuralFloat'); + RegisterMethod('Function GetMinWeight( ) : TNeuralFloat'); + RegisterMethod('Function GetMaxDelta( ) : TNeuralFloat'); + RegisterMethod('Function GetMinDelta( ) : TNeuralFloat'); + RegisterMethod('Function ForceMaxAbsoluteDelta( vMax : TNeuralFloat) : TNeuralFloat'); + RegisterMethod('Function GetMaxAbsoluteDelta( ) : TNeuralFloat'); + RegisterMethod('Procedure GetMinMaxAtDepth( pDepth : integer; var pMin, pMax : TNeuralFloat)'); + RegisterMethod('Function GetWeightSum( ) : TNeuralFloat'); + RegisterMethod('Function GetBiasSum( ) : TNeuralFloat'); + RegisterMethod('Function GetInertiaSum( ) : TNeuralFloat'); + RegisterMethod('Function CountWeights( ) : integer'); + RegisterMethod('Procedure MulWeights( V : TNeuralFloat)'); + RegisterMethod('Procedure MulDeltas( V : TNeuralFloat)'); + RegisterMethod('Procedure ClearInertia( )'); + RegisterMethod('Procedure ClearTimes( )'); + RegisterMethod('Procedure AddTimes( Origin : TNNetLayer)'); + RegisterMethod('Procedure CopyTimes( Origin : TNNetLayer)'); + RegisterMethod('Procedure MulMulAddWeights( Value1, Value2 : TNeuralFloat; Origin : TNNetLayer)'); + RegisterMethod('Procedure SumWeights( Origin : TNNetLayer)'); + RegisterMethod('Procedure SumDeltas( Origin : TNNetLayer)'); + RegisterMethod('Procedure SumDeltasNoChecks( Origin : TNNetLayer)'); + RegisterMethod('Procedure CopyWeights( Origin : TNNetLayer)'); + RegisterMethod('Procedure ForceRangeWeights( V : TNeuralFloat)'); + RegisterMethod('Procedure NormalizeWeights( VMax : TNeuralFloat)'); + RegisterMethod('Function SaveDataToString( ) : string'); + RegisterMethod('Procedure LoadDataFromString( strData : string)'); + RegisterMethod('Function SaveStructureToString( ) : string'); + RegisterMethod('Procedure SetBatchUpdate( pBatchUpdate : boolean)'); + RegisterMethod('Procedure UpdateWeights( )'); + RegisterMethod('Function InitBasicPatterns( ) : TNNetLayer'); + RegisterMethod('Procedure IncDepartingBranchesCnt( )'); + RegisterMethod('Procedure ResetBackpropCallCurrCnt( )'); + RegisterMethod('Function InitUniform( Value : TNeuralFloat) : TNNetLayer'); + RegisterMethod('Function InitLeCunUniform( Value : TNeuralFloat) : TNNetLayer'); + RegisterMethod('Function InitHeUniform( Value : TNeuralFloat) : TNNetLayer'); + RegisterMethod('Function InitHeUniformDepthwise( Value : TNeuralFloat) : TNNetLayer'); + RegisterMethod('Function InitHeGaussian( Value : TNeuralFloat) : TNNetLayer'); + RegisterMethod('Function InitHeGaussianDepthwise( Value : TNeuralFloat) : TNNetLayer'); + RegisterMethod('Function InitGlorotBengioUniform( Value : TNeuralFloat) : TNNetLayer'); + RegisterMethod('Function InitSELU( Value : TNeuralFloat) : TNNetLayer'); + RegisterMethod('Procedure InitDefault( )'); + RegisterProperty('ActivationFn', 'TNeuralActivationFunction', iptrw); + RegisterProperty('ActivationFnDerivative', 'TNeuralActivationFunction', iptrw); + RegisterProperty('Neurons', 'TNNetNeuronList', iptr); + RegisterProperty('Output', 'TNNetVolume', iptr); + RegisterProperty('OutputRaw', 'TNNetVolume', iptr); + RegisterProperty('PrevLayer', 'TNNetLayer', iptrw); + RegisterProperty('LearningRate', 'TNeuralFloat', iptrw); + RegisterProperty('L2Decay', 'TNeuralFloat', iptrw); + RegisterProperty('Inertia', 'TNeuralFloat', iptr); + RegisterProperty('OutputError', 'TNNetVolume', iptrw); + RegisterProperty('OutputErrorDeriv', 'TNNetVolume', iptrw); + RegisterProperty('LayerIdx', 'integer', iptr); + RegisterProperty('SmoothErrorPropagation', 'boolean', iptrw); + RegisterProperty('BackwardTime', 'double', iptrw); + RegisterProperty('ForwardTime', 'double', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetNeuronList(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetNeuron', 'TNNetNeuronList') do + with CL.AddClassN(CL.FindClass('TNNetNeuron'),'TNNetNeuronList') do + begin + RegisterProperty('Items', 'TNNetNeuron Integer', iptrw); + SetDefaultPropery('Items'); + RegisterMethod('Constructor CreateWithElements( ElementCount : integer)'); + RegisterMethod('Function GetMaxWeight( ) : TNeuralFloat'); + RegisterMethod('Function GetMinWeight( ) : TNeuralFloat'); + RegisterMethod('Procedure InitForDebug( )'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetNeuron(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TMObject', 'TNNetNeuron') do + with CL.AddClassN(CL.FindClass('TMObject'),'TNNetNeuron') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Procedure Fill( Value : TNeuralFloat)'); + RegisterMethod('Procedure AddInertia( )'); + RegisterMethod('Procedure UpdateWeights( Inertia : TNeuralFloat)'); + RegisterMethod('Function SaveToString( ) : string'); + RegisterMethod('Procedure LoadFromString( strData : string)'); + RegisterMethod('Procedure ClearDelta'); + RegisterMethod('Procedure InitUniform( Value : TNeuralFloat)'); + RegisterMethod('Procedure InitGaussian( Value : TNeuralFloat)'); + RegisterMethod('Procedure InitLeCunUniform( Value : TNeuralFloat)'); + RegisterMethod('Procedure InitHeUniform( Value : TNeuralFloat)'); + RegisterMethod('Procedure InitHeGaussian( Value : TNeuralFloat)'); + RegisterMethod('Procedure InitHeUniformDepthwise( Value : TNeuralFloat)'); + RegisterMethod('Procedure InitHeGaussianDepthwise( Value : TNeuralFloat)'); + RegisterMethod('Procedure InitSELU( Value : TNeuralFloat)'); + RegisterProperty('Weights', 'TNNetVolume', iptr); + RegisterProperty('BackInertia', 'TNNetVolume', iptr); + RegisterProperty('Delta', 'TNNetVolume', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_neuralnetwork(CL: TPSPascalCompiler); +begin + CL.AddConstantN('csMaxInterleavedSize','integer').SetInt( 95); + SIRegister_TNNetNeuron(CL); + SIRegister_TNNetNeuronList(CL); + CL.AddConstantN('csNNetMaxParameterIdx','LongInt').SetInt( 7); + SIRegister_TNNetLayer(CL); + //CL.AddTypeS('TNNetLayerClass', 'class of TNNetLayer'); + SIRegister_TNNetLayerConcatedWeights(CL); + SIRegister_TNNetLayerList(CL); + SIRegister_TNNetInputBase(CL); + SIRegister_TNNetInput(CL); + SIRegister_TNNetIdentity(CL); + SIRegister_TNNetIdentityWithoutL2(CL); + SIRegister_TNNetIdentityWithoutBackprop(CL); + SIRegister_TNNetReLUBase(CL); + SIRegister_TNNetReLU(CL); + SIRegister_TNNetReLUL(CL); + SIRegister_TNNetSELU(CL); + SIRegister_TNNetLeakyReLU(CL); + SIRegister_TNNetVeryLeakyReLU(CL); + SIRegister_TNNetSigmoid(CL); + SIRegister_TNNetHyperbolicTangent(CL); + SIRegister_TNNetMulLearning(CL); + SIRegister_TNNetAddAndDiv(CL); + SIRegister_TNNetAddNoiseBase(CL); + SIRegister_TNNetDropout(CL); + SIRegister_TNNetRandomMulAdd(CL); + SIRegister_TNNetChannelRandomMulAdd(CL); + SIRegister_TNNetLayerMaxNormalization(CL); + SIRegister_TNNetLayerStdNormalization(CL); + SIRegister_TNNetMovingStdNormalization(CL); + SIRegister_TNNetChannelTransformBase(CL); + SIRegister_TNNetChannelShiftBase(CL); + SIRegister_TNNetChannelBias(CL); + SIRegister_TNNetChannelMul(CL); + SIRegister_TNNetCellBias(CL); + SIRegister_TNNetCellMul(CL); + SIRegister_TNNetChannelZeroCenter(CL); + SIRegister_TNNetChannelStdNormalization(CL); + SIRegister_TNNetLocalResponseNorm2D(CL); + SIRegister_TNNetLocalResponseNormDepth(CL); + SIRegister_TNNetReshape(CL); + SIRegister_TNNetConcatBase(CL); + SIRegister_TNNetConcat(CL); + SIRegister_TNNetDeepConcat(CL); + SIRegister_TNNetSum(CL); + SIRegister_TNNetSplitChannels(CL); + SIRegister_TNNetSplitChannelEvery(CL); + SIRegister_TNNetFullConnect(CL); + SIRegister_TNNetFullConnectLinear(CL); + SIRegister_TNNetFullConnectSigmoid(CL); + SIRegister_TNNetFullConnectReLU(CL); + SIRegister_TNNetFullConnectDiff(CL); + SIRegister_TNNetSoftMax(CL); + CL.AddClassN(CL.FindClass('TOBJECT'),'TNNetLayerFullConnect'); + CL.AddClassN(CL.FindClass('TOBJECT'),'TNNetLayerFullConnectReLU'); + CL.AddClassN(CL.FindClass('TOBJECT'),'TNNetLayerSoftMax'); + CL.AddClassN(CL.FindClass('TOBJECT'),'TNNetDense'); + CL.AddClassN(CL.FindClass('TOBJECT'),'TNNetDenseReLU'); + SIRegister_TNNetConvolutionAbstract(CL); + SIRegister_TNNetDepthwiseConv(CL); + SIRegister_TNNetDepthwiseConvLinear(CL); + SIRegister_TNNetDepthwiseConvReLU(CL); + SIRegister_TNNetConvolutionBase(CL); + //CL.AddTypeS('TNNetConvolutionClass', 'class of TNNetConvolutionBase'); + SIRegister_TNNetConvolution(CL); + SIRegister_TNNetDeconvolution(CL); + SIRegister_TNNetConvolutionReLU(CL); + SIRegister_TNNetPointwiseConvReLU(CL); + SIRegister_TNNetConvolutionLinear(CL); + SIRegister_TNNetPointwiseConvLinear(CL); + SIRegister_TNNetDeconvolutionReLU(CL); + SIRegister_TNNetLocalConnect(CL); + SIRegister_TNNetDeLocalConnect(CL); + SIRegister_TNNetLocalConnectReLU(CL); + SIRegister_TNNetDeLocalConnectReLU(CL); + SIRegister_TNNetPoolBase(CL); + SIRegister_TNNetMaxPool(CL); + SIRegister_TNNetMaxPoolPortable(CL); + SIRegister_TNNetMinPool(CL); + SIRegister_TNNetMaxChannel(CL); + SIRegister_TNNetMinChannel(CL); + SIRegister_TNNetAvgPool(CL); + SIRegister_TNNetAvgChannel(CL); + SIRegister_TNNetDeMaxPool(CL); + SIRegister_TNNetUpsample(CL); + CL.AddClassN(CL.FindClass('TOBJECT'),'TNNetDeAvgPool'); + SIRegister_TNNet(CL); + SIRegister_THistoricalNets(CL); + SIRegister_TNNetDataParallelism(CL); + CL.AddDelphiFunction('Procedure TestConvolutionAPI( )'); + CL.AddDelphiFunction('Procedure TestConvolutionOpenCL( platform_id : cl_platform_id; device_id : cl_device_id)'); + CL.AddDelphiFunction('Procedure RebuildPatternOnPreviousPatterns( Calculated : TNNetVolume; LocalWeight : TNNetVolume; PrevLayer : TNNetNeuronList; PrevStride : integer; ReLU : boolean; Threshold : TNeuralFloat)'); + CL.AddDelphiFunction('Procedure RebuildNeuronListOnPreviousPatterns( CalculatedLayer : TNNetNeuronList; CurrentLayer, PrevLayer : TNNetNeuronList; PrevStride : integer; ReLU : boolean; Threshold : TNeuralFloat)'); +end; + +(* === run-time registration functions === *) +(*----------------------------------------------------------------------------*) +Function TNNetDataParallelismCreate41_P(Self: TClass; CreateNewInstance: Boolean; pSize : integer; pFreeObjects : Boolean):TObject; +Begin Result := TNNetDataParallelism.Create(pSize, pFreeObjects); END; + +(*----------------------------------------------------------------------------*) +Function TNNetDataParallelismCreate40_P(Self: TClass; CreateNewInstance: Boolean; CloneNN : TNNet; pSize : integer; pFreeObjects : Boolean):TObject; +Begin Result := TNNetDataParallelism.Create(CloneNN, pSize, pFreeObjects); END; + +(*----------------------------------------------------------------------------*) +procedure TNNetDataParallelismItems_W(Self: TNNetDataParallelism; const T: TNNet; const t1: Integer); +begin Self.Items[t1] := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetDataParallelismItems_R(Self: TNNetDataParallelism; var T: TNNet; const t1: Integer); +begin T := Self.Items[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayers_R(Self: TNNet; var T: TNNetLayerList); +begin T := Self.Layers; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetForwardTime_W(Self: TNNet; const T: double); +begin Self.ForwardTime := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetForwardTime_R(Self: TNNet; var T: double); +begin T := Self.ForwardTime; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetBackwardTime_W(Self: TNNet; const T: double); +begin Self.BackwardTime := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetBackwardTime_R(Self: TNNet; var T: double); +begin T := Self.BackwardTime; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLearningRate_R(Self: TNNet; var T: TNeuralFloat); +begin T := Self.LearningRate; end; + +(*----------------------------------------------------------------------------*) +Procedure TNNetBackpropagate39_P(Self: TNNet; pOutput : array of TNeuralFloat); +Begin Self.Backpropagate(pOutput); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetBackpropagate38_P(Self: TNNet; pOutput : TNNetVolume); +Begin Self.Backpropagate(pOutput); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetCompute37_P(Self: TNNet; pInput : array of TNeuralFloat; FromLayerIdx : integer); +Begin Self.Compute(pInput, FromLayerIdx); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetCompute36_P(Self: TNNet; pInput : TNNetVolume; FromLayerIdx : integer); +Begin Self.Compute(pInput, FromLayerIdx); END; + +(*----------------------------------------------------------------------------*) +Function TNNetAddLayerAfter35_P(Self: TNNet; strData : string; pAfterLayerIdx : integer) : TNNetLayer; +Begin Result := Self.AddLayerAfter(strData, pAfterLayerIdx); END; + +(*----------------------------------------------------------------------------*) +Function TNNetAddLayerAfter34_P(Self: TNNet; pLayer : TNNetLayer; pAfterLayerIdx : integer) : TNNetLayer; +Begin Result := Self.AddLayerAfter(pLayer, pAfterLayerIdx); END; + +(*----------------------------------------------------------------------------*) +Function TNNetAddLayerAfter33_P(Self: TNNet; pLayer, pAfterLayer : TNNetLayer) : TNNetLayer; +Begin Result := Self.AddLayerAfter(pLayer, pAfterLayer); END; + +(*----------------------------------------------------------------------------*) +Function TNNetAddMovingNorm32_P(Self: TNNet; PerCell : boolean; RandomBias, RandomAmplifier : integer; pAfterLayer : TNNetLayer) : TNNetLayer; +Begin Result := Self.AddMovingNorm(PerCell, RandomBias, RandomAmplifier, pAfterLayer); END; + +(*----------------------------------------------------------------------------*) +Function TNNetAddMovingNorm31_P(Self: TNNet; PerCell : boolean; pAfterLayer : TNNetLayer) : TNNetLayer; +Begin Result := Self.AddMovingNorm(PerCell, pAfterLayer); END; + +(*----------------------------------------------------------------------------*) +Function TNNetAddLayer30_P(Self: TNNet; pLayers : array of TNNetLayer) : TNNetLayer; +Begin Result := Self.AddLayer(pLayers); END; + +(*----------------------------------------------------------------------------*) +Function TNNetAddLayer29_P(Self: TNNet; strData : string) : TNNetLayer; +Begin Result := Self.AddLayer(strData); END; + +(*----------------------------------------------------------------------------*) +Function TNNetAddLayer28_P(Self: TNNet; pLayer : TNNetLayer) : TNNetLayer; +Begin Result := Self.AddLayer(pLayer); END; + +(*----------------------------------------------------------------------------*) +procedure TNNetConvolutionBasePointwise_R(Self: TNNetConvolutionBase; var T: boolean); +begin T := Self.Pointwise; end; + +(*----------------------------------------------------------------------------*) +Procedure TNNetConvolutionBasePrepareInputForConvolution27_P(Self: TNNetConvolutionBase; OutputX, OutputY : integer); +Begin Self.PrepareInputForConvolution(OutputX, OutputY); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetConvolutionBasePrepareInputForConvolution26_P(Self: TNNetConvolutionBase; ); +Begin Self.PrepareInputForConvolution; END; + +(*----------------------------------------------------------------------------*) +Function TNNetFullConnectDiffCreate25_P(Self: TClass; CreateNewInstance: Boolean; pSize : integer; pSuppressBias : integer):TObject; +Begin Result := TNNetFullConnectDiff.Create(pSize, pSuppressBias); END; + +(*----------------------------------------------------------------------------*) +Function TNNetFullConnectDiffCreate24_P(Self: TClass; CreateNewInstance: Boolean; pSizeX, pSizeY, pDepth : integer; pSuppressBias : integer):TObject; +Begin Result := TNNetFullConnectDiff.Create(pSizeX, pSizeY, pDepth, pSuppressBias); END; + +(*----------------------------------------------------------------------------*) +Function TNNetFullConnectReLUCreate23_P(Self: TClass; CreateNewInstance: Boolean; pSize : integer; pSuppressBias : integer):TObject; +Begin Result := TNNetFullConnectReLU.Create(pSize, pSuppressBias); END; + +(*----------------------------------------------------------------------------*) +Function TNNetFullConnectReLUCreate22_P(Self: TClass; CreateNewInstance: Boolean; pSizeX, pSizeY, pDepth : integer; pSuppressBias : integer):TObject; +Begin Result := TNNetFullConnectReLU.Create(pSizeX, pSizeY, pDepth, pSuppressBias); END; + +(*----------------------------------------------------------------------------*) +Function TNNetFullConnectSigmoidCreate21_P(Self: TClass; CreateNewInstance: Boolean; pSize : integer; pSuppressBias : integer):TObject; +Begin Result := TNNetFullConnectSigmoid.Create(pSize, pSuppressBias); END; + +(*----------------------------------------------------------------------------*) +Function TNNetFullConnectSigmoidCreate20_P(Self: TClass; CreateNewInstance: Boolean; pSizeX, pSizeY, pDepth : integer; pSuppressBias : integer):TObject; +Begin Result := TNNetFullConnectSigmoid.Create(pSizeX, pSizeY, pDepth, pSuppressBias); END; + +(*----------------------------------------------------------------------------*) +Function TNNetFullConnectLinearCreate19_P(Self: TClass; CreateNewInstance: Boolean; pSize : integer; pSuppressBias : integer):TObject; +Begin Result := TNNetFullConnectLinear.Create(pSize, pSuppressBias); END; + +(*----------------------------------------------------------------------------*) +Function TNNetFullConnectLinearCreate18_P(Self: TClass; CreateNewInstance: Boolean; pSizeX, pSizeY, pDepth : integer; pSuppressBias : integer):TObject; +Begin Result := TNNetFullConnectLinear.Create(pSizeX, pSizeY, pDepth, pSuppressBias); END; + +(*----------------------------------------------------------------------------*) +Function TNNetFullConnectCreate17_P(Self: TClass; CreateNewInstance: Boolean; pSize : integer; pSuppressBias : integer):TObject; +Begin Result := TNNetFullConnect.Create(pSize, pSuppressBias); END; + +(*----------------------------------------------------------------------------*) +Function TNNetFullConnectCreate16_P(Self: TClass; CreateNewInstance: Boolean; pSizeX, pSizeY, pDepth : integer; pSuppressBias : integer):TObject; +Begin Result := TNNetFullConnect.Create(pSizeX, pSizeY, pDepth, pSuppressBias); END; + +(*----------------------------------------------------------------------------*) +Function TNNetSplitChannelEveryCreate15_P(Self: TClass; CreateNewInstance: Boolean; pChannels : array of integer):TObject; +Begin Result := TNNetSplitChannelEvery.Create(pChannels); END; + +(*----------------------------------------------------------------------------*) +Function TNNetSplitChannelEveryCreate14_P(Self: TClass; CreateNewInstance: Boolean; GetChannelEvery, ChannelShift : integer):TObject; +Begin Result := TNNetSplitChannelEvery.Create(GetChannelEvery, ChannelShift); END; + +(*----------------------------------------------------------------------------*) +Function TNNetSplitChannelsCreate13_P(Self: TClass; CreateNewInstance: Boolean; pChannels : array of integer):TObject; +Begin Result := TNNetSplitChannels.Create(pChannels); END; + +(*----------------------------------------------------------------------------*) +Function TNNetSplitChannelsCreate12_P(Self: TClass; CreateNewInstance: Boolean; ChannelStart, ChannelLen : integer):TObject; +Begin Result := TNNetSplitChannels.Create(ChannelStart, ChannelLen); END; + +(*----------------------------------------------------------------------------*) +Function TNNetSumCreate11_P(Self: TClass; CreateNewInstance: Boolean; aL : array of TNNetLayer):TObject; +Begin Result := TNNetSum.Create(aL); END; + +(*----------------------------------------------------------------------------*) +Function TNNetDeepConcatCreate10_P(Self: TClass; CreateNewInstance: Boolean; aL : array of TNNetLayer):TObject; +Begin Result := TNNetDeepConcat.Create(aL); END; + +(*----------------------------------------------------------------------------*) +Function TNNetConcatCreate9_P(Self: TClass; CreateNewInstance: Boolean; aL : array of TNNetLayer):TObject; +Begin Result := TNNetConcat.Create(aL); END; + +(*----------------------------------------------------------------------------*) +Function TNNetConcatCreate8_P(Self: TClass; CreateNewInstance: Boolean; pSizeX, pSizeY, pDepth : integer; aL : array of TNNetLayer):TObject; +Begin Result := TNNetConcat.Create(pSizeX, pSizeY, pDepth, aL); END; + +(*----------------------------------------------------------------------------*) +Function TNNetReshapeCreate7_P(Self: TClass; CreateNewInstance: Boolean; pSizeX, pSizeY, pDepth : integer):TObject; +Begin Result := TNNetReshape.Create(pSizeX, pSizeY, pDepth); END; + +(*----------------------------------------------------------------------------*) +procedure TNNetDropoutDropoutMask_R(Self: TNNetDropout; var T: TNNetVolume); +begin T := Self.DropoutMask; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetAddNoiseBaseEnabled_W(Self: TNNetAddNoiseBase; const T: boolean); +begin Self.Enabled := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetAddNoiseBaseEnabled_R(Self: TNNetAddNoiseBase; var T: boolean); +begin T := Self.Enabled; end; + +(*----------------------------------------------------------------------------*) +Function TNNetAddAndDivCreate6_P(Self: TClass; CreateNewInstance: Boolean; pAdd, pDiv : integer):TObject; +Begin Result := TNNetAddAndDiv.Create(pAdd, pDiv); END; + +(*----------------------------------------------------------------------------*) +Function TNNetInputCreate5_P(Self: TClass; CreateNewInstance: Boolean; pSizeX, pSizeY, pDepth, pError : integer):TObject; +Begin Result := TNNetInput.Create(pSizeX, pSizeY, pDepth, pError); END; + +(*----------------------------------------------------------------------------*) +Function TNNetInputCreate4_P(Self: TClass; CreateNewInstance: Boolean; pSizeX, pSizeY, pDepth : integer):TObject; +Begin Result := TNNetInput.Create(pSizeX, pSizeY, pDepth); END; + +(*----------------------------------------------------------------------------*) +Function TNNetInputCreate3_P(Self: TClass; CreateNewInstance: Boolean; pSize : integer):TObject; +Begin Result := TNNetInput.Create(pSize); END; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerListItems_W(Self: TNNetLayerList; const T: TNNetLayer; const t1: Integer); +begin Self.Items[t1] := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerListItems_R(Self: TNNetLayerList; var T: TNNetLayer; const t1: Integer); +begin T := Self.Items[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerForwardTime_W(Self: TNNetLayer; const T: double); +begin Self.ForwardTime := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerForwardTime_R(Self: TNNetLayer; var T: double); +begin T := Self.ForwardTime; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerBackwardTime_W(Self: TNNetLayer; const T: double); +begin Self.BackwardTime := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerBackwardTime_R(Self: TNNetLayer; var T: double); +begin T := Self.BackwardTime; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerSmoothErrorPropagation_W(Self: TNNetLayer; const T: boolean); +begin Self.SmoothErrorPropagation := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerSmoothErrorPropagation_R(Self: TNNetLayer; var T: boolean); +begin T := Self.SmoothErrorPropagation; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerLayerIdx_R(Self: TNNetLayer; var T: integer); +begin T := Self.LayerIdx; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerOutputErrorDeriv_W(Self: TNNetLayer; const T: TNNetVolume); +begin Self.OutputErrorDeriv := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerOutputErrorDeriv_R(Self: TNNetLayer; var T: TNNetVolume); +begin T := Self.OutputErrorDeriv; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerOutputError_W(Self: TNNetLayer; const T: TNNetVolume); +begin Self.OutputError := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerOutputError_R(Self: TNNetLayer; var T: TNNetVolume); +begin T := Self.OutputError; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerInertia_R(Self: TNNetLayer; var T: TNeuralFloat); +begin T := Self.Inertia; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerL2Decay_W(Self: TNNetLayer; const T: TNeuralFloat); +begin Self.L2Decay := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerL2Decay_R(Self: TNNetLayer; var T: TNeuralFloat); +begin T := Self.L2Decay; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerLearningRate_W(Self: TNNetLayer; const T: TNeuralFloat); +begin Self.LearningRate := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerLearningRate_R(Self: TNNetLayer; var T: TNeuralFloat); +begin T := Self.LearningRate; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerPrevLayer_W(Self: TNNetLayer; const T: TNNetLayer); +begin Self.PrevLayer := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerPrevLayer_R(Self: TNNetLayer; var T: TNNetLayer); +begin T := Self.PrevLayer; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerOutputRaw_R(Self: TNNetLayer; var T: TNNetVolume); +begin T := Self.OutputRaw; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerOutput_R(Self: TNNetLayer; var T: TNNetVolume); +begin T := Self.Output; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerNeurons_R(Self: TNNetLayer; var T: TNNetNeuronList); +begin T := Self.Neurons; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerActivationFnDerivative_W(Self: TNNetLayer; const T: TNeuralActivationFunction); +begin Self.ActivationFnDerivative := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerActivationFnDerivative_R(Self: TNNetLayer; var T: TNeuralActivationFunction); +begin T := Self.ActivationFnDerivative; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerActivationFn_W(Self: TNNetLayer; const T: TNeuralActivationFunction); +begin Self.ActivationFn := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetLayerActivationFn_R(Self: TNNetLayer; var T: TNeuralActivationFunction); +begin T := Self.ActivationFn; end; + +(*----------------------------------------------------------------------------*) +Procedure TNNetLayerSetNumWeightsForAllNeurons2_P(Self: TNNetLayer; Origin : TNNetVolume); +Begin Self.SetNumWeightsForAllNeurons(Origin); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetLayerSetNumWeightsForAllNeurons1_P(Self: TNNetLayer; x, y, d : integer); +Begin Self.SetNumWeightsForAllNeurons(x, y, d); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetLayerSetNumWeightsForAllNeurons0_P(Self: TNNetLayer; NumWeights : integer); +Begin Self.SetNumWeightsForAllNeurons(NumWeights); END; + +(*----------------------------------------------------------------------------*) +procedure TNNetNeuronListItems_W(Self: TNNetNeuronList; const T: TNNetNeuron; const t1: Integer); +begin Self.Items[t1] := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetNeuronListItems_R(Self: TNNetNeuronList; var T: TNNetNeuron; const t1: Integer); +begin T := Self.Items[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetNeuronDelta_R(Self: TNNetNeuron; var T: TNNetVolume); +begin T := Self.Delta; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetNeuronBackInertia_R(Self: TNNetNeuron; var T: TNNetVolume); +begin T := Self.BackInertia; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetNeuronWeights_R(Self: TNNetNeuron; var T: TNNetVolume); +begin T := Self.Weights; end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_neuralnetwork_Routines(S: TPSExec); +begin + S.RegisterDelphiFunction(@TestConvolutionAPI, 'TestConvolutionAPI', cdRegister); + S.RegisterDelphiFunction(@TestConvolutionOpenCL, 'TestConvolutionOpenCL', cdRegister); + S.RegisterDelphiFunction(@RebuildPatternOnPreviousPatterns, 'RebuildPatternOnPreviousPatterns', cdRegister); + S.RegisterDelphiFunction(@RebuildNeuronListOnPreviousPatterns, 'RebuildNeuronListOnPreviousPatterns', cdRegister); +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDataParallelism(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDataParallelism) do + begin + RegisterPropertyHelper(@TNNetDataParallelismItems_R,@TNNetDataParallelismItems_W,'Items'); + RegisterConstructor(@TNNetDataParallelismCreate40_P, 'Create40'); + RegisterConstructor(@TNNetDataParallelismCreate41_P, 'Create41'); + RegisterMethod(@TNNetDataParallelism.SetLearningRate, 'SetLearningRate'); + RegisterMethod(@TNNetDataParallelism.SetBatchUpdate, 'SetBatchUpdate'); + RegisterMethod(@TNNetDataParallelism.SetL2Decay, 'SetL2Decay'); + RegisterMethod(@TNNetDataParallelism.SetL2DecayToConvolutionalLayers, 'SetL2DecayToConvolutionalLayers'); + RegisterMethod(@TNNetDataParallelism.EnableDropouts, 'EnableDropouts'); + RegisterMethod(@TNNetDataParallelism.CopyWeights, 'CopyWeights'); + RegisterMethod(@TNNetDataParallelism.SumWeights, 'SumWeights'); + RegisterMethod(@TNNetDataParallelism.SumDeltas, 'SumDeltas'); + RegisterMethod(@TNNetDataParallelism.AvgWeights, 'AvgWeights'); + RegisterMethod(@TNNetDataParallelism.ReplaceAtIdxAndUpdateWeightAvg, 'ReplaceAtIdxAndUpdateWeightAvg'); + RegisterMethod(@TNNetDataParallelism.DisableOpenCL, 'DisableOpenCL'); + RegisterMethod(@TNNetDataParallelism.EnableOpenCL, 'EnableOpenCL'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_THistoricalNets(CL: TPSRuntimeClassImporter); +begin + with CL.Add(THistoricalNets) do + begin + RegisterMethod(@THistoricalNets.AddLeCunLeNet5, 'AddLeCunLeNet5'); + RegisterMethod(@THistoricalNets.AddAlexNet, 'AddAlexNet'); + RegisterMethod(@THistoricalNets.AddVGGNet, 'AddVGGNet'); + RegisterMethod(@THistoricalNets.AddResNetUnit, 'AddResNetUnit'); + RegisterMethod(@THistoricalNets.AddDenseNetBlock, 'AddDenseNetBlock'); + RegisterMethod(@THistoricalNets.AddDenseNetTransition, 'AddDenseNetTransition'); + RegisterMethod(@THistoricalNets.AddDenseNetBlockCAI, 'AddDenseNetBlockCAI'); + RegisterMethod(@THistoricalNets.AddDenseFullyConnected, 'AddDenseFullyConnected'); + RegisterMethod(@THistoricalNets.AddSuperResolution, 'AddSuperResolution'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNet(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNet) do + begin + RegisterConstructor(@TNNet.Create, 'Create'); + RegisterMethod(@TNNet.CreateLayer, 'CreateLayer'); + RegisterMethod(@TNNetAddLayer28_P, 'AddLayer28'); + RegisterMethod(@TNNetAddLayer29_P, 'AddLayer29'); + RegisterMethod(@TNNetAddLayer30_P, 'AddLayer30'); + RegisterMethod(@TNNet.AddSeparableConvReLU, 'AddSeparableConvReLU'); + RegisterMethod(@TNNet.AddSeparableConvLinear, 'AddSeparableConvLinear'); + RegisterMethod(@TNNetAddMovingNorm31_P, 'AddMovingNorm31'); + RegisterMethod(@TNNetAddMovingNorm32_P, 'AddMovingNorm32'); + RegisterMethod(@TNNet.AddChannelMovingNorm, 'AddChannelMovingNorm'); + RegisterMethod(@TNNet.AddConvOrSeparableConv, 'AddConvOrSeparableConv'); + RegisterMethod(@TNNet.AddCompression, 'AddCompression'); + RegisterMethod(@TNNet.AddMinMaxPool, 'AddMinMaxPool'); + RegisterMethod(@TNNet.AddAvgMaxPool, 'AddAvgMaxPool'); + RegisterMethod(@TNNet.AddMinMaxChannel, 'AddMinMaxChannel'); + RegisterMethod(@TNNet.AddAvgMaxChannel, 'AddAvgMaxChannel'); + RegisterMethod(@TNNet.AddToExponentialWeightAverage, 'AddToExponentialWeightAverage'); + RegisterMethod(@TNNet.AddToWeightAverage, 'AddToWeightAverage'); + RegisterMethod(@TNNetAddLayerAfter33_P, 'AddLayerAfter33'); + RegisterMethod(@TNNetAddLayerAfter34_P, 'AddLayerAfter34'); + RegisterMethod(@TNNetAddLayerAfter35_P, 'AddLayerAfter35'); + RegisterMethod(@TNNet.GetFirstNeuronalLayerIdx, 'GetFirstNeuronalLayerIdx'); + RegisterMethod(@TNNet.GetFirstImageNeuronalLayerIdx, 'GetFirstImageNeuronalLayerIdx'); + RegisterMethod(@TNNet.GetFirstNeuronalLayerIdxWithChannels, 'GetFirstNeuronalLayerIdxWithChannels'); + RegisterMethod(@TNNet.GetLastLayerIdx, 'GetLastLayerIdx'); + RegisterMethod(@TNNet.GetLastLayer, 'GetLastLayer'); + RegisterMethod(@TNNetCompute36_P, 'Compute36'); + RegisterMethod(@TNNetCompute37_P, 'Compute37'); + RegisterMethod(@TNNetBackpropagate38_P, 'Backpropagate38'); + RegisterMethod(@TNNet.BackpropagateForIdx, 'BackpropagateForIdx'); + RegisterMethod(@TNNet.BackpropagateFromLayerAndNeuron, 'BackpropagateFromLayerAndNeuron'); + RegisterMethod(@TNNetBackpropagate39_P, 'Backpropagate39'); + RegisterMethod(@TNNet.GetOutput, 'GetOutput'); + RegisterMethod(@TNNet.AddOutput, 'AddOutput'); + RegisterMethod(@TNNet.SetActivationFn, 'SetActivationFn'); + RegisterMethod(@TNNet.SetLearningRate, 'SetLearningRate'); + RegisterMethod(@TNNet.SetBatchUpdate, 'SetBatchUpdate'); + RegisterMethod(@TNNet.InitWeights, 'InitWeights'); + RegisterMethod(@TNNet.UpdateWeights, 'UpdateWeights'); + RegisterMethod(@TNNet.ClearDeltas, 'ClearDeltas'); + RegisterMethod(@TNNet.ResetBackpropCallCurrCnt, 'ResetBackpropCallCurrCnt'); + RegisterMethod(@TNNet.SetL2Decay, 'SetL2Decay'); + RegisterMethod(@TNNet.SetL2DecayToConvolutionalLayers, 'SetL2DecayToConvolutionalLayers'); + RegisterMethod(@TNNet.ComputeL2Decay, 'ComputeL2Decay'); + RegisterMethod(@TNNet.SetSmoothErrorPropagation, 'SetSmoothErrorPropagation'); + RegisterMethod(@TNNet.ClearTime, 'ClearTime'); + RegisterMethod(@TNNet.Clear, 'Clear'); + RegisterMethod(@TNNet.IdxsToLayers, 'IdxsToLayers'); + RegisterMethod(@TNNet.EnableDropouts, 'EnableDropouts'); + RegisterMethod(@TNNet.RefreshDropoutMask, 'RefreshDropoutMask'); + RegisterMethod(@TNNet.MulMulAddWeights, 'MulMulAddWeights'); + RegisterMethod(@TNNet.MulAddWeights, 'MulAddWeights'); + RegisterMethod(@TNNet.MulWeights, 'MulWeights'); + RegisterMethod(@TNNet.MulDeltas, 'MulDeltas'); + RegisterMethod(@TNNet.SumWeights, 'SumWeights'); + RegisterMethod(@TNNet.SumDeltas, 'SumDeltas'); + RegisterMethod(@TNNet.SumDeltasNoChecks, 'SumDeltasNoChecks'); + RegisterMethod(@TNNet.CopyWeights, 'CopyWeights'); + RegisterMethod(@TNNet.ForceMaxAbsoluteDelta, 'ForceMaxAbsoluteDelta'); + RegisterMethod(@TNNet.GetMaxAbsoluteDelta, 'GetMaxAbsoluteDelta'); + RegisterMethod(@TNNet.NormalizeMaxAbsoluteDelta, 'NormalizeMaxAbsoluteDelta'); + RegisterMethod(@TNNet.ClearInertia, 'ClearInertia'); + RegisterMethod(@TNNet.DisableOpenCL, 'DisableOpenCL'); + RegisterMethod(@TNNet.EnableOpenCL, 'EnableOpenCL'); + RegisterMethod(@TNNet.DebugWeights, 'DebugWeights'); + RegisterMethod(@TNNet.DebugErrors, 'DebugErrors'); + RegisterMethod(@TNNet.DebugStructure, 'DebugStructure'); + RegisterMethod(@TNNet.CountLayers, 'CountLayers'); + RegisterMethod(@TNNet.CountNeurons, 'CountNeurons'); + RegisterMethod(@TNNet.CountWeights, 'CountWeights'); + RegisterMethod(@TNNet.GetWeightSum, 'GetWeightSum'); + RegisterMethod(@TNNet.SaveDataToString, 'SaveDataToString'); + RegisterMethod(@TNNet.LoadDataFromString, 'LoadDataFromString'); + RegisterMethod(@TNNet.LoadDataFromFile, 'LoadDataFromFile'); + RegisterMethod(@TNNet.SaveStructureToString, 'SaveStructureToString'); + RegisterMethod(@TNNet.LoadStructureFromString, 'LoadStructureFromString'); + RegisterMethod(@TNNet.SaveToString, 'SaveToString'); + RegisterMethod(@TNNet.SaveToFile, 'SaveToFile'); + RegisterMethod(@TNNet.LoadFromString, 'LoadFromString'); + RegisterMethod(@TNNet.LoadFromFile, 'LoadFromFile'); + RegisterMethod(@TNNet.Clone, 'Clone'); + RegisterMethod(@TNNet.MulWeightsGlorotBengio, 'MulWeightsGlorotBengio'); + RegisterMethod(@TNNet.MulWeightsHe, 'MulWeightsHe'); + RegisterPropertyHelper(@TNNetLearningRate_R,nil,'LearningRate'); + RegisterPropertyHelper(@TNNetBackwardTime_R,@TNNetBackwardTime_W,'BackwardTime'); + RegisterPropertyHelper(@TNNetForwardTime_R,@TNNetForwardTime_W,'ForwardTime'); + RegisterPropertyHelper(@TNNetLayers_R,nil,'Layers'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetUpsample(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetUpsample) do + begin + RegisterConstructor(@TNNetUpsample.Create, 'Create'); + RegisterMethod(@TNNetUpsample.Compute, 'Compute'); + RegisterMethod(@TNNetUpsample.ComputePreviousLayerError, 'ComputePreviousLayerError'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDeMaxPool(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDeMaxPool) do + begin + RegisterConstructor(@TNNetDeMaxPool.Create, 'Create'); + RegisterMethod(@TNNetDeMaxPool.Compute, 'Compute'); + RegisterMethod(@TNNetDeMaxPool.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetDeMaxPool.ComputePreviousLayerError, 'ComputePreviousLayerError'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetAvgChannel(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetAvgChannel) do + begin + RegisterConstructor(@TNNetAvgChannel.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetAvgPool(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetAvgPool) do + begin + RegisterConstructor(@TNNetAvgPool.Create, 'Create'); + RegisterMethod(@TNNetAvgPool.Compute, 'Compute'); + RegisterMethod(@TNNetAvgPool.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetMinChannel(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetMinChannel) do + begin + RegisterConstructor(@TNNetMinChannel.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetMaxChannel(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetMaxChannel) do + begin + RegisterConstructor(@TNNetMaxChannel.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetMinPool(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetMinPool) do + begin + RegisterMethod(@TNNetMinPool.Compute, 'Compute'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetMaxPoolPortable(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetMaxPoolPortable) do + begin + RegisterMethod(@TNNetMaxPoolPortable.Compute, 'Compute'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetMaxPool(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetMaxPool) do + begin + RegisterMethod(@TNNetMaxPool.Compute, 'Compute'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetPoolBase(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetPoolBase) do + begin + RegisterConstructor(@TNNetPoolBase.Create, 'Create'); + RegisterMethod(@TNNetPoolBase.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDeLocalConnectReLU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDeLocalConnectReLU) do + begin + RegisterConstructor(@TNNetDeLocalConnectReLU.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetLocalConnectReLU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetLocalConnectReLU) do + begin + RegisterConstructor(@TNNetLocalConnectReLU.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDeLocalConnect(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDeLocalConnect) do + begin + RegisterConstructor(@TNNetDeLocalConnect.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetLocalConnect(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetLocalConnect) do + begin + RegisterMethod(@TNNetLocalConnect.Compute, 'Compute'); + RegisterMethod(@TNNetLocalConnect.ComputeNTL, 'ComputeNTL'); + RegisterMethod(@TNNetLocalConnect.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetLocalConnect.BackpropagateCPU, 'BackpropagateCPU'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDeconvolutionReLU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDeconvolutionReLU) do + begin + RegisterConstructor(@TNNetDeconvolutionReLU.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetPointwiseConvLinear(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetPointwiseConvLinear) do + begin + RegisterConstructor(@TNNetPointwiseConvLinear.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetConvolutionLinear(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetConvolutionLinear) do + begin + RegisterConstructor(@TNNetConvolutionLinear.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetPointwiseConvReLU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetPointwiseConvReLU) do + begin + RegisterConstructor(@TNNetPointwiseConvReLU.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetConvolutionReLU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetConvolutionReLU) do + begin + RegisterConstructor(@TNNetConvolutionReLU.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDeconvolution(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDeconvolution) do + begin + RegisterConstructor(@TNNetDeconvolution.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetConvolution(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetConvolution) do + begin + RegisterMethod(@TNNetConvolution.Compute, 'Compute'); + RegisterMethod(@TNNetConvolution.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetConvolution.BackpropagateCPU, 'BackpropagateCPU'); + RegisterMethod(@TNNetConvolution.BackpropagateFastCPU, 'BackpropagateFastCPU'); + RegisterMethod(@TNNetConvolution.BackpropagateFastCPUDev, 'BackpropagateFastCPUDev'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetConvolutionBase(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetConvolutionBase) do + begin + RegisterConstructor(@TNNetConvolutionBase.Create, 'Create'); + RegisterMethod(@TNNetConvolutionBase.EnableOpenCL, 'EnableOpenCL'); + RegisterPropertyHelper(@TNNetConvolutionBasePointwise_R,nil,'Pointwise'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDepthwiseConvReLU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDepthwiseConvReLU) do + begin + RegisterConstructor(@TNNetDepthwiseConvReLU.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDepthwiseConvLinear(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDepthwiseConvLinear) do + begin + RegisterConstructor(@TNNetDepthwiseConvLinear.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDepthwiseConv(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDepthwiseConv) do + begin + RegisterConstructor(@TNNetDepthwiseConv.Create, 'Create'); + RegisterMethod(@TNNetDepthwiseConv.Compute, 'Compute'); + RegisterMethod(@TNNetDepthwiseConv.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetDepthwiseConv.InitDefault, 'InitDefault'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetConvolutionAbstract(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetConvolutionAbstract) do + begin + RegisterConstructor(@TNNetConvolutionAbstract.Create, 'Create'); + RegisterMethod(@TNNetConvolutionAbstract.InitDefault, 'InitDefault'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetSoftMax(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetSoftMax) do + begin + RegisterMethod(@TNNetSoftMax.Compute, 'Compute'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetFullConnectDiff(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetFullConnectDiff) do + begin + RegisterConstructor(@TNNetFullConnectDiffCreate24_P, 'Create24'); + RegisterConstructor(@TNNetFullConnectDiffCreate25_P, 'Create25'); + RegisterMethod(@TNNetFullConnectDiff.Compute, 'Compute'); + RegisterMethod(@TNNetFullConnectDiff.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetFullConnectReLU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetFullConnectReLU) do + begin + RegisterMethod(@TNNetFullConnectReLU.ComputeCPU, 'ComputeCPU'); + RegisterMethod(@TNNetFullConnectReLU.BackpropagateCPU, 'BackpropagateCPU'); + RegisterConstructor(@TNNetFullConnectReLUCreate22_P, 'Create22'); + RegisterConstructor(@TNNetFullConnectReLUCreate23_P, 'Create23'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetFullConnectSigmoid(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetFullConnectSigmoid) do + begin + RegisterConstructor(@TNNetFullConnectSigmoidCreate20_P, 'Create20'); + RegisterConstructor(@TNNetFullConnectSigmoidCreate21_P, 'Create21'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetFullConnectLinear(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetFullConnectLinear) do + begin + RegisterMethod(@TNNetFullConnectLinear.ComputeCPU, 'ComputeCPU'); + RegisterMethod(@TNNetFullConnectLinear.BackpropagateCPU, 'BackpropagateCPU'); + RegisterConstructor(@TNNetFullConnectLinearCreate18_P, 'Create18'); + RegisterConstructor(@TNNetFullConnectLinearCreate19_P, 'Create19'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetFullConnect(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetFullConnect) do + begin + RegisterConstructor(@TNNetFullConnectCreate16_P, 'Create16'); + RegisterConstructor(@TNNetFullConnectCreate17_P, 'Create17'); + RegisterMethod(@TNNetFullConnect.Compute, 'Compute'); + RegisterVirtualMethod(@TNNetFullConnect.ComputeCPU, 'ComputeCPU'); + RegisterMethod(@TNNetFullConnect.Backpropagate, 'Backpropagate'); + RegisterVirtualMethod(@TNNetFullConnect.BackpropagateCPU, 'BackpropagateCPU'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetSplitChannelEvery(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetSplitChannelEvery) do + begin + RegisterConstructor(@TNNetSplitChannelEveryCreate14_P, 'Create14'); + RegisterConstructor(@TNNetSplitChannelEveryCreate15_P, 'Create15'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetSplitChannels(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetSplitChannels) do + begin + RegisterConstructor(@TNNetSplitChannelsCreate12_P, 'Create12'); + RegisterConstructor(@TNNetSplitChannelsCreate13_P, 'Create13'); + RegisterMethod(@TNNetSplitChannels.Compute, 'Compute'); + RegisterMethod(@TNNetSplitChannels.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetSplitChannels.SaveStructureToString, 'SaveStructureToString'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetSum(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetSum) do + begin + RegisterConstructor(@TNNetSumCreate11_P, 'Create11'); + RegisterMethod(@TNNetSum.Compute, 'Compute'); + RegisterMethod(@TNNetSum.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDeepConcat(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDeepConcat) do + begin + RegisterConstructor(@TNNetDeepConcatCreate10_P, 'Create10'); + RegisterMethod(@TNNetDeepConcat.Compute, 'Compute'); + RegisterMethod(@TNNetDeepConcat.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetConcat(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetConcat) do + begin + RegisterConstructor(@TNNetConcatCreate8_P, 'Create8'); + RegisterConstructor(@TNNetConcatCreate9_P, 'Create9'); + RegisterMethod(@TNNetConcat.Compute, 'Compute'); + RegisterMethod(@TNNetConcat.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetConcatBase(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetConcatBase) do + begin + RegisterConstructor(@TNNetConcatBase.Create, 'Create'); + RegisterMethod(@TNNetConcatBase.SaveStructureToString, 'SaveStructureToString'); + RegisterMethod(@TNNetConcatBase.BackpropagateConcat, 'BackpropagateConcat'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetReshape(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetReshape) do + begin + RegisterConstructor(@TNNetReshapeCreate7_P, 'Create7'); + RegisterMethod(@TNNetReshape.Compute, 'Compute'); + RegisterMethod(@TNNetReshape.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetLocalResponseNormDepth(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetLocalResponseNormDepth) do + begin + RegisterMethod(@TNNetLocalResponseNormDepth.Compute, 'Compute'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetLocalResponseNorm2D(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetLocalResponseNorm2D) do + begin + RegisterConstructor(@TNNetLocalResponseNorm2D.Create, 'Create'); + RegisterMethod(@TNNetLocalResponseNorm2D.Compute, 'Compute'); + RegisterMethod(@TNNetLocalResponseNorm2D.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetChannelStdNormalization(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetChannelStdNormalization) do + begin + RegisterConstructor(@TNNetChannelStdNormalization.Create, 'Create'); + RegisterMethod(@TNNetChannelStdNormalization.Compute, 'Compute'); + RegisterMethod(@TNNetChannelStdNormalization.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetChannelStdNormalization.InitDefault, 'InitDefault'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetChannelZeroCenter(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetChannelZeroCenter) do + begin + RegisterMethod(@TNNetChannelZeroCenter.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetChannelZeroCenter.ComputeL2Decay, 'ComputeL2Decay'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetCellMul(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetCellMul) do + begin + RegisterMethod(@TNNetCellMul.Compute, 'Compute'); + RegisterMethod(@TNNetCellMul.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetCellMul.InitDefault, 'InitDefault'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetCellBias(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetCellBias) do + begin + RegisterMethod(@TNNetCellBias.Compute, 'Compute'); + RegisterMethod(@TNNetCellBias.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetCellBias.InitDefault, 'InitDefault'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetChannelMul(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetChannelMul) do + begin + RegisterMethod(@TNNetChannelMul.Compute, 'Compute'); + RegisterMethod(@TNNetChannelMul.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetChannelMul.InitDefault, 'InitDefault'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetChannelBias(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetChannelBias) do + begin + RegisterMethod(@TNNetChannelBias.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetChannelShiftBase(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetChannelShiftBase) do + begin + RegisterMethod(@TNNetChannelShiftBase.Compute, 'Compute'); + RegisterMethod(@TNNetChannelShiftBase.InitDefault, 'InitDefault'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetChannelTransformBase(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetChannelTransformBase) do + begin + RegisterConstructor(@TNNetChannelTransformBase.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetMovingStdNormalization(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetMovingStdNormalization) do + begin + RegisterConstructor(@TNNetMovingStdNormalization.Create, 'Create'); + RegisterMethod(@TNNetMovingStdNormalization.Compute, 'Compute'); + RegisterMethod(@TNNetMovingStdNormalization.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetMovingStdNormalization.InitDefault, 'InitDefault'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetLayerStdNormalization(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetLayerStdNormalization) do + begin + RegisterMethod(@TNNetLayerStdNormalization.Compute, 'Compute'); + RegisterMethod(@TNNetLayerStdNormalization.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetLayerMaxNormalization(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetLayerMaxNormalization) do + begin + RegisterMethod(@TNNetLayerMaxNormalization.Compute, 'Compute'); + RegisterMethod(@TNNetLayerMaxNormalization.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetChannelRandomMulAdd(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetChannelRandomMulAdd) do + begin + RegisterConstructor(@TNNetChannelRandomMulAdd.Create, 'Create'); + RegisterMethod(@TNNetChannelRandomMulAdd.SetPrevLayer, 'SetPrevLayer'); + RegisterMethod(@TNNetChannelRandomMulAdd.Compute, 'Compute'); + RegisterMethod(@TNNetChannelRandomMulAdd.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetRandomMulAdd(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetRandomMulAdd) do + begin + RegisterConstructor(@TNNetRandomMulAdd.Create, 'Create'); + RegisterMethod(@TNNetRandomMulAdd.Compute, 'Compute'); + RegisterMethod(@TNNetRandomMulAdd.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDropout(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDropout) do + begin + RegisterConstructor(@TNNetDropout.Create, 'Create'); + RegisterMethod(@TNNetDropout.Compute, 'Compute'); + RegisterMethod(@TNNetDropout.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetDropout.CopyWeights, 'CopyWeights'); + RegisterMethod(@TNNetDropout.RefreshDropoutMask, 'RefreshDropoutMask'); + RegisterPropertyHelper(@TNNetDropoutDropoutMask_R,nil,'DropoutMask'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetAddNoiseBase(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetAddNoiseBase) do + begin + RegisterPropertyHelper(@TNNetAddNoiseBaseEnabled_R,@TNNetAddNoiseBaseEnabled_W,'Enabled'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetAddAndDiv(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetAddAndDiv) do + begin + RegisterConstructor(@TNNetAddAndDivCreate6_P, 'Create6'); + RegisterMethod(@TNNetAddAndDiv.Compute, 'Compute'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetMulLearning(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetMulLearning) do + begin + RegisterConstructor(@TNNetMulLearning.Create, 'Create'); + RegisterMethod(@TNNetMulLearning.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetHyperbolicTangent(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetHyperbolicTangent) do + begin + RegisterConstructor(@TNNetHyperbolicTangent.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetSigmoid(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetSigmoid) do + begin + RegisterConstructor(@TNNetSigmoid.Create, 'Create'); + RegisterMethod(@TNNetSigmoid.Compute, 'Compute'); + RegisterMethod(@TNNetSigmoid.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetVeryLeakyReLU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetVeryLeakyReLU) do + begin + RegisterConstructor(@TNNetVeryLeakyReLU.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetLeakyReLU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetLeakyReLU) do + begin + RegisterConstructor(@TNNetLeakyReLU.Create, 'Create'); + RegisterMethod(@TNNetLeakyReLU.Compute, 'Compute'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetSELU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetSELU) do + begin + RegisterConstructor(@TNNetSELU.Create, 'Create'); + RegisterMethod(@TNNetSELU.Compute, 'Compute'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetReLUL(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetReLUL) do + begin + RegisterConstructor(@TNNetReLUL.Create, 'Create'); + RegisterMethod(@TNNetReLUL.Compute, 'Compute'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetReLU(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetReLU) do + begin + RegisterMethod(@TNNetReLU.Compute, 'Compute'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetReLUBase(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetReLUBase) do + begin + RegisterMethod(@TNNetReLUBase.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetIdentityWithoutBackprop(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetIdentityWithoutBackprop) do + begin + RegisterMethod(@TNNetIdentityWithoutBackprop.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetIdentityWithoutL2(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetIdentityWithoutL2) do + begin + RegisterMethod(@TNNetIdentityWithoutL2.ComputeL2Decay, 'ComputeL2Decay'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetIdentity(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetIdentity) do + begin + RegisterMethod(@TNNetIdentity.Compute, 'Compute'); + RegisterMethod(@TNNetIdentity.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetInput(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetInput) do + begin + RegisterConstructor(@TNNetInputCreate3_P, 'Create3'); + RegisterConstructor(@TNNetInputCreate4_P, 'Create4'); + RegisterConstructor(@TNNetInputCreate5_P, 'Create5'); + RegisterMethod(@TNNetInput.EnableErrorCollection, 'EnableErrorCollection'); + RegisterMethod(@TNNetInput.DisableErrorCollection, 'DisableErrorCollection'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetInputBase(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetInputBase) do + begin + RegisterMethod(@TNNetInputBase.Compute, 'Compute'); + RegisterMethod(@TNNetInputBase.Backpropagate, 'Backpropagate'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetLayerList(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetLayerList) do + begin + RegisterPropertyHelper(@TNNetLayerListItems_R,@TNNetLayerListItems_W,'Items'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetLayerConcatedWeights(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetLayerConcatedWeights) do + begin + RegisterConstructor(@TNNetLayerConcatedWeights.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetLayer(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetLayer) do + begin + RegisterConstructor(@TNNetLayer.Create, 'Create'); + RegisterVirtualMethod(@TNNetLayer.DisableOpenCL, 'DisableOpenCL'); + RegisterVirtualMethod(@TNNetLayer.EnableOpenCL, 'EnableOpenCL'); + RegisterVirtualAbstractMethod(@TNNetLayer, @!.Compute, 'Compute'); + RegisterVirtualAbstractMethod(@TNNetLayer, @!.Backpropagate, 'Backpropagate'); + RegisterMethod(@TNNetLayer.ComputeOutputErrorForOneNeuron, 'ComputeOutputErrorForOneNeuron'); + RegisterVirtualMethod(@TNNetLayer.ComputeOutputErrorWith, 'ComputeOutputErrorWith'); + RegisterVirtualMethod(@TNNetLayer.ComputeOutputErrorForIdx, 'ComputeOutputErrorForIdx'); + RegisterMethod(@TNNetLayer.ComputeErrorDeriv, 'ComputeErrorDeriv'); + RegisterMethod(@TNNetLayer.Fill, 'Fill'); + RegisterMethod(@TNNetLayer.ClearDeltas, 'ClearDeltas'); + RegisterMethod(@TNNetLayer.AddNeurons, 'AddNeurons'); + RegisterMethod(@TNNetLayer.AddMissingNeurons, 'AddMissingNeurons'); + RegisterMethod(@TNNetLayerSetNumWeightsForAllNeurons0_P, 'SetNumWeightsForAllNeurons0'); + RegisterMethod(@TNNetLayerSetNumWeightsForAllNeurons1_P, 'SetNumWeightsForAllNeurons1'); + RegisterMethod(@TNNetLayerSetNumWeightsForAllNeurons2_P, 'SetNumWeightsForAllNeurons2'); + RegisterMethod(@TNNetLayer.GetMaxWeight, 'GetMaxWeight'); + RegisterMethod(@TNNetLayer.GetMinWeight, 'GetMinWeight'); + RegisterMethod(@TNNetLayer.GetMaxDelta, 'GetMaxDelta'); + RegisterMethod(@TNNetLayer.GetMinDelta, 'GetMinDelta'); + RegisterMethod(@TNNetLayer.ForceMaxAbsoluteDelta, 'ForceMaxAbsoluteDelta'); + RegisterMethod(@TNNetLayer.GetMaxAbsoluteDelta, 'GetMaxAbsoluteDelta'); + RegisterMethod(@TNNetLayer.GetMinMaxAtDepth, 'GetMinMaxAtDepth'); + RegisterMethod(@TNNetLayer.GetWeightSum, 'GetWeightSum'); + RegisterMethod(@TNNetLayer.GetBiasSum, 'GetBiasSum'); + RegisterMethod(@TNNetLayer.GetInertiaSum, 'GetInertiaSum'); + RegisterMethod(@TNNetLayer.CountWeights, 'CountWeights'); + RegisterMethod(@TNNetLayer.MulWeights, 'MulWeights'); + RegisterMethod(@TNNetLayer.MulDeltas, 'MulDeltas'); + RegisterMethod(@TNNetLayer.ClearInertia, 'ClearInertia'); + RegisterMethod(@TNNetLayer.ClearTimes, 'ClearTimes'); + RegisterMethod(@TNNetLayer.AddTimes, 'AddTimes'); + RegisterMethod(@TNNetLayer.CopyTimes, 'CopyTimes'); + RegisterMethod(@TNNetLayer.MulMulAddWeights, 'MulMulAddWeights'); + RegisterMethod(@TNNetLayer.SumWeights, 'SumWeights'); + RegisterMethod(@TNNetLayer.SumDeltas, 'SumDeltas'); + RegisterMethod(@TNNetLayer.SumDeltasNoChecks, 'SumDeltasNoChecks'); + RegisterVirtualMethod(@TNNetLayer.CopyWeights, 'CopyWeights'); + RegisterMethod(@TNNetLayer.ForceRangeWeights, 'ForceRangeWeights'); + RegisterMethod(@TNNetLayer.NormalizeWeights, 'NormalizeWeights'); + RegisterVirtualMethod(@TNNetLayer.SaveDataToString, 'SaveDataToString'); + RegisterVirtualMethod(@TNNetLayer.LoadDataFromString, 'LoadDataFromString'); + RegisterVirtualMethod(@TNNetLayer.SaveStructureToString, 'SaveStructureToString'); + RegisterMethod(@TNNetLayer.SetBatchUpdate, 'SetBatchUpdate'); + RegisterMethod(@TNNetLayer.UpdateWeights, 'UpdateWeights'); + RegisterMethod(@TNNetLayer.InitBasicPatterns, 'InitBasicPatterns'); + RegisterMethod(@TNNetLayer.IncDepartingBranchesCnt, 'IncDepartingBranchesCnt'); + RegisterMethod(@TNNetLayer.ResetBackpropCallCurrCnt, 'ResetBackpropCallCurrCnt'); + RegisterMethod(@TNNetLayer.InitUniform, 'InitUniform'); + RegisterMethod(@TNNetLayer.InitLeCunUniform, 'InitLeCunUniform'); + RegisterMethod(@TNNetLayer.InitHeUniform, 'InitHeUniform'); + RegisterMethod(@TNNetLayer.InitHeUniformDepthwise, 'InitHeUniformDepthwise'); + RegisterMethod(@TNNetLayer.InitHeGaussian, 'InitHeGaussian'); + RegisterMethod(@TNNetLayer.InitHeGaussianDepthwise, 'InitHeGaussianDepthwise'); + RegisterMethod(@TNNetLayer.InitGlorotBengioUniform, 'InitGlorotBengioUniform'); + RegisterMethod(@TNNetLayer.InitSELU, 'InitSELU'); + RegisterVirtualMethod(@TNNetLayer.InitDefault, 'InitDefault'); + RegisterPropertyHelper(@TNNetLayerActivationFn_R,@TNNetLayerActivationFn_W,'ActivationFn'); + RegisterPropertyHelper(@TNNetLayerActivationFnDerivative_R,@TNNetLayerActivationFnDerivative_W,'ActivationFnDerivative'); + RegisterPropertyHelper(@TNNetLayerNeurons_R,nil,'Neurons'); + RegisterPropertyHelper(@TNNetLayerOutput_R,nil,'Output'); + RegisterPropertyHelper(@TNNetLayerOutputRaw_R,nil,'OutputRaw'); + RegisterPropertyHelper(@TNNetLayerPrevLayer_R,@TNNetLayerPrevLayer_W,'PrevLayer'); + RegisterPropertyHelper(@TNNetLayerLearningRate_R,@TNNetLayerLearningRate_W,'LearningRate'); + RegisterPropertyHelper(@TNNetLayerL2Decay_R,@TNNetLayerL2Decay_W,'L2Decay'); + RegisterPropertyHelper(@TNNetLayerInertia_R,nil,'Inertia'); + RegisterPropertyHelper(@TNNetLayerOutputError_R,@TNNetLayerOutputError_W,'OutputError'); + RegisterPropertyHelper(@TNNetLayerOutputErrorDeriv_R,@TNNetLayerOutputErrorDeriv_W,'OutputErrorDeriv'); + RegisterPropertyHelper(@TNNetLayerLayerIdx_R,nil,'LayerIdx'); + RegisterPropertyHelper(@TNNetLayerSmoothErrorPropagation_R,@TNNetLayerSmoothErrorPropagation_W,'SmoothErrorPropagation'); + RegisterPropertyHelper(@TNNetLayerBackwardTime_R,@TNNetLayerBackwardTime_W,'BackwardTime'); + RegisterPropertyHelper(@TNNetLayerForwardTime_R,@TNNetLayerForwardTime_W,'ForwardTime'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetNeuronList(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetNeuronList) do + begin + RegisterPropertyHelper(@TNNetNeuronListItems_R,@TNNetNeuronListItems_W,'Items'); + RegisterConstructor(@TNNetNeuronList.CreateWithElements, 'CreateWithElements'); + RegisterMethod(@TNNetNeuronList.GetMaxWeight, 'GetMaxWeight'); + RegisterMethod(@TNNetNeuronList.GetMinWeight, 'GetMinWeight'); + RegisterMethod(@TNNetNeuronList.InitForDebug, 'InitForDebug'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetNeuron(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetNeuron) do + begin + RegisterConstructor(@TNNetNeuron.Create, 'Create'); + RegisterMethod(@TNNetNeuron.Fill, 'Fill'); + RegisterMethod(@TNNetNeuron.AddInertia, 'AddInertia'); + RegisterMethod(@TNNetNeuron.UpdateWeights, 'UpdateWeights'); + RegisterMethod(@TNNetNeuron.SaveToString, 'SaveToString'); + RegisterMethod(@TNNetNeuron.LoadFromString, 'LoadFromString'); + RegisterMethod(@TNNetNeuron.ClearDelta, 'ClearDelta'); + RegisterMethod(@TNNetNeuron.InitUniform, 'InitUniform'); + RegisterMethod(@TNNetNeuron.InitGaussian, 'InitGaussian'); + RegisterMethod(@TNNetNeuron.InitLeCunUniform, 'InitLeCunUniform'); + RegisterMethod(@TNNetNeuron.InitHeUniform, 'InitHeUniform'); + RegisterMethod(@TNNetNeuron.InitHeGaussian, 'InitHeGaussian'); + RegisterMethod(@TNNetNeuron.InitHeUniformDepthwise, 'InitHeUniformDepthwise'); + RegisterMethod(@TNNetNeuron.InitHeGaussianDepthwise, 'InitHeGaussianDepthwise'); + RegisterMethod(@TNNetNeuron.InitSELU, 'InitSELU'); + RegisterPropertyHelper(@TNNetNeuronWeights_R,nil,'Weights'); + RegisterPropertyHelper(@TNNetNeuronBackInertia_R,nil,'BackInertia'); + RegisterPropertyHelper(@TNNetNeuronDelta_R,nil,'Delta'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_neuralnetwork(CL: TPSRuntimeClassImporter); +begin + RIRegister_TNNetNeuron(CL); + RIRegister_TNNetNeuronList(CL); + RIRegister_TNNetLayer(CL); + RIRegister_TNNetLayerConcatedWeights(CL); + RIRegister_TNNetLayerList(CL); + RIRegister_TNNetInputBase(CL); + RIRegister_TNNetInput(CL); + RIRegister_TNNetIdentity(CL); + RIRegister_TNNetIdentityWithoutL2(CL); + RIRegister_TNNetIdentityWithoutBackprop(CL); + RIRegister_TNNetReLUBase(CL); + RIRegister_TNNetReLU(CL); + RIRegister_TNNetReLUL(CL); + RIRegister_TNNetSELU(CL); + RIRegister_TNNetLeakyReLU(CL); + RIRegister_TNNetVeryLeakyReLU(CL); + RIRegister_TNNetSigmoid(CL); + RIRegister_TNNetHyperbolicTangent(CL); + RIRegister_TNNetMulLearning(CL); + RIRegister_TNNetAddAndDiv(CL); + RIRegister_TNNetAddNoiseBase(CL); + RIRegister_TNNetDropout(CL); + RIRegister_TNNetRandomMulAdd(CL); + RIRegister_TNNetChannelRandomMulAdd(CL); + RIRegister_TNNetLayerMaxNormalization(CL); + RIRegister_TNNetLayerStdNormalization(CL); + RIRegister_TNNetMovingStdNormalization(CL); + RIRegister_TNNetChannelTransformBase(CL); + RIRegister_TNNetChannelShiftBase(CL); + RIRegister_TNNetChannelBias(CL); + RIRegister_TNNetChannelMul(CL); + RIRegister_TNNetCellBias(CL); + RIRegister_TNNetCellMul(CL); + RIRegister_TNNetChannelZeroCenter(CL); + RIRegister_TNNetChannelStdNormalization(CL); + RIRegister_TNNetLocalResponseNorm2D(CL); + RIRegister_TNNetLocalResponseNormDepth(CL); + RIRegister_TNNetReshape(CL); + RIRegister_TNNetConcatBase(CL); + RIRegister_TNNetConcat(CL); + RIRegister_TNNetDeepConcat(CL); + RIRegister_TNNetSum(CL); + RIRegister_TNNetSplitChannels(CL); + RIRegister_TNNetSplitChannelEvery(CL); + RIRegister_TNNetFullConnect(CL); + RIRegister_TNNetFullConnectLinear(CL); + RIRegister_TNNetFullConnectSigmoid(CL); + RIRegister_TNNetFullConnectReLU(CL); + RIRegister_TNNetFullConnectDiff(CL); + RIRegister_TNNetSoftMax(CL); + with CL.Add(TNNetLayerFullConnect) do + with CL.Add(TNNetLayerFullConnectReLU) do + with CL.Add(TNNetLayerSoftMax) do + with CL.Add(TNNetDense) do + with CL.Add(TNNetDenseReLU) do + RIRegister_TNNetConvolutionAbstract(CL); + RIRegister_TNNetDepthwiseConv(CL); + RIRegister_TNNetDepthwiseConvLinear(CL); + RIRegister_TNNetDepthwiseConvReLU(CL); + RIRegister_TNNetConvolutionBase(CL); + RIRegister_TNNetConvolution(CL); + RIRegister_TNNetDeconvolution(CL); + RIRegister_TNNetConvolutionReLU(CL); + RIRegister_TNNetPointwiseConvReLU(CL); + RIRegister_TNNetConvolutionLinear(CL); + RIRegister_TNNetPointwiseConvLinear(CL); + RIRegister_TNNetDeconvolutionReLU(CL); + RIRegister_TNNetLocalConnect(CL); + RIRegister_TNNetDeLocalConnect(CL); + RIRegister_TNNetLocalConnectReLU(CL); + RIRegister_TNNetDeLocalConnectReLU(CL); + RIRegister_TNNetPoolBase(CL); + RIRegister_TNNetMaxPool(CL); + RIRegister_TNNetMaxPoolPortable(CL); + RIRegister_TNNetMinPool(CL); + RIRegister_TNNetMaxChannel(CL); + RIRegister_TNNetMinChannel(CL); + RIRegister_TNNetAvgPool(CL); + RIRegister_TNNetAvgChannel(CL); + RIRegister_TNNetDeMaxPool(CL); + RIRegister_TNNetUpsample(CL); + with CL.Add(TNNetDeAvgPool) do + RIRegister_TNNet(CL); + RIRegister_THistoricalNets(CL); + RIRegister_TNNetDataParallelism(CL); +end; + + + +{ TPSImport_neuralnetwork } +(*----------------------------------------------------------------------------*) +procedure TPSImport_neuralnetwork.CompileImport1(CompExec: TPSScript); +begin + SIRegister_neuralnetwork(CompExec.Comp); +end; +(*----------------------------------------------------------------------------*) +procedure TPSImport_neuralnetwork.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); +begin + RIRegister_neuralnetwork(ri); + RIRegister_neuralnetwork_Routines(CompExec.Exec); // comment it if no routines +end; +(*----------------------------------------------------------------------------*) + + +end. diff --git a/Source/uPSI_neuralvolume.pas b/Source/uPSI_neuralvolume.pas new file mode 100644 index 00000000..312bebe9 --- /dev/null +++ b/Source/uPSI_neuralvolume.pas @@ -0,0 +1,1437 @@ +unit uPSI_neuralvolume; +{ +This file has been generated by UnitParser v0.7, written by M. Knight +and updated by NP. v/d Spek and George Birbilis. +Source Code from Carlo Kok has been used to implement various sections of +UnitParser. Components of ROPS are used in the construction of UnitParser, +code implementing the class wrapper is taken from Carlo Kok's conv utility + +} +interface + + + +uses + SysUtils + ,Classes + ,uPSComponent + ,uPSRuntime + ,uPSCompiler + ; + +type +(*----------------------------------------------------------------------------*) + TPSImport_neuralvolume = class(TPSPlugin) + public + procedure CompileImport1(CompExec: TPSScript); override; + procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + end; + + +{ compile-time registration functions } +procedure SIRegister_TNNetDictionary(CL: TPSPascalCompiler); +procedure SIRegister_TStringListInt(CL: TPSPascalCompiler); +procedure SIRegister_TNNetStringList(CL: TPSPascalCompiler); +procedure SIRegister_TNNetKMeans(CL: TPSPascalCompiler); +procedure SIRegister_TNNetVolumePairList(CL: TPSPascalCompiler); +procedure SIRegister_TNNetVolumeList(CL: TPSPascalCompiler); +procedure SIRegister_TMObject(CL: TPSPascalCompiler); +procedure SIRegister_TNNetVolumePair(CL: TPSPascalCompiler); +procedure SIRegister_TNNetVolume(CL: TPSPascalCompiler); +procedure SIRegister_TVolume(CL: TPSPascalCompiler); +procedure SIRegister_TNNetList(CL: TPSPascalCompiler); +procedure SIRegister_neuralvolume(CL: TPSPascalCompiler); + +{ run-time registration functions } +procedure RIRegister_neuralvolume_Routines(S: TPSExec); +procedure RIRegister_TNNetDictionary(CL: TPSRuntimeClassImporter); +procedure RIRegister_TStringListInt(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetStringList(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetKMeans(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetVolumePairList(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetVolumeList(CL: TPSRuntimeClassImporter); +procedure RIRegister_TMObject(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetVolumePair(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetVolume(CL: TPSRuntimeClassImporter); +procedure RIRegister_TVolume(CL: TPSRuntimeClassImporter); +procedure RIRegister_TNNetList(CL: TPSRuntimeClassImporter); +procedure RIRegister_neuralvolume(CL: TPSRuntimeClassImporter); + +procedure Register; + +implementation + + +uses + fgl + ,Contnrs + ,neuralvolume + ; + + +procedure Register; +begin + RegisterComponents('Pascal Script', [TPSImport_neuralvolume]); +end; + +(* === compile-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetDictionary(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TStringListInt', 'TNNetDictionary') do + with CL.AddClassN(CL.FindClass('TStringListInt'),'TNNetDictionary') do + begin + RegisterMethod('Constructor Create( pMaxSize : integer)'); + RegisterMethod('Function AddWordToDictionary( pWord : string) : boolean'); + RegisterMethod('Function AddWordsToDictionary( pString : string) : boolean'); + RegisterMethod('Function WordToIndex( pWord : string) : integer'); + RegisterMethod('Procedure StringToVolume( pString : string; Volume : TNNetVolume)'); + RegisterMethod('Function VolumeToString( Volume : TNNetVolume; Threshold : TNeuralFloat) : string'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TStringListInt(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetStringList', 'TStringListInt') do + with CL.AddClassN(CL.FindClass('TNNetStringList'),'TStringListInt') do + begin + RegisterMethod('Constructor Create'); + RegisterMethod('Procedure SortByIntegerAsc'); + RegisterMethod('Procedure SortByIntegerDesc'); + RegisterMethod('Function AddInteger( const S : string; AValue : PtrInt) : integer'); + RegisterProperty('Integers', 'PtrInt Integer', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetStringList(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TStringList', 'TNNetStringList') do + with CL.AddClassN(CL.FindClass('TStringList'),'TNNetStringList') do + begin + RegisterMethod('Function GetRandomIndex( ) : integer'); + RegisterMethod('Procedure DeleteFirst( Cnt : integer)'); + RegisterMethod('Procedure DeleteLast( Cnt : integer)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetKMeans(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TMObject', 'TNNetKMeans') do + with CL.AddClassN(CL.FindClass('TMObject'),'TNNetKMeans') do + begin + RegisterMethod('Constructor Create( pVolNum, pSizeX, pSizeY, pDepth : integer; pManhattan : boolean)'); + RegisterMethod('Procedure RunStep( RepositionClusters : boolean)'); + RegisterMethod('Procedure Resize( pVolNum, pSizeX, pSizeY, pDepth : integer)'); + RegisterMethod('Procedure Randomize( )'); + RegisterMethod('Procedure RandomizeEmptyClusters( )'); + RegisterMethod('Procedure AddSample( Original : TNNetVolume)'); + RegisterMethod('Function GetClusterId( Original : TNNetVolume) : integer'); + RegisterMethod('Function GetTotalSize( ) : integer'); + RegisterProperty('Sample', 'TNNetVolumeList', iptr); + RegisterProperty('Clusters', 'TNNetVolumeList', iptr); + RegisterProperty('LastStepTime', 'double', iptr); + RegisterProperty('LastDistance', 'TNeuralFloat', iptr); + RegisterProperty('ManhattanDistance', 'boolean', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetVolumePairList(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetList', 'TNNetVolumePairList') do + with CL.AddClassN(CL.FindClass('TNNetList'),'TNNetVolumePairList') do + begin + RegisterProperty('Items', 'TNNetVolumePair Integer', iptrw); + SetDefaultPropery('Items'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetVolumeList(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TNNetList', 'TNNetVolumeList') do + with CL.AddClassN(CL.FindClass('TNNetList'),'TNNetVolumeList') do + begin + RegisterMethod('Function GetTotalSize( ) : integer'); + RegisterMethod('Function GetSum( ) : TNeuralFloat'); + RegisterMethod('Function GetAvg( ) : TNeuralFloat'); + RegisterMethod('Function GetClosestId( Original : TNNetVolume; var MinDist : TNeuralFloat) : integer'); + RegisterMethod('Function GetManhattanClosestId( Original : TNNetVolume; var MinDist : TNeuralFloat) : integer'); + RegisterMethod('Procedure Fill( c : Single)'); + RegisterMethod('Procedure ClearTag( )'); + RegisterMethod('Procedure ConcatInto( V : TNNetVolume)'); + RegisterMethod('Procedure InterleaveInto( V : TNNetVolume)'); + RegisterMethod('Procedure SplitFrom( V : TNNetVolume)'); + RegisterMethod('Procedure AddVolumes84( pVolNum, pSizeX, pSizeY, pDepth : integer; c : TNeuralFloat);'); + RegisterMethod('Procedure AddVolumes85( Origin : TNNetVolumeList);'); + RegisterMethod('Procedure AddCopy( Origin : TNNetVolume)'); + RegisterMethod('Procedure AddInto( Original : TNNetVolume)'); + RegisterMethod('Procedure SortByTagAsc'); + RegisterMethod('Procedure SortByTagDesc'); + RegisterMethod('Procedure GetColumn( V : TNNetVolume; colIdx : integer)'); + RegisterMethod('Procedure ResizeImage( NewSizeX, NewSizeY : integer)'); + RegisterProperty('Items', 'TNNetVolume Integer', iptrw); + SetDefaultPropery('Items'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TMObject(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TObject', 'TMObject') do + with CL.AddClassN(CL.FindClass('TObject'),'TMObject') do + begin + RegisterMethod('Constructor Create( )'); + RegisterMethod('Procedure DefaultMessageProc( const S : string)'); + RegisterMethod('Procedure DefaultErrorProc( const S : string)'); + RegisterMethod('Procedure DefaultHideMessages( const S : string)'); + RegisterMethod('Procedure HideMessages( )'); + RegisterProperty('MessageProc', 'TGetStrProc', iptrw); + RegisterProperty('ErrorProc', 'TGetStrProc', iptrw); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetVolumePair(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TObject', 'TNNetVolumePair') do + with CL.AddClassN(CL.FindClass('TObject'),'TNNetVolumePair') do + begin + RegisterMethod('Constructor Create81( );'); + RegisterMethod('Constructor Create82( pA, pB : TNNetVolume);'); + RegisterMethod('Constructor CreateCopying83( pA, pB : TNNetVolume);'); + RegisterProperty('A', 'TNNetVolume', iptr); + RegisterProperty('B', 'TNNetVolume', iptr); + RegisterProperty('I', 'TNNetVolume', iptr); + RegisterProperty('O', 'TNNetVolume', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetVolume(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TVolume', 'TNNetVolume') do + with CL.AddClassN(CL.FindClass('TVolume'),'TNNetVolume') do + begin + RegisterMethod('Function GetMemSize( ) : integer'); + RegisterMethod('Procedure CalculateLocalResponseFrom2D( Original : TNNetVolume; pSize : integer; alpha, beta : TNeuralFloat)'); + RegisterMethod('Procedure CalculateLocalResponseFromDepth( Original : TNNetVolume; pSize : integer; alpha, beta : TNeuralFloat)'); + RegisterMethod('Procedure InterleavedDotProduct59( InterleavedAs, B : TNNetVolume);'); + RegisterMethod('Procedure InterleavedDotProduct60( InterleavedAs, Bs : TNNetVolume; VectorSize : integer);'); + RegisterMethod('Procedure DotProducts( NumAs, NumBs, VectorSize : integer; VAs, VBs : TNNetVolume)'); + RegisterMethod('Procedure AddArea( DestX, DestY, OriginX, OriginY, LenX, LenY : integer; Original : TNNetVolume)'); + RegisterMethod('Function HasAVX : boolean'); + RegisterMethod('Function HasAVX2 : boolean'); + RegisterMethod('Function HasAVX512 : boolean'); + RegisterMethod('Function PearsonCorrelation( Y : TNNetVolume) : TNeuralFloat'); + RegisterMethod('Procedure AddSumChannel( Original : TNNetVolume)'); + RegisterMethod('Procedure AddSumSqrChannel( Original : TNNetVolume)'); + RegisterMethod('Procedure AddToChannels( Original : TNNetVolume)'); + RegisterMethod('Procedure MulChannels( Original : TNNetVolume)'); + RegisterMethod('Procedure Mul61( Original : TNNetVolume);'); + RegisterMethod('Procedure NormalizeMax( Value : TNeuralFloat)'); + RegisterMethod('Procedure RecurrencePlot( Original : TNNetVolume; Threshold : TNeuralFloat)'); + RegisterMethod('Procedure RecurrencePlotCAI( Original : TNNetVolume)'); + RegisterMethod('Procedure Fill( c : Single)'); + RegisterMethod('Procedure Add62( Original : TNNetVolume);'); + RegisterMethod('Procedure Add63( PtrA, PtrB : TNeuralFloatArrPtr; NumElements : integer);'); + RegisterMethod('Procedure Sub64( Original : TNNetVolume);'); + RegisterMethod('Function DotProduct65( Original : TNNetVolume) : TNeuralFloat;'); + RegisterMethod('Function DotProduct66( PtrA, PtrB : TNeuralFloatArrPtr; NumElements : integer) : Single;'); + RegisterMethod('Procedure Mul67( Value : Single);'); + RegisterMethod('Procedure Mul68( PtrA, PtrB : TNeuralFloatArrPtr; pSize : integer);'); + RegisterMethod('Procedure MulAdd69( Value : TNeuralFloat; Original : TNNetVolume);'); + RegisterMethod('Procedure MulAdd70( Original1, Original2 : TNNetVolume);'); + RegisterMethod('Procedure MulMulAdd71( Value1, Value2 : TNeuralFloat; Original : TNNetVolume);'); + RegisterMethod('Procedure MulAdd72( Value : TNeuralFloat; PtrB : TNeuralFloatArrPtr);'); + RegisterMethod('Procedure MulAdd73( PtrA, PtrB : TNeuralFloatArrPtr; Value : TNeuralFloat; pSize : integer);'); + RegisterMethod('Procedure MulAdd74( PtrA, PtrB, PtrC : TNeuralFloatArrPtr; pSize : integer);'); + RegisterMethod('Procedure Divi75( Value : Single);'); + RegisterMethod('Procedure Copy76( Original : TNNetVolume);'); + RegisterMethod('Procedure CopyRelu77( Original : TNNetVolume);'); + RegisterMethod('Procedure CopyPadding( Original : TNNetVolume; Padding : integer)'); + RegisterMethod('Procedure CopyNoChecks( Original : TNNetVolume)'); + RegisterMethod('Function GetDistanceSqr78( Original : TNNetVolume) : TNeuralFloat;'); + RegisterMethod('Function GetDistance79( Original : TNNetVolume) : TNeuralFloat;'); + RegisterMethod('Function SumDiff80( Original : TNNetVolume) : TNeuralFloat;'); + RegisterProperty('DataPtr', 'TNeuralFloatArrPtr', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TVolume(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TObject', 'TVolume') do + with CL.AddClassN(CL.FindClass('TObject'),'TVolume') do + begin + RegisterProperty('FData', 'array of T', iptrw); + RegisterMethod('Constructor Create0( pSizeX, pSizeY, pDepth : integer; c : T);'); + RegisterMethod('Constructor Create1( pInput : array of T);'); + RegisterMethod('Constructor Create2( Original : array of byte);'); + RegisterMethod('Constructor Create3( Original : TVolume);'); + RegisterMethod('Constructor Create4( Original : TBits; pFalse : T; pTrue : T);'); + RegisterMethod('Constructor CreateAsBits5( Original : array of byte; pFalse : T; pTrue : T);'); + RegisterMethod('Constructor Create6( pSize : integer; c : T);'); + RegisterMethod('Constructor Create7( );'); + RegisterMethod('Procedure Fill( c : T)'); + RegisterMethod('Procedure FillForIdx( c : T; const aIdx : array of integer)'); + RegisterMethod('Procedure FillAtDepth( pDepth : integer; Value : T)'); + RegisterMethod('Procedure FillForDebug( )'); + RegisterMethod('Procedure Resize8( pSize : integer);'); + RegisterMethod('Procedure ReSize9( pSizeX, pSizeY, pDepth : integer);'); + RegisterMethod('Procedure ReSize10( Original : TVolume);'); + RegisterMethod('Function Get( x, y, d : integer) : T'); + RegisterMethod('Function GetAsByte( x, y, d : integer) : byte'); + RegisterMethod('Function GetRaw( x : integer) : T'); + RegisterMethod('Procedure SetRaw( X : integer; Value : T)'); + RegisterMethod('Procedure Store( x, y, d : integer; Value : T)'); + RegisterMethod('Procedure Add11( x, y, d : integer; Value : T);'); + RegisterMethod('Procedure Add12( Original : TVolume);'); + RegisterMethod('Procedure Add13( Value : T);'); + RegisterMethod('Procedure Add14( PtrA, PtrB : TNeuralFloatArrPtr; NumElements : integer);'); + RegisterMethod('Procedure AddAtDepth15( pDepth : integer; Value : T);'); + RegisterMethod('Procedure AddLayers16( A, B : TVolume);'); + RegisterMethod('Procedure Sub17( x, y, d : integer; Value : T);'); + RegisterMethod('Procedure Sub18( Original : TVolume);'); + RegisterMethod('Procedure Sub19( Value : T);'); + RegisterMethod('Procedure Diff20( Original : TVolume);'); + RegisterMethod('Procedure InterleaveWithDepthFrom( Original : TVolume; NewDepth : integer)'); + RegisterMethod('Procedure InterleaveWithXFrom( Original : TVolume; NewX : integer)'); + RegisterMethod('Function IncYSize( ) : integer'); + RegisterMethod('Function IncYSizeBytes( ) : integer'); + RegisterMethod('Procedure DeInterleaveWithXFrom( Original : TVolume; NewX : integer)'); + RegisterMethod('Procedure DeInterleaveWithDepthFrom( Original : TVolume; NewDepth : integer)'); + RegisterMethod('Procedure SetMin21( Value : TNeuralFloat);'); + RegisterMethod('Procedure SetMax22( Value : TNeuralFloat);'); + RegisterMethod('Procedure Mul23( x, y, d : integer; Value : T);'); + RegisterMethod('Procedure Mul24( Original : TVolume);'); + RegisterMethod('Procedure Mul25( PtrA, PtrB : TNeuralFloatArrPtr; pSize : integer);'); + RegisterMethod('Procedure Mul26( Value : T);'); + RegisterMethod('Procedure MulAtDepth27( pDepth : integer; Value : T);'); + RegisterMethod('Procedure Pow28( Value : T);'); + RegisterMethod('Procedure VSqrt( )'); + RegisterMethod('Procedure MulAdd29( Value : T; Original : TVolume);'); + RegisterMethod('Procedure MulMulAdd30( Value1, Value2 : T; Original : TVolume);'); + RegisterMethod('Procedure MulAdd31( Value : T; PtrB : TNeuralFloatArrPtr);'); + RegisterMethod('Procedure MulAdd32( Original1, Original2 : TVolume);'); + RegisterMethod('Procedure MulAdd33( PtrA, PtrB : TNeuralFloatArrPtr; Value : T; pSize : integer);'); + RegisterMethod('Procedure MulAdd34( PtrA, PtrB, PtrC : TNeuralFloatArrPtr; pSize : integer);'); + RegisterMethod('Procedure Divi35( x, y, d : integer; Value : T);'); + RegisterMethod('Procedure Divi36( Original : TVolume);'); + RegisterMethod('Procedure Divi37( Value : T);'); + RegisterMethod('Procedure ForceMinRange( Value : T)'); + RegisterMethod('Procedure ForceMaxRange( Value : T)'); + RegisterMethod('Procedure Randomize( a : integer; b : integer; c : integer)'); + RegisterMethod('Procedure RandomizeGaussian( pMul : TNeuralFloat)'); + RegisterMethod('Procedure AddGaussianNoise( pMul : TNeuralFloat)'); + RegisterMethod('Procedure AddSaltAndPepper( pNum : integer; pSalt : T; pPepper : T; pColor : boolean)'); + RegisterMethod('Function RandomGaussianValue( ) : TNeuralFloat'); + RegisterMethod('Procedure Copy38( Original : TVolume);'); + RegisterMethod('Procedure CopyRelu39( Original : TVolume);'); + RegisterMethod('Procedure Copy40( Original : TVolume; Len : integer);'); + RegisterMethod('Procedure Copy41( var Original : array of T);'); + RegisterMethod('Procedure Copy42( var Original : array of byte);'); + RegisterMethod('Procedure Copy43( Original : TBits; pFlase : T; pTrue : T);'); + RegisterMethod('Procedure CopyPadding( Original : TVolume; Padding : integer)'); + RegisterMethod('Procedure CopyCropping( Original : TVolume; StartX, StartY, pSizeX, pSizeY : integer)'); + RegisterMethod('Procedure CopyResizing( Original : TVolume; NewSizeX, NewSizeY : integer)'); + RegisterMethod('Procedure CopyNoChecks( Original : TVolume)'); + RegisterMethod('Procedure CopyChannels( Original : TVolume; aChannels : array of integer)'); + RegisterMethod('Procedure Define( Original : array of T)'); + RegisterMethod('Function DotProduct44( Original : TVolume) : T;'); + RegisterMethod('Function DotProduct45( PtrA, PtrB : TNeuralFloatArrPtr; NumElements : integer) : Single;'); + RegisterMethod('Function SumDiff( Original : TVolume) : T'); + RegisterMethod('Procedure SumToPos( Original : TVolume)'); + RegisterMethod('Function GetDistanceSqr46( Original : TVolume) : T;'); + RegisterMethod('Function GetDistance47( Original : TVolume) : T;'); + RegisterMethod('Function SumAtDepth( pDepth : integer) : T'); + RegisterMethod('Function AvgAtDepth( pDepth : integer) : T'); + RegisterMethod('Function GetRawPos48( x, y, d : integer) : integer;'); + RegisterMethod('Function GetRawPos49( x, y : integer) : integer;'); + RegisterMethod('Function GetRawPtr50( x, y, d : integer) : pointer;'); + RegisterMethod('Function GetRawPtr51( x, y : integer) : pointer;'); + RegisterMethod('Function GetRawPtr52( x : integer) : pointer;'); + RegisterMethod('Function GetRawPtr53( ) : pointer;'); + RegisterMethod('Function GetMin( ) : T'); + RegisterMethod('Function GetMax( ) : T'); + RegisterMethod('Function GetNonZero( ) : integer'); + RegisterMethod('Function GetMaxAbs( ) : T'); + RegisterMethod('Procedure GetMinMaxAtDepth( pDepth : integer; out pMin, pMax : T)'); + RegisterMethod('Function GetSum( ) : T'); + RegisterMethod('Function GetSumAbs( ) : T'); + RegisterMethod('Function GetSumSqr( ) : T'); + RegisterMethod('Function GetAvg( ) : T'); + RegisterMethod('Function GetVariance( ) : T'); + RegisterMethod('Function GetStdDeviation( ) : T'); + RegisterMethod('Function GetMagnitude( ) : T'); + RegisterMethod('Procedure FlipX( )'); + RegisterMethod('Procedure FlipY( )'); + RegisterMethod('Procedure IncTag( )'); + RegisterMethod('Procedure ClearTag( )'); + RegisterMethod('Function NeuralToStr( V : TNeuralFloat) : string'); + RegisterMethod('Procedure RgbImgToNeuronalInput( color_encoding : integer)'); + RegisterMethod('Procedure NeuronalInputToRgbImg( color_encoding : integer)'); + RegisterMethod('Procedure NeuronalWeightToImg54( color_encoding : integer);'); + RegisterMethod('Procedure NeuronalWeightToImg55( MaxW, MinW : TNeuralFloat; color_encoding : integer);'); + RegisterMethod('Procedure NeuronalWeightToImg3Channel( MaxW0, MinW0, MaxW1, MinW1, MaxW2, MinW2 : TNeuralFloat; color_encoding : integer)'); + RegisterMethod('Procedure ZeroCenter( )'); + RegisterMethod('Procedure Print( )'); + RegisterMethod('Procedure PrintWithIndex( )'); + RegisterMethod('Procedure PrintDebug( )'); + RegisterMethod('Procedure PrintDebugChannel( )'); + RegisterMethod('Procedure InitUniform( Value : T)'); + RegisterMethod('Procedure InitGaussian( Value : T)'); + RegisterMethod('Procedure InitLeCunUniform( Value : T)'); + RegisterMethod('Procedure InitHeUniform( Value : T)'); + RegisterMethod('Procedure InitLeCunGaussian( Value : T)'); + RegisterMethod('Procedure InitHeGaussian( Value : T)'); + RegisterMethod('Procedure InitSELU( Value : T)'); + RegisterMethod('Function SaveToString( ) : string'); + RegisterMethod('Procedure LoadFromString( strData : string)'); + RegisterMethod('Procedure CopyAsBits56( var Original : array of byte; pFlase : T; pTrue : T);'); + RegisterMethod('Procedure ReadAsBits( var Dest : array of byte; Threshold : T)'); + RegisterMethod('Procedure SetClass57( pClass : integer; value : T);'); + RegisterMethod('Procedure SetClass58( pClass : integer; TrueValue, FalseValue : T);'); + RegisterMethod('Procedure SetClassForHiperbolicTangent( pClass : integer)'); + RegisterMethod('Procedure SetClassForReLU( pClass : integer)'); + RegisterMethod('Procedure SetClassForSoftMax( pClass : integer)'); + RegisterMethod('Function GetClass( ) : integer'); + RegisterMethod('Function SoftMax( ) : T'); + RegisterMethod('Procedure RgbToHsv( )'); + RegisterMethod('Procedure HsvToRgb( )'); + RegisterMethod('Procedure RgbToHsl( )'); + RegisterMethod('Procedure HslToRgb( )'); + RegisterMethod('Procedure RgbToLab( )'); + RegisterMethod('Procedure LabToRgb( )'); + RegisterMethod('Procedure RgbToGray( )'); + RegisterMethod('Procedure GetGrayFromRgb( Rgb : TVolume)'); + RegisterMethod('Procedure MakeGray( color_encoding : integer)'); + RegisterMethod('Procedure ShiftRight( Positions : integer)'); + RegisterMethod('Procedure ShiftLeft( )'); + RegisterProperty('Data', 'T integer integer integer', iptrw); + SetDefaultPropery('Data'); + RegisterProperty('AsByte', 'byte integer integer integer', iptr); + RegisterProperty('Raw', 'T integer', iptrw); + RegisterProperty('Tag', 'integer', iptrw); + RegisterProperty('Tags', 'integer integer', iptrw); + RegisterProperty('Size', 'integer', iptr); + RegisterProperty('SizeX', 'integer', iptr); + RegisterProperty('SizeY', 'integer', iptr); + RegisterProperty('Depth', 'integer', iptr); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_TNNetList(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TList', 'TNNetList') do + with CL.AddClassN(CL.FindClass('TList'),'TNNetList') do + begin + RegisterProperty('FreeObjects', 'boolean', iptrw); + RegisterMethod('Constructor Create( pFreeObjects : boolean)'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure SIRegister_neuralvolume(CL: TPSPascalCompiler); +begin + CL.AddConstantN('csMinAvxSize','LongInt').SetInt( 16); + CL.AddConstantN('csEncodeRGB','LongInt').SetInt( 0); + CL.AddConstantN('csEncodeHSV','LongInt').SetInt( 1); + CL.AddConstantN('csEncodeHSL','LongInt').SetInt( 2); + CL.AddConstantN('csEncodeLAB','LongInt').SetInt( 3); + CL.AddConstantN('csEncodeGray','LongInt').SetInt( 4); + CL.AddTypeS('TNeuralFloat', 'Single'); + CL.AddTypeS('TNeuralFloatPtr', '^TNeuralFloat // will not work'); + CL.AddTypeS('TNeuralFloatArrPtr', '^TNeuralFloatArr // will not work'); + CL.AddTypeS('TNeuralIntegerArray', 'array of integer'); + CL.AddTypeS('T', 'TNeuralFloat'); + CL.AddTypeS('PtrInt', 'Integer'); + SIRegister_TNNetList(CL); + SIRegister_TVolume(CL); + SIRegister_TNNetVolume(CL); + SIRegister_TNNetVolumePair(CL); + SIRegister_TMObject(CL); + SIRegister_TNNetVolumeList(CL); + SIRegister_TNNetVolumePairList(CL); + SIRegister_TNNetKMeans(CL); + SIRegister_TNNetStringList(CL); + SIRegister_TStringListInt(CL); + SIRegister_TNNetDictionary(CL); + CL.AddDelphiFunction('Function CreateTokenizedStringList86( str : string; c : char) : TStringList;'); + CL.AddDelphiFunction('Function CreateTokenizedStringList87( c : char) : TStringList;'); + CL.AddDelphiFunction('Function HiperbolicTangent( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function HiperbolicTangentDerivative( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function RectifiedLinearUnit( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function RectifiedLinearUnitDerivative( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function RectifiedLinearUnitLeaky( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function RectifiedLinearUnitLeakyDerivative( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function ReLULeakyBound( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function ReLULeakyBoundDerivative( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function Sigmoid( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function SigmoidDerivative( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function Identity( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function IdentityDerivative( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function SoftmaxDerivative( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function DiffAct( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function DiffActDerivative( x : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function NeuronForceMinMax88( x, pMin, pMax : TNeuralFloat) : TNeuralFloat;'); + CL.AddDelphiFunction('Function NeuronForceMinMax89( x, pMin, pMax : integer) : integer;'); + CL.AddDelphiFunction('Function NeuronForceRange( x, range : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Function NeuronForceMinRange( x, range : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Procedure rgb2hsv( r, g, b : TNeuralFloat; var h, s, v : TNeuralFloat)'); + CL.AddDelphiFunction('Procedure hsv2rgb( h, s, v : TNeuralFloat; var r, g, b : TNeuralFloat)'); + CL.AddDelphiFunction('Function hue2rgb( p, q, t : TNeuralFloat) : TNeuralFloat'); + CL.AddDelphiFunction('Procedure rgb2hsl( r, g, b : TNeuralFloat; var h, s, l : TNeuralFloat)'); + CL.AddDelphiFunction('Procedure hsl2rgb( h, s, l : TNeuralFloat; var r, g, b : TNeuralFloat)'); + CL.AddDelphiFunction('Procedure lab2rgb( l, a, b : TNeuralFloat; var r, g, bb : TNeuralFloat)'); + CL.AddDelphiFunction('Procedure rgb2lab( r, g, b : TNeuralFloat; var l, a, bb : TNeuralFloat)'); + CL.AddDelphiFunction('Function RoundAsByte( x : TNeuralFloat) : byte'); + CL.AddDelphiFunction('Function CompareStringListIntegerAsc( List : TStringList; Index1, Index2 : Integer) : Integer'); + CL.AddDelphiFunction('Function CompareStringListIntegerDesc( List : TStringList; Index1, Index2 : Integer) : Integer'); + CL.AddDelphiFunction('Function CompareNNetVolumeListAsc( const Item1, Item2 : TNNetVolume) : Integer'); + CL.AddDelphiFunction('Function CompareNNetVolumeListDesc( const Item1, Item2 : TNNetVolume) : Integer'); + CL.AddDelphiFunction('Function NeuralFloatToStr( V : TNeuralFloat) : string'); + CL.AddDelphiFunction('Function NeuralStrToFloat( V : String) : TNeuralFloat'); + CL.AddDelphiFunction('Procedure TestTNNetVolume( )'); + CL.AddDelphiFunction('Procedure TestKMeans( )'); +end; + +(* === run-time registration functions === *) +(*----------------------------------------------------------------------------*) +Function NeuronForceMinMax89_P( x, pMin, pMax : integer) : integer; +Begin Result := neuralvolume.NeuronForceMinMax(x, pMin, pMax); END; + +(*----------------------------------------------------------------------------*) +Function NeuronForceMinMax88_P( x, pMin, pMax : TNeuralFloat) : TNeuralFloat; +Begin Result := neuralvolume.NeuronForceMinMax(x, pMin, pMax); END; + +(*----------------------------------------------------------------------------*) +Function CreateTokenizedStringList87_P( c : char) : TStringList; +Begin Result := neuralvolume.CreateTokenizedStringList(c); END; + +(*----------------------------------------------------------------------------*) +Function CreateTokenizedStringList86_P( str : string; c : char) : TStringList; +Begin Result := neuralvolume.CreateTokenizedStringList(str, c); END; + +(*----------------------------------------------------------------------------*) +procedure TStringListIntIntegers_W(Self: TStringListInt; const T: PtrInt; const t1: Integer); +begin Self.Integers[t1] := T; end; + +(*----------------------------------------------------------------------------*) +procedure TStringListIntIntegers_R(Self: TStringListInt; var T: PtrInt; const t1: Integer); +begin T := Self.Integers[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetKMeansManhattanDistance_W(Self: TNNetKMeans; const T: boolean); +begin Self.ManhattanDistance := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetKMeansManhattanDistance_R(Self: TNNetKMeans; var T: boolean); +begin T := Self.ManhattanDistance; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetKMeansLastDistance_R(Self: TNNetKMeans; var T: TNeuralFloat); +begin T := Self.LastDistance; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetKMeansLastStepTime_R(Self: TNNetKMeans; var T: double); +begin T := Self.LastStepTime; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetKMeansClusters_R(Self: TNNetKMeans; var T: TNNetVolumeList); +begin T := Self.Clusters; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetKMeansSample_R(Self: TNNetKMeans; var T: TNNetVolumeList); +begin T := Self.Sample; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetVolumePairListItems_W(Self: TNNetVolumePairList; const T: TNNetVolumePair; const t1: Integer); +begin Self.Items[t1] := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetVolumePairListItems_R(Self: TNNetVolumePairList; var T: TNNetVolumePair; const t1: Integer); +begin T := Self.Items[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetVolumeListItems_W(Self: TNNetVolumeList; const T: TNNetVolume; const t1: Integer); +begin Self.Items[t1] := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetVolumeListItems_R(Self: TNNetVolumeList; var T: TNNetVolume; const t1: Integer); +begin T := Self.Items[t1]; end; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeListAddVolumes85_P(Self: TNNetVolumeList; Origin : TNNetVolumeList); +Begin Self.AddVolumes(Origin); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeListAddVolumes84_P(Self: TNNetVolumeList; pVolNum, pSizeX, pSizeY, pDepth : integer; c : TNeuralFloat); +Begin Self.AddVolumes(pVolNum, pSizeX, pSizeY, pDepth, c); END; + +(*----------------------------------------------------------------------------*) +procedure TMObjectErrorProc_W(Self: TMObject; const T: TGetStrProc); +begin Self.ErrorProc := T; end; + +(*----------------------------------------------------------------------------*) +procedure TMObjectErrorProc_R(Self: TMObject; var T: TGetStrProc); +begin T := Self.ErrorProc; end; + +(*----------------------------------------------------------------------------*) +procedure TMObjectMessageProc_W(Self: TMObject; const T: TGetStrProc); +begin Self.MessageProc := T; end; + +(*----------------------------------------------------------------------------*) +procedure TMObjectMessageProc_R(Self: TMObject; var T: TGetStrProc); +begin T := Self.MessageProc; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetVolumePairO_R(Self: TNNetVolumePair; var T: TNNetVolume); +begin T := Self.O; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetVolumePairI_R(Self: TNNetVolumePair; var T: TNNetVolume); +begin T := Self.I; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetVolumePairB_R(Self: TNNetVolumePair; var T: TNNetVolume); +begin T := Self.B; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetVolumePairA_R(Self: TNNetVolumePair; var T: TNNetVolume); +begin T := Self.A; end; + +(*----------------------------------------------------------------------------*) +Function TNNetVolumePairCreateCopying83_P(Self: TClass; CreateNewInstance: Boolean; pA, pB : TNNetVolume):TObject; +Begin Result := TNNetVolumePair.CreateCopying(pA, pB); END; + +(*----------------------------------------------------------------------------*) +Function TNNetVolumePairCreate82_P(Self: TClass; CreateNewInstance: Boolean; pA, pB : TNNetVolume):TObject; +Begin Result := TNNetVolumePair.Create(pA, pB); END; + +(*----------------------------------------------------------------------------*) +Function TNNetVolumePairCreate81_P(Self: TClass; CreateNewInstance: Boolean; ):TObject; +Begin Result := TNNetVolumePair.Create; END; + +(*----------------------------------------------------------------------------*) +procedure TNNetVolumeDataPtr_R(Self: TNNetVolume; var T: TNeuralFloatArrPtr); +begin T := Self.DataPtr; end; + +(*----------------------------------------------------------------------------*) +Function TNNetVolumeSumDiff80_P(Self: TNNetVolume; Original : TNNetVolume) : TNeuralFloat; +Begin Result := Self.SumDiff(Original); END; + +(*----------------------------------------------------------------------------*) +Function TNNetVolumeGetDistance79_P(Self: TNNetVolume; Original : TNNetVolume) : TNeuralFloat; +Begin Result := Self.GetDistance(Original); END; + +(*----------------------------------------------------------------------------*) +Function TNNetVolumeGetDistanceSqr78_P(Self: TNNetVolume; Original : TNNetVolume) : TNeuralFloat; +Begin Result := Self.GetDistanceSqr(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeCopyRelu77_P(Self: TNNetVolume; Original : TNNetVolume); +Begin Self.CopyRelu(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeCopy76_P(Self: TNNetVolume; Original : TNNetVolume); +Begin Self.Copy(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeDivi75_P(Self: TNNetVolume; Value : Single); +Begin Self.Divi(Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeMulAdd74_P(Self: TNNetVolume; PtrA, PtrB, PtrC : TNeuralFloatArrPtr; pSize : integer); +Begin Self.MulAdd(PtrA, PtrB, PtrC, pSize); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeMulAdd73_P(Self: TNNetVolume; PtrA, PtrB : TNeuralFloatArrPtr; Value : TNeuralFloat; pSize : integer); +Begin Self.MulAdd(PtrA, PtrB, Value, pSize); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeMulAdd72_P(Self: TNNetVolume; Value : TNeuralFloat; PtrB : TNeuralFloatArrPtr); +Begin Self.MulAdd(Value, PtrB); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeMulMulAdd71_P(Self: TNNetVolume; Value1, Value2 : TNeuralFloat; Original : TNNetVolume); +Begin Self.MulMulAdd(Value1, Value2, Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeMulAdd70_P(Self: TNNetVolume; Original1, Original2 : TNNetVolume); +Begin Self.MulAdd(Original1, Original2); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeMulAdd69_P(Self: TNNetVolume; Value : TNeuralFloat; Original : TNNetVolume); +Begin Self.MulAdd(Value, Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeMul68_P(Self: TNNetVolume; PtrA, PtrB : TNeuralFloatArrPtr; pSize : integer); +Begin Self.Mul(PtrA, PtrB, pSize); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeMul67_P(Self: TNNetVolume; Value : Single); +Begin Self.Mul(Value); END; + +(*----------------------------------------------------------------------------*) +Function TNNetVolumeDotProduct66_P(Self: TNNetVolume; PtrA, PtrB : TNeuralFloatArrPtr; NumElements : integer) : Single; +Begin Result := Self.DotProduct(PtrA, PtrB, NumElements); END; + +(*----------------------------------------------------------------------------*) +Function TNNetVolumeDotProduct65_P(Self: TNNetVolume; Original : TNNetVolume) : TNeuralFloat; +Begin Result := Self.DotProduct(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeSub64_P(Self: TNNetVolume; Original : TNNetVolume); +Begin Self.Sub(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeAdd63_P(Self: TNNetVolume; PtrA, PtrB : TNeuralFloatArrPtr; NumElements : integer); +Begin Self.Add(PtrA, PtrB, NumElements); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeAdd62_P(Self: TNNetVolume; Original : TNNetVolume); +Begin Self.Add(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeMul61_P(Self: TNNetVolume; Original : TNNetVolume); +Begin Self.Mul(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeInterleavedDotProduct60_P(Self: TNNetVolume; InterleavedAs, Bs : TNNetVolume; VectorSize : integer); +Begin Self.InterleavedDotProduct(InterleavedAs, Bs, VectorSize); END; + +(*----------------------------------------------------------------------------*) +Procedure TNNetVolumeInterleavedDotProduct59_P(Self: TNNetVolume; InterleavedAs, B : TNNetVolume); +Begin Self.InterleavedDotProduct(InterleavedAs, B); END; + +(*----------------------------------------------------------------------------*) +procedure TVolumeDepth_R(Self: TVolume; var T: integer); +begin T := Self.Depth; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeSizeY_R(Self: TVolume; var T: integer); +begin T := Self.SizeY; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeSizeX_R(Self: TVolume; var T: integer); +begin T := Self.SizeX; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeSize_R(Self: TVolume; var T: integer); +begin T := Self.Size; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeTags_W(Self: TVolume; const T: integer; const t1: integer); +begin Self.Tags[t1] := T; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeTags_R(Self: TVolume; var T: integer; const t1: integer); +begin T := Self.Tags[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeTag_W(Self: TVolume; const T: integer); +begin Self.Tag := T; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeTag_R(Self: TVolume; var T: integer); +begin T := Self.Tag; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeRaw_W(Self: TVolume; const T: T; const t1: integer); +begin Self.Raw[t1] := T; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeRaw_R(Self: TVolume; var T: T; const t1: integer); +begin T := Self.Raw[t1]; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeAsByte_R(Self: TVolume; var T: byte; const t1: integer; const t2: integer; const t3: integer); +begin T := Self.AsByte[t1, t2, t3]; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeData_W(Self: TVolume; const T: T; const t1: integer; const t2: integer; const t3: integer); +begin Self.Data[t1, t2, t3] := T; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeData_R(Self: TVolume; var T: T; const t1: integer; const t2: integer; const t3: integer); +begin T := Self.Data[t1, t2, t3]; end; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeSetClass58_P(Self: TVolume; pClass : integer; TrueValue, FalseValue : T); +Begin Self.SetClass(pClass, TrueValue, FalseValue); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeSetClass57_P(Self: TVolume; pClass : integer; value : T); +Begin Self.SetClass(pClass, value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeCopyAsBits56_P(Self: TVolume; var Original : array of byte; pFlase : T; pTrue : T); +Begin Self.CopyAsBits(Original, pFlase, pTrue); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeNeuronalWeightToImg55_P(Self: TVolume; MaxW, MinW : TNeuralFloat; color_encoding : integer); +Begin Self.NeuronalWeightToImg(MaxW, MinW, color_encoding); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeNeuronalWeightToImg54_P(Self: TVolume; color_encoding : integer); +Begin Self.NeuronalWeightToImg(color_encoding); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeGetRawPtr53_P(Self: TVolume; ) : pointer; +Begin Result := Self.GetRawPtr; END; + +(*----------------------------------------------------------------------------*) +Function TVolumeGetRawPtr52_P(Self: TVolume; x : integer) : pointer; +Begin Result := Self.GetRawPtr(x); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeGetRawPtr51_P(Self: TVolume; x, y : integer) : pointer; +Begin Result := Self.GetRawPtr(x, y); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeGetRawPtr50_P(Self: TVolume; x, y, d : integer) : pointer; +Begin Result := Self.GetRawPtr(x, y, d); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeGetRawPos49_P(Self: TVolume; x, y : integer) : integer; +Begin Result := Self.GetRawPos(x, y); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeGetRawPos48_P(Self: TVolume; x, y, d : integer) : integer; +Begin Result := Self.GetRawPos(x, y, d); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeGetDistance47_P(Self: TVolume; Original : TVolume) : T; +Begin Result := Self.GetDistance(Original); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeGetDistanceSqr46_P(Self: TVolume; Original : TVolume) : T; +Begin Result := Self.GetDistanceSqr(Original); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeDotProduct45_P(Self: TVolume; PtrA, PtrB : TNeuralFloatArrPtr; NumElements : integer) : Single; +Begin Result := Self.DotProduct(PtrA, PtrB, NumElements); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeDotProduct44_P(Self: TVolume; Original : TVolume) : T; +Begin Result := Self.DotProduct(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeCopy43_P(Self: TVolume; Original : TBits; pFlase : T; pTrue : T); +Begin Self.Copy(Original, pFlase, pTrue); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeCopy42_P(Self: TVolume; var Original : array of byte); +Begin Self.Copy(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeCopy41_P(Self: TVolume; var Original : array of T); +Begin Self.Copy(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeCopy40_P(Self: TVolume; Original : TVolume; Len : integer); +Begin Self.Copy(Original, Len); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeCopyRelu39_P(Self: TVolume; Original : TVolume); +Begin Self.CopyRelu(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeCopy38_P(Self: TVolume; Original : TVolume); +Begin Self.Copy(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeDivi37_P(Self: TVolume; Value : T); +Begin Self.Divi(Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeDivi36_P(Self: TVolume; Original : TVolume); +Begin Self.Divi(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeDivi35_P(Self: TVolume; x, y, d : integer; Value : T); +Begin Self.Divi(x, y, d, Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMulAdd34_P(Self: TVolume; PtrA, PtrB, PtrC : TNeuralFloatArrPtr; pSize : integer); +Begin Self.MulAdd(PtrA, PtrB, PtrC, pSize); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMulAdd33_P(Self: TVolume; PtrA, PtrB : TNeuralFloatArrPtr; Value : T; pSize : integer); +Begin Self.MulAdd(PtrA, PtrB, Value, pSize); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMulAdd32_P(Self: TVolume; Original1, Original2 : TVolume); +Begin Self.MulAdd(Original1, Original2); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMulAdd31_P(Self: TVolume; Value : T; PtrB : TNeuralFloatArrPtr); +Begin Self.MulAdd(Value, PtrB); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMulMulAdd30_P(Self: TVolume; Value1, Value2 : T; Original : TVolume); +Begin Self.MulMulAdd(Value1, Value2, Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMulAdd29_P(Self: TVolume; Value : T; Original : TVolume); +Begin Self.MulAdd(Value, Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumePow28_P(Self: TVolume; Value : T); +Begin Self.Pow(Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMulAtDepth27_P(Self: TVolume; pDepth : integer; Value : T); +Begin Self.MulAtDepth(pDepth, Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMul26_P(Self: TVolume; Value : T); +Begin Self.Mul(Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMul25_P(Self: TVolume; PtrA, PtrB : TNeuralFloatArrPtr; pSize : integer); +Begin Self.Mul(PtrA, PtrB, pSize); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMul24_P(Self: TVolume; Original : TVolume); +Begin Self.Mul(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeMul23_P(Self: TVolume; x, y, d : integer; Value : T); +Begin Self.Mul(x, y, d, Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeSetMax22_P(Self: TVolume; Value : TNeuralFloat); +Begin Self.SetMax(Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeSetMin21_P(Self: TVolume; Value : TNeuralFloat); +Begin Self.SetMin(Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeDiff20_P(Self: TVolume; Original : TVolume); +Begin Self.Diff(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeSub19_P(Self: TVolume; Value : T); +Begin Self.Sub(Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeSub18_P(Self: TVolume; Original : TVolume); +Begin Self.Sub(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeSub17_P(Self: TVolume; x, y, d : integer; Value : T); +Begin Self.Sub(x, y, d, Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeAddLayers16_P(Self: TVolume; A, B : TVolume); +Begin Self.AddLayers(A, B); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeAddAtDepth15_P(Self: TVolume; pDepth : integer; Value : T); +Begin Self.AddAtDepth(pDepth, Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeAdd14_P(Self: TVolume; PtrA, PtrB : TNeuralFloatArrPtr; NumElements : integer); +Begin Self.Add(PtrA, PtrB, NumElements); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeAdd13_P(Self: TVolume; Value : T); +Begin Self.Add(Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeAdd12_P(Self: TVolume; Original : TVolume); +Begin Self.Add(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeAdd11_P(Self: TVolume; x, y, d : integer; Value : T); +Begin Self.Add(x, y, d, Value); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeReSize10_P(Self: TVolume; Original : TVolume); +Begin Self.ReSize(Original); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeReSize9_P(Self: TVolume; pSizeX, pSizeY, pDepth : integer); +Begin Self.ReSize(pSizeX, pSizeY, pDepth); END; + +(*----------------------------------------------------------------------------*) +Procedure TVolumeResize8_P(Self: TVolume; pSize : integer); +Begin Self.Resize(pSize); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeCreate7_P(Self: TClass; CreateNewInstance: Boolean; ):TObject; +Begin Result := TVolume.Create; END; + +(*----------------------------------------------------------------------------*) +Function TVolumeCreate6_P(Self: TClass; CreateNewInstance: Boolean; pSize : integer; c : T):TObject; +Begin Result := TVolume.Create(pSize, c); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeCreateAsBits5_P(Self: TClass; CreateNewInstance: Boolean; Original : array of byte; pFalse : T; pTrue : T):TObject; +Begin Result := TVolume.CreateAsBits(Original, pFalse, pTrue); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeCreate4_P(Self: TClass; CreateNewInstance: Boolean; Original : TBits; pFalse : T; pTrue : T):TObject; +Begin Result := TVolume.Create(Original, pFalse, pTrue); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeCreate3_P(Self: TClass; CreateNewInstance: Boolean; Original : TVolume):TObject; +Begin Result := TVolume.Create(Original); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeCreate2_P(Self: TClass; CreateNewInstance: Boolean; Original : array of byte):TObject; +Begin Result := TVolume.Create(Original); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeCreate1_P(Self: TClass; CreateNewInstance: Boolean; pInput : array of T):TObject; +Begin Result := TVolume.Create(pInput); END; + +(*----------------------------------------------------------------------------*) +Function TVolumeCreate0_P(Self: TClass; CreateNewInstance: Boolean; pSizeX, pSizeY, pDepth : integer; c : T):TObject; +Begin Result := TVolume.Create(pSizeX, pSizeY, pDepth, c); END; + +(*----------------------------------------------------------------------------*) +procedure TVolumeFData_W(Self: TVolume; const T: array of T); +Begin Self.FData := T; end; + +(*----------------------------------------------------------------------------*) +procedure TVolumeFData_R(Self: TVolume; var T: array of T); +Begin T := Self.FData; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetListFreeObjects_W(Self: TNNetList; const T: boolean); +Begin Self.FreeObjects := T; end; + +(*----------------------------------------------------------------------------*) +procedure TNNetListFreeObjects_R(Self: TNNetList; var T: boolean); +Begin T := Self.FreeObjects; end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_neuralvolume_Routines(S: TPSExec); +begin + S.RegisterDelphiFunction(@CreateTokenizedStringList86, 'CreateTokenizedStringList86', cdRegister); + S.RegisterDelphiFunction(@CreateTokenizedStringList87, 'CreateTokenizedStringList87', cdRegister); + S.RegisterDelphiFunction(@HiperbolicTangent, 'HiperbolicTangent', cdRegister); + S.RegisterDelphiFunction(@HiperbolicTangentDerivative, 'HiperbolicTangentDerivative', cdRegister); + S.RegisterDelphiFunction(@RectifiedLinearUnit, 'RectifiedLinearUnit', cdRegister); + S.RegisterDelphiFunction(@RectifiedLinearUnitDerivative, 'RectifiedLinearUnitDerivative', cdRegister); + S.RegisterDelphiFunction(@RectifiedLinearUnitLeaky, 'RectifiedLinearUnitLeaky', cdRegister); + S.RegisterDelphiFunction(@RectifiedLinearUnitLeakyDerivative, 'RectifiedLinearUnitLeakyDerivative', cdRegister); + S.RegisterDelphiFunction(@ReLULeakyBound, 'ReLULeakyBound', cdRegister); + S.RegisterDelphiFunction(@ReLULeakyBoundDerivative, 'ReLULeakyBoundDerivative', cdRegister); + S.RegisterDelphiFunction(@Sigmoid, 'Sigmoid', cdRegister); + S.RegisterDelphiFunction(@SigmoidDerivative, 'SigmoidDerivative', cdRegister); + S.RegisterDelphiFunction(@Identity, 'Identity', cdRegister); + S.RegisterDelphiFunction(@IdentityDerivative, 'IdentityDerivative', cdRegister); + S.RegisterDelphiFunction(@SoftmaxDerivative, 'SoftmaxDerivative', cdRegister); + S.RegisterDelphiFunction(@DiffAct, 'DiffAct', cdRegister); + S.RegisterDelphiFunction(@DiffActDerivative, 'DiffActDerivative', cdRegister); + S.RegisterDelphiFunction(@NeuronForceMinMax88, 'NeuronForceMinMax88', cdRegister); + S.RegisterDelphiFunction(@NeuronForceMinMax89, 'NeuronForceMinMax89', cdRegister); + S.RegisterDelphiFunction(@NeuronForceRange, 'NeuronForceRange', cdRegister); + S.RegisterDelphiFunction(@NeuronForceMinRange, 'NeuronForceMinRange', cdRegister); + S.RegisterDelphiFunction(@rgb2hsv, 'rgb2hsv', cdRegister); + S.RegisterDelphiFunction(@hsv2rgb, 'hsv2rgb', cdRegister); + S.RegisterDelphiFunction(@hue2rgb, 'hue2rgb', cdRegister); + S.RegisterDelphiFunction(@rgb2hsl, 'rgb2hsl', cdRegister); + S.RegisterDelphiFunction(@hsl2rgb, 'hsl2rgb', cdRegister); + S.RegisterDelphiFunction(@lab2rgb, 'lab2rgb', cdRegister); + S.RegisterDelphiFunction(@rgb2lab, 'rgb2lab', cdRegister); + S.RegisterDelphiFunction(@RoundAsByte, 'RoundAsByte', cdRegister); + S.RegisterDelphiFunction(@CompareStringListIntegerAsc, 'CompareStringListIntegerAsc', cdRegister); + S.RegisterDelphiFunction(@CompareStringListIntegerDesc, 'CompareStringListIntegerDesc', cdRegister); + S.RegisterDelphiFunction(@CompareNNetVolumeListAsc, 'CompareNNetVolumeListAsc', cdRegister); + S.RegisterDelphiFunction(@CompareNNetVolumeListDesc, 'CompareNNetVolumeListDesc', cdRegister); + S.RegisterDelphiFunction(@NeuralFloatToStr, 'NeuralFloatToStr', cdRegister); + S.RegisterDelphiFunction(@NeuralStrToFloat, 'NeuralStrToFloat', cdRegister); + S.RegisterDelphiFunction(@TestTNNetVolume, 'TestTNNetVolume', cdRegister); + S.RegisterDelphiFunction(@TestKMeans, 'TestKMeans', cdRegister); +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetDictionary(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetDictionary) do + begin + RegisterConstructor(@TNNetDictionary.Create, 'Create'); + RegisterMethod(@TNNetDictionary.AddWordToDictionary, 'AddWordToDictionary'); + RegisterMethod(@TNNetDictionary.AddWordsToDictionary, 'AddWordsToDictionary'); + RegisterMethod(@TNNetDictionary.WordToIndex, 'WordToIndex'); + RegisterMethod(@TNNetDictionary.StringToVolume, 'StringToVolume'); + RegisterMethod(@TNNetDictionary.VolumeToString, 'VolumeToString'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TStringListInt(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TStringListInt) do + begin + RegisterConstructor(@TStringListInt.Create, 'Create'); + RegisterMethod(@TStringListInt.SortByIntegerAsc, 'SortByIntegerAsc'); + RegisterMethod(@TStringListInt.SortByIntegerDesc, 'SortByIntegerDesc'); + RegisterMethod(@TStringListInt.AddInteger, 'AddInteger'); + RegisterPropertyHelper(@TStringListIntIntegers_R,@TStringListIntIntegers_W,'Integers'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetStringList(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetStringList) do + begin + RegisterMethod(@TNNetStringList.GetRandomIndex, 'GetRandomIndex'); + RegisterMethod(@TNNetStringList.DeleteFirst, 'DeleteFirst'); + RegisterMethod(@TNNetStringList.DeleteLast, 'DeleteLast'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetKMeans(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetKMeans) do + begin + RegisterConstructor(@TNNetKMeans.Create, 'Create'); + RegisterMethod(@TNNetKMeans.RunStep, 'RunStep'); + RegisterMethod(@TNNetKMeans.Resize, 'Resize'); + RegisterMethod(@TNNetKMeans.Randomize, 'Randomize'); + RegisterMethod(@TNNetKMeans.RandomizeEmptyClusters, 'RandomizeEmptyClusters'); + RegisterMethod(@TNNetKMeans.AddSample, 'AddSample'); + RegisterMethod(@TNNetKMeans.GetClusterId, 'GetClusterId'); + RegisterMethod(@TNNetKMeans.GetTotalSize, 'GetTotalSize'); + RegisterPropertyHelper(@TNNetKMeansSample_R,nil,'Sample'); + RegisterPropertyHelper(@TNNetKMeansClusters_R,nil,'Clusters'); + RegisterPropertyHelper(@TNNetKMeansLastStepTime_R,nil,'LastStepTime'); + RegisterPropertyHelper(@TNNetKMeansLastDistance_R,nil,'LastDistance'); + RegisterPropertyHelper(@TNNetKMeansManhattanDistance_R,@TNNetKMeansManhattanDistance_W,'ManhattanDistance'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetVolumePairList(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetVolumePairList) do + begin + RegisterPropertyHelper(@TNNetVolumePairListItems_R,@TNNetVolumePairListItems_W,'Items'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetVolumeList(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetVolumeList) do + begin + RegisterMethod(@TNNetVolumeList.GetTotalSize, 'GetTotalSize'); + RegisterMethod(@TNNetVolumeList.GetSum, 'GetSum'); + RegisterMethod(@TNNetVolumeList.GetAvg, 'GetAvg'); + RegisterMethod(@TNNetVolumeList.GetClosestId, 'GetClosestId'); + RegisterMethod(@TNNetVolumeList.GetManhattanClosestId, 'GetManhattanClosestId'); + RegisterMethod(@TNNetVolumeList.Fill, 'Fill'); + RegisterMethod(@TNNetVolumeList.ClearTag, 'ClearTag'); + RegisterMethod(@TNNetVolumeList.ConcatInto, 'ConcatInto'); + RegisterMethod(@TNNetVolumeList.InterleaveInto, 'InterleaveInto'); + RegisterMethod(@TNNetVolumeList.SplitFrom, 'SplitFrom'); + RegisterMethod(@TNNetVolumeListAddVolumes84_P, 'AddVolumes84'); + RegisterMethod(@TNNetVolumeListAddVolumes85_P, 'AddVolumes85'); + RegisterMethod(@TNNetVolumeList.AddCopy, 'AddCopy'); + RegisterMethod(@TNNetVolumeList.AddInto, 'AddInto'); + RegisterMethod(@TNNetVolumeList.SortByTagAsc, 'SortByTagAsc'); + RegisterMethod(@TNNetVolumeList.SortByTagDesc, 'SortByTagDesc'); + RegisterMethod(@TNNetVolumeList.GetColumn, 'GetColumn'); + RegisterMethod(@TNNetVolumeList.ResizeImage, 'ResizeImage'); + RegisterPropertyHelper(@TNNetVolumeListItems_R,@TNNetVolumeListItems_W,'Items'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TMObject(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TMObject) do + begin + RegisterConstructor(@TMObject.Create, 'Create'); + RegisterMethod(@TMObject.DefaultMessageProc, 'DefaultMessageProc'); + RegisterMethod(@TMObject.DefaultErrorProc, 'DefaultErrorProc'); + RegisterMethod(@TMObject.DefaultHideMessages, 'DefaultHideMessages'); + RegisterMethod(@TMObject.HideMessages, 'HideMessages'); + RegisterPropertyHelper(@TMObjectMessageProc_R,@TMObjectMessageProc_W,'MessageProc'); + RegisterPropertyHelper(@TMObjectErrorProc_R,@TMObjectErrorProc_W,'ErrorProc'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetVolumePair(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetVolumePair) do + begin + RegisterConstructor(@TNNetVolumePairCreate81_P, 'Create81'); + RegisterConstructor(@TNNetVolumePairCreate82_P, 'Create82'); + RegisterConstructor(@TNNetVolumePairCreateCopying83_P, 'CreateCopying83'); + RegisterPropertyHelper(@TNNetVolumePairA_R,nil,'A'); + RegisterPropertyHelper(@TNNetVolumePairB_R,nil,'B'); + RegisterPropertyHelper(@TNNetVolumePairI_R,nil,'I'); + RegisterPropertyHelper(@TNNetVolumePairO_R,nil,'O'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetVolume(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetVolume) do + begin + RegisterMethod(@TNNetVolume.GetMemSize, 'GetMemSize'); + RegisterMethod(@TNNetVolume.CalculateLocalResponseFrom2D, 'CalculateLocalResponseFrom2D'); + RegisterMethod(@TNNetVolume.CalculateLocalResponseFromDepth, 'CalculateLocalResponseFromDepth'); + RegisterMethod(@TNNetVolumeInterleavedDotProduct59_P, 'InterleavedDotProduct59'); + RegisterMethod(@TNNetVolumeInterleavedDotProduct60_P, 'InterleavedDotProduct60'); + RegisterMethod(@TNNetVolume.DotProducts, 'DotProducts'); + RegisterMethod(@TNNetVolume.AddArea, 'AddArea'); + RegisterMethod(@TNNetVolume.HasAVX, 'HasAVX'); + RegisterMethod(@TNNetVolume.HasAVX2, 'HasAVX2'); + RegisterMethod(@TNNetVolume.HasAVX512, 'HasAVX512'); + RegisterMethod(@TNNetVolume.PearsonCorrelation, 'PearsonCorrelation'); + RegisterMethod(@TNNetVolume.AddSumChannel, 'AddSumChannel'); + RegisterMethod(@TNNetVolume.AddSumSqrChannel, 'AddSumSqrChannel'); + RegisterMethod(@TNNetVolume.AddToChannels, 'AddToChannels'); + RegisterMethod(@TNNetVolume.MulChannels, 'MulChannels'); + RegisterMethod(@TNNetVolumeMul61_P, 'Mul61'); + RegisterMethod(@TNNetVolume.NormalizeMax, 'NormalizeMax'); + RegisterMethod(@TNNetVolume.RecurrencePlot, 'RecurrencePlot'); + RegisterMethod(@TNNetVolume.RecurrencePlotCAI, 'RecurrencePlotCAI'); + RegisterMethod(@TNNetVolume.Fill, 'Fill'); + RegisterMethod(@TNNetVolumeAdd62_P, 'Add62'); + RegisterMethod(@TNNetVolumeAdd63_P, 'Add63'); + RegisterMethod(@TNNetVolumeSub64_P, 'Sub64'); + RegisterMethod(@TNNetVolumeDotProduct65_P, 'DotProduct65'); + RegisterMethod(@TNNetVolumeDotProduct66_P, 'DotProduct66'); + RegisterMethod(@TNNetVolumeMul67_P, 'Mul67'); + RegisterMethod(@TNNetVolumeMul68_P, 'Mul68'); + RegisterMethod(@TNNetVolumeMulAdd69_P, 'MulAdd69'); + RegisterMethod(@TNNetVolumeMulAdd70_P, 'MulAdd70'); + RegisterMethod(@TNNetVolumeMulMulAdd71_P, 'MulMulAdd71'); + RegisterMethod(@TNNetVolumeMulAdd72_P, 'MulAdd72'); + RegisterMethod(@TNNetVolumeMulAdd73_P, 'MulAdd73'); + RegisterMethod(@TNNetVolumeMulAdd74_P, 'MulAdd74'); + RegisterMethod(@TNNetVolumeDivi75_P, 'Divi75'); + RegisterMethod(@TNNetVolumeCopy76_P, 'Copy76'); + RegisterMethod(@TNNetVolumeCopyRelu77_P, 'CopyRelu77'); + RegisterMethod(@TNNetVolume.CopyPadding, 'CopyPadding'); + RegisterMethod(@TNNetVolume.CopyNoChecks, 'CopyNoChecks'); + RegisterMethod(@TNNetVolumeGetDistanceSqr78_P, 'GetDistanceSqr78'); + RegisterMethod(@TNNetVolumeGetDistance79_P, 'GetDistance79'); + RegisterMethod(@TNNetVolumeSumDiff80_P, 'SumDiff80'); + RegisterPropertyHelper(@TNNetVolumeDataPtr_R,nil,'DataPtr'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TVolume(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TVolume) do + begin + RegisterPropertyHelper(@TVolumeFData_R,@TVolumeFData_W,'FData'); + RegisterConstructor(@TVolumeCreate0_P, 'Create0'); + RegisterConstructor(@TVolumeCreate1_P, 'Create1'); + RegisterConstructor(@TVolumeCreate2_P, 'Create2'); + RegisterConstructor(@TVolumeCreate3_P, 'Create3'); + RegisterConstructor(@TVolumeCreate4_P, 'Create4'); + RegisterConstructor(@TVolumeCreateAsBits5_P, 'CreateAsBits5'); + RegisterConstructor(@TVolumeCreate6_P, 'Create6'); + RegisterConstructor(@TVolumeCreate7_P, 'Create7'); + RegisterMethod(@TVolume.Fill, 'Fill'); + RegisterMethod(@TVolume.FillForIdx, 'FillForIdx'); + RegisterMethod(@TVolume.FillAtDepth, 'FillAtDepth'); + RegisterMethod(@TVolume.FillForDebug, 'FillForDebug'); + RegisterVirtualMethod(@TVolumeResize8_P, 'Resize8'); + RegisterVirtualMethod(@TVolumeReSize9_P, 'ReSize9'); + RegisterVirtualMethod(@TVolumeReSize10_P, 'ReSize10'); + RegisterMethod(@TVolume.Get, 'Get'); + RegisterMethod(@TVolume.GetAsByte, 'GetAsByte'); + RegisterMethod(@TVolume.GetRaw, 'GetRaw'); + RegisterMethod(@TVolume.SetRaw, 'SetRaw'); + RegisterMethod(@TVolume.Store, 'Store'); + RegisterMethod(@TVolumeAdd11_P, 'Add11'); + RegisterMethod(@TVolumeAdd12_P, 'Add12'); + RegisterMethod(@TVolumeAdd13_P, 'Add13'); + RegisterMethod(@TVolumeAdd14_P, 'Add14'); + RegisterMethod(@TVolumeAddAtDepth15_P, 'AddAtDepth15'); + RegisterMethod(@TVolumeAddLayers16_P, 'AddLayers16'); + RegisterMethod(@TVolumeSub17_P, 'Sub17'); + RegisterMethod(@TVolumeSub18_P, 'Sub18'); + RegisterMethod(@TVolumeSub19_P, 'Sub19'); + RegisterMethod(@TVolumeDiff20_P, 'Diff20'); + RegisterMethod(@TVolume.InterleaveWithDepthFrom, 'InterleaveWithDepthFrom'); + RegisterMethod(@TVolume.InterleaveWithXFrom, 'InterleaveWithXFrom'); + RegisterMethod(@TVolume.IncYSize, 'IncYSize'); + RegisterMethod(@TVolume.IncYSizeBytes, 'IncYSizeBytes'); + RegisterMethod(@TVolume.DeInterleaveWithXFrom, 'DeInterleaveWithXFrom'); + RegisterMethod(@TVolume.DeInterleaveWithDepthFrom, 'DeInterleaveWithDepthFrom'); + RegisterMethod(@TVolumeSetMin21_P, 'SetMin21'); + RegisterMethod(@TVolumeSetMax22_P, 'SetMax22'); + RegisterMethod(@TVolumeMul23_P, 'Mul23'); + RegisterMethod(@TVolumeMul24_P, 'Mul24'); + RegisterMethod(@TVolumeMul25_P, 'Mul25'); + RegisterMethod(@TVolumeMul26_P, 'Mul26'); + RegisterMethod(@TVolumeMulAtDepth27_P, 'MulAtDepth27'); + RegisterMethod(@TVolumePow28_P, 'Pow28'); + RegisterMethod(@TVolume.VSqrt, 'VSqrt'); + RegisterMethod(@TVolumeMulAdd29_P, 'MulAdd29'); + RegisterMethod(@TVolumeMulMulAdd30_P, 'MulMulAdd30'); + RegisterMethod(@TVolumeMulAdd31_P, 'MulAdd31'); + RegisterMethod(@TVolumeMulAdd32_P, 'MulAdd32'); + RegisterMethod(@TVolumeMulAdd33_P, 'MulAdd33'); + RegisterMethod(@TVolumeMulAdd34_P, 'MulAdd34'); + RegisterMethod(@TVolumeDivi35_P, 'Divi35'); + RegisterMethod(@TVolumeDivi36_P, 'Divi36'); + RegisterMethod(@TVolumeDivi37_P, 'Divi37'); + RegisterMethod(@TVolume.ForceMinRange, 'ForceMinRange'); + RegisterMethod(@TVolume.ForceMaxRange, 'ForceMaxRange'); + RegisterMethod(@TVolume.Randomize, 'Randomize'); + RegisterMethod(@TVolume.RandomizeGaussian, 'RandomizeGaussian'); + RegisterMethod(@TVolume.AddGaussianNoise, 'AddGaussianNoise'); + RegisterMethod(@TVolume.AddSaltAndPepper, 'AddSaltAndPepper'); + RegisterMethod(@TVolume.RandomGaussianValue, 'RandomGaussianValue'); + RegisterMethod(@TVolumeCopy38_P, 'Copy38'); + RegisterMethod(@TVolumeCopyRelu39_P, 'CopyRelu39'); + RegisterMethod(@TVolumeCopy40_P, 'Copy40'); + RegisterMethod(@TVolumeCopy41_P, 'Copy41'); + RegisterMethod(@TVolumeCopy42_P, 'Copy42'); + RegisterMethod(@TVolumeCopy43_P, 'Copy43'); + RegisterMethod(@TVolume.CopyPadding, 'CopyPadding'); + RegisterMethod(@TVolume.CopyCropping, 'CopyCropping'); + RegisterMethod(@TVolume.CopyResizing, 'CopyResizing'); + RegisterMethod(@TVolume.CopyNoChecks, 'CopyNoChecks'); + RegisterMethod(@TVolume.CopyChannels, 'CopyChannels'); + RegisterMethod(@TVolume.Define, 'Define'); + RegisterMethod(@TVolumeDotProduct44_P, 'DotProduct44'); + RegisterMethod(@TVolumeDotProduct45_P, 'DotProduct45'); + RegisterMethod(@TVolume.SumDiff, 'SumDiff'); + RegisterMethod(@TVolume.SumToPos, 'SumToPos'); + RegisterMethod(@TVolumeGetDistanceSqr46_P, 'GetDistanceSqr46'); + RegisterMethod(@TVolumeGetDistance47_P, 'GetDistance47'); + RegisterMethod(@TVolume.SumAtDepth, 'SumAtDepth'); + RegisterMethod(@TVolume.AvgAtDepth, 'AvgAtDepth'); + RegisterMethod(@TVolumeGetRawPos48_P, 'GetRawPos48'); + RegisterMethod(@TVolumeGetRawPos49_P, 'GetRawPos49'); + RegisterMethod(@TVolumeGetRawPtr50_P, 'GetRawPtr50'); + RegisterMethod(@TVolumeGetRawPtr51_P, 'GetRawPtr51'); + RegisterMethod(@TVolumeGetRawPtr52_P, 'GetRawPtr52'); + RegisterMethod(@TVolumeGetRawPtr53_P, 'GetRawPtr53'); + RegisterMethod(@TVolume.GetMin, 'GetMin'); + RegisterMethod(@TVolume.GetMax, 'GetMax'); + RegisterMethod(@TVolume.GetNonZero, 'GetNonZero'); + RegisterMethod(@TVolume.GetMaxAbs, 'GetMaxAbs'); + RegisterMethod(@TVolume.GetMinMaxAtDepth, 'GetMinMaxAtDepth'); + RegisterVirtualMethod(@TVolume.GetSum, 'GetSum'); + RegisterVirtualMethod(@TVolume.GetSumAbs, 'GetSumAbs'); + RegisterVirtualMethod(@TVolume.GetSumSqr, 'GetSumSqr'); + RegisterMethod(@TVolume.GetAvg, 'GetAvg'); + RegisterMethod(@TVolume.GetVariance, 'GetVariance'); + RegisterMethod(@TVolume.GetStdDeviation, 'GetStdDeviation'); + RegisterMethod(@TVolume.GetMagnitude, 'GetMagnitude'); + RegisterMethod(@TVolume.FlipX, 'FlipX'); + RegisterMethod(@TVolume.FlipY, 'FlipY'); + RegisterMethod(@TVolume.IncTag, 'IncTag'); + RegisterMethod(@TVolume.ClearTag, 'ClearTag'); + RegisterMethod(@TVolume.NeuralToStr, 'NeuralToStr'); + RegisterMethod(@TVolume.RgbImgToNeuronalInput, 'RgbImgToNeuronalInput'); + RegisterMethod(@TVolume.NeuronalInputToRgbImg, 'NeuronalInputToRgbImg'); + RegisterMethod(@TVolumeNeuronalWeightToImg54_P, 'NeuronalWeightToImg54'); + RegisterMethod(@TVolumeNeuronalWeightToImg55_P, 'NeuronalWeightToImg55'); + RegisterMethod(@TVolume.NeuronalWeightToImg3Channel, 'NeuronalWeightToImg3Channel'); + RegisterMethod(@TVolume.ZeroCenter, 'ZeroCenter'); + RegisterMethod(@TVolume.Print, 'Print'); + RegisterMethod(@TVolume.PrintWithIndex, 'PrintWithIndex'); + RegisterMethod(@TVolume.PrintDebug, 'PrintDebug'); + RegisterMethod(@TVolume.PrintDebugChannel, 'PrintDebugChannel'); + RegisterMethod(@TVolume.InitUniform, 'InitUniform'); + RegisterMethod(@TVolume.InitGaussian, 'InitGaussian'); + RegisterMethod(@TVolume.InitLeCunUniform, 'InitLeCunUniform'); + RegisterMethod(@TVolume.InitHeUniform, 'InitHeUniform'); + RegisterMethod(@TVolume.InitLeCunGaussian, 'InitLeCunGaussian'); + RegisterMethod(@TVolume.InitHeGaussian, 'InitHeGaussian'); + RegisterMethod(@TVolume.InitSELU, 'InitSELU'); + RegisterMethod(@TVolume.SaveToString, 'SaveToString'); + RegisterMethod(@TVolume.LoadFromString, 'LoadFromString'); + RegisterMethod(@TVolumeCopyAsBits56_P, 'CopyAsBits56'); + RegisterMethod(@TVolume.ReadAsBits, 'ReadAsBits'); + RegisterMethod(@TVolumeSetClass57_P, 'SetClass57'); + RegisterMethod(@TVolumeSetClass58_P, 'SetClass58'); + RegisterMethod(@TVolume.SetClassForHiperbolicTangent, 'SetClassForHiperbolicTangent'); + RegisterMethod(@TVolume.SetClassForReLU, 'SetClassForReLU'); + RegisterMethod(@TVolume.SetClassForSoftMax, 'SetClassForSoftMax'); + RegisterMethod(@TVolume.GetClass, 'GetClass'); + RegisterMethod(@TVolume.SoftMax, 'SoftMax'); + RegisterMethod(@TVolume.RgbToHsv, 'RgbToHsv'); + RegisterMethod(@TVolume.HsvToRgb, 'HsvToRgb'); + RegisterMethod(@TVolume.RgbToHsl, 'RgbToHsl'); + RegisterMethod(@TVolume.HslToRgb, 'HslToRgb'); + RegisterMethod(@TVolume.RgbToLab, 'RgbToLab'); + RegisterMethod(@TVolume.LabToRgb, 'LabToRgb'); + RegisterMethod(@TVolume.RgbToGray, 'RgbToGray'); + RegisterMethod(@TVolume.GetGrayFromRgb, 'GetGrayFromRgb'); + RegisterMethod(@TVolume.MakeGray, 'MakeGray'); + RegisterMethod(@TVolume.ShiftRight, 'ShiftRight'); + RegisterMethod(@TVolume.ShiftLeft, 'ShiftLeft'); + RegisterPropertyHelper(@TVolumeData_R,@TVolumeData_W,'Data'); + RegisterPropertyHelper(@TVolumeAsByte_R,nil,'AsByte'); + RegisterPropertyHelper(@TVolumeRaw_R,@TVolumeRaw_W,'Raw'); + RegisterPropertyHelper(@TVolumeTag_R,@TVolumeTag_W,'Tag'); + RegisterPropertyHelper(@TVolumeTags_R,@TVolumeTags_W,'Tags'); + RegisterPropertyHelper(@TVolumeSize_R,nil,'Size'); + RegisterPropertyHelper(@TVolumeSizeX_R,nil,'SizeX'); + RegisterPropertyHelper(@TVolumeSizeY_R,nil,'SizeY'); + RegisterPropertyHelper(@TVolumeDepth_R,nil,'Depth'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_TNNetList(CL: TPSRuntimeClassImporter); +begin + with CL.Add(TNNetList) do + begin + RegisterPropertyHelper(@TNNetListFreeObjects_R,@TNNetListFreeObjects_W,'FreeObjects'); + RegisterConstructor(@TNNetList.Create, 'Create'); + end; +end; + +(*----------------------------------------------------------------------------*) +procedure RIRegister_neuralvolume(CL: TPSRuntimeClassImporter); +begin + RIRegister_TNNetList(CL); + RIRegister_TVolume(CL); + RIRegister_TNNetVolume(CL); + RIRegister_TNNetVolumePair(CL); + RIRegister_TMObject(CL); + RIRegister_TNNetVolumeList(CL); + RIRegister_TNNetVolumePairList(CL); + RIRegister_TNNetKMeans(CL); + RIRegister_TNNetStringList(CL); + RIRegister_TStringListInt(CL); + RIRegister_TNNetDictionary(CL); +end; + + + +{ TPSImport_neuralvolume } +(*----------------------------------------------------------------------------*) +procedure TPSImport_neuralvolume.CompileImport1(CompExec: TPSScript); +begin + SIRegister_neuralvolume(CompExec.Comp); +end; +(*----------------------------------------------------------------------------*) +procedure TPSImport_neuralvolume.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); +begin + RIRegister_neuralvolume(ri); + RIRegister_neuralvolume_Routines(CompExec.Exec); // comment it if no routines +end; +(*----------------------------------------------------------------------------*) + + +end. diff --git a/Source/uPSI_neuralvolumev.pas b/Source/uPSI_neuralvolumev.pas new file mode 100644 index 00000000..b615b2d2 --- /dev/null +++ b/Source/uPSI_neuralvolumev.pas @@ -0,0 +1,95 @@ +unit uPSI_neuralvolumev; +{ +This file has been generated by UnitParser v0.7, written by M. Knight +and updated by NP. v/d Spek and George Birbilis. +Source Code from Carlo Kok has been used to implement various sections of +UnitParser. Components of ROPS are used in the construction of UnitParser, +code implementing the class wrapper is taken from Carlo Kok's conv utility + +} +interface + + + +uses + SysUtils + ,Classes + ,uPSComponent + ,uPSRuntime + ,uPSCompiler + ; + +type +(*----------------------------------------------------------------------------*) + TPSImport_neuralvolumev = class(TPSPlugin) + public + procedure CompileImport1(CompExec: TPSScript); override; + procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + end; + + +{ compile-time registration functions } +procedure SIRegister_neuralvolumev(CL: TPSPascalCompiler); + +{ run-time registration functions } +procedure RIRegister_neuralvolumev_Routines(S: TPSExec); + +procedure Register; + +implementation + + +uses + ExtCtrls + ,Graphics + ,neuralvolume + ,neuralvolumev + ; + + +procedure Register; +begin + RegisterComponents('Pascal Script', [TPSImport_neuralvolumev]); +end; + +(* === compile-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure SIRegister_neuralvolumev(CL: TPSPascalCompiler); +begin + CL.AddDelphiFunction('Procedure SaveHandleToBitmap( OutputFileName : string; hWnd : HWND)'); + CL.AddDelphiFunction('Procedure LoadVolumeIntoTImage( V : TNNetVolume; Image : TImage; color_encoding : integer)'); + CL.AddDelphiFunction('Procedure LoadRGBVolumeIntoTImage( V : TNNetVolume; Image : TImage)'); + CL.AddDelphiFunction('Procedure LoadPictureIntoVolume( LocalPicture : TPicture; Vol : TNNetVolume)'); + CL.AddDelphiFunction('Procedure LoadBitmapIntoVolume( LocalBitmap : TBitmap; Vol : TNNetVolume)'); + CL.AddDelphiFunction('Procedure LoadImageFromFileIntoVolume( ImageFileName : string; V : TNNetVolume)'); +end; + +(* === run-time registration functions === *) +(*----------------------------------------------------------------------------*) +procedure RIRegister_neuralvolumev_Routines(S: TPSExec); +begin + S.RegisterDelphiFunction(@SaveHandleToBitmap, 'SaveHandleToBitmap', cdRegister); + S.RegisterDelphiFunction(@LoadVolumeIntoTImage, 'LoadVolumeIntoTImage', cdRegister); + S.RegisterDelphiFunction(@LoadRGBVolumeIntoTImage, 'LoadRGBVolumeIntoTImage', cdRegister); + S.RegisterDelphiFunction(@LoadPictureIntoVolume, 'LoadPictureIntoVolume', cdRegister); + S.RegisterDelphiFunction(@LoadBitmapIntoVolume, 'LoadBitmapIntoVolume', cdRegister); + S.RegisterDelphiFunction(@LoadImageFromFileIntoVolume, 'LoadImageFromFileIntoVolume', cdRegister); +end; + + + +{ TPSImport_neuralvolumev } +(*----------------------------------------------------------------------------*) +procedure TPSImport_neuralvolumev.CompileImport1(CompExec: TPSScript); +begin + SIRegister_neuralvolumev(CompExec.Comp); +end; +(*----------------------------------------------------------------------------*) +procedure TPSImport_neuralvolumev.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); +begin + RIRegister_neuralvolumev_Routines(CompExec.Exec); // comment it if no routines +end; +(*----------------------------------------------------------------------------*) + + +end. diff --git a/Tests/1013_saint_source23testsPython.txt b/Tests/1013_saint_source23testsPython.txt new file mode 100644 index 00000000..acbdcd0b --- /dev/null +++ b/Tests/1013_saint_source23testsPython.txt @@ -0,0 +1,3152 @@ +Program SaintSourceSnippets3_UnitTestBox; + +//uses parseutils.pas + +// #sign: max: MAXBOX8: 12/08/2021 10:45:10 +//#tech:4.7.5perf: 0:0:2.922 threads: 6 192.168.80.1 10:45:10 4.7.5.80.80 + +//https://github.com/pyscripter/python4delphi/blob/master/PythonForDelphi/Components/Sources/Core/PythonEngine.pas +//Machine Learning Mastery With Python Mini-Course + + +(*Functionality: Delphi Components that provide an interface to the *) +(* Python language (see python.txt for more infos on *) +(* Python itself). *) + + //uses parseutils.pas + + //{$I examples/parseutils.pas} + + Const TEXTOUT = 'Set and Clear a Bit in a Byte'; + +//##################################################################### +//## ## +//## examples of https://my6.code.blog/2020/03/29/saint-source/ ## +//## ## +//##################################################################### + + {function OpenPythonDLL (lpMachineName : string; + lpDatabaseName : string; + dwDesiredAccess : DWORD): THANDLE; + // external 'OpenSCManager@ADVAPI32.DLL.dll stdcall'; + external 'OpenSCManagerA@python37.dll stdcall'; } + + //function SafeLoadLibrary(const Filename: string; ErrorMode: UINT): HMODULE; + + function LoadLibrary32(const Filename: string): Longint; + external 'LoadLibraryA@kernel32.dll stdcall'; + + //uses parseutils.pas + + +type + aTPythonVersionProp = record + DllName : string; + RegVersion : string; + APIVersion : Integer; + end; + + var PythonVersionProp: TPythonVersionProp; + + + procedure TDynamicDllOpenDll(const aDllName : string); forward; + +//const +{$IFDEF MSWINDOWS} + PYTHON_KNOWN_VERSIONS: array[1..8] of TPythonVersionProp = + ( + (DllName: 'python27.dll'; RegVersion: '2.7'; APIVersion: 1013), + (DllName: 'python32.dll'; RegVersion: '3.2'; APIVersion: 1013), + (DllName: 'python33.dll'; RegVersion: '3.3'; APIVersion: 1013), + (DllName: 'python34.dll'; RegVersion: '3.4'; APIVersion: 1013), + (DllName: 'python35.dll'; RegVersion: '3.5'; APIVersion: 1013), + (DllName: 'python36.dll'; RegVersion: '3.6'; APIVersion: 1013), + (DllName: 'python37.dll'; RegVersion: '3.7'; APIVersion: 1013), + (DllName: 'python38.dll'; RegVersion: '3.8'; APIVersion: 1013) + ); +{$ENDIF} +{$IFDEF _so_files} + PYTHON_KNOWN_VERSIONS: array[1..8] of TPythonVersionProp = + ( + (DllName: 'libpython2.7.so'; RegVersion: '2.7'; APIVersion: 1013), + (DllName: 'libpython3.2m.so'; RegVersion: '3.2'; APIVersion: 1013), + (DllName: 'libpython3.3m.so'; RegVersion: '3.3'; APIVersion: 1013), + (DllName: 'libpython3.4m.so'; RegVersion: '3.4'; APIVersion: 1013), + (DllName: 'libpython3.5m.so'; RegVersion: '3.5'; APIVersion: 1013), + (DllName: 'libpython3.6m.so'; RegVersion: '3.6'; APIVersion: 1013), + (DllName: 'libpython3.7m.so'; RegVersion: '3.7'; APIVersion: 1013), + (DllName: 'libpython3.8m.so'; RegVersion: '3.8'; APIVersion: 1013) + ); +{$ENDIF} +{$IFDEF DARWIN} + PYTHON_KNOWN_VERSIONS: array[1..8] of TPythonVersionProp = + ( + (DllName: 'libpython2.7.dylib'; RegVersion: '2.7'; APIVersion: 1013), + (DllName: 'libpython3.2.dylib'; RegVersion: '3.2'; APIVersion: 1013), + (DllName: 'libpython3.3.dylib'; RegVersion: '3.3'; APIVersion: 1013), + (DllName: 'libpython3.4.dylib'; RegVersion: '3.4'; APIVersion: 1013), + (DllName: 'libpython3.5.dylib'; RegVersion: '3.5'; APIVersion: 1013), + (DllName: 'libpython3.6.dylib'; RegVersion: '3.6'; APIVersion: 1013), + (DllName: 'libpython3.7.dylib'; RegVersion: '3.7'; APIVersion: 1013), + (DllName: 'libpython3.8.dylib'; RegVersion: '3.8'; APIVersion: 1013) + ); +{$endif} + + Const + aPYT_METHOD_BUFFER_INCREASE = 10; + aPYT_MEMBER_BUFFER_INCREASE = 10; + aPYT_GETSET_BUFFER_INCREASE = 10; + + KEY_ALL_ACCESS = $2003F; + + aMETH_VARARGS = $0001; + aMETH_KEYWORDS = $0002; + + // Masks for the co_flags field of PyCodeObject + aCO_OPTIMIZED = $0001; + aCO_NEWLOCALS = $0002; + aCO_VARARGS = $0004; + aCO_VARKEYWORDS = $0008; + + // Rich comparison opcodes introduced in version 2.1 + aPy_LT = 0; + aPy_LE = 1; + aPy_EQ = 2; + aPy_NE = 3; + aPy_GT = 4; + aPy_GE = 5; + + aPy_TPFLAGS_HAVE_GETCHARBUFFER = (1 shl 0); + + // PySequenceMethods contains sq_contains + aPy_TPFLAGS_HAVE_SEQUENCE_IN = (1 shl 1); + +// Objects which participate in garbage collection (see objimp.h) + aPy_TPFLAGS_GC = (1 shl 2); + +// PySequenceMethods and PyNumberMethods contain in-place operators + Py_TPFLAGS_HAVE_INPLACEOPS = (1 shl 3); + +// PyNumberMethods do their own coercion */ + Py_TPFLAGS_CHECKTYPES = (1 shl 4); + + Py_TPFLAGS_HAVE_RICHCOMPARE = (1 shl 5); + +// Objects which are weakly referencable if their tp_weaklistoffset is >0 +// XXX Should this have the same value as Py_TPFLAGS_HAVE_RICHCOMPARE? +// These both indicate a feature that appeared in the same alpha release. + + Py_TPFLAGS_HAVE_WEAKREFS = (1 shl 6); + +// tp_iter is defined + Py_TPFLAGS_HAVE_ITER = (1 shl 7); + + {Py_TPFLAGS_DEFAULT = Py_TPFLAGS_HAVE_GETCHARBUFFER + or Py_TPFLAGS_HAVE_SEQUENCE_IN + or Py_TPFLAGS_HAVE_INPLACEOPS + or Py_TPFLAGS_HAVE_RICHCOMPARE + or Py_TPFLAGS_HAVE_WEAKREFS + or Py_TPFLAGS_HAVE_ITER + ; } + +type + // Delphi equivalent used by TPyObject + aTRichComparisonOpcode = (pyLT, pyLE, pyEQ, pyNE, pyGT, pyGE); + + var myst: TStringStream; + x, ib: byte; condition: boolean; + //s : TUTF8Scanner.Create(Memo1.Text); + //asd: TSimpleIPCClient + + function OpenSCManagerX (lpMachineName : string; + lpDatabaseName : string; + dwDesiredAccess : DWORD): THANDLE; + // external 'OpenSCManager@ADVAPI32.DLL.dll stdcall'; + external 'OpenSCManagerA@advapi32.dll stdcall'; + + +function ClearBit( const aValue, aBitNumber: integer ): integer; +begin + result:= aValue And not(1 Shl aBitNumber); +end; + +function SetBit(const aValue, aBitNumber : integer ): integer; +begin + result:= aValue And (1 Shl aBitNumber); +end; + +function CleanStringANSI(const s : AnsiString; AppendLF : Boolean) : AnsiString; +var + i : Integer; +begin + result := s; + if s = '' then + Exit; + i := Pos((CR),s); + while i > 0 do begin + Delete( result, i, 1 ); + i := PosEx((CR),result, i); + end; + if AppendLF and (result[length(result)] <> LF) then + Result := Result + LF; +end; + +function CleanString(const s : UnicodeString; AppendLF : Boolean) : UnicodeString; +begin + {$IFDEF FPC} + Result := UnicodeString(AdjustLineBreaks(AnsiString(s), tlbsLF)); + {$ELSE} + Result := AdjustLineBreaks(s, tlbsLF); + {$ENDIF} + if AppendLF and (result[length(result)] <> LF) then + Result := Result + LF; +end; + +{$DEFINE MSWINDOWS} + +procedure TPythonEngineCheckRegistry; +{$IFDEF MSWINDOWS} +var + key : string; + Path : string; + NewPath : string; +{$IFDEF CPUX86} + MajorVersion : integer; + MinorVersion : integer; +{$ENDIF} + VersionSuffix: string; +{$ENDIF} +begin +{$IFDEF MSWINDOWS} + //if Assigned( FOnPathInitialization ) then + try + with TRegistry.Create1(KEY_ALL_ACCESS and not KEY_NOTIFY) do + try + VersionSuffix := ''; +{$IFDEF CPUX86} + MajorVersion := StrToInt(RegVersion[1]); + MinorVersion := StrToInt(RegVersion[3]); + if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 5)) then + VersionSuffix := '-32'; +{$ENDIF} + key:= Format('\Software\Python\PythonCore\%s%s\PythonPath', + [PythonVersionProp.RegVersion, PythonVersionProp.RegVersion, VersionSuffix]); + + RootKey := HKEY_LOCAL_MACHINE; + if not KeyExists( key ) then + begin + // try a current user installation + RootKey := HKEY_CURRENT_USER; + if not KeyExists( key ) then Exit; + end; + // Key found + OpenKey( key, True ); + try + Path := ReadString(''); + NewPath := Path; + //FOnPathInitialization( Self, NewPath ); + if NewPath <> Path then begin + WriteString( '', NewPath ); + end; + finally + CloseKey; + end; + finally + Free; + end; + except + // under WinNT, with a user without admin rights, the access to the + // LocalMachine keys would raise an exception. + end; +{$ENDIF} +end; + +//{$IFDEF MSWINDOWS} +function IsPythonVersionRegistered(PythonVersion : string; + out InstallPath: string; out AllUserInstall: Boolean) : Boolean; + // Python provides for All user and Current user installations + // All User installations place the Python DLL in the Windows System directory + // and write registry info to HKEY_LOCAL_MACHINE + // Current User installations place the DLL in the install path and + // the registry info in HKEY_CURRENT_USER. + // Hence, for Current user installations we need to try and find the install path + // since it may not be on the system path. + + // The above convension was changed in Python 3.5. Now even for all user + // installations the dll is located at the InstallPath. + // Also from version 3.5 onwards 32 bit version have a suffix -32 e.g. "3.6-32" + // See also PEP 514 + +var + key: string; + VersionSuffix: string; + MajorVersion : integer; + MinorVersion : integer; +begin + Result := False; + InstallPath := ''; + AllUserInstall := False; + MajorVersion := StrToInt(PythonVersion[1]); + MinorVersion := StrToInt(PythonVersion[3]); + VersionSuffix := ''; +{$IFDEF CPUX86} + if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 5)) then + VersionSuffix := '-32'; +{$ENDIF} + key := Format('\Software\Python\PythonCore\%s%s\InstallPath', + [PythonVersion, VersionSuffix]); + + // First try HKEY_CURRENT_USER as per PEP514 + try + with TRegistry.Create1(KEY_READ and not KEY_NOTIFY) do + try + RootKey := HKEY_CURRENT_USER; + if OpenKey(Key, False) then begin + InstallPath := ReadString(''); + Result := True; + Exit; + end; + finally + Free; + end; + except + end; + + //Then try for an all user installation + try + with TRegistry.Create1(KEY_READ and not KEY_NOTIFY) do + try + RootKey := HKEY_LOCAL_MACHINE; + if OpenKey(Key, False) then begin + AllUserInstall := True; + if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 5)) then + InstallPath := ReadString(''); + Result := True; + end; + finally + Free; + end; + except + end; +end; +//{$ENDIF} + + +var FDLLHandle : THandle; + FDllName : String; + FFatalMsgDlg : Boolean; + FFatalAbort : Boolean; + +function TDynamicDllGetDllPath : string; +{$IFDEF MSWINDOWS} +var + AllUserInstall: Boolean; + DllPath : string; + RegVersion : string; +{$ENDIF} +begin + Result := DllPath; + AllUserInstall:= True; + + {$IFDEF MSWINDOWS} + if DLLPath = '' then begin + IsPythonVersionRegistered(PythonVersionProp.RegVersion, Result, + {PythonVersionProp.}AllUserInstall); + end; + {$ENDIF} + + if Result <> '' then begin + Result := IncludeTrailingPathDelimiter(Result); + end; +end; + +function TDynamicDllIsHandleValid : Boolean; +begin +{$IFDEF MSWINDOWS} + Result := (FDLLHandle >= 32); +{$ENDIF} +{$IFDEF LINUX} + Result := FDLLHandle <> 0; +{$ENDIF} +end; + +procedure TDynamicDllDoOpenDll(const aDllName : string); +begin + if not TDynamicDllIsHandleValid then begin + FDllName := aDllName; + writeln('try open dll: '+TDynamicDllGetDllPath+FDllName); + {$IFDEF MSWINDOWS} + FDLLHandle := SafeLoadLibrary( + {$IFDEF FPC} + PAnsiChar(AnsiString(GetDllPath+DllName)) + {$ELSE} + TDynamicDllGetDllPath+FDllName, SEM_NOOPENFILEERRORBOX + {$ENDIF}); + {$ELSE} + //Linux: need here RTLD_GLOBAL, so Python can do "import ctypes" + FDLLHandle := THandle(dlopen(PAnsiChar(AnsiString(GetDllPath+DllName)), + RTLD_LAZY+RTLD_GLOBAL)); + {$ENDIF} + end; +end; + +procedure TDynamicDllLoadDll; +begin + TDynamicDllOpenDll( FDllName ); +end; + +function TDynamicDllGetQuitMessage : string; +begin + Result:= Format( 'Dll %s could not be loaded. We must quit.', [FDllName]); +end; + +procedure TDynamicDllUnloadDll; +begin + if TDynamicDllIsHandleValid then begin + //BeforeUnload; + FreeLibrary(FDLLHandle); + FDLLHandle := 0; + end; +end; + + +procedure TDynamicDllOpenDll(const aDllName : string); +var s : string; +begin + TDynamicDllUnloadDll; + + //BeforeLoad; + FDLLHandle := 0; + + TDynamicDllDoOpenDll(aDllName); + + if not TDynamicDllIsHandleValid then begin +{$IFDEF MSWINDOWS} + s := Format('Error %d: Could not open Dll "%s"',[GetLastError, FDllName]); +{$ENDIF} +{$IFDEF LINUX} + s := Format('Error: Could not open Dll "%s"',[DllName]); +{$ENDIF} + if FFatalMsgDlg then +{$IFDEF MSWINDOWS} + MessageBox( GetActiveWindow, PChar(s), 'Error', MB_TASKMODAL or MB_ICONSTOP ); +{$ENDIF} +{$IFDEF LINUX} + WriteLn(ErrOutput, s); +{$ENDIF} + + if FFatalAbort then + Exit; //Quit; + end else + //AfterLoad; +end; + + +{function GetPythonEngine : TPythonEngine; +begin + if not Assigned( gPythonEngine ) then + raise Exception.Create( 'No Python engine was created' ); + if not gPythonEngine.Finalizing then + if not gPythonEngine.Initialized then + raise Exception.Create( 'The Python engine is not properly initialized' ); + Result := gPythonEngine; +end;} + +//************************Saint Source Snippets*************************** +//************************************************************************ + +//1. Showing a message box with a default button + +const MB_DEFBUTTON2 = $1234; +procedure ShowaMessageBox; +begin + if MessageBox(Hinstance,'mytext','mycaption', + MB_OKCANCEL or MB_ICONQUESTION or MB_DEFBUTTON2 ) = IDCANCEL then begin + exit; + end else begin + ShowMessage('oki dic'); + end; +end; + +//procedure Set_ReportMemoryLeaksOnShutdown(abo: boolean) +//2. Checking for memory leaks + +procedure ReportMemoryLeaksOnShutdown; +begin + Set_ReportMemoryLeaksOnShutdown(true) +end; + +{Since D2006, Delphi includes a way to check for memory leaks in the IDE once the application has terminated. } + +//3. Playing with radio buttons +procedure PlaywithRadioButton; +var Radiogroup1: TRadiogroup; + index: integer; +begin + //Here�s how to display the radio button currently selected, if any: + ShowMessage(Radiogroup1.Items.Strings[RadioGroup1.ItemIndex]); + + //A more complicated way: + for index := 0 to RadioGroup1.Items.Count - 1 do begin + if RadioGroup1.ItemIndex = index then begin + ShowMessage(RadioGroup1.Items[index]); + end; + end; + +//Here�s how to clear it: + RadioGroup1.ItemIndex:=-1; +end; + +//4. Playing with TStringList hashed arrays +// In addition to indexes, a TStringList array can use names so as to build key name=value + +procedure Stringlist_HashedArrays; + var indexclassifications : TStringList; + i : Integer; + begin + indexclassifications:= TStringList.Create; + indexclassifications.Add('unix=good'); + indexclassifications[0]:= 'windows=bad'; + + for i := 0 to indexclassifications.Count-1 do begin + ShowMessage(indexclassifications[i]); + ShowMessage(indexclassifications.Names[i]); + + ShowMessage(indexclassifications.ValueFromIndex[i]); + ShowMessage(indexclassifications.Values[indexclassifications.Names[i]]); + end; + + indexclassifications.Free; + end; + +//5. Playing with a ListBox + +Procedure ListBoxTest; +var + listBox : TListBox; + index : Integer; + begin + //Adding items + ListBox.Items.Add('Hello'); + + listBox := TListBox(self); + index := listBox.ItemIndex; + ShowMessage(listBox.Items[index]); + + //Adding an item at a specific location in the list + ListBox.Items.Insert(3,'Hello'); + end; + +//6. Selecting a directory +{Here�s how to display a dialog box so the user can choose a directory: } + + procedure TForm1Button1ClickDir(Sender: TObject); + var + chosenDirectory : string; + options : TSelectDirOpts; + LabeledEdit1: TEdit; + + begin + chosenDirectory := 'C:\'; + if SelectDirectory(chosenDirectory, options, 0) then + LabeledEdit1.Text :=chosenDirectory + '\'; + end; + +//7. Removing unwanted characters +//Here�s how to strip unwanted characters from a string: + + function CleanInput(input : String) : String; + var + output : string; + index : Integer; + begin + output := StringReplace(input, #9, '',[rfReplaceAll, rfIgnoreCase]); + output := StringReplace(output, #10, '',[rfReplaceAll, rfIgnoreCase]); + output := StringReplace(output, #13, '',[rfReplaceAll, rfIgnoreCase]); + output := StringReplace(output, ' ', '',[rfReplaceAll, rfIgnoreCase]); + output := StringReplace(output, ' ', '',[rfReplaceAll, rfIgnoreCase]); + output := StringReplace(output, ' ', '',[rfReplaceAll, rfIgnoreCase]); + output := StringReplace(output, '
', '',[rfReplaceAll, rfIgnoreCase]); + Result := output; + end; + +//8. Associative array ("hash") + +{You can use Delphi�s TStringList object: } + +procedure Associative_Array; + var + myhash : TStringList; + Index : Integer; + ListBox1 : TListBox; + + begin + myhash := TStringList.Create; + myhash.Add('mykey=myvalue'); + myhash.Add('mykey2=myvalue2'); + + ShowMessage(myhash.Values['mykey']); + + for Index := 0 to myhash.Count-1 do begin + if assigned(listbox1) then + ListBox1.Items.Add(myhash.Names[Index]+ '=' + + myhash.ValueFromIndex[Index]) + else + writeln(myhash.Names[Index]+ '=' + + myhash.ValueFromIndex[Index]); + + end; + myhash.Free; + end; + +//9. Indy Ping Example + + procedure TForm1Timer1TimerPing(Sender: TObject); + var IdIcmpClient1: TIdIcmpClient; + replystatustype: TReplyStatus; + ListBox1: TListBox; + begin + IdIcmpClient1.Host:= 'www.cisco.com'; + try + IdIcmpClient1.Ping('aQuote', 0); + replystatustype:= IdIcmpClient1.ReplyStatus; + except + //{case IdIcmpClient.ReplyStatus.ReplyStatusType of} + case replystatustype of + rsEcho: + begin + ListBox1.Items.Append(format('response from host %s in %d millisec.', + [replystatustype.FromIpAddress, + replystatustype.MsRoundTripTime])); + end; + rsError: + ListBox1.Items.Append('Unknown error.'); + rsTimeOut: + ListBox1.Items.Append('Timed out.'); + rsErrorUnreachable: + ListBox1.Items.Append(format('Host %s reports destination network unreachable.', + [replystatustype.FromIpAddress])); + rsErrorTTLExceeded: + ListBox1.Items.Append(format('Hope %d %s: TTL expired.', + [IdIcmpClient1.TTL, replystatustype.FromIpAddress])); + end; // case + //on E: EIdException do begin + ListBox1.Items.Append('Error : ' + 'E.Message'); + //end; + end; //Except + end; + +// 10. Here's how to download a bunch of files that have an increasing suffix: +// http://www.fredshack.com/docs/indy.html +// use the TDownloadUrl component (but data is saved into a file, not a variable) + + //From Simple HTML page scraping with Delphi + function Download_HTM(const sURL, sLocalFileName:string): boolean; + begin + Result:=True; + with TDownLoadURL.Create(nil) do + try + URL:=sURL; + Filename:=sLocalFileName; + try + ExecuteTarget(nil); + except + Result:=False + end; + finally + Free; + end; + end; + + + Const + //ADPNEWHOTURL='http://acme/picture_'; + ADPNEWHOTURL= 'https://picsum.photos/seed/'; + // UrlPictureLookupInfo = 'https://picsum.photos/seed/%d/%d/%d'; + + procedure TForm1Button1ClickACMEDownload(Sender: TObject); + var + sPathToF : String; + iIndex : Integer; + sPictureFileName, sPathToPictures : String; + begin + sPathToPictures:= ExtractFilePath(Application.ExeName) + 'pictures'; + + if not DirectoryExists(sPathToPictures) then + CreateDir(sPathToPictures); + SetCurrentDir(sPathToPictures); + + For iIndex := 1 to 25 do begin + sPictureFileName:= 'picture_' + Format('%.4d', [iIndex]) + '.jpg'; + writeln( 'Source = ' + ADPNEWHOTURL + IntToStr(iIndex) + + ' Target = ' + sPictureFileName); + if Not Download_HTM(ADPNEWHOTURL+ IntToStr(iIndex)+'/200/200',sPictureFileName) then begin + ShowMessage('Error in HTML file download ' + IntToStr(iIndex)); + Exit; + end; + Application.ProcessMessages; + end; + + end; + + // 11. Usage of it is really simple! Just add �hashes� (filename of .pas file) to uses clause and then somewhere in code write: + + procedure stringHashtest; + var hash : TStringHash2; + //Here�s unit with those TIntegerHash2 and TStringHash2, TObjectHash2 described @ + basehash: THash2; + begin + hash:= TStringHash2.Create; + try + hash['one']:= 'viens value'; + hash['two']:= 'divi value'; + //ShowMessage(hash['one']); + //ShowMessage(hash['two']); + if hash.exists('one') then + writeln(hash['one']); + writeln(hash['two']); + hash.Rename('one', 'onerename'); + writeln(hash['onerename']); + finally + hash.Free; + end; + end; + + procedure integerHashtest; + var hash : TIntegerHash2; + //Here�s unit with those TIntegerHash2 and TStringHash2, TObjectHash2 described @ + basehash: THash2; + begin + hash:= TIntegerHash2.Create; + try + hash['one']:= 1; + hash['two']:= 2; + //ShowMessage(hash['one']); + //ShowMessage(hash['two']); + if hash.exists('one') then + write(itoa(hash['one'])); + write(itoa(hash['two'])); + hash.Rename('one', 'onerename'); + write(itoa(hash['onerename'])); + writeln('') + finally + hash.Free; + end; +end; + + procedure integerHashtest2; + //Here�s unit with those TIntegerHash2 described @ + begin + with TIntegerHash2.Create do begin + try + items['one']:= 1; + items['two']:= 2; + //ShowMessage(hash['one']); + if exists('one') then + write(itoa(items['one'])); + write(itoa(items['two'])); + Rename('one', 'onerename'); + write(itoa(items['onerename'])); + finally + Free; + end + end; + end; + + + { Purpose: A collection of hash components for Delphi. These are + similar to arrays, but the index is a string. A hashing + algorithm is used to provide extremely fast searching. } + + //12. Datasets offer navigation and search methods like First, Last, Next, Prior, MoveBy, Bof, Eof, Bookmark, Locate, Lookup, Filter. + + //Here�s how to have a dataset run an SQL query programmatically: + procedure SQLQuerySet; + var MyQuery, SQLQuery1, CustomerQuery: TQuery; + CustTable: TTable; + Edit1: TEdit; + begin + + //The dataset must be closed when you specify or modify the SQL property. + MyQuery.Close; + MyQuery.SQL.Clear; + MyQuery.SQL.Add('SELECT CustNo, OrderNO, SaleDate'); + MyQuery.SQL.Add(' FROM Orders'); + MyQuery.SQL.Add('ORDER BY SaleDate'); + MyQuery.Open; + + //Since MyQuery is a TStrings, any item can be access and changed: + MyQuery.SQL[2] := 'ORDER BY OrderNo'; + + //You can also load an SQL query from file: + MyQuery.SQL.LoadFromFile('custquery.sql'); + + //Here�s how to build an SQL query by providing parameters at runtime: + SQLQuery1.ParamByName('Capital').AsString := Edit1.Text; + //INSERT INTO Country (Capital) VALUES (:Capital) + + //Queries that don�t return a result set should be run by calling ExecSQL: + CustomerQuery.ExecSQL; + + //If you are executing query multiple times, it is a good idea to set the Prepared property to True. + //Here�s to modify a record in a dataset: + with CustTable do begin + Edit; + FieldValues['CustNo'] := 1234; + Post; + end; + + end; + +//13. If you want both to handle an exception and perform some tasks even when things went ok, you�ll have to run the following structure with a second try embedded : + + procedure AllocateSomeResources; + begin + try + try + //stuff that could trigger an exception + finally + //perform general actions, such as FreeAndNIL() + end; + except + //handle exception + //on E: Exception do begin + MessageDlg('E.Message', mtWarning, [mbOK], 0); + end; + end; + + //(Delphi and maXbox provides also a single try/except/finally structure) + procedure AllocateSomeResources2; + begin + try + //stuff that could trigger an exception + finally + //perform general actions, such as FreeAndNIL() + except + //handle exception + //on E: Exception do begin + if ExceptionType = erInvalidOpcode then + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + MessageDlg('E.Message', mtWarning, [mbOK], 0); + end; + end; + + {TIFException', '(ErNoError, erCannotImport, erInvalidType, ErInternalError, '+ + 'erInvalidHeader, erInvalidOpcode, erInvalidOpcodeParameter, erNoMainProc, erOutOfGlobalVarsRange, '+ + 'erOutOfProcRange, ErOutOfRange, erOutOfStackRange, ErTypeMismatch, erUnexpectedEof, '+ + 'erVersionError, ErDivideByZero, ErMathError,erCouldNotCallProc, erOutofRecordRange, '+ + 'erOutOfMemory,erException,erNullPointerException,erNullVariantErrorerInterfaceNotSupportederError);} + + // If you only want to catch an exception but actually have it handled elsewhere (eg. centralizing it), use the Raise() function: + + function Raiseit: TStringlist; + begin + Result:= TStringList.Create; + try + //Result.TrySomething; + Result.text; + except + Result.Free; + raise; //Let error bubble up and be handled elsewhere up there + end; + end; + + //14. Borland�s TValueListEditor + +//This is a two-column grid that you can use to display/change "key=value" tuples: + procedure columngridtest; + var ASQLite3Query1: TQuery; + ValueListEditor1: TValueListEditor; + i: integer; + FieldName, keyval: string; + //ad: TKStringGrid TAdvColumnGrid + begin + for i := 0 to ASQLite3Query1.FieldCount -1 do begin + FieldName := ASQLite3Query1.Fields[i].FieldName; + KeyVal := Format('%s=%s',[FieldName,ASQLite3Query1.FieldByName(FieldName).AsString]); + ValueListEditor1.Strings.Add(KeyVal); + end; + end; + +// 15. Creating objects at runtime + + //If using "nil" as the owner, you must call the Free() method or you�ll get a memory leak. +//You don�t have to use a variable to hold the pointer to the instance (source): + + procedure Objects_at_Runtime; + var FTimer : TTimer; + begin + with TTimer.Create(Self) do begin + Interval := 1000; + Enabled := False; + //OnTimer := @MyTimerEventHandler; + end; + //Do NOT call Free with try/finally! + //or + with TTable.Create(nil) do + try + DataBaseName := 'MyAlias'; + TableName := 'MyTable'; + Open; + Edit; + FieldByName('Busy').AsBoolean := True; + Post; + finally + Free; //If using variables, you can call FreeAndNil() instead + end; + + //� but it�s recommended to use a variable, so you can refer to it later: + + FTimer := TTimer.Create(Self) ; + + if not Assigned(FTimer) then begin + ShowMessage('Not assigned'); + Exit; + end; + + with FTimer do begin + Interval := 1000; + Enabled := False; + //OnTimer := @MyInternalTimerEventHandler; + end; + //FreeAndNil(FTimer); + Ftimer.Free; + Ftimer:= Nil; + +//Alternatively: + + FTimer:= TTimer.Create(Self) ; + try + with FTimer do begin + Interval := 1000; + Enabled := False; + //OnTimer := @MyInternalTimerEventHandler; + end; + finally + //Since Delphi 5 doesn�t provide try/expect/finally, here�s a way to check for errors + if not Assigned(FTimer) then begin + ShowMessage('Failed creating Timer�'); + end else begin; + //FreeAndNil(FTimer); + Ftimer.Free; + Ftimer:= Nil; + end; + end; + end; + + {An array created in a routine (procedure or function), even if its size is statically defined, is considered an "open array", and thus, starts at 0:, in maXbox a type mismatch} + + //procedure Check4(var ReturnArray: Array of String); + procedure Check4(var ReturnArray: TStringArray); + + var + Index : Integer; + begin + // Says 1! + ShowMessage(IntToStr(High(ReturnArray))); + end; + + procedure check2(Sender: TObject); + var + ReturnArray : Array[1..2] of String; + begin + //Says 2, as expected + ShowMessage(IntToStr(High(ReturnArray))); + //Check4(ReturnArray); + end; + + + // 16. King Regex TPerlRegex + {To install this RegEx engine for Delphi, open, compile and install PerlRegExD7.dpk, which creates PerlRegExD7.bpl, add its directory to the Library path, and add a TPerlRegEx control to the project�s form. + + Here�s how to extract a single bit in a text: } + + {TPerlRegEx (free wrapper around PCRE, with additional support for replace and split actions; "You can choose to link the OBJ files directly into your application, or to use the DLL"; Under active development; Made by author of www.regular-expressions.info)} + + + //https://stackoverflow.com/questions/15941001/how-to-create-a-regex-expression-on-delphi-to-remove-brackets-and-quotes + + function TPerlRegexfirst: string; + var RegEx: TPerlRegEx; + SubjectString: string; + begin + RegEx := TPerlRegEx.Create; + subjectstring:= '["some regex text"]' //result: some text + try + Regex.RegEx := '\["(.+?)"\]'; + Regex.Subject := SubjectString; // ["any text between brackets and quotes"] + Regex.Replacement := '$1'; + Regex.ReplaceAll; + Result := Regex.Subject; + finally + RegEx.Free; + end; + end; + + //http://www.regexguru.com/2010/09/new-tperlregex-compatible-with-delphi-xe/ + + procedure TPerlRegexTest; + var PerlRegEx1 : TPerlRegEx; + begin + PerlRegEx1.RegEx := '(.+?)'; + PerlRegEx1.Options := [preCaseLess]; + PerlRegEx1.Subject := 'test bla test'; + + If PerlRegEx1.Match then begin + ShowMessage(PerlRegEx1.Groups[1]) + end else begin + ShowMessage('Not found') + end; + end; + + //Next, here�s how to look for a pattern, and extract bits if found: + + procedure secondRegexTest; + var + RegEx : TPerlRegEx; + Stuff : TStringList; + i: byte; + begin + RegEx := TPerlRegEx.Create; + Stuff := TStringList.Create; + Try + RegEx.RegEx := 'my pattern'; + RegEx.Options := [preCaseLess]; + RegEx.Subject := 'this is the text to search for my pattern'; + + If RegEx.Match then begin + repeat + for i := 1 to regex.GroupCount do begin + Stuff.Add(regex.Groups[i]); + Application.ProcessMessages; + end; + until not RegEx.MatchAgain; + + For I := 0 to Stuff.Count - 1 do begin + Memo2.Lines.Add(Stuff[I]); + end; + + end else begin + ShowMessage('Not found'); + end; + Finally + RegEx.Free; + Stuff.Free; + End; + End; + +//Here�s how to replace a pattern with something else: + + procedure thirdRegexTest; + var RegEx : TPerlRegEx; + begin + RegEx := TPerlRegEx.Create; + try + RegEx.Subject := LoadFile('myfile.txt^'); + RegEx.RegEx := 'HERE'; + RegEx.Replacement := '�THERE�'; + If RegEx.Match then begin + RegEx.Replace; + ShowMessage(RegEx.Subject); + end; + finally + RegEx.Free; + end; + end; + + //TRegExpr + +{Although TRegExp is much slower than TPerlRegEx on more complex operations, it�s OK for light searches. Here�s how to extract tokens from a text file using TRegExpr: } + + + procedure Tregexprtest; + var mystuff: string; + begin + MyStuff := 'My stuff'; + + with TRegExpr.Create do + try + //Make it case-insensitive + ModifierI := True; + Expression := '(.*?)'; + if Exec (MyStuff) then + ShowMessage(Match[1]); + + finally + Free; + end; + end; + + //Here�s how to extract several tokens, and put them in an array: + + procedure Tregexprtest2; + var + Tokens : TStringList; + MyRegex : TRegExpr; + I: integer; + begin + MyRegex := TRegExpr.Create; + Tokens := TStringList.Create; + try + MyRegex.ModifierI := True; + MyRegex.Expression := 'some stuf (\d+) some other stuff'; + //if MyRegex.Exec (Response) then begin + if MyRegex.Exec (MyRegex.Expression) then begin + REPEAT + Tokens.Add (MyRegex.Match[1]) + UNTIL not MyRegex.ExecNext; + + Memo2.Clear; + for I := 0 to Tokens.Count-1 do begin + Memo2.Lines.Add(Tokens[I]); + end; + + end else begin + Memo2.Text := 'Pattern Not Found'; + end; + finally + MyRegex.Free; + Tokens.Free; + end; + end; + + procedure WriteToFileStream; + var + FileStream1: TFileStream; + Int1, Int2, Int3, Int4: Integer; + begin + Int1 := 100; + Int2 := 200; + Int3 := 1918986307; + Int4 := 1702521171; + FileStream1 := TFileStream.Create(exepath+'examples\streamTest2.txt', + fmCreate or fmOpenWrite or fmShareDenyWrite); + try + FileStream1.Writebuffer(itoa(Int1), SizeOf(Int1)); + FileStream1.Writebuffer(itoa(Int2), SizeOf(Int2)); + FileStream1.Writebuffer(itoa(Int3), SizeOf(Int3)+8); + FileStream1.Writebuffer(itoa(Int4), SizeOf(Int4)+8); + finally + FileStream1.Free;; + end; + end; + + //http://www.angelfire.com/hi5/delphizeus/ + + + function Int2Str(Number : Int64) : String; + var Minus : Boolean; + begin + {SysUtils is not in the Uses Clause so I can not use IntToStr( ) + and have to define an Int2Str( ) function here} + Result := ''; + if Number = 0 then + Result := '0'; + Minus := Number < 0; + if Minus then + Number := -Number; + while Number > 0 do begin + Result := Chr((Number mod 10) + ord('0')) + Result; + Number := Number div 10; + end; + if Minus then + Result := '-' + Result; + end; + + function Str2Int(const Value : String) : Int64; + var M, I : Integer; + begin + Result := 0; + if Value = '' then Exit; + M := 1; + I := 1; + if Value[ 1 ] = '-' then + begin + M := -1; + Inc( I ); + end; + for I := I to Length( Value ) do begin + if (Value[ I ] < '0') or (Value[ I ] > '9') then + break; + Result := Result * 10 + atoi( Value[ I ] ) - atoi('0' ); + end; + if M < 0 then + Result := -Result; + end; + + procedure PlayBeep(ActionType: TMsgDlgType); + var amb: dWord; + begin + case ActionType of + mtInformation: amb := MB_ICONASTERISK; //SystemAsterisk + mtWarning: amb := MB_ICONEXCLAMATION; //SystemExclamation + mtError: amb := MB_ICONHAND; //SystemHand + mtConfirmation: amb := MB_ICONQUESTION; //SystemQuestion + mtCustom: amb := MB_OK; //SystemDefault + else + amb:= $0FFFFFFFF; //Standard beep using the computer speaker + end; + MessageBeep(amb); +end; + +procedure PrintOut3; +var at: TTEEGradient; +begin + Printer.BeginDoc; + //PrintText(#27'&l12D' + 'Hello, World!'); + Printer.EndDoc; + //trydatetimetostring +end; + +////Some guesswork here ;-) + +type TUArrDW2 = array of DWord; + +function SwapEndian(const Value: LongWord): LongWord; +begin + Result := ((Value and $000000FF) shl 24) or + ((Value and $0000FF00) shl 8) or + ((Value and $00FF0000) shr 8) or + ((Value and $FF000000) shr 24); +end; + +procedure UASwapEndian(var UC: TUArrDW2); +var i: integer; +begin + for i := 0 to High(UC) do UC[i] := SwapEndian(DWord(UC[i])); +end; + +procedure TForm1ClientDataSet1BeforeGetRecords(Sender: TObject; var OwnerData: OleVariant); +var + LastValue: OleVariant; + CDSClone: TClientDataSet; + ClientDataSet1: TClientDataSet; + form1: TForm; +begin + if ClientDataSet1.Active then + begin + CDSClone := TClientDataSet.Create(Form1); + try + //CDSClone.CloneCursor(ClientDataSet1, True); + { Turn off FetchOnDemand so that the clone only fetches + the last LOCAL record. } + CDSClone.FetchOnDemand := False; + CDSClone.Last; + LastValue := CDSClone.Fields[0].AsString; + CDSClone.Close; + finally + CDSClone.Free; + end; + end else + LastValue := NULL; + OwnerData := VarArrayOf([Memo2.Lines.Text, LastValue]); +end; + +const + RFC1123Pattern = 'ddd, dd mmm yyyy HH'':''nn'':''ss ''GMT'''; + +function RFC1123DateGMT(const DT: TDateTime): string; +begin + Result := {SysUtils.}FormatDateTime(RFC1123Pattern, DT); +end; + +function TreeNodeChildCount(ParentNode: {ComCtrls.}TTreeNode): Integer; +var + ChildNode: {ComCtrls.}TTreeNode; // references each child node +begin + Result := 0; + if ParentNode = nil then + Exit; + ChildNode := ParentNode.GetFirstChild; + while (ChildNode <> nil) do begin + Inc(Result); + ChildNode := ChildNode.GetNextSibling; + end; +end; + +function SliceByteArray2(const B: array of Byte; Start, Len: Integer): + TBytes; +begin + if Start < 0 then + Start := 0; + if Len < 0 then + Len := 0 + else if Start >= Length(B) then + Len := 0 + else if Start + Len > Length(B) then + Len := Length(B) - Start; + SetLength(Result, Len); + if Len > 0 then + //Move(B[Start], Result[0], Len); +end; + +procedure SaveHandleToBitmap(OutputFileName: string; hWnd: HWND); +{$IFDEF FPC} +var + MyBitmap: TBitmap; + MyDC: HDC; +begin + MyDC := GetDC(hWnd); + MyBitmap := TBitmap.Create; + try + MyBitmap.LoadFromDevice(MyDC); + MyBitmap.SaveToFile(OutputFileName); + finally + ReleaseDC(hWnd, MyDC); + FreeAndNil(MyBitmap); + end; +end; +{$ELSE} +var + MyBitmap: {Graphics.}TBitmap; + MyDC : HDC; + pRect : TRect; + w,h : integer; +begin + MyDC := GetDC(hWnd); + MyBitmap := {Graphics.}TBitmap.Create; + try + GetWindowRect(HWND,pRect); + w := pRect.Right - pRect.Left; + h := pRect.Bottom - pRect.Top; + + MyBitmap.Width := w; + MyBitmap.Height:= h; + + BitBlt(MyBitmap.Canvas.Handle, + 0, + 0, + MyBitmap.Width, + MyBitmap.Height, + MyDC, + 0, + 0, + SRCCOPY) ; + MyBitmap.SaveToFile(OutputFileName); + finally + ReleaseDC(hWnd, MyDC); + //FreeAndNil(MyBitmap); + MyBitmap.Free; + MyBitmap:= Nil; + end; +end; +{$ENDIF} + +procedure SIRegister_neuralbit; +begin + //CL.AddTypeS('TArrOf2BytesPtr', '^TArrOf2Bytes // will not work'); + //CL.AddTypeS('TArrOf3BytesPtr', '^TArrOf3Bytes // will not work'); + //CL.AddTypeS('TArrOf4BytesPtr', '^TArrOf4Bytes // will not work'); + //CL.AddTypeS('TArrBytePtr', '^TLongByteArray // will not work'); + //POT( numero, elevado : extended) : extended'); + //LongintBitTest( Data : longint; P : longint) : boolean'); + //LongintBitFlip( Data : longint; P : longint) : longint'); + //BAClear( var VARS : array of byte)'); + //BAMake1( var VARS : array of byte)'); + //BARead( var A : array of byte; P : longint) : byte'); + //BAFlip( var A : array of byte; P : longint)'); + //&&BAWrite( var A : array of byte; P : longint; Data : byte)'); + //BATest( var A : array of byte; P : longint) : boolean'); + //BASum( var x, y : array of byte)'); + //BASub( var x, y : array of byte)'); + //BAIncPos( var x : array of byte; POS : longint)'); + //BADecPos( var x : array of byte; POS : longint)'); + //BAInc( var x : array of byte)'); + //BADec( var x : array of byte)'); + //BAToString( VARS : array of byte) : string'); + //BAToFloat( var VARS : array of byte) : extended'); + //PFloatToBA( var VARS : array of byte; Valor : extended)'); + //BANot( var VARS : array of byte)'); + //BAAnd( var r, x, y : array of byte)'); + //BAOr( var r, x, y : array of byte)'); + //BAXOr( var r, x, y : array of byte)'); + //BAGrater( var x, y : array of byte) : boolean'); + //BALower( var x, y : array of byte) : boolean'); + //BAEqual( var x, y : array of byte) : boolean'); + //BAPMul( var r, x, y : array of byte)'); + //nnRAnd( A, B : extended) : extended'); + //nnROr( A, B : extended) : extended'); + //nnRNot( A : extended) : extended'); + //nnRXor( A, B : extended) : extended'); + //REqual( A, B : extended) : extended'); + //RSum( x, y, z : extended; var R, C : extended)'); + //RegSum( var x, y : array of extended)'); + //RegEqual( var x, y : array of extended) : extended'); + //RegOrdEqual( var x, y : array of extended) : extended'); + //RegToString( var VARS : array of extended) : string'); + //ROrer( var VARS : array of extended) : extended'); + //RAnder( var VARS : array of extended) : extended'); + //RCNot( X : extended; var VARS : array of extended) : extended'); + //ROrMaxTerm( var VARS : array of extended; NumMaxTerm : longint) : extended'); + //ROrMaxTermStr( NumVars : longint; NumMaxTerm : longint) : string'); + //RSatFunc( var VARS : array of extended; NumFunc : longint) : extended'); + //RSatFuncStr( NumVars : longint; NumFunc : longint) : string'); + //RRegen( var VARS : array of extended)'); + //RDegen( var VARS : array of extended)'); + //RDegenP( var VARS : array of extended; P : extended)'); + //nnClear( var VARS : array of extended)'); + //BARAnd( var R, A, B : array of byte)'); + //BAROr( var R, AUX, A, B : array of byte)'); + //BARNot( var R, A : array of byte)'); +end; + +procedure SIRegister_neuralab; +begin + // SIRegister_TABHash(CL); + //ABKey( S : array of byte; Divisor : longint) : longint'); + //ABCmp( var X, Y : array of byte) : boolean'); + //ABGetNext1( var AB : array of byte; ST : word) : word'); + //ABCountDif( var X, Y : array of byte) : longint'); + //ABCountDifZero( var X : array of byte) : longint'); + //ABAnd( var A, B : array of byte)'); + //ABGetEqual( var Equal, X, Y : array of byte) : longint'); + //ABShiftLogicalLeft( var X : array of byte)'); + //ABShiftLogicalRight( var X : array of byte)'); + //ABGetDif( var Dif, X, Y : array of byte) : longint'); + //ABToString( var AB : array of byte) : string'); + //ABToStringR( var AB : array of byte) : string'); + //ABClear( var AB : array of byte)'); + //ABFull( var AB : array of byte)'); + //ABBitOnPos( var AB : array of byte; POS : longint)'); + //ABBitOnPosAtPos( var AB : array of byte; X, Start, Len : longint)'); + //ABReadBitOnPosAtPos( var AB : array of single; Start, Len : longint) : longint'); + //ABCopy( var A, B : array of byte)'); + //ABTriPascal( var A, B : array of byte)'); + //ABSet( var A : array of byte; B : array of byte)'); +end; + +type + { Note the creation of two arrays } + TByteArr = array of byte; + TStringArr = array of String; + + + +function ByteToString(var Value: TBytes): String; +var I: integer; + S : String; + Letra: char; +begin + S := ''; + for I := Length(Value)-1 Downto 0 do begin + letra := Chr(Value[I] + 48); + S := letra + S; + end; + Result := S; +end; + +procedure TForm2btOpenClickMedia(Sender: TObject); +var + OpenMediaDialog : TOpenDialog; + MediaPlayer1: TMediaPlayer; +begin + OpenMediaDialog := TOpenDialog.Create(Self); + OpenMediaDialog.Filter := 'All Video Files (*.avi)|*.avi'; + // Browse for .avi files on your computer + if OpenMediaDialog.Execute() then begin + { Assign a file to the media player. } + MediaPlayer1.FileName := OpenMediaDialog.FileName; + + { Check if the file exists and is not a directory. } + if (FileExists(OpenMediaDialog.FileName)) and + (not DirectoryExists(OpenMediaDialog.FileName)) then begin + { Open the files. } + MediaPlayer1.Wait := true; + MediaPlayer1.Open; + MediaPlayer1.Play; + + { Override automatic button controlling. } + MediaPlayer1.EnabledButtons := + [{TMPBtnType.}btPause, {TMPBtnType.}btStop, btPlay]; + + { Enable the Stop button. } + //btStop.Enabled := true; + //btOpen.Enabled := false; + end; + end; + OpenMediaDialog.Free; +end; + +procedure FGPlayASound_(const AResName: string); + var + HResource: TResourceHandle; + HResData: THandle; + PWav: ___Pointer; + begin + HResource := FindResource(HInstance, PChar(AResName), 'WAV'); + if HResource <> 0 then begin + HResData:=LoadResource(HInstance, HResource); + if HResData <> 0 then begin + PWav:=LockResource(HResData); + if Assigned(PWav) then begin + // uses MMSystem + sndPlaySound('0', SND_NODEFAULT); // nil = stop currently playing + sndPlaySound(PWav, SND_ASYNC or SND_MEMORY); + end; +// UnlockResource(HResData); // unnecessary per MSDN +// FreeResource(HResData); // unnecessary per MSDN + end; + end + else + RaiseLastOSError; +end; + +function GetCokkiesDirectory: string; +var + reg : TRegistry; +begin + reg := TRegistry.Create1(KEY_READ); + try + reg.RootKey := HKEY_LOCAL_MACHINE; + reg.Access := KEY_READ; + reg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Special Paths\Cookies', + false); + Result := reg.ReadString('Directory'); + finally + reg.Free; + end; +end; + +function gcdE(a, b: Integer): Integer; +var + rest: Integer; +begin + //ggT Berechnung nach dem Algorithmus von Euklid + //Konvergiert sehr schnell! + + //gcd using Euklid algorithm + //converge very fast + + repeat + rest := a mod b; + a := b; + b := rest; + until (rest = 0); + + Result := absint(a); + //ggT is immer positiv + //gcd is always positive +end; + +function LastDayOfCurrentMonth: TDate; +var + y, m, d: Word; +begin + DecodeDate(now, y, m, d); + m := m + 1; + if m = 12 then begin + y := y + 1; + m := 1; + end; + //Result := EncodeDate(y, m, 1) - 1; +end; + +procedure PageControl1Change(Sender: TObject); +begin + //if pagecontrol1.activepage=tabsheet3 then setup; + writeln('pagecontrol change as exit call') +end; + +function StrHash(const st:string):cardinal; + var + i:integer; + begin + result:=0; + for i:=1 to length(st) do + result:=result*$20844 xor ord(st[i]); + end; + + procedure complexDemo(input, output, stderr: string); +//uses +// uComplex; +var + x, y: complex; +begin + // specifying real and imaginary part + //x := -5 + 2 * i; + + // specifying magnitude and phase angle + // y := sqrt(2) * (cos(pi/4) + i * sin(pi/4)) + //y.re := 1; + //y.im := 1; + + //x := x + y; + // there is no toString functionality: + //writeLn('x = ', x.re, ' + ', x.im, 'i'); +end; + +function Int32toBytes2(const Cint: Integer): TBytes; +begin + result[0]:= Cint and $FF; + result[1]:= (Cint shr 8) and $FF; + result[2]:= (Cint shr 16) and $FF; +end; + +procedure FormMouseWheel(Sender: TObject; Shift: TShiftState; +WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); +begin +// your code here +// WheelDelta returns you - or + values (in my computer -120 and + 120 ; +// It depends on control panel mouse wheel settings) + +// If it is a font make the font size bigger or +// if it is a image + // strech := true; +// increase width and height of the Timage +//and put them inside a scrollbox + writeln(itoa(wheeldelta)) +// +end; + +procedure XORCharSet2(var DestSet: CharSet; const SourceSet: CharSet); +var Ch: Char; +begin + { for Ch := ByteChar(0) to ByteChar(255) do + if Ch in DestSet then + begin + if Ch in SourceSet then + Exclude(DestSet, Ch); + end else + if Ch in SourceSet then + Include(DestSet, Ch); } + //strtocharset(charsettostr(C)) + for it:= 0 to 255-1 do begin + ch:= chr(it) + //if chr(it) in strtocharset(charsettostr(destset)) then + if ch in destset then begin + if ch in SourceSet then + //Exclude(DestSet, Ch); + DestSet:= Destset + strtochars(ch); + end else + if Ch in SourceSet then + //Include(DestSet, Ch); } + DestSet:= destset - strtochars(Ch) ; + end; +end; + +procedure XORCharSet3(var DestSet: CharSet; const SourceSet: CharSet); +var Ch: Char; + chs, chs2: tsyscharset; +begin + for it:= 0 to 255-1 do begin + ch:= chr(it) + //if chr(it) in strtocharset(charsettostr(destset)) then + if ch in destset then begin + if ch in SourceSet then + include(destset, ch); + //DestSet:= Destset + strtochars(ch) + //union(destset, sourceset) + end else + if Ch in SourceSet then + exclude(destset, Ch); + //DestSet:= destset - strtochars(Ch) ; + end; +end; + +function abt(S: string): Integer; +var + I, L: Integer; +begin + Result := 0; + L := Length(S); + for I := 1 to L do + if S[I] = '1' then + Result := Result + Round(Power(2, L - I)); +end; + +function DateTimeToStrUs(dt: TDatetime): string; +var + us: string; +begin + //Spit out most of the result: '20160802 11:34:36.' + Result := FormatDateTime('yyyymmdd hh":"nn":"ss"."', dt); + + //extract the number of microseconds + dt := Frac(dt); //fractional part of day + dt := dt * 24*60*60; //number of seconds in that day + us := IntToStr(Round(Frac(dt)*1000000)); + + //Add the us integer to the end: + // '20160801 11:34:36.' + '00' + '123456' + Result := Result + StringOfChar('0', 6-Length(us)) + us; +end; + +procedure Test_StringBuilder; +var A : TStringBuilder; +begin + A := TStringBuilder.Create(''); + try + Assert(A.Length = 0,''); + A.Append('X'); + Assert(A.Length = 1,''); + A.Append('ABC'); + Assert(A.Length = 4,''); + Assert(A.AsString = 'XABC',''); + A.AppendCRLF; + Assert(A.Length = 6,''); + A.AppendCh('D'); + Assert(A.Length = 7,''); + A.AppendCh1('E', 3); + Assert(A.Length = 10,''); + Assert(A.AsString = 'XABC'#13#10'DEEE',''); + A.Pack; + Assert(A.Length = 10,''); + A.Clear; + Assert(A.Length = 0,''); + finally + A.Free; + end; +end; + + +//var aur: TUArrDW; + + var asum: float; + aStream : {TABHash} TStream; + abcd: array of byte; //TBytearray; //array of byte; + abc: mTBytearray; + ab, bc, dd: TBytes; + var A, B: TBytes; + gh: byte; + BA: TByteArray; //TByteArr; + BAT: TBytes; //TByteArr; + affine: TAffineVector; orbelem: TOrbitalElements ; + pubdic: Tdic; publist: TStringlist; + test1: array of THashObject ; + getv: TVectorE; + complex: complexreal; + acomp: TFR; ansi, ansi2: ansistring; mycharset: tcharset; + obo2: TJsonObject2; + Json : TJson; + atc: TJclStringList; atci: IJclStringList; //soa: TSetOfAnsiChar; + var Protocol, Host, Path : String; var DestSet: CharSet; + spl: TstringArray; var lcount: Int64; + var OutPutList: TStringList; agb: TBytes; tp3: TPoint3DFloat; tp2s: TPoint3D2; + var myc2r, myc2i: MFloatArray; //array of Mfloat; + var RealOut, ImagOut: MFloat; + var + I : Integer; + sURL: String; + sWork: UTF8String; + C: Char; + bB: Byte; + mscs: Tsyscharset; + wDecoded: WideString; + //I: Integer; + + PythonEngine : TPythonEngine; PythonGUIInputOutput1: TPythonInputOutput; + pyvar, pyvarenum: variant; + + var + gEngine : TPythonEngine; + gModule : TPythonModule; st: Tstringlist; + + const pycmd = 'import sys' + #13 + + 'print(sys.path)'; // + #13 + + + //const PYHOME = 'C:\Users\Max\AppData\Local\Programs\Python\Python37\'; + + const PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + + //https://en.delphipraxis.net/topic/5190-how-should-i-do-syspathinit/ + +procedure initDemodll; +begin + try + gEngine := TPythonEngine.Create(nil); + gEngine.AutoFinalize := False; + gengine.pythonhome:= + //'C:\Users\Max\AppData\Local\Programs\Python\Python37\'; + //python37_32.dll + //'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + 'C:\Users\max\AppData\Local\Programs\Python\Python36\'; + + gEngine.LoadDll; + gModule := TPythonModule.Create(nil); + gModule.Engine := gEngine; + gModule.ModuleName := 'demodll'; + //gModule.AddMethod( 'add', @Add, 'add(a,b) -> a+b' ); + // The engine has a property, PythonEngine.InitScript: + gEngine.InitScript.Add('import sys'); + gEngine.InitScript.Add('sys.path.insert(0, "path/to/script")'); + //gModule.Initialize; + writeln('PythonOK: in init '+botostr(PythonOK)); + //gEngine.EvalStringAsStr(pycmd); + except + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + writeln('ghis python except') + gEngine.Free; + gModule.Free; + end; +end; + +Begin //@main +// + for it:= 1 to 2 do + Println(TEXTOUT); + maXcalcF('Sqrt(PI/e^2)') + + //with TDownloadUrl.Create(Self) do + //ReportMemoryLeaksOnShutdown + //SliceByteArray + + //enigma test + {writeln(uppercase(AllTrimSpaces('this is � Strng : string'))); + writeln(StripSpaces('this is Strng : string')); + writeln(DelSpace('this is Strng : string')); } + + x:= 1; if condition then x:= 1 else x:= 0; + //x = 1 if condition else 0; + + //writeln(itoa(ClearBit(15,0))) + writeln(inttobin(ClearBit(15,1))) + writeln(inttobin(SetBit(255,7))+CRLF) + + PythonVersionProp.Regversion:= '3.7'; + FFatalAbort:= false; + FFatalMsgDlg:= true; + //LoadLibrary Fails with error 193 on 64 bit Windows + FDllName:= 'python37_32.dll' + // FDllName:= 'libssl32.dll' + + //FDllName:= 'dmath.dll' + + {writeln('TDynamicDllGetDllPath: '+TDynamicDllGetDllPath); + TDynamicDllOpenDll(FDllName); + writeln('Python DLL Handle: '+itoa(FDLLHandle)) } + + //FDLLHandle:= + //LoadLibrary32('C:\Users\Max\AppData\Local\Programs\Python\Python37\dmath.dll') + //LoadLibrary32('C:\Users\Max\AppData\Local\Programs\Python\Python37\python37.dll') + + //writeln('Python DLL Handle: '+itoa(FDLLHandle)) + + {for ib:= 1 to 8 do + writeln(Cinttobin(SetBit(255,8-ib),8)); + writeln('') + for ib:= 1 to 8 do + writeln(Cinttobin(ClearBit(255,8-ib),8)); } + + // Associative_Array; + //TForm1Button1ClickACMEDownload(self) + stringhashtest; + writeln(TPerlRegexfirst) + //WriteToFileStream; + writeln(inttostr(Str2Int('234588944')) ) + writeln(int2str(Str2Int('234588944')) ) + + for it:= 0 to 30 do + asum:= asum + (1/pow(2,it)); + writeln(floattostr(asum)) + PrintF('%.16f',[asum]) + + with TLegendSymbol.create(nil) do begin + gradient + free + end; + + writeln(botostr(isinternet)) + //UTF8BOM + //UTF16BEBOM','string').SetString( #$FE#$FF); + //UTF16LEBOM','string').SetString( #$FF#$FE); + //UTF32BEBOM','string').SetString( #$00#$00#$FE#$FF); + //UTF32LEBOM','string').SetString( #$FF#$FE#$00#$00); + + //test: for ib:= 1 to 16 do + //if pos('1',inttobin(ib div 4 and 1 shl ib)) > 1 then writeln(itoa(ib)) ; + + //writeln(botostr(HasUTF8BOM1(#$FF#$FE#$00#$00))) + writeln(botostr(HasUTF8BOM1(#$EF#$BB#$BF))) + + astream:= TMemoryStream.create; + //StringToStream( 'const Text : string;', astream); + StringToStream(#$EF#$BB#$BF, astream); + //writeln(botostr(HasUTF8BOM(astream))) + astream.Free; + + //pot nnclear + //SetDecimalSeparator + //GetWaveOutDevices + + //abcd[1]:= 2; abcd[2]:=3 ; + //abc[1]:= 2; abc[2]:=3 ; + setarraylength(ab,2); + //ab:= abc; + //Function MaxBArray( const B : array of Byte) : Byte + MaxBArray(ab); + //BATostring([3]); + //BAClear(ab); + //ABToString (abc[1]); + //BARNot(ab, bc) + + setarraylength(A,2); + A[0]:= 34; A[1]:= 134; + //gh:= PopByteArray(BAT); + SaveBytesToFile(A, exepath+'examples\FileName.txt'); + B:= CloneByteArray(A); + setarraylength(BAT,3); + BAT[0] := 40 + BAT[1] := 41 + BAT[2] := 42 + writeln(itoa(length(BAT))) + + writeln(ByteToString(BAT)); + + //Good judgement is the result of experience � Experience is the result of bad judgement. + //writeln(sha1('C:\Program Files (x86)\maxbox3\Import\maxbox4.zip')) + + writeln(utf8toansi('Vous avez indiqué votre adresse E-Mail pour acheter des pins pour le test mentionné en haut.')) + + writeln(utf8toansi(ALUTF8HTMLdecode('Kaufbestätigung'))) + writeln(utf8toansi(ALUTF8HTMLdecode('hhhhhhhhhhhhh ffffff Hier sind Ihre PINs für Check: '))) + writeln((utf8tostring(('Besten Dank f�r Ihren Kauf. Hier sind Ihre PINs für Check: ')))) + writeln('this: '+httpDecode('https://teams.microsoft.com/l/meetup-join/19%3ameeting_YTVlN2JmYWYtOGFjZS00ZDIyLTlhMzktMjNmYjcwYzczZjVk%40thread.v2/0?context=%7b%22Tid%22%3a%22d6a1cf8c-768e-4187-a738-b6e50c4deb4a%22%2c%22Oid%22%3a%22ac73bd7f-0a4e-4450-9e49-785a027100d3%22%7d')) + + + integerHashtest; + integerHashtest2; + + writeln('set'+GetCokkiesDirectory); + + writeln(datetostr(LastDayOfCurrentMonth )) + + with TTabcontrol.create(self) do begin + + // parent:= dcform; + //Align := alClient + TabOrder := 0 + //BGColor backgroundcolor:= clnavy; + //TCustomTabControl(pagecontrol1).onchange; + //OnChange := @PageControl1Change doesnt work! + //onchange + //end; //*) + onchange:= @PageControl1Change; + ongetSiteInfo; + free; + end; + + with TCheckListBox.create(self) do begin + itemheight:= 20; + columns + color + font + sorted + style:= lbStandard; + autocomplete + free + ondblclick + ondatafind + ondata + end; + + with TListBox.create(self) do begin + itemheight:= 20; + columns + color + font + autocomplete + free + ondblclick + ondatafind + ondata + end; + + writeln(floattostr(GMTDateTimeToJulianDay (now))) + affine:= ComputePlanetPosition(orbelem) + + strtochars('ths') + + with TSearchAnagrams.create(self) do begin + pubdic:= Tdic.create(true); + //pubdic.LoadDicFromFile('C:\maXbox\TestApp2\maxbox2\maxbox2\source_2007\maxbox29\maxbox36beta\Import\970_Small.dic'); + publist:= TStringlist.create; + init('Hometown Run', 1 ,10 , true, false, false, pubdic) + FindAllWords('He', publist) + writeln('found: '+publist.text) + free ; + pubdic.free; + publist.Free; + end; + + with THashStr.create(12, 8) do begin + writeln(itoa(length(test))) + writeln(itoa(hash( 'hitbox1'))) + writeln(itoa(hash( 'hitbox2'))) + free; + end; + + //FixedStrToFloat + + with TJson.Create do begin + writeln(itoa(count)); + writeln(values['ghjh'].asstring); + JsonObject; + free; + end; + + //object + Json := TJson.Create(); + with Json['field7'].AsObject do + begin + Put13('subfield1', 2.7182818284); + Put14('subfield2', 'json4delphi'); + Put10('subfield1',jsnull2); + end; + + with TP2.create do begin + input:= 23.3 + G:= 1.2; amplitude:= 3.5; omega:= 1; + simulate; + //writeln(floattostr(fr.phi)); + writeln('TP2 '+floattostr(output)) + writeln(floattostr(SimOutput)); + free ; + end; + + acomp.m:= 12.5; + complex.re:= 23; + complex.im:= -0; + + acomp.F:= complex; + + + //BCE03C310FAEBA451DF2BDEE7B3A0DE2B5ECB8BD + + for it:= 0 to 9 do + if itoa(it)[1] in strtochars('BCE03C310FAEBA451DF2BDEE7B3A0DE2B5ECB8BD') then + write('found: '+ itoa(it)+' '); + writeln(CRLF) + for it:= ord('A') to ord('F') do + if chr(it) in strtochars('BCE03C310FAEBA451DF2BDEE7B3A0DE2B5ECB8BD') then + write('found: '+ chr(it)+' '); + + // writeln(itoa(LocalExecute32 (exepath+'maxbox4.exe', false , SW_SHOW , INFINITE))) + + //printusingshell(exepath+'"maxboxerrorlog - Copy.txt"') + //loadform2 + //copyex + + //selftestinternetutils + + //writeln(flcMIMEContentTypeFromExtention('ctavi')) + + flcDecodeURL('http://www.softwareschule.ch/download/maxbox_functions.txt', + Protocol, Host, Path) + writeln('hist: '+protocol) + + //PlaySound('INDIGO_WAV', hInstance, SND_RESOURCE or SND_ASYNC); + //PlaySound('MOON', hInstance, SND_RESOURCE or SND_ASYNC); + + + with THeaderCls.create('') do begin + getfieldnames + free + end; //} + + + + atci:= JclStringList; + atc:= TJclStringlist.create; + atc.free; + + with TJclStringList.create do begin + //atci:= loadfromfile(Exepath+'maxboxdef2.ini'); + atci:= addstrings(['thisi is']) + //atci + //atci:= JclStringList; + addstrings(['thisi is','dhhhd']) + writeln('get '+getcommatext) + writeln('get '+text) + //keepregex + //files + //ExtractWords + free + end; //} + + //RaiseLastOSError; + //flcRaiseLastOSError; + flcGetWinPortNames + writeln(flcGetLocalHostName) + //triminplace + + spl:= flcStrSplit('this -is -maxbox -rocks','-') + for it:= 0 to length(spl)-1 do + write(spl[it]+' '); + + OutPutList := TStringList.Create; + try + strSplit(':', 'word:doc,txt,docx', OutPutList) ; + Writeln(OutPutList.Text); + //Readln; + finally + OutPutList.Free; + end; + //strsplit + + //OutPutList := TStringlist.Create; + outputlist:= strSplitF(':', 'word:doc,txt,docx') ; + Writeln(OutPutList.Text); + OutPutList.Free; + + //setlength(agb,3) + + agb:= int32tobytes(123456) + writeln(itoa(agb[0]) ); + + SelfTestCFundamentUtils; + + // maxform1.JumptoOutput1Click(self) + writeln(GetLastOSErrorMessage ) + writeln(itoa(GetLastOSErrorcode)) + + writeln(itoa(hton32(123456789))) //bytesequal + ansi:= 'this is'; + ansi:= 'this is box'; + ansi:= 'this'; + ansi2:= 'this is'; + writeln('StringRefCount: '+itoa(StringRefCount2 (ansi)) ); + writeln('StringRefCount: '+itoa(StringRefCount (ansi)) ); + + writeln(itoa( bytescompare(StrToBytes(ansi), StrToBytes(ansi2)) )); + writeln(botostr( bytesequal(StrToBytes(ansi), StrToBytes(ansi2)) )); + + //FGPlayASound2('moon','wav') + writeln('async') + //FGPlayASound2('promote','wave') + //FGPlayASound2('petra','mid') + PlayReswav('promote','wave') + //PlayReswav('emptywave','rcdata') + //PlayReswav('maxboxwav','wav') + + with TForm.create(self) do begin + caption:= '' + onmousewheel:= @FormMouseWheel ; + //OnMouseWheelup + //showmodal; + free + end; + + with TSCROLLBOX.create(self) do begin + //caption:= '' + onmousewheelup + free + end; + + //SphereTPoint3D + lcount:= 20000; + + writeln(botostr(QueryPerformanceCounter2(lcount))) ; + writeln(itoa(lcount)) + + QueryPerformanceCounter1(lcount) ; + writeln(itoa(lcount)) + + writeln(botostr(QueryPerformanceFrequency1(lcount))) ; + writeln(itoa(lcount)) + //writeln(botostr(QueryPerformanceCounter2(lcount))) + //writeln(itoa(QueryPerformanceCounter(lcount))) + QueryPerformanceCounter(lcount) ; + writeln(itoa(lcount)) + + writeln(floattostr(gmlgetfuzz)) + + with TFrame.create(self) do begin + //caption + align + free + end; + + with TRotateImage.create(self) do begin + UniqueSize + //onexit + ondblclick + free + end; + + //CreateRotatedBitmap + + TestStatisticClass; + writeln(floattostr(flcerf(0.0036567))) + writeln(floattostr(erf(36.567))) + + writeln(floattostr(flcBinomialCoeff(42,6))) + writeln(floattostr(BinomialCoeff(42,6))) + + //include + + //XORCharSet2 + destset:= strtochars('t9pOS'); + //include((destset), 'i') ; + XORCharSet(destset, strtochars('t9pOA')); + writeln('XORCharSet1: '+charsettostr(destset)) + XORCharSet2(destset, strtochars('t9pOA')); + writeln('XORCharSet2: '+charsettostr(destset)); + Assert(charsettostr(destset)='AS','XORCharSet2 must AS'); // } + XORCharSet3(destset, strtochars('t9pOA')); + writeln('XORCharSet3: '+charsettostr(destset)); + Assert(charsettostr(destset)='AS','XORCharSet2 must AS'); // } + + //StatisticFloatDelta + + TestMathClass; + TestStatisticClass; + + writeln(floattostr(flcE)) + + setlength(myc2r,2) + setlength(myc2i,2) + myc2r[0]:= 17.8 myc2i[0]:= 117.8 + myc2r[1]:= 16.7 myc2i[1]:= 116.7 + //flcFourierTransform( const AngleNumerator : MFloat; const RealIn, ImagIn : array of MFloat; var RealOut, ImagOut : MFloatArray)'); + flcFourierTransform (2, myc2r, myc2i, myc2r, myc2i ); + flcCalcFrequency(2, myc2r, myc2i, RealOut, ImagOut); + + //Procedure flcFFT( const RealIn, ImagIn : array of MFloat; var RealOut, ImagOut : MFloatArray)'); + flcFFT( myc2r, myc2i, myc2r, myc2i); + + flcFourierTransform( 4.6, myc2r, myc2i, myc2r, myc2i); + + writeln(floattostr(RealOut)) + writeln(floattostr(imagOut)) + + writeln(floattostr( flcCummChiSquare(73.5, 90.5))); + + Assert(not flcIsPrime(0), 'IsPrime(0)'); + Assert(not flcIsPrime(1), 'IsPrime(1)'); + Assert(flcIsPrime(2), 'IsPrime(2)'); + Assert(flcIsPrime(3), 'IsPrime(3)'); + //Assert2(IsPrime(-3), 'IsPrime(-3)'); + Assert(not flcIsPrime(4), 'IsPrime(4)'); + Assert(not flcIsPrime(-4), 'IsPrime(-4)'); + Assert(flcIsPrime(257), 'IsPrime(257)'); + Assert(not flcIsPrime($10002), 'IsPrime($10002)'); + Assert(flcIsPrime($10003), 'IsPrime($10003)'); + + //union + + writeln(itoa(flccharcount(['t','9','p','O']))); + writeln(itoa(flccharcount(strtochars('t9pO')))); + + destset:= strtochars('t9pOS'); + flcXORCharSet(destset, strtochars('t9pOA')); + writeln('flcXORCharSet1: '+charsettostr(destset)) + destset:= strtochars('t9pOS'); + flcXORCharSet(destset, strtochars('t9pOA')); + writeln('flcXORCharSet2: '+charsettostr(destset)); + Assert(charsettostr(destset)='AS','XORCharSet2 must AS'); // } + + //Function IsComplete( const C : CharSet) : Boolean + writeln(botostr(IsComplete(destset))); + writeln(botostr(IsComplete(strtochars(getASCIIline)))); + writeln(botostr(IsComplete(strtochars(getASCIIline+chr(0))))); + writeln(botostr(flcIsComplete(destset))); + writeln(botostr(flcIsComplete(strtochars(getASCIIline)))); + writeln(botostr(flcIsComplete(strtochars(getASCIIline+chr(0))))); + + // CL.AddDelphiFunction('function AddQuantumToDateTime(const dt: TDateTime): TDateTime;'); + writeln(datetimetostr(AddQuantumToDateTime(now))); + + with TPrimes.create do begin + CanonicalFactors; + writeln(itoa(length(Divisors))); + free; + end; + with TStatisticClass.create do begin + add(576.6) + add(176.6) + writeln(floattostr(mean)); + //CustomSort; + //writeln(itoa(length(Divisors))); + free; + end; + + TestBitClass; + testtimerclass; + + writeln(IntToHex(abt('1000100011111111'), 8)); + + writeln('GetHighResolutionFrequency: '+inttostr64(GetHighResolutionFrequency)) + //TestFull; + writeln('MicroDateTimeTest: '+ + datetimetostr(MicroDateTimeToDateTime(GetMicroDateTimeNow))); + writeln(DateTimeToStrUs(now)); + writeln(datetimetostr(getnowutc (false))) + //TLexCharProc + with TBlaiseLexer.create do begin + gettoken + free + end; + //randomint + + testRationalClass; + //ifthenint + + TestComplexClass; + TestMatrixClass; + + TestStringBuilderClass; + + //TPoints2 + + //PlgBlt3 + + //LinkerTimeStamp + + writeln('LinkerTimeStamp '+datetimetostr(LinkerTimeStamp(exepath+'maxbox47520.exe'))); + + Test_StringBuilder; + + mycharset:= ['%','&']; + + writeln(StrRemoveCharSet(' this os % a box& of ',['%','&'])) + writeln(StrRemoveCharSet(' this os % a box& of ',mycharset)) + TestASCIIRoutines; + + //MakeComplexSound2 + writeln(IntToByteCharDigit(8)) + + TestPatternmatcher; + + { Assert(StrPosPatternU('', '', I, 1, mpgGreedy) = 0); Assert(I = 0); + Assert(StrPosPatternU('', 'a', I, 1, mpgGreedy) = 1); Assert(I = 0); + Assert(StrPosPatternU('a', '', I, 1, mpgGreedy) = 0); Assert(I = 0); + Assert(StrPosPatternU('a*b', 'xacb', I, 1, mpgGreedy) = 2); Assert(I = 3); + Assert(StrPosPatternU('a*b', 'xaccbd', I, 1, mpgGreedy) = 2); Assert(I = 4); + Assert(StrPosPatternU('a*b', 'xa', I, 1, mpgGreedy) = 0); Assert(I = 0); } + + Assert(MatchFileMaskB('*', 'A',true), 'MatchFileMask'); + Assert(MatchFileMaskB('?', 'A',true), 'MatchFileMask'); + Assert(MatchFileMaskB('', 'A',true), 'MatchFileMask'); + + TestUnicodeChar; + + writeln(botostr(UnicodeIsDashOrHyphen('-'))) + + sURL := 'ga:referralPath=/add/%D0%9F%D0%B8%D0%B6%D0%B0%D0%BC'; + sWork := sURL; + I := 1; + while I <= Length(sWork) do begin + if sWork[I] = '%' then begin + if (I+2) > Length(sWork) then + Xraise (Exception.Create('Incomplete encoding detected')); + sWork[I] := Chr((HexToBits(sWork[I+1]) shl 4) or HexToBits(sWork[I+2])); + Delete(sWork, I+1, 2); + end; + Inc(I); + end; + wDecoded := UTF8Decode(sWork); + writeln(wdecoded) + +// 15 CLF_Fundamentals Testroutines 47520 +//------------------------------------ + TestMathClass; + TestStatisticClass; + TestBitClass; + TestCharset; + TestTimerClass; + TestRationalClass; + TestComplexClass; + TestMatrixClass; + TestStringBuilderClass; + TestASCII; + TestASCIIRoutines; + TestPatternmatcher; + TestUnicodeChar; + + ///////////////////////// TestUnits ////////////////////////// +//@procedure + + SelftestPEM; + SelfTestCFundamentUtils; + SelfTestCFileUtils; + try + SelfTestCDateTime; + except + writeln('I/O error: '+ExceptionToString(ExceptionType, ExceptionParam)); + end; + try + SelfTestCTimer; + except + writeln('high Res Timer: '+ExceptionToString(ExceptionType, ExceptionParam)); + end; + SelfTestCRandom; + //SelftestAES; + SelfTestASN1; + SelfTestX509; + writeln(botostr(TestDes)); + writeln(botostr(Test3Des)); + writeln(botostr(TestAes)); + SelfTestcTLSUtils; + SelfTestCFundamentUtils; + //SelfTestcHTTPUtils + SelfTestcXMLFunctions + SelfTestHugeWord + SelfTestRSA + + writeln('All 30 Unit Tests passed!^?') ; + //playreswav('maxboxwav','wav'); + + //CreateDOSProcessRedirected3 + + //LoadJPEGResource + + with Tsemaphorgrid.create(self) do begin + free; + end; + + writeln(datetimetostr(utcnow)); + //ParseRSSFeed + with TFastStringStream.create('') do begin + free; + end; //} + + //writeln(DecodeStringRSS(etBase64rss,'this is decode')); + + writeln(botostr(_IsEmptyStr( 'const Str : string'))); + //StreamToByteArray + synassert(3=3) + //ValidateBitcoinAddress + //SysCharSetToStr /// + mscs:= StrToSysCharSet('gghj') + + //PythonEngine := GetPythonEngine ; + + with TPythonModule.create(self) do begin + writeln('modulename '+modulename) + //writeln(errors[0].name) + //initialize; //Exception: No Engine defined for component "". + free + end; + + PythonGUIInputOutput1:= TPythonInputOutput.create(self); + + //https://stackoverflow.com/questions/8244121/creating-python-extension-with-delphi + + initdemoDLL; + + with TPythonEngine.create(self) do begin + //SetProgramName('PYProgramName.py'); + programname:= 'PYProgramName.py'; + //AutoFinalize:= true; + AutoFinalize := False; + //InitScript; + //LoadDll; + IO := PythonGUIInputOutput1; + // initialize(TPythonModule.create(self)); + //initialize2; + writeln('progmodulename '+programname) + pythonhome:= 'C:\Users\Max\AppData\Local\Programs\Python\Python37\'; //python37_32.dll + writeln('pyhome '+pythonhome) + //VariantAsPyObject + //Function Run_CommandAsString( const command : AnsiString; mode : Integer) : string'); + //writeln(Run_CommandAsString( pycmd, 1) ) + //EvalStringAsStr(pycmd); + //istype + //writeln(errors[0].name) + //initialize2; + DoOpenDll2('C:\Users\Max\AppData\Local\Programs\Python\Python37\python37_32.dll'); + //SetProgramArgs2; + //EvalStringAsStr(pycmd); + //Exception: Access violation at address 6E96BC56 in module 'python36.dll'. Read of address 000000AC. + //free; + end; + + PythonEngine := TPythonEngine.create(self); + setgPythonEngine(pythonengine) + writeln(objtostr(pythonengine)); + writeln(objtostr(getgPythonEngine)); + // writeln(objtostr(GetPythonEngine )); + + + writeln('SysVersionFromDLLName '+SysVersionFromDLLName (PYHOME+ 'python37.dll')); + writeln('SysVersionFromDLLName '+SysVersionFromDLLName (PYHOME+ 'python37_32.dll')); + + writeln('PythonOK '+botostr(PythonOK)); + PythonEngine.Free; + + PythonEngine := TPythonEngine.create(self); + setgPythonEngine(pythonengine) + + //pyvar:= PyImport('C:\maXbox\maxbox3\maxbox4\maxbox4\python\module1maxbox.py'); + + PythonEngine.Free; + writeln(botostr(wdc_IsWow64)); + + //GetOleVariantEnum( pyvarenum) + + //writeln(itoa(wdc_GetRemoteFileSize('https://sourceforge.net/projects/maxbox/files/Android/weatherapp4.txt/download'))); + + +End. + + +Ref: + +procedure SIRegister_TPythonModule(CL: TPSPascalCompiler); +begin + //with RegClassS(CL,'TMethodsContainer', 'TPythonModule') do + with CL.AddClassN(CL.FindClass('TMethodsContainer'),'TPythonModule') do begin + Constructor Create( AOwner : TComponent)'); + Procedure MakeModule'); + Procedure DefineDocString'); + Procedure Initialize'); + Procedure InitializeForNewInterpreter'); + Procedure AddClient( client : TEngineClient)'); + Function ErrorByName( const AName : AnsiString) : TError'); + Procedure RaiseError( const error, msg : AnsiString)'); + Procedure RaiseErrorFmt( const error, format : AnsiString; const Args : array of const)'); + Procedure RaiseErrorObj( const error, msg : AnsiString; obj : PPyObject)'); + Procedure BuildErrors'); + Procedure SetVar( const varName : AnsiString; value : PPyObject)'); + Function GetVar( const varName : AnsiString) : PPyObject'); + Procedure DeleteVar( const varName : AnsiString)'); + Procedure ClearVars'); + Procedure SetVarFromVariant( const varName : AnsiString; const value : Variant)'); + Function GetVarAsVariant( const varName : AnsiString) : Variant'); + Module', 'PPyObject', iptr); + Clients', 'TEngineClient Integer', iptr); + ClientCount', 'Integer', iptr); + DocString', 'TStringList', iptrw); + ModuleName', 'AnsiString', iptrw); + Errors', 'TErrors', iptrw); + OnAfterInitialization', 'TNotifyEvent', iptrw); + end; +end; + +**************************************************************** +Release Notes maXbox 4.7.5.20 Jan 2021 mX47 +**************************************************************** +Add 25 Units + 4 Tutorials + +1277 unit uPSI_SystemsDiagram.pas Dendron +1278 unit uPSI_qsFoundation.pas Dendron +1279 uPSI_JclStringLists2 JCL +1280 uPSI_cInternetUtils2 FLC +1281 uPSI_cWindows.pas FLC +1282 uPSI_flcSysUtils.pas +TBytes utils +1283 unit uPSI_RotImg.pas DA +1284 uPSI_SimpleImageLoader.pas LAZ +1285 uPSI_HSLUtils.pas LAZ +1286 uPSI_GraphicsMathLibrary.pas EF +1287 unit uPSI_umodels.pas DMath +1288 uPSI_flcStatistics.pas FLC5 +1289 uPSI_flcMaths.pas FLC5 +1290 uPSI_flcCharSet.pas +1291 uPSI_flcBits32.pas +1292 uPSI_flcTimers.pas +1293 uPSI_cBlaiseParserLexer.pas +1294 uPSI_flcRational.pas +1295 uPSI_flcComplex.pas +1296 unit uPSI_flcMatrix (uPSI_flcVectors.pas) +1297 unit uPSI_flcStringBuilder.pas +1298 unit PJResFile_Routines; +1299 uPSI_flcASCII.pas +1300 uPSI_flcStringPatternMatcher; +1301 unit uPSI_flcUnicodeChar.pas + +Totals of Function Calls: 33282 +SHA1: of 4.7.5.20 D82EAD01C58738887661428F94B207DB1D8FAEB5 +CRC32: 203C82F0 29.5 MB (31,012,768 bytes + +//0.0964047009787458 double +//0.0964050595696765 extended + +procedure ClearSysCharSet(var C: TsysCharSet); +begin + C := []; +end; + + +#------------------------------------------------------------------------------- +# Name: module1 +# Purpose: +# +# Author: Max +# +# Created: 01/02/2018 +# Copyright: (c) Max 2018 +# Licence: +#------------------------------------------------------------------------------- + +def main(): + print(20**50) + pass + +if __name__ == '__main__': + main() + + +// mX4 executed: 23/12/2020 20:22:27 Runtime: 0:0:1.694 Memload: 34% use + +Ref: https://my6.code.blog/2020/03/29/saint-source/ + http://www.angelfire.com/hi5/delphizeus/ + https://stackoverflow.com/questions/17101532/loading-pre-compiled-script-in-remobjects-pascal-script-delphi + + http://www.felix-colibri.com/papers/web/rss_reader/rss_reader.html + https://ddmf.eu/ + + "Solid Ball Of Rock" + +One night in Louisiana down by highway eighty four +You could hear a strange dog howling right outside his mamma's door +The baby was a killer, the cousin was a priest +The baby upped and said, "I play the music of the beast" + + + Kopien von Mails lassen sich �ber die Siri-Datenbank ohne den zur S/MIME-Entschl�sselung erforderlichen privaten Schl�ssel einsehen. + + https://sourceforge.net/projects/maxbox/files/Examples/IBZ/pki2020praktikum.zip/download + 1633dace2c2b541e1fb9f48aa7575c0cfd4498cf + + https://sourceforge.net/projects/maxbox/files/Examples/IBZ/Tag1_4_IT_SEC.zip/download + + >>> result=0 +>>> for i in range(31): +... result += (1/pow(2,i)) +... +>>> result +1.9999999990686774 + + >>> for i in range(30): +... result += 1/pow(2,i) +... +>>> result +1.9999999981373549 + +Source = https://picsum.photos/seed/1 Target = picture_0001.jpg +Source = https://picsum.photos/seed/2 Target = picture_0002.jpg +Source = https://picsum.photos/seed/3 Target = picture_0003.jpg +Source = https://picsum.photos/seed/4 Target = picture_0004.jpg +Source = https://picsum.photos/seed/5 Target = picture_0005.jpg +Source = https://picsum.photos/seed/6 Target = picture_0006.jpg +Source = https://picsum.photos/seed/7 Target = picture_0007.jpg +Source = https://picsum.photos/seed/8 Target = picture_0008.jpg +Source = https://picsum.photos/seed/9 Target = picture_0009.jpg +Source = https://picsum.photos/seed/10 Target = picture_0010.jpg +Source = https://picsum.photos/seed/11 Target = picture_0011.jpg +Source = https://picsum.photos/seed/12 Target = picture_0012.jpg + + mX4 executed: 30/03/2020 23:09:29 Runtime: 0:0:4.453 Memload: 46% use + +Doc: + +The unit importer parses the interface section of a unit and generates an import unit for use by Pascal Script. It makes the Delphi code from the imported unit accessible to the Pascal Script interpreter. Include both units (the original and the generated one) in your project. + +Instead of manually typing all the AddDelphiFunction calls to add your functions to Pascal Script, the importer generates code to call those functions for you. If you have USEIMPORTER defined in your project, then the import unit will automatically register the imported types, functions, and constants with the interpreter. Otherwise, you'll have to call the SIRegister_X function yourself when you have your own interpreter class ready. + + SafeLoadLibrary loads a Windows DLL or Linux shared object file, as specified by Filename. SafeLoadLibrary preserves the current FPU control word, preventing library initialization code from permanently overwriting precision and exception masks. +Note: On Windows, SafeLoadLibrary temporarily sets the system error mode to ErrorMode. The default, SEM_NOOPENFILEERRORBOX, suppresses error dialogs. The previous error mode is restored before SafeLoadLibrary exits. For a list of error modes, refer to SetErrorMode in the Microsoft documentation. +Note: On Linux, the Dummy argument is ignored. + +https://maxbox4.files.wordpress.com/2020/03/max_train.jpg?w=725&h=&zoom=2 + +Ref: // Standard exception classes of Python + + Hierarchy of Python exceptions, Python 2.3, copied from \Python\exceptions.c +Exception\n\ + |\n\ + +-- SystemExit\n\ + +-- StopIteration\n\ + +-- StandardError\n\ + | |\n\ + | +-- KeyboardInterrupt\n\ + | +-- ImportError\n\ + | +-- EnvironmentError\n\ + | | |\n\ + | | +-- IOError\n\ + | | +-- OSError\n\ + | | |\n\ + | | +-- WindowsError\n\ + | | +-- VMSError\n\ + | |\n\ + | +-- EOFError\n\ + | +-- RuntimeError\n\ + | | |\n\ + | | +-- NotImplementedError\n\ + | |\n\ + | +-- NameError\n\ + | | |\n\ + | | +-- UnboundLocalError\n\ + | |\n\ + | +-- AttributeError\n\ + | +-- SyntaxError\n\ + | | |\n\ + | | +-- IndentationError\n\ + | | |\n\ + | | +-- TabError\n\ + | |\n\ + | +-- TypeError\n\ + | +-- AssertionError\n\ + | +-- LookupError\n\ + | | |\n\ + | | +-- IndexError\n\ + | | +-- KeyError\n\ + | |\n\ + | +-- ArithmeticError\n\ + | | |\n\ + | | +-- OverflowError\n\ + | | +-- ZeroDivisionError\n\ + | | +-- FloatingPointError\n\ + | |\n\ + | +-- ValueError\n\ + | | |\n\ + | | +-- UnicodeError\n\ + | | |\n\ + | | +-- UnicodeEncodeError\n\ + | | +-- UnicodeDecodeError\n\ + | | +-- UnicodeTranslateError\n\ + | |\n\ + | +-- ReferenceError\n\ + | +-- SystemError\n\ + | +-- MemoryError\n\ + |\n\ + +---Warning\n\ + |\n\ + +-- UserWarning\n\ + +-- DeprecationWarning\n\ + +-- PendingDeprecationWarning\n\ + +-- SyntaxWarning\n\ + +-- RuntimeWarning\n\ + +-- FutureWarning" +//} + +ref: https://wiki.freepascal.org/Shl + +Ref: +https://kb.paessler.com/en/topic/1073-what-are-the-most-common-errors-when-monitoring-wmi +https://msdn.microsoft.com/en-us/library/aa394217(v=vs.85).aspx + + 16-03-2020 11:30 +Virus: les march�s chutent, les fronti�res se ferment + +EventType - //"BUILTIN\\Administrators"'; +'1 Error +'2 Warning() +'3 Information() +'4 Security audit success +'5 Security audit failure + + + + + + + + +public class MainClassWMI +{ + public static void MainWMI() + { + ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'"); + ManagementObjectCollection queryCollection = query.Get(); + foreach (ManagementObject mo in queryCollection) + { + string[] addresses = (string[])mo["IPAddress"]; + + foreach (string ipaddress in addresses) + { + Console.WriteLine("IP Address: {0}", ipaddress); + } + } + } +} + + +Lerninhalte ML: + +Regression: + + Lineare Regression + Polynomiale Regression + +Klassifizierung: + + Logistische Regression + Support Vector Machine (SVM) + SVM mit Kernel (rbf, poly) + Naive Bayes + Entscheidungsb�ume + Random Forest + +Clustering + +Natural Language Processing + + Tokenizing + Stemming + POS-Tagging (welchen Typ hat ein Wort?) + + +Bonus: Deep Learning / Neuronale Netze (nur Python) + Aufbau eines Neuronalen Netzes + Was ist ein Neuron? + Tensorflow + Keras + +Anwendung: + + Dimensionsreduktion mit der Principal Component Analysis (PCA) + Daten einlesen (mit vollst�ndigem Praxisbeispiel, Schritt f�r Schritt erkl�rt + +Hyperparameter finden + + �Parameter Tuning� + GridSearch (GridSearchCV in Python / tuneGrid in R) + +Modelle vergleichen: + + K-Fold Cross-Validation + Bestimmtheitsma� + +Besonders geeignet f�r: Entwickler, die sich f�r Machine Learning interessieren. + +PBIDesktop_x64.msi + +Die Weiterentwicklung der Automatisierungstechnik hat in den letzten Jahren einige interessante und vielversprechende Innovationen hervorgebracht. Hierzu z�hlt insbesondere die durchgehende Integration einiger Spezialtechnologien des Machine Learning wie die Mustererkennung, Predictive Maintanance und das Condition Monitoring. Dies verdeutlicht, wie weit die Optimierung der Automation schon vorangeschritten ist oder sein kann. + +Ein unmittelbarer Nutzen ist allerdings bereits heute klar: Bereiche wie die Robotik, mathematische Optimierung, Anomaliedetektion oder modellbasierte Regelung w�rden direkt durch eine entsprechende Integration profitieren. Dazu dienen die Grundlagen dieses CAS. + +https://unibe-ch.academia.edu/MaxKleiner/CurriculumVitae + +https://github.com/joaopauloschuler/neural-api +https://sourceforge.net/projects/cai/ + +https://www.bytesin.com/software/maXbox/ + +zip: b433e3cc7ce4e21c20929fa050fbc9be219f1b31 + +CAI NEURAL API - Pascal based neural network API optimized for AVX, AVX2 and AVX512 instruction sets plus OpenCL capable devices including AMD, Intel and NVIDIA. + +unit uPSI_neuralbit.pas +unit uPSI_neuralab.pas + +unit uPSI_neuralvolumev.pas +unit uPSI_neuralabfun.pas + +procedure SetDecimalSeparator2(Ch: Char); +procedure GetWaveOutDevices(DeviceNames: TStrings); +var + DNum: Integer; + i: Integer; + Caps: TWaveOutCapsA; +begin + DNum := waveOutGetNumDevs; // Number of Devices + for i := 0 to DNum - 1 do // Query Devicenames + begin + waveOutGetDevCaps(i, @Caps, SizeOf(TWaveOutCapsA)); + DeviceNames.Add(string(Caps.szPname)); + end; +end; + +procedure GetWaveOutDevices(DeviceNames: TStrings); +procedure GetMIDIOutDevices(Devices: TStrings); + +procedure TestKMeans(); +var + KMeans: TNNetKMeans; + Clusters, ClusterSize, Samples: integer; + SampleCnt, StepCnt, ClusterCnt: integer; + SampleVolume: TNNetVolume; + ClustersWithElements: integer; + ClusteredElements: integer; +begin + Clusters := Random(128) + 1; + ClusterSize := Random(128) + 1; + Samples := Random(1280) + 1; + WriteLn('Testing KMeans - Clusters:', Clusters, ' Cluster Size:', ClusterSize, + ' Samples:', Samples); + KMeans := TNNetKMeans.Create(Clusters, 1, 1, ClusterSize); + // Creates the sample for clustering. + for SampleCnt := 0 to Samples - 1 do + begin + SampleVolume := TNNetVolume.Create(1, 1, ClusterSize); + SampleVolume.FillForDebug(); + SampleVolume.Mul(Random(Clusters)); + SampleVolume.Add(Random(100)/100); + KMeans.AddSample( SampleVolume ); + end; + // Runs the clusteting. + KMeans.Randomize(); + for StepCnt := 1 to 20 do + begin + KMeans.RunStep(); + KMeans.RandomizeEmptyClusters(); + end; + KMeans.RunStep(False); + // Counts how many clusters have elements. + ClustersWithElements := 0; + ClusteredElements := 0; + for ClusterCnt := 0 to KMeans.Clusters.Count - 1 do + begin + if KMeans.Clusters[ClusterCnt].Tag > 0 then Inc(ClustersWithElements); + Inc(ClusteredElements, KMeans.Clusters[ClusterCnt].Tag); + end; + WriteLn(ClustersWithElements, ' clusters have ', ClusteredElements, + ' elements. KMeans testing has finished.'); + KMeans.Free; +end; + +procedure SIRegister_neuralab(CL: TPSPascalCompiler); +begin + SIRegister_TABHash(CL); + CL.AddDelphiFunction('Function ABKey( S : array of byte; Divisor : longint) : longint'); + CL.AddDelphiFunction('Function ABCmp( var X, Y : array of byte) : boolean'); + CL.AddDelphiFunction('Function ABGetNext1( var AB : array of byte; ST : word) : word'); + CL.AddDelphiFunction('Function ABCountDif( var X, Y : array of byte) : longint'); + CL.AddDelphiFunction('Function ABCountDifZero( var X : array of byte) : longint'); + CL.AddDelphiFunction('Procedure ABAnd( var A, B : array of byte)'); + CL.AddDelphiFunction('Function ABGetEqual( var Equal, X, Y : array of byte) : longint'); + CL.AddDelphiFunction('Procedure ABShiftLogicalLeft( var X : array of byte)'); + CL.AddDelphiFunction('Procedure ABShiftLogicalRight( var X : array of byte)'); + CL.AddDelphiFunction('Function ABGetDif( var Dif, X, Y : array of byte) : longint'); + CL.AddDelphiFunction('Function ABToString( var AB : array of byte) : string'); + CL.AddDelphiFunction('Function ABToStringR( var AB : array of byte) : string'); + CL.AddDelphiFunction('Procedure ABClear( var AB : array of byte)'); + CL.AddDelphiFunction('Procedure ABFull( var AB : array of byte)'); + CL.AddDelphiFunction('Procedure ABBitOnPos( var AB : array of byte; POS : longint)'); + CL.AddDelphiFunction('Procedure ABBitOnPosAtPos(var AB: array of byte; X,Start,Len: longint)'); + CL.AddDelphiFunction('Function ABReadBitOnPosAtPos(var AB:array of single;Start,Len:longint): longint'); + CL.AddDelphiFunction('Procedure ABCopy( var A, B : array of byte)'); + CL.AddDelphiFunction('Procedure ABTriPascal( var A, B : array of byte)'); + CL.AddDelphiFunction('Procedure ABSet( var A : array of byte; B : array of byte)'); +end; + +procedure SIRegister_neuralbit(CL: TPSPascalCompiler); +begin + //CL.AddTypeS('TArrOf2BytesPtr', '^TArrOf2Bytes // will not work'); + //CL.AddTypeS('TArrOf3BytesPtr', '^TArrOf3Bytes // will not work'); + //CL.AddTypeS('TArrOf4BytesPtr', '^TArrOf4Bytes // will not work'); + //CL.AddTypeS('TArrBytePtr', '^TLongByteArray // will not work'); + CL.AddDelphiFunction('Function POT( numero, elevado : extended) : extended'); + CL.AddDelphiFunction('Function LongintBitTest( Data : longint; P : longint) : boolean'); + CL.AddDelphiFunction('Function LongintBitFlip( Data : longint; P : longint) : longint'); + CL.AddDelphiFunction('Procedure BAClear( var VARS : array of byte)'); + CL.AddDelphiFunction('Procedure BAMake1( var VARS : array of byte)'); + CL.AddDelphiFunction('Function BARead( var A : array of byte; P : longint) : byte'); + CL.AddDelphiFunction('Procedure BAFlip( var A : array of byte; P : longint)'); + CL.AddDelphiFunction('Procedure BAWrite( var A : array of byte; P : longint; Data : byte)'); + CL.AddDelphiFunction('Function BATest( var A : array of byte; P : longint) : boolean'); + CL.AddDelphiFunction('Procedure BASum( var x, y : array of byte)'); + CL.AddDelphiFunction('Procedure BASub( var x, y : array of byte)'); + CL.AddDelphiFunction('Procedure BAIncPos( var x : array of byte; POS : longint)'); + CL.AddDelphiFunction('Procedure BADecPos( var x : array of byte; POS : longint)'); + CL.AddDelphiFunction('Procedure BAInc( var x : array of byte)'); + CL.AddDelphiFunction('Procedure BADec( var x : array of byte)'); + CL.AddDelphiFunction('Function BAToString( VARS : array of byte) : string'); + CL.AddDelphiFunction('Function BAToFloat( var VARS : array of byte) : extended'); + CL.AddDelphiFunction('Procedure PFloatToBA( var VARS : array of byte; Valor : extended)'); + CL.AddDelphiFunction('Procedure BANot( var VARS : array of byte)'); + CL.AddDelphiFunction('Procedure BAAnd( var r, x, y : array of byte)'); + CL.AddDelphiFunction('Procedure BAOr( var r, x, y : array of byte)'); + CL.AddDelphiFunction('Procedure BAXOr( var r, x, y : array of byte)'); + CL.AddDelphiFunction('Function BAGrater( var x, y : array of byte) : boolean'); + CL.AddDelphiFunction('Function BALower( var x, y : array of byte) : boolean'); + CL.AddDelphiFunction('Function BAEqual( var x, y : array of byte) : boolean'); + CL.AddDelphiFunction('Procedure BAPMul( var r, x, y : array of byte)'); + CL.AddDelphiFunction('Function nnRAnd( A, B : extended) : extended'); + CL.AddDelphiFunction('Function nnROr( A, B : extended) : extended'); + CL.AddDelphiFunction('Function nnRNot( A : extended) : extended'); + CL.AddDelphiFunction('Function nnRXor( A, B : extended) : extended'); + CL.AddDelphiFunction('Function REqual( A, B : extended) : extended'); + CL.AddDelphiFunction('Procedure RSum( x, y, z : extended; var R, C : extended)'); + CL.AddDelphiFunction('Procedure RegSum( var x, y : array of extended)'); + CL.AddDelphiFunction('Function RegEqual( var x, y : array of extended) : extended'); + CL.AddDelphiFunction('Function RegOrdEqual( var x, y : array of extended) : extended'); + CL.AddDelphiFunction('Function RegToString( var VARS : array of extended) : string'); + CL.AddDelphiFunction('Function ROrer( var VARS : array of extended) : extended'); + CL.AddDelphiFunction('Function RAnder( var VARS : array of extended) : extended'); + CL.AddDelphiFunction('Function RCNot( X : extended; var VARS : array of extended) : extended'); + CL.AddDelphiFunction('Function ROrMaxTerm(var VARS:array of extended; NumMaxTerm : longint) : extended'); + CL.AddDelphiFunction('Function ROrMaxTermStr( NumVars : longint; NumMaxTerm: longint): string'); + CL.AddDelphiFunction('Function RSatFunc( var VARS : array of extended; NumFunc : longint) : extended'); + CL.AddDelphiFunction('Function RSatFuncStr( NumVars : longint; NumFunc : longint) : string'); + CL.AddDelphiFunction('Procedure RRegen( var VARS : array of extended)'); + CL.AddDelphiFunction('Procedure RDegen( var VARS : array of extended)'); + CL.AddDelphiFunction('Procedure RDegenP( var VARS : array of extended; P : extended)'); + CL.AddDelphiFunction('Procedure nnClear( var VARS : array of extended)'); + CL.AddDelphiFunction('Procedure BARAnd( var R, A, B : array of byte)'); + CL.AddDelphiFunction('Procedure BAROr( var R, AUX, A, B : array of byte)'); + CL.AddDelphiFunction('Procedure BARNot( var R, A : array of byte)'); +end; + +March 2020 (version 1.44.2) +New Python tutorials - Tutorials for creating Python containers and building Data Science models. +https://code.visualstudio.com/docs/python/data-science-tutorial + +4.7.4.60 + +TDynExtendedArray = array of Extended; + +unit uPSI_winsvc2.pas +unit uPSI_neuralcache.pas +unit uPSI_neuralbyteprediction.pas +//unit uPSI_neuralplanbuilder.pas + +(*----------------------------------------------------------------------------*) +procedure SIRegister_winsvc2(CL: TPSPascalCompiler); +begin + CL.AddConstantN('SERVICE_AUTO_START','LongWord').SetUInt( $00000002); + CL.AddConstantN('SERVICE_CONFIG_DELAYED_AUTO_START_INFO','LongInt').SetInt( 3); + CL.AddConstantN('SERVICE_CONFIG_FAILURE_ACTIONS_FLAG','LongInt').SetInt( 4); + CL.AddConstantN('SERVICE_CONFIG_PREFERRED_NODE','LongInt').SetInt( 9); + CL.AddConstantN('SERVICE_CONFIG_PRESHUTDOWN_INFO','LongInt').SetInt( 7); + CL.AddConstantN('SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO','LongInt').SetInt( 6); + CL.AddConstantN('SERVICE_CONFIG_SERVICE_SID_INFO','LongInt').SetInt( 5); + CL.AddConstantN('SERVICE_CONFIG_TRIGGER_INFO','LongInt').SetInt( 8); + CL.AddConstantN('SC_MANAGER_ALL_ACCESS','LongWord').SetUInt($F003F); + CL.AddConstantN('SERVICE_ALL_ACCESS','LongWord').SetUInt($F01FF); + CL.AddDelphiFunction('Function ChangeServiceType(ServiceName: String; TypeID:DWord):Boolean'); + CL.AddDelphiFunction('Function GetServiceStatus2( ServiceName:String;ErrorState:Bool): Bool'); + CL.AddDelphiFunction('Function StartService2( ServiceName : string) : boolean'); + CL.AddDelphiFunction('Function StopService2( ServiceName : string) : boolean'); +end; + +procedure SIRegister_neuralbyteprediction(CL: TPSPascalCompiler); +begin + CL.AddTypeS('TNeuralCountings', 'array of longint'); + SIRegister_TNeuronGroupBase(CL); + SIRegister_TNeuronGroup(CL); + CL.AddTypeS('TNeuralNetwork', 'array of TNeuronGroup'); + SIRegister_TStatePredictionClass(CL); + SIRegister_TLabeledState(CL); + SIRegister_TClassifier(CL); + SIRegister_TEasyLearnAndPredictClass(CL); +end; + +procedure SIRegister_neuralcache(CL: TPSPascalCompiler); +begin + CL.AddConstantN('NeuralMaxStates','LongInt').SetInt( 400000); + CL.AddTypeS('TNeuralState', 'TBytes'); + CL.AddTypeS('TProcPred', 'Procedure ( var ST : TBytes; Acao : byte)'); + SIRegister_TCacheMem(CL); +end; + +ResizeBitmap + +procedure ResizeBitmap(Bitmap: TBitmap; Width, Height: Integer; Background: TColor); +function WMIRegConnect(WBemLocator: ISWBemLocator; Server, account, password: string): ISWBemServices; +procedure WMIGetMethodInfo(srv: ISWbemServices; objname, method: string; var regobject, inparms: ISWBemObject); +procedure WMISetValue(InParam: ISWBemObject; keyvalue: string; invalue: OleVariant); + + function ProcessCount(const ExeName: String): Integer; + function MaxWidthOfStrings(const Strings:Classes.TStrings; const Font: Graphics.TFont): Integer; + procedure ScreenShotMonitor(var Bitmap: TBitmap; const MonitorNum: Integer; const DrawCursor: Boolean; const Quality: TPixelFormat); + + function CloneByteArray(const B: array of Byte): TBytes; + function PopByteArray(var A: TBytes): Byte; + procedure PushByteArray(const B: Byte; var A: TBytes); + procedure AppendByteArray(var B1: TBytes; const B2: array of Byte); + function ShiftByteArray(var A: TBytes): Byte; + + function ShiftByteArray(var A: TBytes): Byte; +begin + Assert(Length(A) > 0, 'A must be a non-empty array'); + Result := A[0]; + Move(A[1], A[0], Length(A) - 1); + SetLength(A, Length(A) - 1); +end; + +procedure PushByteArray(const B: Byte; var A: TBytes); +begin + SetLength(A, Length(A) + 1); + A[Pred(Length(A))] := B; +end; + +function PopByteArray(var A: TBytes): Byte; +begin + Assert(Length(A) > 0, 'A must be a non-empty array'); + Result := A[Pred(Length(A))]; + SetLength(A, Length(A) - 1); +end; + +procedure AppendByteArray(var B1: TBytes; const B2: array of Byte); +var + OldB1Len: Integer; +begin + if Length(B2) = 0 then + Exit; + OldB1Len := Length(B1); + SetLength(B1, OldB1Len + Length(B2)); + Move(B2[0], B1[OldB1Len], Length(B2)); +end; + +function CloneByteArray(const B: array of Byte): TBytes; +begin + SetLength(Result, Length(B)); + if Length(B) > 0 then + Move(B[0], Result[0], Length(B)); +end; + + +procedure PushByteArray(const B: Byte; var A: TBytes); +begin + SetLength(A, Length(A) + 1); + A[Pred(Length(A))] := B; +end; + +function PopByteArray(var A: TBytes): Byte; +begin + Assert(Length(A) > 0, 'A must be a non-empty array'); + Result := A[Pred(Length(A))]; + SetLength(A, Length(A) - 1); +end; + +procedure AppendByteArray(var B1: TBytes; const B2: array of Byte); +var + OldB1Len: Integer; +begin + if Length(B2) = 0 then + Exit; + OldB1Len := Length(B1); + SetLength(B1, OldB1Len + Length(B2)); + Move(B2[0], B1[OldB1Len], Length(B2)); +end; + +function CloneByteArray(const B: array of Byte): TBytes; +begin + SetLength(Result, Length(B)); + if Length(B) > 0 then + Move(B[0], Result[0], Length(B)); +end; + + +  mX4 executed: 19/04/2020 23:43:23 Runtime: 0:0:1.527 Memload: 33% use +  mX4 executed: 27/04/2020 21:33:18 Runtime: 0:0:1.611 Memload: 44% use +  mX4 executed: 07/06/2020 13:41:27 Runtime: 0:0:1.571 Memload: 33% use +  +  https://wiki.freepascal.org/complex_number + + +Max Kleiner's professional environment lies in the areas of machine learning, e-learning, OOP, UML and system architecture - including as a trainer, developer, consultant and publicist. His focus is on training, IT security, databases and frameworks that work in an event-oriented manner. As a lecturer and consultant at a university of applied sciences and on behalf of a company, microcontrollers and IoT have also been added. His book "Patterns in C #", published in 2003, is still up to date with the Clean Code Initiative. + +"Every war when it comes, or before it comes, is represented + not as a war but as an act of self-defense against a homicidal + maniac." + -- George Orwell + +>>> from sklearn.feature_extraction.text import TfidfVectorizer +>>> corpus = [ +... 'This is the first document.', +... 'This document is the second document.', +... 'And this is the third one.', +... 'Is this the first document?', +... ] +>>> vectorizer = TfidfVectorizer() +>>> X = vectorizer.fit_transform(corpus) +>>> print(vectorizer.get_feature_names()) +['and', 'document', 'first', 'is', 'one', 'second', 'the', 'third', 'this'] +>>> print(X.shape) +(4, 9) + + print('shape',X.shape()) +TypeError: 'tuple' object is not callable +The terminal process terminated with exit code: 1 + + +  mX4 executed: 07/06/2020 13:41:11 Runtime: 0:0:1.619 Memload: 33% use +   mX4 executed: 07/06/2020 13:42:08 Runtime: 0:0:1.556 Memload: 33% use +    mX4 executed: 27/12/2020 15:28:40 Runtime: 0:0:1.831 Memload: 46% use + mX4 executed: 18/07/2021 19:54:40 Runtime: 0:0:6.90 Memload: 44% use + mX4 executed: 20/07/2021 21:10:33 Runtime: 0:0:5.909 Memload: 30% use + mX4 executed: 21/07/2021 17:21:16 Runtime: 0:0:6.1 Memload: 40% use + mX4 executed: 21/07/2021 17:21:44 Runtime: 0:0:5.862 Memload: 40% use diff --git a/Tests/1050_pydemo_5_powerliners23.txt b/Tests/1050_pydemo_5_powerliners23.txt new file mode 100644 index 00000000..2e4b000c --- /dev/null +++ b/Tests/1050_pydemo_5_powerliners23.txt @@ -0,0 +1,360 @@ +Program PyDemo5_Eval_Exec5_Powerliners23; + +//https://github.com/maxkleiner/python4delphi/blob/master/Demos/Demo02/Unit1.pas +//https://stackoverflow.com/questions/21464102/reset-python4delphi-engine +//https://thepythonguru.com/python-builtin-functions/eval/ +//https://maxbox4.wordpress.com/2021/07/28/python4maxbox-code/ +//https://stackoverflow.com/questions/359498/how-can-i-unload-a-dll-using-ctypes-in-python +//https://levelup.gitconnected.com/5-powerful-python-one-liners-you-should-know-469b9c4737c7 + +//interface - customize your PY environment first +{uses + Classes, SysUtils, + Windows, Messages, Graphics, Controls, Forms, Dialogs, + StdCtrls, ComCtrls, ExtCtrls, + PythonEngine, Vcl.PythonGUIInputOutput, PythonVersions.pas ; } + +{procedure PyFinalize(); + external + 'Py_Finalize@C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\python37.dll stdcall'; } +//Note: modify PYHOME and PYDLL : + +const //PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; + PYDLL = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\python36.dll'; + PYSCRIPT = 'C:\maXbox\maxbox3\maxbox3\maXbox3\examples\module1maxbox1.py'; + PYSCRIPT2= 'C:\maXbox\maxbox3\maXbox4\examples\896_textclassification.py'; + LB = CR+LF; + +const PyModule = + 'def printData(data): '+#13#10+ + ' return data+data+"/n"'; + +const PYCMD = 'print("this is box")'+LB+ + 'import sys'+LB+ + 'f=open(r"1050pytest21_5powers.txt","w")'+LB+ + 'f.write("Hello PyWorld_mX47580, \n")'+LB+ + 'f.write("This data will be written on the file.")'+LB+ + 'f.close()'; + +var myloadscript: string; + PyForm: TForm; pyMemo: TMemo; + avar: string; pyval: variant; pyint: integer; + + function AddWhereClause4: string; + var + Start: PChar; + Rest, FName, SQL: string; + SQLToken, CurSection: TSQLToken; + begin + Start := PChar(SQL); + CurSection := stUnknown; + repeat + SQLToken := NextSQLToken(Start, FName, CurSection); + until SQLToken in [stFrom, stEnd]; + if SQLToken = stFrom then + NextSQLToken(Start, FName, CurSection); + Rest := string(Start); + if Rest = '' then + Result := SQL + ' ' {+ GenerateParamSQL } + else + Result := Copy(SQL, 1, pos(Rest, SQL)) + ' ' + {GenerateParamSQL +} Rest; + //DecomposeDatabaseName + end; + + +Procedure PYLaz_P4D_Demo2; +//https://wiki.freepascal.org/Python4Delphi +var eng : TPythonEngine; + Out1: TPythonGUIInputOutput; + pystrings: TStrings; +begin + eng:= TPythonEngine.Create(Nil); + Out1:= TPythonGUIInputOutput.create(nil) + Out1.output:= pyMemo; //debugout.output; or memo2; + Out1.RawOutput:= True; + Out1.UnicodeIO:= False; + Out1.maxlines:= 20; + out1.displaystring('this string thing draw the line') + + writeln(botostr(Isx64(PYDLL))); + //writeln(botostr(Isx64(pydllpath2))); + //eng.dllpath:= exepath; + //eng.dllname:='python37.dll'; + eng.pythonhome:= PYHOME; + try + //pymod.InitializeForNewInterpreter; //} + //pymod.engine:= eng; + eng.opendll(PYDLL) + //eng.loadDLL; + eng.IO:= Out1; + eng.traceback + eng.AutoFinalize:= True; + //eng.AutoUnload:= false; + writeln(eng.dllname); + //pymod.engine:= eng; + if eng.IsHandleValid then begin + writeln('DLLhandle: '+botostr(eng.IsHandleValid)) + WriteLn('evens: '+ eng.EvalStringAsStr('[x**2 for x in range(15)]')); + WriteLn('gauss: '+ eng.EvalStringAsStr('sum([x for x in range(101)])')); + WriteLn('gauss2: '+ eng.EvalStr('sum([x % 2 for x in range(10100)])')); + WriteLn('mathstr: '+ eng.EvalStr('"py " * 7')); + WriteLn('builtins: '+ eng.EvalStr('dir(__builtins__)')); + WriteLn('upperstr: '+ eng.EvalStr('"hello again".upper()')); + pymemo.lines.add('workdir: '+ eng.EvalStr('__import__("os").getcwd()')); + writeln('syncheck '+ + botostr(eng.CheckEvalSyntax('print("powers:",[x**2 for x in range(10)])'))); + + WriteLn('powerline1: '+ eng.EvalStr('list(map(int, ["1", "2", "3"]))')); + WriteLn('powerline2: '+ + eng.EvalStr('list(map(float,["1",2,"3.0",4.0,"5",6]))')); + eng.Execstring('sum_of_digits=lambda x: sum(map(int, str(x)))'); + WriteLn('powerline3: '+ eng.EvalStr('sum_of_digits(1789)')); + + eng.Execstring('A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]'); + eng.Execstring('transpose_A = [list(i) for i in zip(*A)]'); + WriteLn('powerline4: '+ eng.EvalStr('transpose_A')); + + //We can use dictionary comprehension to swap key-value pairs. + eng.Execstring('staff={"Data Scientist":"John","Django Developer":"Max"}'); + WriteLn('powerline5: '+ eng.EvalStr('{i:j for j, i in staff.items()}')); + eng.ExecString('print("powers:",[x**2 for x in range(10)])'); + writeln('ExecSynCheck1 '+botostr(eng.CheckExecSyntax(PYCMD))); + eng.ExecString(PYCMD); + + { pystrings:= TStringlist.create; + pystrings.add('import matplotlib.pyplot as plt') + pystrings.add('import numpy as np') + pystrings.add('np.arange(5, 24, 3)') + pystrings.add('fig, ax = plt.subplots(dpi=153)') + pystrings.add('plt.plot([1,2,3,4,5,6], [1,2,3,4,9,5], "go")') + pystrings.add('plt.show()') + eng.ExecStrings4(pystrings); + pystrings.free; } + + (* eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "sympy"])') + eng.ExecString('from sympy import *'); + eng.ExecString('from sympy.plotting import plot'); + writeln(eng.EvalStr('list(primerange(7, 150))')); + writeln(eng.EvalStr('sum(list(primerange(0, 100)))')); + writeln(eng.EvalStr('(list(primerange(0, 101)))')); + writeln(eng.EvalStr('len(list(primerange(0, 101)))')); + //https://www.tutorialspoint.com/sympy/sympy_solvers.htm + avar:= '-2'; + eng.ExecString('x=Symbol("x")'); + eng.ExecString('x,y=symbols("x y")'); + writeln(eng.EvalStr('solveset(Eq(x**2-9,0), x)')); + writeln(eng.EvalStr('solveset(Eq(x**2-3*x,'+avar+'),x)')); + writeln(eng.EvalStr('solveset(exp(x),x)')); + println(eng.EvalStr('linsolve([Eq(x-y,4),Eq( x + y ,1) ], (x, y))')); + *) + + //eng.ExecString('plot(x**'+avar+', line_color="red")'); + //eng.ExecString('plot((sin(x),(x, -2*pi, 2*pi)),(cos(x), (x, -pi, pi)))'); + { + eng.ExecString('from sympy.plotting import plot3d'); + eng.ExecString('x,y=symbols("x y") '); + eng.ExecString('plot3d(x*y, (x, -10,10), (y, -10,10))'); } + + WriteLn('powerline6: '+ eng.EvalStr('len(str(2**4096))')); + pymemo.lines.add('Decimal: '+ + eng.EvalStr('__import__("decimal").Decimal((0,(3,1,4),-2))')); + pymemo.lines.add('Decimal: '+ + eng.EvalStr('__import__("decimal").Decimal(0.1)')); + eng.ExecString('import decimal') + //https://www.w3schools.com/python/python_ref_functions.asp + writeln('is instance: '+eng.EvalStr('isinstance(decimal.Decimal,'+ + '(float, int, str, list, dict, tuple, type))')); + writeln('is type: '+eng.EvalStr('type(str(decimal.Decimal(0.1)))')); + writeln('is type: '+eng.EvalStr('type(float(decimal.Decimal(0.1)))')); + writeln('is type: '+eng.EvalStr('type(decimal.Decimal)')); + writeln('is type: '+eng.EvalStr('type(decimal)')); + //eng.ExecString('from spacy import *'); + //eng.ExecString('from nltk.classify import MaxentClassifier') + //eng.ExecString('import tensorflow') + + eng.ExecString('print("2*4")'); + + pyval:= VarPythonEval('sum([x for x in range(201)])'); + //writeln('evalvar '+botostr(VarIsPythonList(pyval))); + writeln('evalvar '+botostr(VarIsnumeric(pyval))); + pyval:= NewPythonDict; + writeln(botostr(VarIsPython( pyval))); + pyval := (VarPythonEval('2 ** 3')); + { eng.ExecString('import subprocess'); + eng.ExecString('subprocess.call(["pip", "install", "langdetect"])') + eng.ExecString('from langdetect import detect'); + println('lang detect: '+eng.EvalStr('detect("bonjour mes ordinateurs")')); + } + Out1.output:= pyMemo; + pymemo.update; + end + else writeln('invalid library handle! '+Getlasterrortext); + println('PythonOK: '+botostr(PythonOK)); + except + eng.raiseError; + writeln('PyErr '+ExceptionToString(ExceptionType, ExceptionParam)); + //PyErr Exception: Access violation at address 50F49DA6 in module '_multiarray_umath.cp37-win32.pyd'. Write of address 00000022. + finally + //eng.close + eng.unloaddll; + //PyFinalize(); + eng.free; + //PyFinalize(); + end; + out1.free; + //pyImport(PyModule); +end; + +begin //@main + //PythonEngine1.Free; + //myloadscript2:= filetostring(PYSCRIPT2); + + PyForm:= loadForm2(300,200, clgreen,'PyFrm4D'); + pyMemo:= TMemo.create(PyForm); + pyMemo.parent:= PyForm + PyForm.show; + + PYLaz_P4D_Demo2; + + //register_PYthonGUI; +End. +----app_template_loaded_code---- +----File newtemplate.txt not exists - now saved!---- + +doc: https://stackoverflow.com/questions/23134820/unhandled-exception-at-multiarray-pyd-the-2nd-time-the-program-runs#23173191 + +https://stackoverflow.com/questions/16779799/py-initialize-and-py-finalize-and-matplotlib + +Doc: Destroying it calls Py_Finalize, which frees all memory allocated by the Python DLL. +Or, if you're just using the Python API without the VCL wrappers, you can probably just call Py_NewInterpreter on your TPythonInterface object to get a fresh execution environment without necessarily discarding everything done before. + +Evil eval() + +You should never pass untrusted source to the eval() directly. As it is quite easy for the malicious user to wreak havoc on your system. For example, the following code can be used to delete all the files from the system. + +1 >>> +2 eval('os.system("RM -RF /")') # command is deliberately capitalized +3 >>> + + +Ref: https://sourceforge.net/projects/maxbox/files/Examples/EKON/P4D/python37.dll/download +-------------------------------------------------------- +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. +PascalScript maXbox4 - RemObjects & SynEdit + +dll EXCEPT Exception: There is already one instance of TPythonEngine running. +TRUE +Exception: Python is not properly initialized. + +dll EXCEPT Exception: Access violation at address 00345A76 in module 'maXbox4.exe'. Read of address 4365636E. +TRUE +Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AD. + +mapdll EXCEPT Exception: There is already one instance of TPythonEngine running. +PythonOK TRUE +ImportEXCEPT Exception: Access violation at address 6BA3BA66 in module 'python36.dll'. Read of address 000000AC. + mX4 executed: 26/07/2021 13:30:51 Runtime: 0:0:2.48 Memload: 71% use + +Example 3: Python multithreading + +All the programs above in this article are single-threaded programs. Here's an example of a multithreaded Python program. + + +import threading + +def print_hello_three_times(): + for i in range(3): + print("Hello") + +def print_hi_three_times(): + for i in range(3): + print("Hi") + +t1 = threading.Thread(target=print_hello_three_times) +t2 = threading.Thread(target=print_hi_three_times) + +t1.start() +t2.start() + +This package implements JSON support for FPC. + +You might want to have a look at the lazarus jsonviewer tool, written using +fpJSON (see lazarus/tools/jsonviewer). It visualizes the fpJSON data and +shows how to program using fpjson. + +JSON support consists of 3 parts: + +unit fpJSON contains the data representation. Basically, it defines a set of +classes: + +TJSONData ++- TJSONNumber + +- TJSONIntegerNumber + +- TJSONFloatNumber + +- TJSONInt64Number ++- TJSONString ++- TJSONBoolean ++- TJSONNull ++- TJSONObject ++- TJSONArray + +The TJSONData.JSONType property is an enumerated: +TJSONtype = (jtUnknown, jtNumber, jtString, jtBoolean, jtNull, jtArray, jtObject); + +Which allows to determine the type of a value. + +Page 7: But the eval-uation of -> But the evaluation of +page 8: Ans here's the -> And here's the +page 10: The mentioned windows dll file for Python. > The mentioned windows dll file from Python. +page 10: (I'll show that in the Tutor III). -> (I'll show that in the Part 3). +page 14: so we use the same inter-preter as from a shell -> so we use the same from a shell + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/1052_OoMiscpas2PyHTTPSServer2LAB.txt b/Tests/1052_OoMiscpas2PyHTTPSServer2LAB.txt new file mode 100644 index 00000000..45987406 --- /dev/null +++ b/Tests/1052_OoMiscpas2PyHTTPSServer2LAB.txt @@ -0,0 +1,4472 @@ +//program OOMISCPAS; +//https://raw.githubusercontent.com/TurboPack/AsyncPro/master/source/OoMisc.pas +(***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is TurboPower Async Professional + * + * The Initial Developer of the Original Code is + * TurboPower Software + * + * Portions created by the Initial Developer are Copyright (C) 1991-2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Sulaiman Mah + * Sean B. Durkin + * Sebastian Zierer + * + * ***** END LICENSE BLOCK ***** *) + +{*********************************************************} +{* OOMISC.PAS 5.00 *} +{*********************************************************} +{* Miscellaneous supporting methods and types *} +{*********************************************************} + +{ + OOMisc is our catch-all unit for supporting methods and definitions. + OOMisc is used by almost all APRO units, and is automatically included + in the uses clause when an APRO component is dropped on a form. + The APRO base classes are defined here also. + A bit of APRO trivia: OOMisc stands for "Object Oriented Miscellaneous", + and was introduced in the early DOS days. +} + +{Global defines potentially affecting this unit} +//{$I AWDEFINE.INC} + +unit OoMisc_mX4_Python_LAB; + {-Unit for miscellaneous routines, INCOMPLETE!} + +interface + +{uses + Windows, + Classes, + Controls, + ShellAPI, + OleCtrls, + Forms, + Graphics, + MMSystem, + SysUtils, + Messages; } + +const + ApVersionStr = 'v5.00'; + {$IFDEF Apax} + ApaxVersionStr = 'v1.14'; // SWB + {$ENDIF} + + { Product name} + ApdProductName = 'Async Professional'; + ApdShortProductName = 'APRO'; + + ApdVendor = 'TurboPower Software Company'; + ApdVendorURL = 'http://www.turbopower.com/'; + + { Version numbers } + ApdXSLImplementation = 0.0; + ApdXMLSpecification = '1.0'; + + fsPathName = 255; + fsDirectory = 255; + fsFileName = 255; + fsExtension = 255; + fsName = 255; + + {shareable reading file mode} + ApdShareFileRead = $40; + +const + { Printer driver consts } + ApdDefFileName = 'C:\DEFAULT.APF'; + ApdPipeTimeout = 5000; { ms } + ApdPipeName = '\\.\pipe\ApFaxCnv'; + ApdSemaphoreName = 'ApFaxCnvSem'; + ApdRegKey = '\SOFTWARE\TurboPower\ApFaxCnv\Settings'; + ApdIniFileName = 'APFPDENG.INI'; + ApdIniSection = 'Settings'; + ApdIniKey = 'AutoExec'; + ApdDef32PrinterName = 'APF Fax Printer'; + ApdDef16PrinterName = 'Print To Fax'; + ApdDefPrinterPort = 'PRINTFAX'; + + ApdDefaultTerminalName = ''; + ApdNoTerminalName = ''; + + + {Event codes: (inbound)} + eNull = 0; + eStartDoc = 1; + eEndDoc = 2; + + {Event codes: (outbound)} + eSetFileName = 3; + +type + TPipeEvent = record + Event : Byte; + Data : ShortString; + end; + { XML definitions } + aDOMString = WideString; +type + aCharSet = set of AnsiChar; + + TPassString = string; //[255]; + TApdHwnd = HWND; + + + {Standard event timer record structure used by all timing routines} + EventTimer = record + StartTicks : Integer; {Tick count when timer was initialized} + ExpireTicks : Integer; {Tick count when timer will expire} + end; + +{$IFNDEF PRNDRV} {!!.06} +type{ moved from AdTapi.pas } {!!.06} + { TAPI device config record, opaque and undefined by definition } {!!.06} + //PTapiConfigRec = ^TTapiConfigRec; {!!.06} + TTapiConfigRec = record {!!.06} + DataSize : Cardinal; {!!.06} + Data : array[0..1023] of Byte; {!!.06} + end; + +{ moved from AdRasUtl.pas } {!!.06} +const {RasMaximum buffer sizes} {!!.06} + RasMaxDomain = 15; {!!.06} + RasMaxPassword = 256; {!!.06} + RasMaxUserName = 256; {!!.06} + RasMaxEntryName = 256; {!!.06} + RasMaxPhoneBook = 256; {!!.06} + RasMaxError = 256; {!!.06} + RasMaxEntries = 64; {!!.06} + RasMaxDeviceName = 128; {!!.06} + RasMaxDeviceType = 16; {!!.06} + RasMaxPhoneNumber = 128; {!!.06} + RasMaxCallBackNum = 128; {!!.06} + RasMaxAreaCode = 10; {!!.06} + RasMaxPadType = 32; {!!.06} + RasMaxX25Address = 200; {!!.06} + RasMaxIPAddress = 15; {!!.06} + RasMaxIPXAddress = 21; {!!.06} + RasMaxFacilities = 200; {!!.06} + RasMaxUserData = 200; {!!.06} + +type { moved from AdRasUtl.pas } {!!.06} + {RAS IP address - "a.b.c.d"} {!!.06} + //PRasIPAddr = ^TRasIPAddr; {!!.06} + TRasIPAddr = record {!!.06} + a : byte; {!!.06} + b : byte; {!!.06} + c : byte; {!!.06} + d : byte; {!!.06} + end; {!!.06} + +type { moved from AdRasUtl.pas } {!!.06} + {RAS phonebook entry properties} {!!.06} + {!!.06} {Renamed fields to sync with underlying RASENTRY structure } + { dwOptions -> dwfOptions, dwAlternatesOffset -> dwAlternateOffset, } + { dwNetProtocols -> dwfNetProtocols } + //PRasEntry = ^TRasEntry; {!!.06} + TRasEntry = record {!!.06} + dwSize : DWord; {!!.06} + dwfOptions : DWord; {!!.06} + dwCountryID : DWord; {!!.06} + dwCountryCode : DWord; {!!.06} + szAreaCode : array[0..RasMaxAreaCode] of char; {!!.06} // tchar + szLocalPhoneNumber : array[0..RasMaxPhoneNumber] of char; {!!.06} // tchar + dwAlternateOffset : DWord; {!!.06} + IPAddr : TRasIPAddr; {!!.06} + IPAddrDns : TRasIPAddr; {!!.06} + IPAddrDnsAlt : TRasIPAddr; {!!.06} + IPAddrWins : TRasIPAddr; {!!.06} + IPAddrWinsAlt : TRasIPAddr; {!!.06} + dwFrameSize : DWord; {!!.06} + dwfNetProtocols : DWord; {!!.06} + dwFramingProtocol : DWord; {!!.06} + szScript : array[0..Max_PATH-1] of char; {!!.06} // --SZ TCHAR in ras.h, so use char here + szAutodialDll : array[0..Max_PATH-1] of char; {!!.06} + szAutodialFunc : array[0..Max_PATH-1] of char; {!!.06} + szDeviceType : array[0..RasMaxDeviceType] of char; {!!.06} + szDeviceName : array[0..RasMaxDeviceName] of char; {!!.06} + szX25PadType : array[0..RasMaxPadType] of char; {!!.06} + szX25Address : array[0..RasMaxX25Address] of char; {!!.06} + szX25Facilities : array[0..RasMaxFacilities] of char; {!!.06} + szX25UserData : array[0..RasMaxUserData] of char; {!!.06} + dwChannels : DWord; {!!.06} + dwReserved1 : DWord; {!!.06} + dwReserved2 : DWord; {!!.06} + end; {!!.06} + +const {RASENTRY 'dwfOptions' bit flags} {!!.06} + RASEO_UseCountryAndAreaCodes = $00000001; {!!.06} + RASEO_SpecificIpAddr = $00000002; {!!.06} + RASEO_SpecificNameServers = $00000004; {!!.06} + RASEO_IpHeaderCompression = $00000008; {!!.06} + RASEO_RemoteDefaultGateway = $00000010; {!!.06} + RASEO_DisableLcpExtensions = $00000020; {!!.06} + RASEO_TerminalBeforeDial = $00000040; {!!.06} + RASEO_TerminalAfterDial = $00000080; {!!.06} + RASEO_ModemLights = $00000100; {!!.06} + RASEO_SwCompression = $00000200; {!!.06} + RASEO_RequireEncryptedPw = $00000400; {!!.06} + RASEO_RequireMsEncryptedPw = $00000800; {!!.06} + RASEO_RequireDataEncryption = $00001000; {!!.06} + RASEO_NetworkLogon = $00002000; {!!.06} + RASEO_UseLogonCredentials = $00004000; {!!.06} + RASEO_PromoteAlternates = $00008000; {!!.06} + RASEO_SecureLocalFiles = $00010000; {!!.06} + RASEO_RequireEAP = $00020000; {!!.06} + RASEO_RequirePAP = $00040000; {!!.06} + RASEO_RequireSPAP = $00080000; {!!.06} + RASEO_Custom = $00100000; {!!.06} + RASEO_PreviewPhoneNumber = $00200000; {!!.06} + RASEO_SharedPhoneNumbers = $00800000; {!!.06} + RASEO_PreviewUserPw = $01000000; {!!.06} + RASEO_PreviewDomain = $02000000; {!!.06} + RASEO_ShowDialingProgress = $04000000; {!!.06} + RASEO_RequireCHAP = $08000000; {!!.06} + RASEO_RequireMsCHAP = $10000000; {!!.06} + RASEO_RequireMsCHAP2 = $20000000; {!!.06} + RASEO_RequireW95MSCHAP = $40000000; {!!.06} + RASEO_CustomScript = $80000000; {!!.06} + + {RASENTRY 'dwfNetProtocols' bit flags} {!!.06} + RASNP_NetBEUI = $00000001; {!!.06} + RASNP_Ipx = $00000002; {!!.06} + RASNP_Ip = $00000004; {!!.06} + + {RASENTRY 'dwFramingProtocols' bit flags} {!!.06} + RASFP_Ppp = $00000001; {!!.06} + RASFP_Slip = $00000002; {!!.06} + RASFP_Ras = $00000004; {!!.06} + + {RASENTRY 'szDeviceType' default strings} {!!.06} + RASDT_Modem = 'modem'; {!!.06} + RASDT_Isdn = 'isdn'; {!!.06} + RASDT_X25 = 'x25'; {!!.06} + RASDT_Vpn = 'vpn'; {!!.06} + RASDT_Pad = 'pad'; {!!.06} + RASDT_Generic = 'GENERIC'; {!!.06} + RASDT_Serial = 'SERIAL'; {!!.06} + RASDT_FrameRelay = 'FRAMERELAY'; {!!.06} + RASDT_Atm = 'ATM'; {!!.06} + RASDT_Sonet = 'SONET'; {!!.06} + RASDT_SW56 = 'SW56'; {!!.06} + RASDT_Irda = 'IRDA'; {!!.06} + RASDT_Parallel = 'PARALLEL'; {!!.06} + +type + //PRasStatistics = ^TRasStatistics; {!!.06} + TRasStatistics = record {!!.06} + dwSize : DWORD; {!!.06} + dwBytesXmited : DWORD; {!!.06} + dwBytesRcved : DWORD; {!!.06} + dwFramesXmited : DWORD; {!!.06} + dwFramesRcved : DWORD; {!!.06} + dwCrcErr : DWORD; {!!.06} + dwTimeoutErr : DWORD; {!!.06} + dwAlignmentErr : DWORD; {!!.06} + dwHardwareOverrunErr : DWORD; {!!.06} + dwFramingErr : DWORD; {!!.06} + dwBufferOverrunErr : DWORD; {!!.06} + dwCompressionRatioIn : DWORD; {!!.06} + dwCompressionRatioOut : DWORD; {!!.06} + dwBps : DWORD; {!!.06} + dwConnectDuration : DWORD; {!!.06} + end; {!!.06} +{$ENDIF} {!!.06} +const + {Compile-time configurations} + MaxComHandles = 50; {Max comm ports open at once} + DispatchBufferSize = 8192; {Size of each port's dispatch buffer} + MaxMessageLen = 80; {All error and status strings less than 80} + + {For skipping line parameter changes} + DontChangeBaud = 0; + DontChangeParity = SpaceParity + 1; + DontChangeDatabits = 9; + DontChangeStopbits = TwoStopbits + 1; + + {Modem status trigger options} + msCTSDelta = $0010; + msDSRDelta = $0020; + msRingDelta = $0004; + msDCDDelta = $0080; + + {Line status trigger options} + lsOverrun = $0001; + lsParity = $0002; + lsFraming = $0004; + lsBreak = $0008; + + {Line and driver errors} + leNoError = 0; {No error, ordinal value matches ecOK} + leBuffer = 1; {Buffer overrun in COMM.DRV} + leOverrun = 2; {UART receiver overrun} + leParity = 3; {UART receiver parity error} + leFraming = 4; {UART receiver framing error} + leCTSTO = 5; {Transmit timeout waiting for CTS} + leDSRTO = 6; {Transmit timeout waiting for DSR} + leDCDTO = 7; {Transmit timeout waiting for RLSD} + leTxFull = 8; {Transmit queue is full} + leBreak = 9; {Break condition received} + leIOError = 10; {Windows error. LastWinError contains the error code.} + + {Status trigger subtypes} + stNotActive = 0; {not active} + stModem = 1; {Trigger on modem status change} + stLine = 2; {Trigger on line status change} + stOutBuffFree = 3; {Trigger on outbuff free level} + stOutBuffUsed = 4; {Trigger on outbuff used level} + stOutSent = 5; {Trigger on any PutXxx call} + + {Next file method} + nfNone = 0; {No next file method specified} + nfMask = 1; {Use built-in next file mask method} + nfList = 2; {Use built-in next file list method} + + {Action to take if incoming file exists} + wfcWriteNone = 0; {No option set yet} + wfcWriteFail = 1; {Fail the open attempt} + wfcWriteRename = 2; {Rename the incoming file} + wfcWriteAnyway = 3; {Overwrite the existing file} + wfcWriteResume = 4; {Resume an interrupted receive} + + {Ascii CR/LF translation options} + aatNone = 0; {No CR/LF translations} + atStrip = 1; {Strip CRs or LFs} + atAddCRBefore = 2; {Add CR before each LF} + atAddLFAfter = 3; {Add LF after each CR} + //atEOFMarker : Ansichar = ^Z; {Add constant for standard EOF } + + {Protocol status start/end flags} + apFirstCall = $01; {Indicates the first call to status} + apLastCall = $02; {Indicates the last call to status} + + {For specifying log file calls} + lfReceiveStart = 0; {Receive starting} + lfReceiveOk = 1; {File received ok} + lfReceiveFail = 2; {File receive failed} + lfReceiveSkip = 3; {File was rejected by receiver} + lfTransmitStart = 4; {Transmit starting} + lfTransmitOk = 5; {File was transmitted ok} + lfTransmitFail = 6; {File transmit failed} + lfTransmitSkip = 7; {File was skipped, rejected by receiver} + +type + {Convenient types used by protocols} + TNameCharArray = array[0..fsFileName ] of AnsiChar; //SZ used by protocols --> Ansi + TExtCharArray = array[0..fsExtension] of AnsiChar; + TPathCharArray = array[0..fsPathName ] of Char; + TPathCharArrayA = array[0..fsPathName ] of AnsiChar; //SZ FIXME can this be changed to Char?? + TDirCharArray = array[0..fsDirectory] of AnsiChar; + TChar20Array = array[0..20] of AnsiChar; + aTCharArray = array[0..255] of AnsiChar; + + {For generic buffer typecasts} + //PByteBuffer = ^TByteBuffer; + TByteBuffer = array[1..65535] of Byte; + + {Port characteristic constants} + //aTDatabits = 5..DontChangeDatabits; + //TStopbits = 1..DontChangeStopbits; + + {NotifyProc type, same as a window procedure} + TApdNotifyProc = procedure(Msg, wParam : Cardinal; + lParam : Integer); + TApdNotifyEvent = procedure(Msg, wParam : Cardinal; + lParam : Integer); // of object; +const + {Avoid requiring WIN31} + ev_CTSS = $0400; {CTS state} + ev_DSRS = $0800; {DSR state} + ev_RLSDS = $1000; {RLSD state} + ev_RingTe = $2000; {Ring trailing edge indicator} + +const + {MSRShadow register from COMM.DRV} + MsrShadowOfs = 35; {Offset of MSRShadow from EventWord} + +const + {Modem status bit masks} + DeltaCTSMask = $01; {CTS changed since last read} + DeltaDSRMask = $02; {DSR changed since last read} + DeltaRIMask = $04; {RI changed since last read} + DeltaDCDMask = $08; {DCD changed since last read} + CTSMask = $10; {Clear to send} + DSRMask = $20; {Data set ready} + RIMask = $40; {Ring indicator} + DCDMask = $80; {Data carrier detect} + +const + {Message base} + apw_First = $7E00; {Sets base for all APW messages} + +const + {Custom message types} + apw_TriggerAvail = apw_First+1; {Trigger for any data avail} + apw_TriggerData = apw_First+2; {Trigger data} + apw_TriggerTimer = apw_First+3; {Trigger timer} + apw_TriggerStatus = apw_First+4; {Status change (modem, line, buffer)} + apw_FromYmodem = apw_First+5; {Tells Xmodem it was called from Ymodem} + apw_PortOpen = apw_First+8; {Apro, tell users port open} + apw_PortClose = apw_First+9; {Apro, tell users port closed} + apw_ClosePending = apw_First+10; {Apro, tell ourself that the port was closed} + +const + {Protocol message types} + apw_ProtocolCancel = apw_First+20; {To protocol - chk for protcl abort} + apw_ProtocolStatus = apw_First+21; {From protocol - update status display} + apw_ProtocolLog = apw_First+22; {From protocol - LogFile message} + apw_ProtocolNextFile = apw_First+23; {From protocol - return next file} + apw_ProtocolAcceptFile = apw_First+24; {From protocol - accept file} + apw_ProtocolFinish = apw_First+25; {From protocol - protocol is finished} + apw_ProtocolResume = apw_First+26; {From protocol - resume request} + apw_ProtocolError = apw_First+27; {From protocol - error during protocol} + apw_ProtocolAbort = apw_First+28; {To protocol - abort the transfer} + +const + {Modem message types} + apw_AutoAnswer = apw_First+40; {To modem, enter AutoAnswer} + apw_CancelCall = apw_First+41; {To modem, cancel the call} + apw_StartDial = apw_First+42; {To modem, start the process} + + {deprecated modem message types, note that some conflict with new messages} + apw_ModemOk = apw_First+40; {From modem - got OK response} + apw_ModemConnect = apw_First+41; {From modem - got CONNECT response} + apw_ModemBusy = apw_First+42; {From modem - got BUSY response} + apw_ModemVoice = apw_First+43; {From modem - got VOICE response} + apw_ModemNoCarrier = apw_First+44; {From modem - got NO CARRIER response} + apw_ModemNoDialTone = apw_First+45; {From modem - got NO DIALTONE response} + apw_ModemError = apw_First+46; {From modem - got ERROR response} + apw_GotLineSpeed = apw_First+47; {From modem - got connect speed} + apw_GotErrCorrection = apw_First+48; {From modem - got EC response} + apw_GotDataCompression = apw_First+49; {From modem - got compression response} + apw_CmdTimeout = apw_First+50; {From modem - command timed out} + apw_DialTimeout = apw_First+51; {From modem - dial timed out} + apw_AnswerTimeout = apw_First+52; {From modem - answer timed out} + apw_DialCount = apw_First+53; {From modem - dial still in progress} + apw_AnswerCount = apw_First+54; {From modem - answer still in progress} + apw_ModemRing = apw_First+55; {From modem - phone rang} + apw_ModemIsConnected = apw_First+56; {From modem - connection completed} + apw_ConnectFailed = apw_First+57; {From modem - connection failed} + apw_CommandProcessed = apw_First+58; {From modem - finished command} + +const + {Terminal message types} + apw_TermStart = apw_First+60; {To terminal - start} + apw_TermStop = apw_First+61; {To terminal - stop} + apw_TermSetCom = apw_First+62; {To terminal - set com handle} + apw_TermRelCom = apw_First+63; {To terminal - release com handle} + apw_TermSetEmuPtr = apw_First+64; {To terminal - set emulator pointer} + apw_TermSetEmuProc = apw_First+65; {To terminal - set emulator proc} + apw_TermClear = apw_First+66; {To terminal - clear window} + apw_TermBuffer = apw_First+67; {To terminal - alloc new buffers} + apw_TermColors = apw_First+68; {To terminal - set new colors} + apw_TermToggleScroll = apw_First+69; {To terminal - toggle scrollback} + apw_TermCapture = apw_First+70; {To terminal - set capture mode} + apw_TermStuff = apw_First+71; {To terminal - stuff data} + apw_TermPaint = apw_First+72; {To terminal - update screen} + apw_TermSetWndProc = apw_First+73; {To terminal - set window proc} + apw_TermColorsH = apw_First+74; {To terminal - set highlight colors} + apw_TermSave = apw_First+75; {To terminal - save/restore} + apw_TermColorMap = apw_First+76; {To terminal - get/set color map} + apw_TermForceSize = apw_First+77; {To terminal - force new size} + apw_TermFontSize = apw_First+78; {To terminal - get font size} + +const + apw_TermStatus = apw_First+80; {From terminal - show status} + apw_TermBPlusStart = apw_First+81; {From terminal - B+ is starting} + apw_TermError = apw_First+82; {From terminal - error} + apw_CursorPosReport = apw_First+83; {From terminal - Cursor Pos Report} + +const + apw_FaxCvtStatus = apw_First+90; {From fax converter - show status} + apw_FaxUnpStatus = apw_First+91; {From fax unpacker - show status} + apw_FaxOutput = apw_First+92; {From fax unpacker - output line} + +const + apw_ViewSetFile = apw_First+100; {To fax viewer - change file name} + apw_ViewSetFG = apw_First+101; {To fax viewer - set foreground color} + apw_ViewSetBG = apw_First+102; {To fax viewer - set background color} + apw_ViewSetScale = apw_First+103; {To fax viewer - set scale factors} + apw_ViewSetScroll = apw_First+104; {To fax viewer - set scroll increments} + apw_ViewSelectAll = apw_First+105; {To fax viewer - select entire image} + apw_ViewSelect = apw_First+106; {To fax viewer - select image rect} + apw_ViewCopy = apw_First+107; {To fax viewer - copy data to cboard} + apw_ViewSetWndProc = apw_First+108; {To fax viewer - set window procedure} + apw_ViewSetWhitespace = apw_First+109; {To fax viewer - set whitespace comp} + apw_ViewGetBitmap = apw_First+110; {To fax viewer - get memory bmp} + apw_ViewGetNumPages = apw_First+111; {To fax viewer - get num pages} + apw_ViewStartUpdate = apw_First+112; {To fax viewer - start scale update} + apw_ViewEndUpdate = apw_First+113; {To fax viewer - end scale upate} + apw_ViewGotoPage = apw_First+114; {To fax viewer - go to a page} + apw_ViewGetCurPage = apw_First+115; {To fax viewer - get current page #} + apw_ViewSetDesignMode = apw_First+116; {To fax viewer - indicate in design} + apw_ViewSetRotation = apw_First+117; {To fax viewer - set rotation} + apw_ViewSetAutoScale = apw_First+118; {To fax viewer - auto scaling} + apw_ViewNotifyPage = apw_First+119; {To fax viewer - notify of page chg} + apw_ViewGetPageDim = apw_First+120; {To fax viewer - get pg dimensions} + apw_ViewSetLoadWholeFax= apw_First+121; {To fax viewer - set load whole fax} + apw_ViewSetBusyCursor = apw_First+122; {To fax viewer - set cursor for busy} + apw_ViewerError = apw_First+123; {Fax viewer error report} + apw_ViewGetPageFlags = apw_First+124; {To fax viewer - get pg flags} + apw_ViewGetFileName = apw_First+125; {To fax viewer - get file name} + +const + apw_TermBlinkTimeChange = apw_First+130; {set new blink time} + apw_TermPersistentMarkChange = apw_First+131; {set persistent blocks} + apw_TermSetKeyEmuPtr = apw_First+132; {set Key Emulator pointer } + apw_TermSetKeyEmuProc = apw_First+133; {set Key Emulator proc } + apw_TermSetHalfDuplex = apw_First+134; {set Duplex mode} + apw_TermGetBuffPtr = apw_First+135; {get a pointer to term buffer} + apw_TermGetClientLine = apw_First+136; {get the first client line in buffer} + apw_TermWaitForPort = apw_First+137; {wait for the port to open}{!!.03} + apw_TermNeedsUpdate = apw_First+138; {update needed} {!!.05} + +const + apw_PrintDriverJobCreated = apw_First+140; {printer driver created fax job} + apw_BeginDoc = apw_First+141; {printer driver starts printing} + apw_EndDoc = apw_First+142; {printer driver has finished printing} + apw_AddPrim = apw_First+143; {internal FaxSrvx sample message} + apw_EndPage = apw_First+144; {printer driver EndOfPage/idShell} + +const + apw_FaxCancel = apw_First+160; {To fax - cancel the session} + apw_FaxNextfile = apw_First+161; {From fax - return next fax to send} + apw_FaxStatus = apw_First+162; {From fax - show the fax status} + apw_FaxLog = apw_First+163; {From fax - log the fax start/stop} + apw_FaxName = apw_First+164; {From fax - name the incoming fax} + apw_FaxAccept = apw_First+165; {From fax - accept this fax?} + apw_FaxError = apw_First+166; {From fax - session had error} + apw_FaxFinish = apw_First+167; {From fax - session finished} + +const + apw_TapiWaveMessage = apw_First+180; {Tapi wave event message} + apw_TapiEventMessage = apw_First+181; {Tapi general event message} + apw_VoIPEventMessage = apw_First+182; {AdVoIP general event message} + apw_VoIPNotifyMessage = apw_First+183; {AdVoIP internal notification message} + +const + apw_StateDeactivate = apw_First+190; {State deactivation message } + apw_StateChange = apw_First+191; {from State to StateMachine } + +const + apw_SapiTrain = apw_First+192; {Sapi training requested} + apw_SapiPhoneCallBack = apw_First+193; {Sapi AskFor phrase return} + apw_SapiInfoPhrase = apw_First+194; {Sapi TAPI connection status} + +const + apw_PgrStatusEvent = apw_First+200; {Pager status event} + +const + {Window class names} + DispatcherClassName = 'awDispatch'; + ProtocolClassName = 'awProtocol'; + TerminalClassName = 'awTerminal'; + MessageHandlerClassName = 'awMsgHandler'; + FaxViewerClassName = 'awViewer'; + FaxViewerClassNameDesign = 'dcViewer'; + TerminalClassNameDesign = 'dcTerminal'; + FaxHandlerClassName = 'awFaxHandler'; + +const + {Error groups} + egDos = -0; {DOS, DOS critical and file I/O} + egGeneral = -1; {General errors} + egOpenComm = -2; {OpenComm errors} + egSerialIO = -3; {Errors during serial I/O processing} + egModem = -4; {Errors during modem processing} + egTrigger = -5; {Error setting up triggers} + egProtocol = -6; {Errors that apply to one or more protocols} + egINI = -7; {INI database errors} + egFax = -8; {FAX errors} + egAdWinsock = 9; {APro specific Winsock errors} + egWinsock = 10; {Winsock errors} + egWinsockEx = 11; {Additional Winsock errors} + egTapi = -13; {TAPI errors} + +const + { Below are all error codes used by APRO -- resource IDs are Abs(ErrorCode) } + { The corresponding strings can be found in APW.STR and AdExcept.inc. If } + { you are adding strings, it's best to go there first to 'stake a claim' on } + { an appropriate range of IDs -- since constants for some status strings } + { are found in the applicable component's unit instead of here... } + + {No error} + aecOK = 0; {Okay} + +const + {egDOS} + ecFileNotFound = -2; {File not found} + ecPathNotFound = -3; {Path not found} + ecTooManyFiles = -4; {Too many open files} + ecAccessDenied = -5; {File access denied} + ecInvalidHandle = -6; {Invalid file handle} + ecOutOfMemory = -8; {Insufficient memory} + ecInvalidDrive = -15; {Invalid drive} + ecNoMoreFiles = -18; {No more files} + ecDiskRead = -100; {Attempt to read beyond end of file} + ecDiskFull = -101; {Disk is full} + ecNotAssigned = -102; {File not Assign-ed} + ecNotOpen = -103; {File not open} + ecNotOpenInput = -104; {File not open for input} + ecNotOpenOutput = -105; {File not open for output} + ecWriteProtected = -150; {Disk is write-protected} + ecUnknownUnit = -151; {Unknown disk unit} + ecDriveNotReady = -152; {Drive is not ready} + ecUnknownCommand = -153; {Unknown command} + ecCrcError = -154; {Data error} + ecBadStructLen = -155; {Bad request structure length} + ecSeekError = -156; {Seek error} + ecUnknownMedia = -157; {Unknown media type} + ecSectorNotFound = -158; {Disk sector not found} + ecOutOfPaper = -159; {Printer is out of paper} + ecDeviceWrite = -160; {Device write error} + ecDeviceRead = -161; {Device read error} + ecHardwareFailure = -162; {General failure} + +const + {egGeneral} + ecBadHandle = -1001; {Bad handle passed to com function} + ecBadArgument = -1002; {Bad argument passed to function} + ecGotQuitMsg = -1003; {Yielding routine got WM_QUIT message} + ecBufferTooBig = -1004; {Terminal buffer size too big} + ecPortNotAssigned = -1005; {ComPort component not assigned} + ecInternal = -1006; {Internal INIDB errors} + ecModemNotAssigned = -1007; {Modem component not assigned} + ecPhonebookNotAssigned = -1008; {Phonebook component not assgnd} + ecCannotUseWithWinSock = -1009; {Component not compatible with WinSock} + +const + {egOpenComm} + ecBadId = -2001; {ie_BadId - bad or unsupported ID} + ecBaudRate = -2002; {ie_Baudrate - unsupported baud rate} + ecByteSize = -2003; {ie_Bytesize - invalid byte size} + ecDefault = -2004; {ie_Default - error in default parameters} + ecHardware = -2005; {ie_Hardware - hardware not present} + ecMemory = -2006; {ie_Memory - unable to allocate queues} + ecCommNotOpen = -2007; {ie_NOpen - device not open} + ecAlreadyOpen = -2008; {ie_Open - device already open} + ecNoHandles = -2009; {No more handles, can't open port} + ecNoTimers = -2010; {No timers available} + ecNoPortSelected = -2011; {No port selected (attempt to open com0)} + ecNotOpenedByTapi = -2012; {Comport was not opened by Tapi} + +const + {egSerialIO} + ecNullApi = -3001; {No device layer specified} + ecNotSupported = -3002; {Function not supported by driver} + ecRegisterHandlerFailed = -3003; {EnableCommNotification failed} + ecPutBlockFail = -3004; {Failed to put entire block} + ecGetBlockFail = -3005; {Failed to get entire block} + ecOutputBufferTooSmall = -3006; {Output buffer too small for block} + ecBufferIsEmpty = -3007; {Buffer is empty} + ecTracingNotEnabled = -3008; {Tracing not enabled} + ecLoggingNotEnabled = -3009; {Logging not enabled} + ecBaseAddressNotSet = -3010; {Base addr not found, RS485 mode} + +const + {Modem/Pager} + ecModemNotStarted = -4001; {StartModem has not been called} + ecModemBusy = -4002; {Modem is busy elsewhere} + ecModemNotDialing = -4003; {Modem is not currently dialing} + ecNotDialing = -4004; {TModemDialer is not dialing} + ecAlreadyDialing = -4005; {TModemdialer is already dialing} + ecModemNotResponding = -4006; {No response from modem} + ecModemRejectedCommand = -4007; {Bad command sent to modem} + ecModemStatusMismatch = -4008; {Wrong modem status requested} + + ecDeviceNotSelected = -4009; { Um, the modem wan't selected } + ecModemDetectedBusy = -4010; { Modem detected busy signal } + ecModemNoDialtone = -4011; { No dialtone detected } + ecModemNoCarrier = -4012; { No carrier from modem } + ecModemNoAnswer = -4013; { Modem returned No Answer response } + + { Pager } + ecInitFail = -4014; { Modem initialization failure } + ecLoginFail = -4015; { Login Failure } + ecMinorSrvErr = -4016; { SNPP - Minor Server Error } + ecFatalSrvErr = -4017; { SNPP - Fatal Server Error } + +const + {LibModem} + ecModemNotFound = -4020; { Modem not found in modemcap } + ecInvalidFile = -4021; { a modemcap file is invalid } + +const {RAS connection status codes} + csOpenPort = 4500; + csPortOpened = 4501; + csConnectDevice = 4502; + csDeviceConnected = 4503; + csAllDevicesConnected = 4504; + csAuthenticate = 4505; + csAuthNotify = 4506; + csAuthRetry = 4507; + csAuthCallback = 4508; + csAuthChangePassword = 4509; + csAuthProject = 4510; + csAuthLinkSpeed = 4511; + csAuthAck = 4512; + csReAuthenticate = 4513; + csAuthenticated = 4514; + csPrepareForCallback = 4515; + csWaitForModemReset = 4516; + csWaitForCallback = 4517; + csProjected = 4518; + + csStartAuthentication = 4519; + csCallbackComplete = 4520; + csLogonNetwork = 4521; + csSubEntryConnected = 4522; + csSubEntryDisconnected = 4523; + csRasInteractive = 4550; + csRasRetryAuthentication = 4551; + csRasCallbackSetByCaller = 4552; + csRasPasswordExpired = 4553; + csRasDeviceConnected = 4599; + csRasBaseEnd = csSubEntryDisconnected; + csRasPaused = $1000; + csInteractive = csRasPaused; + csRetryAuthentication = csRasPaused + 1; + csCallbackSetByCaller = csRasPaused + 2; + csPasswordExpired = csRasPaused + 3; + csRasPausedEnd = csRasPaused + 3; + + csRasConnected = $2000; + csRasDisconnected = csRasConnected + 1; + + { Protocols } + { If strings are added -- apStatusMsg needs to be changed in AWABSPCL.PAS } + +const + psOK = 4700; {Protocol is ok} + psProtocolHandshake = 4701; {Protocol handshaking in progress} + psInvalidDate = 4702; {Bad date/time stamp received and ignored} + psFileRejected = 4703; {Incoming file was rejected} + psFileRenamed = 4704; {Incoming file was renamed} + psSkipFile = 4705; {Incoming file was skipped} + psFileDoesntExist = 4706; {Incoming file doesn't exist locally, skipped} + psCantWriteFile = 4707; {Incoming file skipped due to Zmodem options} + psTimeout = 4708; {Timed out waiting for something} + psBlockCheckError = 4709; {Bad checksum or CRC} + psLongPacket = 4710; {Block too long} + psDuplicateBlock = 4711; {Duplicate block received and ignored} + psProtocolError = 4712; {Error in protocol} + psCancelRequested = 4713; {Cancel requested} + psEndFile = 4714; {At end of file} + psResumeBad = 4715; {B+ host refused resume request} + psSequenceError = 4716; {Block was out of sequence} + psAbortNoCarrier = 4717; {Aborting on carrier loss} + psAbort = 4730; {Session aborted} + +const + {Specific to certain protocols} + psGotCrcE = 4718; {Got CrcE packet (Zmodem)} + psGotCrcG = 4719; {Got CrcG packet (Zmodem)} + psGotCrcW = 4720; {Got CrcW packet (Zmodem)} + psGotCrcQ = 4721; {Got CrcQ packet (Zmodem)} + psTryResume = 4722; {B+ is trying to resume a download} + psHostResume = 4723; {B+ host is resuming} + psWaitAck = 4724; {Waiting for B+ ack (internal)} + +const + {Internal} + psNoHeader = 4725; {Protocol is waiting for header (internal)} + psGotHeader = 4726; {Protocol has header (internal)} + psGotData = 4727; {Protocol has data packet (internal)} + psNoData = 4728; {Protocol doesn't have data packet yet (internal)} + + { Constants for fax strings } + { If strings are added -- afStatusMsg needs to be changed in AWABSFAX.PAS } +const + {Fax progress codes, sending} + fpInitModem = 4801; {Initializing modem for fax processing} + fpDialing = 4802; {Dialing} + fpBusyWait = 4803; {Busy, FaxTransmit is waiting} + fpSendPage = 4804; {Sending document page data} + fpSendPageStatus = 4805; {Send EOP} + fpPageError = 4806; {Error sending page} + fpPageOK = 4807; {Page accepted by remote} + fpConnecting = 4808; {Send call handoff connecting} + +const + {Fax progress codes, receiving} + fpWaiting = 4820; {Waiting for incoming call} + fpNoConnect = 4821; {No connect on this call} + fpAnswer = 4822; {Answering incoming call} + fpIncoming = 4823; {Incoming call validated as fax} + fpGetPage = 4824; {Getting page data} + fpGetPageResult = 4825; {Getting end-of-page signal} + fpCheckMorePages = 4826; {getting end-of-document status} + fpGetHangup = 4827; {Get hangup command} + fpGotHangup = 4828; {Got Class 2 FHNG code} + +const + {Fax server codes } + fpSwitchModes = 4830; {Switching from send/recv or recv/send} + fpMonitorEnabled = 4831; {Monitoring for incoming faxes} + fpMonitorDisabled = 4832; {Not monitoring for incoming faxes} + +const + {Fax progress codes, common} + fpSessionParams = 4840; {Getting connection params} + fpGotRemoteID = 4841; {got called-station ID} + fpCancel = 4842; {User abort} + fpFinished = 4843; {Finished with this fax} + +const + {Trigger errors} + ecNoMoreTriggers = -5001; {No more trigger slots} + ecTriggerTooLong = -5002; {Data trigger too long} + ecBadTriggerHandle = -5003; {Bad trigger handle} + +const + {Packet errors} + ecStartStringEmpty = -5501; {Start string is empty} + ecPacketTooSmall = -5502; {Packet size cannot be smaller than start string} + ecNoEndCharCount = -5503; {CharCount packets must have an end-condition} + ecEmptyEndString = -5504; {End string is empty} + ecZeroSizePacket = -5505; {Packet size cannot be zero} + ecPacketTooLong = -5506; {Packet too long} + +const + {Protocol errors} + ecBadFileList = -6001; {Bad format in file list} + ecNoSearchMask = -6002; {No search mask specified during transmit} + ecNoMatchingFiles = -6003; {No files matched search mask} + ecDirNotFound = -6004; {Directory in search mask doesn't exist} + ecCancelRequested = -6005; {Cancel requested} + aecTimeout = -6006; {Fatal time out} + ecProtocolError = -6007; {Unrecoverable event during protocol} + ecTooManyErrors = -6008; {Too many errors during protocol} + ecSequenceError = -6009; {Block sequence error in Xmodem} + ecNoFilename = -6010; {No filename specified in protocol receive} + ecFileRejected = -6011; {File was rejected} + ecCantWriteFile = -6012; {Cant write file} + ecTableFull = -6013; {Kermit window table is full, fatal error} + ecAbortNoCarrier = -6014; {Aborting due to carrier loss} + ecBadProtocolFunction = -6015; {Function not support by protocol} + ecProtocolAbort = -6016; {Session aborted} + +const + {INI database} + ecKeyTooLong = -7001; {Key string too long} + ecDataTooLarge = -7002; {Data string too long} + ecNoFieldsDefined = -7003; {No fields defined in database} + ecIniWrite = -7004; {Generic INI file write error} + ecIniRead = -7005; {Generic INI file read error} + ecNoIndexKey = -7006; {No index defined for database} + ecRecordExists = -7007; {Record already exists} + ecRecordNotFound = -7008; {Record not found in database} + ecMustHaveIdxVal = -7009; {Invalid index key name} + ecDatabaseFull = -7010; {Maximum database records (999) reached} + ecDatabaseEmpty = -7011; {No records in database} + ecDatabaseNotPrepared = -7012; {iPrepareIniDatabase not called} + ecBadFieldList = -7013; {Bad field list in INIDB} + ecBadFieldForIndex = -7014; {Bad field for index in INIDB} + +const {!!.04} + {State Machine} {!!.04} + ecNoStateMachine = -7500; {No state machine} {!!.04} + ecNoStartState = -7501; {StartState not set} {!!.04} + ecNoSapiEngine = -7502; {SAPI Engine not set} {!!.04} + +const + ecFaxBadFormat = -8001; {File is not an APF file} + ecBadGraphicsFormat = -8002; {Unsupported graphics file format} + ecConvertAbort = -8003; {User aborted fax conversion} + ecUnpackAbort = -8004; {User aborted fax unpack} + ecCantMakeBitmap = -8005; {CreateBitmapIndirect API failure} + ecNoImageLoaded = -8050; {no image loaded into viewer} + ecNoImageBlockMarked = -8051; {no block of image marked} + ecFontFileNotFound = -8052; {APFAX.FNT not found, or resource bad} + ecInvalidPageNumber = -8053; {Invalid page number specified for fax} + ecBmpTooBig = -8054; {BMP size exceeds Windows' maxheight of 32767} + ecEnhFontTooBig = -8055; {Font selected for enh text converter too large} + +const + ecFaxBadMachine = -8060; {Fax incompatible with remote fax} + ecFaxBadModemResult = -8061; {Bad response from modem} + ecFaxTrainError = -8062; {Modems failed to train} + ecFaxInitError = -8063; {Error while initializing modem} + ecFaxBusy = -8064; {Called fax number was busy} + ecFaxVoiceCall = -8065; {Called fax number answered with voice} + ecFaxDataCall = -8066; {Incoming data call} + ecFaxNoDialTone = -8067; {No dial tone} + ecFaxNoCarrier = -8068; {Failed to connect to remote fax} + ecFaxSessionError = -8069; {Fax failed in mid-session} + ecFaxPageError = -8070; {Fax failed at page end} + ecFaxGDIPrintError = -8071; {NextBand GDI error in fax print driver} + ecFaxMixedResolution = -8072; {Multiple resolutions in one session} + ecFaxConverterInitFail = -8073; {Initialization of fax converter failed} + ecNoAnswer = -8074; {Remote fax did not answer} + ecAlreadyMonitored = -8075; {MonitorDir already being used} + ecFaxMCFNoAnswer = -8076; {Remote disconnected after last page}{!!.06} + +const + ecUniAlreadyInstalled = -8080; {Unidrv support files already installed} + ecUniCannotGetSysDir = -8081; {Cannot determine windows system dir} + ecUniCannotGetWinDir = -8082; {Cannot determine windows dir} + ecUniUnknownLayout = -8083; {Cannot determine setup file layout} + ecUniCannotInstallFile = -8085; {Cannot install Unidrv files to system dir} + ecRasDDNotInstalled = -8086; {Cannot install RASDD files } {!!.05} + ecDrvCopyError = -8087; {Error copying printer driver} + ecCannotAddPrinter = -8088; {32-bit AddPrinter call failed} + ecDrvBadResources = -8089; {Bad/missing resources in driver} + ecDrvDriverNotFound = -8090; {Driver file not found} + ecUniCannotGetPrinterDriverDir + = -8091; {Cannot determine Win NT printer driver dir} + ecInstallDriverFailed = -8092; {AddPrinterDriver API failed} + + { TApdGSMPhone error codes } +const + ecSMSBusy = -8100; {Busy with another command} + ecSMSTimedOut = -8101; {Timed out, no response back} + ecSMSTooLong = -8102; {SMS message too long} + ecSMSUnknownStatus = -8103; {Status unknown} + ecSMSInvalidNumber = -8138; {Invalid Number or Network out of order} {!!.06} + ecMEFailure = -8300; {Mobile Equipment Failure} + ecServiceRes = -8301; {SMS service of ME reserved} + ecBadOperation = -8302; {Operation not allowed} + ecUnsupported = -8303; {Operation not supported} + ecInvalidPDU = -8304; {Invalid PDU mode parameter} + ecInvalidText = -8305; {Invalid Text mode parameter} + ecSIMInsert = -8310; {SIM card not inserted} + ecSIMPin = -8311; {SIM PIN required} + ecSIMPH = -8312; {PH-SIM PIN required} + ecSIMFailure = -8313; {SIM failure} + ecSIMBusy = -8314; {SIM busy} + ecSIMWrong = -8315; {SIM wrong} + ecSIMPUK = -8316; {SIM PUK required} + ecSIMPIN2 = -8317; {SIM PIN2 required} + ecSIMPUK2 = -8318; {SIM PUK2 required} + ecMemFail = -8320; {Memory failure} + ecInvalidMemIndex = -8321; {Invalid memory index} + ecMemFull = -8322; {Memory full} + ecSMSCAddUnknown = -8330; {SMS Center Address unknown} + ecNoNetwork = -8331; {No network service} + ecNetworkTimeout = -8332; {Network timeout} + ecCNMAAck = -8340; {No +CNMA acknowledgement expected} + aecUnknown = -8500; {Unknown error} + + +const + ecADWSERROR = 9001; + ecADWSLOADERROR = 9002; + ecADWSVERSIONERROR = 9003; + ecADWSNOTINIT = 9004; + ecADWSINVPORT = 9005; + ecADWSCANTCHANGE = 9006; + ecADWSCANTRESOLVE = 9007; + + { All Windows Sockets error constants are biased by 10000 from the "normal" } + wsaBaseErr = 10000; + + { Windows Sockets definitions of regular Microsoft C error constants } + wsaEIntr = 10004; + wsaEBadF = 10009; + wsaEAcces = 10013; + wsaEFault = 10014; + wsaEInVal = 10022; + wsaEMFile = 10024; + + { Windows Sockets definitions of regular Berkeley error constants } + wsaEWouldBlock = 10035; + wsaEInProgress = 10036; + wsaEAlReady = 10037; + wsaENotSock = 10038; + wsaEDestAddrReq = 10039; + wsaEMsgSize = 10040; + wsaEPrototype = 10041; + wsaENoProtoOpt = 10042; + wsaEProtoNoSupport = 10043; + wsaESocktNoSupport = 10044; + wsaEOpNotSupp = 10045; + wsaEPfNoSupport = 10046; + wsaEAfNoSupport = 10047; + wsaEAddrInUse = 10048; + wsaEAddrNotAvail = 10049; + wsaENetDown = 10050; + wsaENetUnreach = 10051; + wsaENetReset = 10052; + wsaEConnAborted = 10053; + wsaEConnReset = 10054; + wsaENoBufs = 10055; + wsaEIsConn = 10056; + wsaENotConn = 10057; + wsaEShutDown = 10058; + wsaETooManyRefs = 10059; + wsaETimedOut = 10060; + wsaEConnRefused = 10061; + wsaELoop = 10062; + wsaENameTooLong = 10063; + wsaEHostDown = 10064; + wsaEHostUnreach = 10065; + wsaENotEmpty = 10066; + wsaEProcLim = 10067; + wsaEUsers = 10068; + wsaEDQuot = 10069; + wsaEStale = 10070; + wsaERemote = 10071; + wsaEDiscOn = 10101; + + { Extended Windows Sockets error constant definitions } + + wsaSysNotReady = 10091; + wsaVerNotSupported = 10092; + wsaNotInitialised = 10093; + + { Error return codes from gethostbyname() and gethostbyaddr() (when using the } + { resolver). Note that these errors are retrieved via wsaGetLastError() and } + { must therefore follow the rules for avoiding clashes with error numbers from } + { specific implementations or language run-time systems. For this reason the } + { codes are based at 10000+1001. Note also that [wsa]No_Address is defined } + { only for compatibility purposes. } + { Authoritative Answer: Host not found } + wsaHost_Not_Found = 11001; + Host_Not_Found = wsaHost_Not_Found; + + { Non-Authoritative: Host not found, or ServerFAIL } + wsaTry_Again = 11002; + Try_Again = wsaTry_Again; + + { Non recoverable errors, FORMERR, REFUSED, NotIMP } + wsaNo_Recovery = 11003; + No_Recovery = wsaNo_Recovery; + + { Valid name, no data record of requested type } + wsaNo_Data = 11004; + No_Data = wsaNo_Data; + + { no address, look for MX record } + wsaNo_Address = wsaNo_Data; + No_Address = wsaNo_Address; + + { The string resource range 13500 - 13800 is used for TAPI } + { status messages, which do not require constants here } + +const + {Adjusted TAPI error codes} + ecAllocated = -13801; + ecBadDeviceID = -13802; + ecBearerModeUnavail = -13803; + ecCallUnavail = -13805; + ecCompletionOverrun = -13806; + ecConferenceFull = -13807; + ecDialBilling = -13808; + ecDialDialtone = -13809; + ecDialPrompt = -13810; + ecDialQuiet = -13811; + ecIncompatibleApiVersion = -13812; + ecIncompatibleExtVersion = -13813; + ecIniFileCorrupt = -13814; + ecInUse = -13815; + ecInvalAddress = -13816; + ecInvalAddressID = -13817; + ecInvalAddressMode = -13818; + ecInvalAddressState = -13819; + ecInvalAppHandle = -13820; + ecInvalAppName = -13821; + ecInvalBearerMode = -13822; + ecInvalCallComplMode = -13823; + ecInvalCallHandle = -13824; + ecInvalCallParams = -13825; + ecInvalCallPrivilege = -13826; + ecInvalCallSelect = -13827; + ecInvalCallState = -13828; + ecInvalCallStatelist = -13829; + ecInvalCard = -13830; + ecInvalCompletionID = -13831; + ecInvalConfCallHandle = -13832; + ecInvalConsultCallHandle = -13833; + ecInvalCountryCode = -13834; + ecInvalDeviceClass = -13835; + ecInvalDeviceHandle = -13836; + ecInvalDialParams = -13837; + ecInvalDigitList = -13838; + ecInvalDigitMode = -13839; + ecInvalDigits = -13840; + ecInvalExtVersion = -13841; + ecInvalGroupID = -13842; + ecInvalLineHandle = -13843; + ecInvalLineState = -13844; + ecInvalLocation = -13845; + ecInvalMediaList = -13846; + ecInvalMediaMode = -13847; + ecInvalMessageID = -13848; + ecInvalParam = -13850; + ecInvalParkID = -13851; + ecInvalParkMode = -13852; + ecInvalPointer = -13853; + ecInvalPrivSelect = -13854; + ecInvalRate = -13855; + ecInvalRequestMode = -13856; + ecInvalTerminalID = -13857; + ecInvalTerminalMode = -13858; + ecInvalTimeout = -13859; + ecInvalTone = -13860; + ecInvalToneList = -13861; + ecInvalToneMode = -13862; + ecInvalTransferMode = -13863; + ecLineMapperFailed = -13864; + ecNoConference = -13865; + ecNoDevice = -13866; + ecNoDriver = -13867; + ecNoMem = -13868; + ecNoRequest = -13869; + ecNotOwner = -13870; + ecNotRegistered = -13871; + ecOperationFailed = -13872; + ecOperationUnavail = -13873; + ecRateUnavail = -13874; + ecResourceUnavail = -13875; + ecRequestOverrun = -13876; + ecStructureTooSmall = -13877; + ecTargetNotFound = -13878; + ecTargetSelf = -13879; + ecUninitialized = -13880; + ecUserUserInfoTooBig = -13881; + ecReinit = -13882; + ecAddressBlocked = -13883; + ecBillingRejected = -13884; + ecInvalFeature = -13885; + ecNoMultipleInstance = -13886; + +const + {Apro encounters a few of its own TAPI errors, place these error + codes after the native TAPI error codes, but leave a little bit + of room for expansion of the TAPI error codes.} + ecTapiBusy = -13928; + ecTapiNotSet = -13929; + ecTapiNoSelect = -13930; + ecTapiLoadFail = -13931; + ecTapiGetAddrFail = -13932; + ecTapiUnexpected = -13934; + ecTapiVoiceNotSupported = -13935; + ecTapiWaveFail = -13936; + ecTapiCIDBlocked = -13937; + ecTapiCIDOutOfArea = -13938; + ecTapiWaveFormatError = -13939; + ecTapiWaveReadError = -13940; + ecTapiWaveBadFormat = -13941; + ecTapiTranslateFail = -13942; + ecTapiWaveDeviceInUse = -13943; + ecTapiWaveFileExists = -13944; + ecTapiWaveNoData = -13945; + + ecVoIPNotSupported = -13950; { TAPI3/H.323 not found } + ecVoIPCallBusy = -13951; { remote was busy } + ecVoIPBadAddress = -13952; { destination address bad } + ecVoIPNoAnswer = -13953; { remote did not answer } + ecVoIPCancelled = -13954; { cancelled } + ecVoIPRejected = -13955; { remote rejected the call } + ecVoIPFailed = -13956; { general failure } + ecVoIPTapi3NotInstalled = -13957; { ITTapi interface failure } {!!.01} + ecVoIPH323NotFound = -13958; { H.323 line not found } {!!.01} + ecVoIPTapi3EventFailure = -13959; { event notify failure } {!!.01} + + {RAS error codes} + ecRasLoadFail = -13980; + +const + {Convenient character constants (and aliases)} + cNul = #0; + cSoh = #1; + cStx = #2; + cEtx = #3; + cEot = #4; + cEnq = #5; + cAck = #6; + cBel = #7; + cBS = #8; + aacTab = #9; + acLF = #10; + cVT = #11; + cFF = #12; + acCR = #13; + cSO = #14; + cSI = #15; + cDle = #16; + cDC1 = #17; cXon = #17; + cDC2 = #18; + cDC3 = #19; cXoff = #19; + cDC4 = #20; + cNak = #21; + cSyn = #22; + cEtb = #23; + cCan = #24; + cEM = #25; + cSub = #26; + cEsc = #27; + cFS = #28; + cGS = #29; + cRS = #30; + cUS = #31; + +type + {Protocol status information record} + TProtocolInfo = record + piProtocolType : Cardinal; + piBlockErrors : Cardinal; + piTotalErrors : Cardinal; + piBlockSize : Cardinal; + piBlockNum : Cardinal; + piFileSize : Integer; + piBytesTransferred : Integer; + piBytesRemaining : Integer; + piInitFilePos : Integer; + piElapsedTicks : Integer; + piFlags : Integer; + piBlockCheck : Cardinal; + piFileName : TPathCharArrayA; + piError : Integer; + piStatus : Cardinal; + end; + +const + {Port options} + poUseEventWord = $04; {Set to use the event word} + + { APRO-specific flags used in InitPort} + ipAssertDTR = $00000001; + ipAssertRTS = $00000002; + ipAutoDTR = $00000010; + ipAutoRTS = $00000020; + + {Hardware flow control options} + hfUseDTR = $01; {Use DTR for receive flow control} + hfUseRTS = $02; {Use RTS for receive flow control} + hfRequireDSR = $04; {Require DSR before transmitting} + hfRequireCTS = $08; {Require CTS before transmitting} + + {Software flow control options} + sfTransmitFlow = $01; {Honor received Xon/Xoffs} + sfReceiveFlow = $02; {Send Xon/Xoff as required} + + {Define bits for TDCB Flags field} + adcb_Binary = $0001; + dcb_Parity = $0002; + adcb_OutxCTSFlow = $0004; + adcb_OutxDSRFlow = $0008; + dcb_DTRBit1 = $0010; + dcb_DTRBit2 = $0020; + dcb_DsrSensitivity = $0040; + adcb_TxContinueOnXoff = $0080; + adcb_OutX = $0100; + adcb_InX = $0200; + adcb_ErrorChar = $0400; + dcb_Null = $0800; + dcb_RTSBit1 = $1000; + dcb_RTSBit2 = $2000; + adcb_AbortOnError = $4000; + + dcb_DTR_CONTROL_ENABLE = dcb_DTRBit1; + dcb_DTR_CONTROL_HANDSHAKE = dcb_DTRBit2; + dcb_RTS_CONTROL_ENABLE = dcb_RTSBit1; + dcb_RTS_CONTROL_HANDSHAKE = dcb_RTSBit2; + dcb_RTS_CONTROL_TOGGLE = (dcb_RTSBit1 + dcb_RTSBit2); + + {For reporting flow states, note: no receive hardware flow status is provided} + fsOff = 1; {No flow control is in use} + fsOn = 2; {Flow control is but not transmit blocked} + fsDsrHold = 3; {Flow control is on and transmit blocked by low DSR} + fsCtsHold = 4; {Flow control is on and transmit blocked by low CTS} + fsDcdHold = 5; {Flow control is on and transmit blocked by low DCD} + fsXOutHold = 6; {Flow control is on and transmit blocked by Xoff} + fsXInHold = 7; {Flow control is on and receive blocked by Xoff} + fsXBothHold= 8; {Flow control is on and both are blocked by Xoff} + +const + {Emulator commands} + eNone = 0; {No command, ignore this char} + eChar = 1; {No command, process the char} + eGotoXY = 2; {X} {Absolute goto cursor position call} + eUp = 3; {X} {Cursor up} + eDown = 4; {X} {Cursor down} + eRight = 5; {X} {Cursor right} + eLeft = 6; {X} {Cursor left} + eClearBelow = 7; {R} {Clear screen below cursor} + eClearAbove = 8; {R} {Clear screen above cursor} + eClearScreen = 9; {R} {Clear entire screen} + eClearEndofLine = 10;{R} {Clear from cursor to end of line} + eClearStartOfLine= 11;{R} {Clear from cursor to the start of line} + eClearLine = 12;{R} {Clear entire line that cursor is on} + eSetMode = 13;{X} {Set video mode} + eSetBackground = 14; {Set background attribute} + eSetForeground = 15; {Set foreground attribute} + eSetAttribute = 16;{X} {Set video attribute (foreground and background)} + eSaveCursorPos = 17; {Save cursor position} + eRestoreCursorPos= 18; {Restore cursor position} + eDeviceStatusReport = 19;{X}{Report device status or cursor position} + eString = 20; {Pascal style string} + eHT = 21; {Horizontal Tab Character} + eError = 255; {indicates a parser error} + + eAPC { } = 30; {Application programming command} + eCBT {X} = 31; {Cursor backward tabulation} + eCCH { } = 32; {Cancel character} + eCHA {X} = 33; {Cursor horizontal absolute} + eCHT {X} = 34; {Cursor horizontal tabulation} + eCNL {X} = 35; {Cursor next line} + eCPL {X} = 36; {Cursor preceding line} + eCPR {X} = 37; {Cursor position report} + eCRM {.} = 38; {Control representation mode} + eCTC {X} = 39; {Cursor tabulation control} + eCUB {X} = eLeft; {Cursor backward} + eCUD {X} = eDown; {Cursor down} + eCUF {X} = eRight; {Cursor forward} + aeCUP {X} = eGotoXY; {Cursor position} + eCUU {X} = eUp; {Cursor up} + eCVT {X} = 40; {Cursor vertical tabulation} + eDA {X} = 41; {Device attributes} + eDAQ { } = 42; {Define area qualification} + eDCH {X} = 43; {Delete character} + eDCS { } = 44; {Device control string} + eDL {X} = 45; {Delete line} + eDMI { } = 46; {Disable manual input} + eDSR {X} = eDeviceStatusReport;{Device status report} + eEA { } = 47; {Erase in area} + eEBM { } = 48; {Editing boundry mode} + eECH {X} = 49; {Erase character} + eED {X} = 50; {Erase in Display} + eEF { } = 51; {Erase in field} + eEL {X} = 52; {Erase in line} + eEMI { } = 53; {Enable manual input} + eEPA { } = 54; {End of protected mode} + eERM { } = 55; {Erasure mode} + eESA { } = 56; {End of selected area} + eFEAM { } = 57; {Format effector action mode} + eFETM { } = 58; {Format effector transfer mode} + eFNT { } = 59; {Font selection} + eGATM { } = 60; {Guarded area transfer mode} + eGSM { } = 61; {Graphics size modification} + eGSS { } = 62; {Graphics size selection} + eHEM { } = 63; {Horizontal editing mode} + eHPA {X} = eCHA; {Horizontal position absolute} + eHPR {X} = eCUF; {Horizontal position relative} + eHTJ {X} = 64; {Horizontal tab with justification} + eHTS {X} = 65; {Horizontal tabulation set} + eHVP {X} = eCUP; {Horizontal and vertical position} + eICH {X} = 66; {Insert character} + eIL {X} = 67; {Insert line} + eIND {X} = eCUD; {Index} + eINT { } = 68; {Interrupt} + eIRM {.} = 69; {Inseration-Replacement mode} + eJFY { } = 70; {Justify} + eKAM {.} = 71; {Keyboard action mode} + eLNM {.} = 72; {Line feed new line mode} + eMATM { } = 73; {Multiple area transfer mode} + eMC {.} = 74; {Media copy} + eMW {.} = 75; {Message waiting} + eNEL {X} = 76; {Next line} + eNP {.} = 77; {Next page} + eOSC { } = 78; {Operating system command} + ePLD { } = 79; {Partial line down} + ePLU { } = 80; {Partial line up} + ePM { } = 81; {Privacy message} + ePP {.} = 82; {Preceding page} + ePU1 { } = 83; {Private use 1} + ePU2 { } = 84; {Private use 2} + ePUM { } = 85; {Positioning unit mode} + eQUAD { } = 86; {Quad} + eREP { } = 87; {Repeat} + eRI {X} = 88; {Reverse index} + eRIS {.} = 89; {Reset to initial state} + eRM {.} = 90; {Reset mode} + eSATM { } = 91; {Selected area transfer mode} + eSD { } = 92; {Scroll down} + eSEM { } = 93; {selected editing extent mode} + eSGR {X} = eSetAttribute;{Select graphics rendition} + eSL { } = 94; {Scroll left} + eSM {.} = eSetMode;{Set Mode} + eSPA { } = 95; {Start of protected area} + eSPI { } = 96; {Spacing increment} + eSR { } = 97; {Scroll right} + eSRM { } = 98; {Send-Receive mode} + eSRTM { } = 99; {Status report transfer mode} + eSS2 { } = 100; {Single shift 2} + eSS3 { } = 101; {Single shift 3} + eSSA { } = 102; {Start of selected area} + eST { } = 103; {String terminator} + eSTS { } = 104; {Set transmit state} + eSU { } = 105; {Scroll up} + eTBC {X} = 106; {Tabulation clear} + eTSM { } = 107; {Tabulation stop mode} + eTSS { } = 108; {Thin space specification} + eTTM { } = 109; {Transfer termination mode} + eVEM { } = 110; {Vertical editing mode} + eVPA {X} = 111; {Vertical position absolute} + eVPR {X} = eCUD; {Vertical position relative} + eVTS {X} = 112; {vertical tabulation set} + eDECSTBM = 113; {dec private-set Top/Bottom margin} + + eENQ {X} = 114; {enquiry request} + eBEL {X} = 115; {sound bell} + eBS {X} = 116; {backspace} + eLF {X} = 117; {line feed command} + eCR {X} = 118; {carriage return} + eSO {X} = 119; {invoke G1 charset} + eSI {X} = 120; {invoke G0 charset} + eIND2 {X} = 121; {corrected eIND (<> eCUD, eDown) new term only} + eDECALN = 122; {DEC PRIVATE-screen alignment display} + eDECDHL = 123; {DEC PRIVATE-Double height line} + eDECDWL = 124; {DEC PRIVATE-Double width line} + eDECLL = 125; {DEC PRIVATE-load LEDs} + eDECREQTPARM = 126; {DEC PRIVATE-request terminal parameters} + eDECSWL = 127; {DEC PRIVATE-single width line} + eDECTST = 128; {DEC PRIVATE-Invoke confidence test} + eDECSCS = 129; {DEC PRIVATE-select charset} + + {Extended attributes} + eattrBlink = $01; + eattrInverse = $02; + eattrIntense = $04; + eattrInvisible = $08; + eattrUnderline = $10; + + {ANSI color constants} + emBlack = 0; + emRed = 1; + emGreen = 2; + emYellow = 3; + emBlue = 4; + emMagenta = 5; + emCyan = 6; + emWhite = 7; + emBlackBold = 8; + emRedBold = 9; + emGreenBold = 10; + emYellowBold = 11; + emBlueBold = 12; + emMagentaBold = 13; + emCyanBold = 14; + emWhiteBold = 15; + + {AnsiEmulator option flags} + teMapVT100 = $0001; + + {Misc} + MaxParams = 5; {Maximum parameters for our interpreter} + MaxQueue = 20; {Maximum characters in queue} + MaxOther = 11; {Maximum other data} + MaxParamLength = 5; {Maximum parameter length for interpreter} + KeyMappingLen = 20; {Maximum length of a keymapping} + +type + {AnsiEmulator's parser states} + TAnsiParser = (GotNone, GotEscape, GotBracket, GotSemiColon, GotParam, + GotCommand, GotControlSeqIntro, GotLeftBrace, GotRightBrace, + GotSpace, GotQuestionMark, GotQuestionParam); + + {Array used for internal queue} + TApQueue = Array[1..MaxQueue] of AnsiChar; // SWB + + {Emulator for PC ANSI codes} + //PAnsiEmulator = ^TAnsiEmulator; + TAnsiEmulator = record + emuType : Cardinal; { Emulator Type } + emuFlags : Cardinal; + emuFirst : Bool; {True if first time thru} + emuAttr : Byte; + emuIndex : Cardinal; {Index into rcvd byte array} + emuParamIndex : Cardinal; {Parameter index} + emuQueue : TApQueue; {Queue of recvd bytes} // SWB + emuParamStr : array[1..MaxParams] of string; //[MaxParamLength]; + emuParamInt : array[1..MaxParams] of Integer; + emuParserState : TAnsiParser; {Current state} + emuOther : _Pointer; + end; + +const + {Terminal window Cardinal} + gwl_Terminal = 0; + + {Terminal options} + tws_WantTab = $0001; {Process tabs internally} + tws_IntHeight = $0002; {Integral height} + tws_IntWidth = $0004; {Integral width} + tws_AutoHScroll = $0008; {Add/remove horiz scroll automatically} + tws_AutoVScroll = $0010; {Add/remove vert scroll automatically} + +type + {For general typecasting} + LH = record + L,H : Word; + end; + + {IniDBase (deprecated) consts and types} +const + MaxDBRecs = 999; {Maximum number of database records} + MaxNameLen = 21; {Maximum length of a profile string key} + MaxIndexLen = 31; {Maximum length of an index string} + NonValue = '#'; {Value of DB fields SPECIFICALLY left blank} + dbIndex = 'Index'; {Item index section heading} + dbDefaults = 'Defaults'; {Default value section heading} + dbNumEntries = '_Entries'; {Number of entries key name} + dbBogus = 'None'; {Bogus key name for creating sections} + +type + //PIniDatabaseKey = ^TIniDatabaseKey; + TIniDatabaseKey = record + //KeyName : PAnsiChar; + DataSize : Cardinal; + StrType : Bool; + Index : Bool; + //Next : PIniDatabaseKey; + end; + + //PIniDatabase = ^TIniDatabase; + TIniDatabase = record + //FName : PAnsiChar; + //DictionaryHead : PIniDatabaseKey; + //DictionaryTail : PIniDatabaseKey; + NumRecords : Integer; + RecordSize : Cardinal; + DefaultRecord : _Pointer; + Prepared : Bool; + end; + +const + ApdMaxTags = 5; {Maximum number of err corr or data comp tags} + ApdTagSepChar = ','; {Character that separates tags in a profile string} + +const + ApdModemNameLen = 31; {Length of a modem name string} + ApdCmdLen = 41; {Maximum length of a modem command} + ApdRspLen = 21; {Maximum length of a modem response} + ApdTagLen = 21; {Maximum length of a tag string} + ApdTagProfLen = 105; {Maximum length of a tag profile string} + ApdBoolLen = 5; {Maximum length of a boolean string} + ApdBaudLen = 7; {Maximum length of a baud rate string} + ApdConfigLen = 255; {Maximum length of a configuration string} + +type + {where these same variables are declared as Strings.} + TModemNameZ = array[0..ApdModemNameLen] of AnsiChar; //SZ: must probably be Ansi + TCmdStringZ = array[0..ApdCmdLen] of AnsiChar; + TRspStringZ = array[0..ApdRspLen] of AnsiChar; + TTagStringZ = array[0..ApdTagLen] of AnsiChar; + TTagProfStringZ = array[0..ApdTagProfLen] of AnsiChar; + TConfigStringZ = array[0..ApdConfigLen] of AnsiChar; + TBoolStrZ = array[0..ApdBoolLen] of AnsiChar; + TBaudStrZ = array[0..ApdBaudLen] of AnsiChar; + + TTagArrayZ = array[1..ApdMaxTags] of TTagStringZ; + + //PModemBaseData = ^TModemBaseData; + TModemBaseData = record + Name : TModemNameZ; + InitCmd : TCmdStringZ; + DialCmd : TCmdStringZ; + DialTerm : TCmdStringZ; + DialCancel : TCmdStringZ; + HangupCmd : TCmdStringZ; + ConfigCmd : TConfigStringZ; + AnswerCmd : TCmdStringZ; + OkMsg : TRspStringZ; + ConnectMsg : TRspStringZ; + BusyMsg : TRspStringZ; + VoiceMsg : TRspStringZ; + NoCarrierMsg : TRspStringZ; + NoDialToneMsg : TRspStringZ; + ErrorMsg : TRspStringZ; + RingMsg : TRspStringZ; + end; + + //PModemData = ^TModemData; + TModemData = record + Data : TModemBaseData; + NumErrors : Cardinal; + Errors : TTagArrayZ; + NumComps : Cardinal; + Compression : TTagArrayZ; + LockDTE : Bool; + DefBaud : Integer; + end; + + //PModemXFer = ^TModemXFer; + TModemXFer = record + Data : TModemBaseData; + Errors : TTagProfStringZ; + Compress : TTagProfStringZ; + LockDTE : TBoolStrZ; + DefBaud : TBaudStrZ; + end; + + //PModemDatabase = ^TModemDatabase; + TModemDatabase = record + DB : {P}TIniDatabase; + end; + + +const + {keyboard shift state masks} + ksControl = $02; + ksAlt = $04; + ksShift = $08; + + {keyboard toggle state masks} + tsCapital = $02; + tsNumlock = $04; + tsScroll = $08; + + {keyboard INI file constants} + ApdKeyMapNameLen = 30; {Length of a KeyMap name string} + ApdMaxKeyMaps = 100; {Maximum possible key mapping per type} + + ApdKeyIndexName = 'EMULATOR'; + ApdKeyIndexMaxLen = 120; + +type + TKeyMapName = array[0..ApdKeyMapNameLen] of AnsiChar; + TKeyMapping = array[0..KeyMappingLen] of Ansichar; + TKeyMappingStr = string; //[KeyMappingLen]; + + + //PKeyMapXFerRec = ^TKeyMapXFerRec; + TKeyMapXFerRec = record + Name : TKeyMapName; + Keys : array[1..ApdMaxKeyMaps] of TKeyMapping; + end; + + //PVKeyMapRec = ^TVKeyMapRec; + TVKEyMapRec = record + KeyCode : Cardinal; + ShiftState: Cardinal; + Mapping : TKeyMappingStr; + end; + + //PKeyEmulator = ^TKeyEmulator; + TKeyEmulator = record + kbKeyFileName : PChar; { current file name } + kbKeyName : TKeyMapName; { current key index name } + kbProcessAll : Bool; + kbProcessExt : Bool; + kbKeyNameList : array[0..ApdKeyIndexMaxLen] of Ansichar; + kbKeyMap : array[1..ApdMaxKeyMaps] of TVKeyMapRec; + kbKeyDataBase : TIniDataBase; { pointer to the INI data base file } + end; + +const + {---- Option codes for protocols ----} + apIncludeDirectory = $0001; {Set to include directory in file names} + apHonorDirectory = $0002; {Set to honor directory in file names} + apRTSLowForWrite = $0004; {Set to lower RTS during disk writes} + apAbortNoCarrier = $0008; {Set to abort protocol on DCD loss} + apKermitLongPackets = $0010; {Set to support long packets} + apKermitSWC = $0020; {Set to support SWC} + apZmodem8K = $0040; {Set to support 8K blocks} + apBP2KTransmit = $0080; {Set to support 2K transmit blocks} + apAsciiSuppressCtrlZ = $0100; {Set to stop transmitting on ^Z} + + {---- Default options for protocols ----} + DefProtocolOptions = 0; + BadProtocolOptions = apKermitLongPackets+apKermitSWC+apZmodem8K; + + {Block check codes} + abcNone = 0; {No block checking} + bcChecksum1 = 1; {Basic checksum} + bcChecksum2 = 2; {Two byte checksum} + bcCrc16 = 3; {16 bit Crc} + bcCrc32 = 4; {32 bit Crc} + bcCrcK = 5; {Kermit style Crc} + + {Convenient blockcheck string constants} + bcsNone = 'No check'; + bcsChecksum1 = 'Checksum'; + bcsChecksum2 = 'Checksum2'; + bcsCrc16 = 'Crc16'; + bcsCrc32 = 'Crc32'; + bcsCrck = 'CrcKermit'; + + {Constants for supported protocol types} + NoProtocol = 0; + Xmodem = 1; + XmodemCRC = 2; + Xmodem1K = 3; + Xmodem1KG = 4; + Ymodem = 5; + YmodemG = 6; + Zmodem = 7; + Kermit = 8; + Ascii = 9; + BPlus = 10; + + {Zmodem attention string length} + MaxAttentionLen = 32; + + {Zmodem file management options} + zfWriteNewerLonger = 1; {Transfer if new, newer or longer} + zfWriteCrc = 2; {Not supported, same as WriteNewer} + zfWriteAppend = 3; {Transfer if new, append if exists} + zfWriteClobber = 4; {Transfer regardless} + zfWriteNewer = 5; {Transfer if new or newer} + zfWriteDifferent = 6; {Transfer if new or diff dates/lens} + zfWriteProtect = 7; {Transfer only if new} + + {Convenient protocol string constants} + var ProtocolString : array[NoProtocol..BPlus] of array[0..9] of AnsiChar; + {= ( + 'None', 'Xmodem', 'XmodemCRC', 'Xmodem1K', 'Xmodem1KG', + 'Ymodem', 'YmodemG', 'Zmodem', 'Kermit', 'Ascii', 'B+'); } + +type + {For holding lists of files to transmit} + //PFileList = ^TFileList; + TFileList = array[0..65535-1] of Char; + +{Fax conversion} + +const + rw1728 = 1; {standard width} + rw2048 = 2; {extra wide} + + {Fax pixel widths} + StandardWidth = 1728; {Standard width in pixels} + WideWidth = 2048; {Allowed higher resolution} + + {Option flags for FAX page header} + ffHighRes = $0001; {Image stored in high-res mode} + ffHighWidth = $0002; {Image uses option high-width mode} + ffLengthWords = $0004; {Set if raster lines include length Cardinal} + + {Options for fax conversion} + fcDoubleWidth = $0001; {Double the horizontal width in std res} + fcHalfHeight = $0002; {Halve the vertical height in std res} + fcCenterImage = $0004; {Center graphics images horizontally} + fcYield = $0008; {Have the converter yield while converting} + fcYieldOften = $0010; {Increases the number of yields} + + {Flags passed to status function} + csStarting = $0001; + csEnding = $0002; + + {Font handles, same value as bytes-per-char} + SmallFont = 16; + StandardFont = 48; + + {Maximum number of tree records} + MaxTreeRec = 306; + + {Max size of decompress buffer} + MaxData = 4096; + + {Text conversion limits} + MaxLineLen = 144; + + {encoding/decoding table limits} + MaxCodeTable = 63; + MaxMUCodeTable = 39; + + {default extensions} + DefTextExt = 'TXT'; + DefTiffExt = 'TIF'; + DefPcxExt = 'PCX'; + DefDcxExt = 'DCX'; + DefBmpExt = 'BMP'; + DefApfExt = 'APF'; + +type + {Compression code tables} + TCodeRec = record + Code : Word; + Sig : Word; + end; + + TTermCodeArray = array[0..MaxCodeTable] of TCodeRec; + TMakeUpCodeArray = array[0..MaxMUCodeTable] of TCodeRec; + + //PBufferedOutputFile = ^TBufferedOutputFile; + TBufferedOutputFile = record + BufPos : Word; + //Buffer : PByteArray; + OutFile : File; + end; + + {For storing station IDs} + Str20 = string; //[20]; + + {Stores information about our fonts} + TFontRecord = record + Bytes : Byte; {# of bytes per char in font} + PWidth : Byte; {width of font in pixels} + Width : Byte; {width of font in bytes (e.g. 16-pixel-wide = 2)} + Height : Byte; {height of font in raster lines} + end; + + {Fax file signature array} + TSigArray = Array[0..5] of AnsiChar; + +var + {Default fax file signature, first 6 chars in an APF} + DefAPFSig : TSigArray; // = 'APF10'#26; + +type + {APRO fax file header record} + TFaxHeaderRec = record + Signature : TSigArray; {APRO FAX signature} + FDateTime : Integer; {Date and time in DOS format} + SenderID : Str20; {Station ID of sender} + Filler : Byte; {Alignment byte, unused} + PageCount : Word; {Number of pages in this file} + PageOfs : Integer; {Offset in file of first page} + Padding : Array[39..64] of Byte; {Expansion room} + end; + + {APRO fax page header record} + TPageHeaderRec = record + ImgLength : Integer; {Bytes of image data in this page} + ImgFlags : Word; {Image flags for width, res, etc} + Padding : Array[7..16] of Byte; {Expansion room} + end; + + {APRO fax server job header} + TFaxJobHeaderRec = record + ID : Integer; {APRO fax job signature} + Status : Byte; {0=none sent, 1=some sent, 2=all sent, 3=paused} + JobName : Str20; {Friendly name of fax job} + Sender : String; //[40]; {Name of sender (same as HeaderSender)} + SchedDT : TDateTime; {TDateTime the first job should be sent} + NumJobs : Byte; {Number of FaxJobInfoRecs for this job} + NextJob : Byte; {The index of the next FaxJobInfo to send} + CoverOfs : Integer; {Offset in file of text CoverFile data} + FaxHdrOfs: Integer; {Offset in file of TFaxHeaderRec} + Padding : Array[86..128] of Byte; {Expansion room} + end; + + {APRO fax server job recipient record } + TFaxRecipientRec = record + Status : Byte; {0=not sent, 1=sending, 2=sent, 3=paused} + JobID : Byte; {Unique ID for this job} + SchedDT : TDateTime; {TDateTime this job should be sent} + AttemptNum : Byte; {Retry number for this recipient} + LastResult : Word; {Last ErrorCode for this fax} + PhoneNumber : String;//[50]; {Phone number to dial for this job} + HeaderLine : String;//[100]; {Header line} + HeaderRecipient: String;//[30]; {Recipient's name} + HeaderTitle : String;//[30]; {Title of fax} + Padding : Array[228..256] of Byte;{Expansion room} + end; + + {Pcx header} + TPcxPalArray = Array[0..47] of Byte; + TPcxHeaderRec = record + Mfgr : Byte; + Ver : Byte; + Encoding : Byte; + BitsPixel : Byte; + XMin : Word; + YMin : Word; + XMax : Word; + YMax : Word; + HRes : Word; + VRes : Word; + Palette : TPcxPalArray; + Reserved : Byte; + Planes : Byte; + BytesLine : Word; + PalType : Word; + Filler : Array[1..58] of Byte; {pad to 128 bytes} + end; + + TDcxOfsArray = array[1..1024] of Integer; + + //PDcxHeaderRec = ^TDcxHeaderRec; + TDcxHeaderRec = record + ID : Integer; + Offsets : TDcxOfsArray; + end; + + TTreeRec = record + Next0 : Integer; + Next1 : Integer; + end; + TTreeArray = array[0..MaxTreeRec] of TTreeRec; + //PTreeArray = ^TTreeArray; + + {$IFNDEF DrvInst} + //PAbsFaxCvt = ^TAbsFaxCvt; + + {callback function to open a converter input file} + (* TOpenFileCallback = function(Cvt : PAbsFaxCvt; FileName : string) : Integer; + + {callback function to close a converter input file} + TCloseFileCallback = procedure(Cvt : PAbsFaxCvt); + + {callback function converters use to get input raster} + TGetLineCallback = function(Cvt : PAbsFaxCvt; var Data; var Len : Integer; + var EndOfPage, MorePages : Bool) : Integer; + + {callback function converters use to output data} + TPutLineCallback = function(Cvt : PAbsFaxCvt; var Data; Len : Integer; + EndOfPage, MorePages : Bool) : Integer; + + + {callback function for status information} + TCvtStatusCallback = function(Cvt : PAbsFaxCvt; StatFlags : Word; + BytesRead, BytesToRead : Integer) : Bool; + + *) + + {base converter data} + TAbsFaxCvt = record + UseHighRes : Bool; {TRUE if for high-res mode} + DoubleWidth : Bool; {TRUE do double each pixel} + HalfHeight : Bool; {TRUE to discard each raster line} + Flags : Cardinal; {Options flags} + ByteOfs : Cardinal; {Byte offset in buffer} + BitOfs : Cardinal; {Bit offset in buffer} + ResWidth : Cardinal; {Width of current resolution in pels} + LeftMargin : Cardinal; {Left margin in pels} + TopMargin : Cardinal; {Top margin in pels} + CurrPage : Cardinal; {Current page being processed} + CurrLine : Cardinal; {Number of text/raster lines cvted} + LastPage : Cardinal; {Last page number used in file cvt} + CurPagePos : Integer; {file offset of current page} + CenterOfs : Cardinal; {Offset of center of bitmap} + UserData : _Pointer; {Data needed by higher level cvters} + OtherData : _Pointer; {Other, miscellaneous data} + BytesRead : Integer; + BytesToRead : Integer; + //DataLine : PByteArray; {Buffered line of compressed data} + //TmpBuffer : PByteArray; {Temp compression buffer} + //GetLine : TGetLineCallback; {Callback function to get a raster line} + //OpenCall : TOpenFileCallback; {To open the input file, if any} + //CloseCall : TCloseFileCallback; {To close the input file, if any} + //StatusFunc : TCvtStatusCallback; {Callback for status display} + StatusWnd : HWnd; {Handle of window receiving status msgs} + DefExt : string; // array[0..3] of AnsiChar; + InFileName : string; // array[0..255] of AnsiChar; + OutFileName : string; // array[0..255] of AnsiChar; + StationID : AnsiString; //array[0..20] of AnsiChar; + MainHeader : TFaxHeaderRec; {main header of fax output file} + PageHeader : TPageHeaderRec; {header for current output page} + //OutFile : PBufferedOutputFile;{Output file} + PadPage : Bool; {True to pad text conversion to full page}{!!.04} + {$IFNDEF PrnDrv} + InBitmap : {Graphics.}TBitmap; + {$ENDIF} + end; + +{$IFNDEF PrnDrv} + +type + { moved from AdWUtil } {!!.06} + SunB = record {!!.06} + s_b1, s_b2, s_b3, s_b4 : AnsiChar; {!!.06} + end; {!!.06} + { moved from AdWUtil } {!!.06} + SunW = record {!!.06} + s_w1, s_w2 : Word; {!!.06} + end; {!!.06} + + { moved from AdWnPort and AdWUtil } {!!.06} + //PInAddr = ^TInAddr; {!!.06} + (* aTInAddr = record {!!.06} + case Integer of {!!.06} + 0 : (S_un_b : SunB); {!!.06} + 1 : (S_un_w : SunW); {!!.06} + 2 : (S_addr : Integer); {!!.06} + end; *) {!!.06} + + { XML support } +//const + {The following constants are the tokens needed to parse an XML + document. The tokens are stored in UCS-4 format to reduce the + number of conversions needed by the filter.} +(* Xpc_BracketAngleLeft : array[0..0] of Integer = (60); {<} + Xpc_BracketAngleRight : array[0..0] of Integer = (62); {>} + Xpc_BracketSquareLeft : array[0..0] of Integer = (91); {[} + Xpc_BracketSquareRight : array[0..0] of Integer = (93); {]} + Xpc_CDATAStart : + array[0..5] of Integer = (67, 68, 65, 84, 65, 91); {CDATA[} + Xpc_CharacterRef : array[0..0] of Integer = (35); {#} + Xpc_CharacterRefHex : array[0..0] of Integer = (120); {x} + Xpc_CommentEnd : array[0..2] of Integer = (45, 45, 62); {-->} + Xpc_CommentStart : array[0..3] of Integer = (60, 33, 45, 45); { Ansi + TExtCharArray = array[0..fsExtension] of AnsiChar; + TPathCharArray = array[0..fsPathName ] of Char; + TPathCharArrayA = array[0..fsPathName ] of AnsiChar; //SZ FIXME can this be changed to Char?? + TDirCharArray = array[0..fsDirectory] of AnsiChar; + TChar20Array = array[0..20] of AnsiChar; + aTCharArray = array[0..255] of AnsiChar; + + {For generic buffer typecasts} + //PByteBuffer = ^TByteBuffer; + TByteBuffer = array[1..65535] of Byte; + + {Port characteristic constants} + //aTDatabits = 5..DontChangeDatabits; + //TStopbits = 1..DontChangeStopbits; + + {NotifyProc type, same as a window procedure} + TApdNotifyProc = procedure(Msg, wParam : Cardinal; + lParam : Integer); + TApdNotifyEvent = procedure(Msg, wParam : Cardinal; + lParam : Integer); // of object; +const + {Avoid requiring WIN31} + ev_CTSS = $0400; {CTS state} + ev_DSRS = $0800; {DSR state} + ev_RLSDS = $1000; {RLSD state} + ev_RingTe = $2000; {Ring trailing edge indicator} + +const + {MSRShadow register from COMM.DRV} + MsrShadowOfs = 35; {Offset of MSRShadow from EventWord} + +const + {Modem status bit masks} + DeltaCTSMask = $01; {CTS changed since last read} + DeltaDSRMask = $02; {DSR changed since last read} + DeltaRIMask = $04; {RI changed since last read} + DeltaDCDMask = $08; {DCD changed since last read} + CTSMask = $10; {Clear to send} + DSRMask = $20; {Data set ready} + RIMask = $40; {Ring indicator} + DCDMask = $80; {Data carrier detect} + +const + {Message base} + apw_First = $7E00; {Sets base for all APW messages} + +const + {Custom message types} + apw_TriggerAvail = apw_First+1; {Trigger for any data avail} + apw_TriggerData = apw_First+2; {Trigger data} + apw_TriggerTimer = apw_First+3; {Trigger timer} + apw_TriggerStatus = apw_First+4; {Status change (modem, line, buffer)} + apw_FromYmodem = apw_First+5; {Tells Xmodem it was called from Ymodem} + apw_PortOpen = apw_First+8; {Apro, tell users port open} + apw_PortClose = apw_First+9; {Apro, tell users port closed} + apw_ClosePending = apw_First+10; {Apro, tell ourself that the port was closed} + +const + {Protocol message types} + apw_ProtocolCancel = apw_First+20; {To protocol - chk for protcl abort} + apw_ProtocolStatus = apw_First+21; {From protocol - update status display} + apw_ProtocolLog = apw_First+22; {From protocol - LogFile message} + apw_ProtocolNextFile = apw_First+23; {From protocol - return next file} + apw_ProtocolAcceptFile = apw_First+24; {From protocol - accept file} + apw_ProtocolFinish = apw_First+25; {From protocol - protocol is finished} + apw_ProtocolResume = apw_First+26; {From protocol - resume request} + apw_ProtocolError = apw_First+27; {From protocol - error during protocol} + apw_ProtocolAbort = apw_First+28; {To protocol - abort the transfer} + +const + {Modem message types} + apw_AutoAnswer = apw_First+40; {To modem, enter AutoAnswer} + apw_CancelCall = apw_First+41; {To modem, cancel the call} + apw_StartDial = apw_First+42; {To modem, start the process} + + {deprecated modem message types, note that some conflict with new messages} + apw_ModemOk = apw_First+40; {From modem - got OK response} + apw_ModemConnect = apw_First+41; {From modem - got CONNECT response} + apw_ModemBusy = apw_First+42; {From modem - got BUSY response} + apw_ModemVoice = apw_First+43; {From modem - got VOICE response} + apw_ModemNoCarrier = apw_First+44; {From modem - got NO CARRIER response} + apw_ModemNoDialTone = apw_First+45; {From modem - got NO DIALTONE response} + apw_ModemError = apw_First+46; {From modem - got ERROR response} + apw_GotLineSpeed = apw_First+47; {From modem - got connect speed} + apw_GotErrCorrection = apw_First+48; {From modem - got EC response} + apw_GotDataCompression = apw_First+49; {From modem - got compression response} + apw_CmdTimeout = apw_First+50; {From modem - command timed out} + apw_DialTimeout = apw_First+51; {From modem - dial timed out} + apw_AnswerTimeout = apw_First+52; {From modem - answer timed out} + apw_DialCount = apw_First+53; {From modem - dial still in progress} + apw_AnswerCount = apw_First+54; {From modem - answer still in progress} + apw_ModemRing = apw_First+55; {From modem - phone rang} + apw_ModemIsConnected = apw_First+56; {From modem - connection completed} + apw_ConnectFailed = apw_First+57; {From modem - connection failed} + apw_CommandProcessed = apw_First+58; {From modem - finished command} + +const + {Terminal message types} + apw_TermStart = apw_First+60; {To terminal - start} + apw_TermStop = apw_First+61; {To terminal - stop} + apw_TermSetCom = apw_First+62; {To terminal - set com handle} + apw_TermRelCom = apw_First+63; {To terminal - release com handle} + apw_TermSetEmuPtr = apw_First+64; {To terminal - set emulator pointer} + apw_TermSetEmuProc = apw_First+65; {To terminal - set emulator proc} + apw_TermClear = apw_First+66; {To terminal - clear window} + apw_TermBuffer = apw_First+67; {To terminal - alloc new buffers} + apw_TermColors = apw_First+68; {To terminal - set new colors} + apw_TermToggleScroll = apw_First+69; {To terminal - toggle scrollback} + apw_TermCapture = apw_First+70; {To terminal - set capture mode} + apw_TermStuff = apw_First+71; {To terminal - stuff data} + apw_TermPaint = apw_First+72; {To terminal - update screen} + apw_TermSetWndProc = apw_First+73; {To terminal - set window proc} + apw_TermColorsH = apw_First+74; {To terminal - set highlight colors} + apw_TermSave = apw_First+75; {To terminal - save/restore} + apw_TermColorMap = apw_First+76; {To terminal - get/set color map} + apw_TermForceSize = apw_First+77; {To terminal - force new size} + apw_TermFontSize = apw_First+78; {To terminal - get font size} + +const + apw_TermStatus = apw_First+80; {From terminal - show status} + apw_TermBPlusStart = apw_First+81; {From terminal - B+ is starting} + apw_TermError = apw_First+82; {From terminal - error} + apw_CursorPosReport = apw_First+83; {From terminal - Cursor Pos Report} + +const + apw_FaxCvtStatus = apw_First+90; {From fax converter - show status} + apw_FaxUnpStatus = apw_First+91; {From fax unpacker - show status} + apw_FaxOutput = apw_First+92; {From fax unpacker - output line} + +const + apw_ViewSetFile = apw_First+100; {To fax viewer - change file name} + apw_ViewSetFG = apw_First+101; {To fax viewer - set foreground color} + apw_ViewSetBG = apw_First+102; {To fax viewer - set background color} + apw_ViewSetScale = apw_First+103; {To fax viewer - set scale factors} + apw_ViewSetScroll = apw_First+104; {To fax viewer - set scroll increments} + apw_ViewSelectAll = apw_First+105; {To fax viewer - select entire image} + apw_ViewSelect = apw_First+106; {To fax viewer - select image rect} + apw_ViewCopy = apw_First+107; {To fax viewer - copy data to cboard} + apw_ViewSetWndProc = apw_First+108; {To fax viewer - set window procedure} + apw_ViewSetWhitespace = apw_First+109; {To fax viewer - set whitespace comp} + apw_ViewGetBitmap = apw_First+110; {To fax viewer - get memory bmp} + apw_ViewGetNumPages = apw_First+111; {To fax viewer - get num pages} + apw_ViewStartUpdate = apw_First+112; {To fax viewer - start scale update} + apw_ViewEndUpdate = apw_First+113; {To fax viewer - end scale upate} + apw_ViewGotoPage = apw_First+114; {To fax viewer - go to a page} + apw_ViewGetCurPage = apw_First+115; {To fax viewer - get current page #} + apw_ViewSetDesignMode = apw_First+116; {To fax viewer - indicate in design} + apw_ViewSetRotation = apw_First+117; {To fax viewer - set rotation} + apw_ViewSetAutoScale = apw_First+118; {To fax viewer - auto scaling} + apw_ViewNotifyPage = apw_First+119; {To fax viewer - notify of page chg} + apw_ViewGetPageDim = apw_First+120; {To fax viewer - get pg dimensions} + apw_ViewSetLoadWholeFax= apw_First+121; {To fax viewer - set load whole fax} + apw_ViewSetBusyCursor = apw_First+122; {To fax viewer - set cursor for busy} + apw_ViewerError = apw_First+123; {Fax viewer error report} + apw_ViewGetPageFlags = apw_First+124; {To fax viewer - get pg flags} + apw_ViewGetFileName = apw_First+125; {To fax viewer - get file name} + +const + apw_TermBlinkTimeChange = apw_First+130; {set new blink time} + apw_TermPersistentMarkChange = apw_First+131; {set persistent blocks} + apw_TermSetKeyEmuPtr = apw_First+132; {set Key Emulator pointer } + apw_TermSetKeyEmuProc = apw_First+133; {set Key Emulator proc } + apw_TermSetHalfDuplex = apw_First+134; {set Duplex mode} + apw_TermGetBuffPtr = apw_First+135; {get a pointer to term buffer} + apw_TermGetClientLine = apw_First+136; {get the first client line in buffer} + apw_TermWaitForPort = apw_First+137; {wait for the port to open}{!!.03} + apw_TermNeedsUpdate = apw_First+138; {update needed} {!!.05} + +const + apw_PrintDriverJobCreated = apw_First+140; {printer driver created fax job} + apw_BeginDoc = apw_First+141; {printer driver starts printing} + apw_EndDoc = apw_First+142; {printer driver has finished printing} + apw_AddPrim = apw_First+143; {internal FaxSrvx sample message} + apw_EndPage = apw_First+144; {printer driver EndOfPage/idShell} + +const + apw_FaxCancel = apw_First+160; {To fax - cancel the session} + apw_FaxNextfile = apw_First+161; {From fax - return next fax to send} + apw_FaxStatus = apw_First+162; {From fax - show the fax status} + apw_FaxLog = apw_First+163; {From fax - log the fax start/stop} + apw_FaxName = apw_First+164; {From fax - name the incoming fax} + apw_FaxAccept = apw_First+165; {From fax - accept this fax?} + apw_FaxError = apw_First+166; {From fax - session had error} + apw_FaxFinish = apw_First+167; {From fax - session finished} + +const + apw_TapiWaveMessage = apw_First+180; {Tapi wave event message} + apw_TapiEventMessage = apw_First+181; {Tapi general event message} + apw_VoIPEventMessage = apw_First+182; {AdVoIP general event message} + apw_VoIPNotifyMessage = apw_First+183; {AdVoIP internal notification message} + +const + apw_StateDeactivate = apw_First+190; {State deactivation message } + apw_StateChange = apw_First+191; {from State to StateMachine } + +const + apw_SapiTrain = apw_First+192; {Sapi training requested} + apw_SapiPhoneCallBack = apw_First+193; {Sapi AskFor phrase return} + apw_SapiInfoPhrase = apw_First+194; {Sapi TAPI connection status} + +const + apw_PgrStatusEvent = apw_First+200; {Pager status event} + +const + {Window class names} + DispatcherClassName = 'awDispatch'; + ProtocolClassName = 'awProtocol'; + TerminalClassName = 'awTerminal'; + MessageHandlerClassName = 'awMsgHandler'; + FaxViewerClassName = 'awViewer'; + FaxViewerClassNameDesign = 'dcViewer'; + TerminalClassNameDesign = 'dcTerminal'; + FaxHandlerClassName = 'awFaxHandler'; + +const + {Error groups} + egDos = -0; {DOS, DOS critical and file I/O} + egGeneral = -1; {General errors} + egOpenComm = -2; {OpenComm errors} + egSerialIO = -3; {Errors during serial I/O processing} + egModem = -4; {Errors during modem processing} + egTrigger = -5; {Error setting up triggers} + egProtocol = -6; {Errors that apply to one or more protocols} + egINI = -7; {INI database errors} + egFax = -8; {FAX errors} + egAdWinsock = 9; {APro specific Winsock errors} + egWinsock = 10; {Winsock errors} + egWinsockEx = 11; {Additional Winsock errors} + egTapi = -13; {TAPI errors} + +const + { Below are all error codes used by APRO -- resource IDs are Abs(ErrorCode) } + { The corresponding strings can be found in APW.STR and AdExcept.inc. If } + { you are adding strings, it's best to go there first to 'stake a claim' on } + { an appropriate range of IDs -- since constants for some status strings } + { are found in the applicable component's unit instead of here... } + + {No error} + aecOK = 0; {Okay} + +const + {egDOS} + ecFileNotFound = -2; {File not found} + ecPathNotFound = -3; {Path not found} + ecTooManyFiles = -4; {Too many open files} + ecAccessDenied = -5; {File access denied} + ecInvalidHandle = -6; {Invalid file handle} + ecOutOfMemory = -8; {Insufficient memory} + ecInvalidDrive = -15; {Invalid drive} + ecNoMoreFiles = -18; {No more files} + ecDiskRead = -100; {Attempt to read beyond end of file} + ecDiskFull = -101; {Disk is full} + ecNotAssigned = -102; {File not Assign-ed} + ecNotOpen = -103; {File not open} + ecNotOpenInput = -104; {File not open for input} + ecNotOpenOutput = -105; {File not open for output} + ecWriteProtected = -150; {Disk is write-protected} + ecUnknownUnit = -151; {Unknown disk unit} + ecDriveNotReady = -152; {Drive is not ready} + ecUnknownCommand = -153; {Unknown command} + ecCrcError = -154; {Data error} + ecBadStructLen = -155; {Bad request structure length} + ecSeekError = -156; {Seek error} + ecUnknownMedia = -157; {Unknown media type} + ecSectorNotFound = -158; {Disk sector not found} + ecOutOfPaper = -159; {Printer is out of paper} + ecDeviceWrite = -160; {Device write error} + ecDeviceRead = -161; {Device read error} + ecHardwareFailure = -162; {General failure} + +const + {egGeneral} + ecBadHandle = -1001; {Bad handle passed to com function} + ecBadArgument = -1002; {Bad argument passed to function} + ecGotQuitMsg = -1003; {Yielding routine got WM_QUIT message} + ecBufferTooBig = -1004; {Terminal buffer size too big} + ecPortNotAssigned = -1005; {ComPort component not assigned} + ecInternal = -1006; {Internal INIDB errors} + ecModemNotAssigned = -1007; {Modem component not assigned} + ecPhonebookNotAssigned = -1008; {Phonebook component not assgnd} + ecCannotUseWithWinSock = -1009; {Component not compatible with WinSock} + +const + {egOpenComm} + ecBadId = -2001; {ie_BadId - bad or unsupported ID} + ecBaudRate = -2002; {ie_Baudrate - unsupported baud rate} + ecByteSize = -2003; {ie_Bytesize - invalid byte size} + ecDefault = -2004; {ie_Default - error in default parameters} + ecHardware = -2005; {ie_Hardware - hardware not present} + ecMemory = -2006; {ie_Memory - unable to allocate queues} + ecCommNotOpen = -2007; {ie_NOpen - device not open} + ecAlreadyOpen = -2008; {ie_Open - device already open} + ecNoHandles = -2009; {No more handles, can't open port} + ecNoTimers = -2010; {No timers available} + ecNoPortSelected = -2011; {No port selected (attempt to open com0)} + ecNotOpenedByTapi = -2012; {Comport was not opened by Tapi} + +const + {egSerialIO} + ecNullApi = -3001; {No device layer specified} + ecNotSupported = -3002; {Function not supported by driver} + ecRegisterHandlerFailed = -3003; {EnableCommNotification failed} + ecPutBlockFail = -3004; {Failed to put entire block} + ecGetBlockFail = -3005; {Failed to get entire block} + ecOutputBufferTooSmall = -3006; {Output buffer too small for block} + ecBufferIsEmpty = -3007; {Buffer is empty} + ecTracingNotEnabled = -3008; {Tracing not enabled} + ecLoggingNotEnabled = -3009; {Logging not enabled} + ecBaseAddressNotSet = -3010; {Base addr not found, RS485 mode} + +const + {Modem/Pager} + ecModemNotStarted = -4001; {StartModem has not been called} + ecModemBusy = -4002; {Modem is busy elsewhere} + ecModemNotDialing = -4003; {Modem is not currently dialing} + ecNotDialing = -4004; {TModemDialer is not dialing} + ecAlreadyDialing = -4005; {TModemdialer is already dialing} + ecModemNotResponding = -4006; {No response from modem} + ecModemRejectedCommand = -4007; {Bad command sent to modem} + ecModemStatusMismatch = -4008; {Wrong modem status requested} + + ecDeviceNotSelected = -4009; { Um, the modem wan't selected } + ecModemDetectedBusy = -4010; { Modem detected busy signal } + ecModemNoDialtone = -4011; { No dialtone detected } + ecModemNoCarrier = -4012; { No carrier from modem } + ecModemNoAnswer = -4013; { Modem returned No Answer response } + + { Pager } + ecInitFail = -4014; { Modem initialization failure } + ecLoginFail = -4015; { Login Failure } + ecMinorSrvErr = -4016; { SNPP - Minor Server Error } + ecFatalSrvErr = -4017; { SNPP - Fatal Server Error } + +const + {LibModem} + ecModemNotFound = -4020; { Modem not found in modemcap } + ecInvalidFile = -4021; { a modemcap file is invalid } + +const {RAS connection status codes} + csOpenPort = 4500; + csPortOpened = 4501; + csConnectDevice = 4502; + csDeviceConnected = 4503; + csAllDevicesConnected = 4504; + csAuthenticate = 4505; + csAuthNotify = 4506; + csAuthRetry = 4507; + csAuthCallback = 4508; + csAuthChangePassword = 4509; + csAuthProject = 4510; + csAuthLinkSpeed = 4511; + csAuthAck = 4512; + csReAuthenticate = 4513; + csAuthenticated = 4514; + csPrepareForCallback = 4515; + csWaitForModemReset = 4516; + csWaitForCallback = 4517; + csProjected = 4518; + + csStartAuthentication = 4519; + csCallbackComplete = 4520; + csLogonNetwork = 4521; + csSubEntryConnected = 4522; + csSubEntryDisconnected = 4523; + csRasInteractive = 4550; + csRasRetryAuthentication = 4551; + csRasCallbackSetByCaller = 4552; + csRasPasswordExpired = 4553; + csRasDeviceConnected = 4599; + csRasBaseEnd = csSubEntryDisconnected; + csRasPaused = $1000; + csInteractive = csRasPaused; + csRetryAuthentication = csRasPaused + 1; + csCallbackSetByCaller = csRasPaused + 2; + csPasswordExpired = csRasPaused + 3; + csRasPausedEnd = csRasPaused + 3; + + csRasConnected = $2000; + csRasDisconnected = csRasConnected + 1; + + { Protocols } + { If strings are added -- apStatusMsg needs to be changed in AWABSPCL.PAS } + +const + psOK = 4700; {Protocol is ok} + psProtocolHandshake = 4701; {Protocol handshaking in progress} + psInvalidDate = 4702; {Bad date/time stamp received and ignored} + psFileRejected = 4703; {Incoming file was rejected} + psFileRenamed = 4704; {Incoming file was renamed} + psSkipFile = 4705; {Incoming file was skipped} + psFileDoesntExist = 4706; {Incoming file doesn't exist locally, skipped} + psCantWriteFile = 4707; {Incoming file skipped due to Zmodem options} + psTimeout = 4708; {Timed out waiting for something} + psBlockCheckError = 4709; {Bad checksum or CRC} + psLongPacket = 4710; {Block too long} + psDuplicateBlock = 4711; {Duplicate block received and ignored} + psProtocolError = 4712; {Error in protocol} + psCancelRequested = 4713; {Cancel requested} + psEndFile = 4714; {At end of file} + psResumeBad = 4715; {B+ host refused resume request} + psSequenceError = 4716; {Block was out of sequence} + psAbortNoCarrier = 4717; {Aborting on carrier loss} + psAbort = 4730; {Session aborted} + +const + {Specific to certain protocols} + psGotCrcE = 4718; {Got CrcE packet (Zmodem)} + psGotCrcG = 4719; {Got CrcG packet (Zmodem)} + psGotCrcW = 4720; {Got CrcW packet (Zmodem)} + psGotCrcQ = 4721; {Got CrcQ packet (Zmodem)} + psTryResume = 4722; {B+ is trying to resume a download} + psHostResume = 4723; {B+ host is resuming} + psWaitAck = 4724; {Waiting for B+ ack (internal)} + +const + {Internal} + psNoHeader = 4725; {Protocol is waiting for header (internal)} + psGotHeader = 4726; {Protocol has header (internal)} + psGotData = 4727; {Protocol has data packet (internal)} + psNoData = 4728; {Protocol doesn't have data packet yet (internal)} + + { Constants for fax strings } + { If strings are added -- afStatusMsg needs to be changed in AWABSFAX.PAS } +const + {Fax progress codes, sending} + fpInitModem = 4801; {Initializing modem for fax processing} + fpDialing = 4802; {Dialing} + fpBusyWait = 4803; {Busy, FaxTransmit is waiting} + fpSendPage = 4804; {Sending document page data} + fpSendPageStatus = 4805; {Send EOP} + fpPageError = 4806; {Error sending page} + fpPageOK = 4807; {Page accepted by remote} + fpConnecting = 4808; {Send call handoff connecting} + +const + {Fax progress codes, receiving} + fpWaiting = 4820; {Waiting for incoming call} + fpNoConnect = 4821; {No connect on this call} + fpAnswer = 4822; {Answering incoming call} + fpIncoming = 4823; {Incoming call validated as fax} + fpGetPage = 4824; {Getting page data} + fpGetPageResult = 4825; {Getting end-of-page signal} + fpCheckMorePages = 4826; {getting end-of-document status} + fpGetHangup = 4827; {Get hangup command} + fpGotHangup = 4828; {Got Class 2 FHNG code} + +const + {Fax server codes } + fpSwitchModes = 4830; {Switching from send/recv or recv/send} + fpMonitorEnabled = 4831; {Monitoring for incoming faxes} + fpMonitorDisabled = 4832; {Not monitoring for incoming faxes} + +const + {Fax progress codes, common} + fpSessionParams = 4840; {Getting connection params} + fpGotRemoteID = 4841; {got called-station ID} + fpCancel = 4842; {User abort} + fpFinished = 4843; {Finished with this fax} + +const + {Trigger errors} + ecNoMoreTriggers = -5001; {No more trigger slots} + ecTriggerTooLong = -5002; {Data trigger too long} + ecBadTriggerHandle = -5003; {Bad trigger handle} + +const + {Packet errors} + ecStartStringEmpty = -5501; {Start string is empty} + ecPacketTooSmall = -5502; {Packet size cannot be smaller than start string} + ecNoEndCharCount = -5503; {CharCount packets must have an end-condition} + ecEmptyEndString = -5504; {End string is empty} + ecZeroSizePacket = -5505; {Packet size cannot be zero} + ecPacketTooLong = -5506; {Packet too long} + +const + {Protocol errors} + ecBadFileList = -6001; {Bad format in file list} + ecNoSearchMask = -6002; {No search mask specified during transmit} + ecNoMatchingFiles = -6003; {No files matched search mask} + ecDirNotFound = -6004; {Directory in search mask doesn't exist} + ecCancelRequested = -6005; {Cancel requested} + aecTimeout = -6006; {Fatal time out} + ecProtocolError = -6007; {Unrecoverable event during protocol} + ecTooManyErrors = -6008; {Too many errors during protocol} + ecSequenceError = -6009; {Block sequence error in Xmodem} + ecNoFilename = -6010; {No filename specified in protocol receive} + ecFileRejected = -6011; {File was rejected} + ecCantWriteFile = -6012; {Cant write file} + ecTableFull = -6013; {Kermit window table is full, fatal error} + ecAbortNoCarrier = -6014; {Aborting due to carrier loss} + ecBadProtocolFunction = -6015; {Function not support by protocol} + ecProtocolAbort = -6016; {Session aborted} + +const + {INI database} + ecKeyTooLong = -7001; {Key string too long} + ecDataTooLarge = -7002; {Data string too long} + ecNoFieldsDefined = -7003; {No fields defined in database} + ecIniWrite = -7004; {Generic INI file write error} + ecIniRead = -7005; {Generic INI file read error} + ecNoIndexKey = -7006; {No index defined for database} + ecRecordExists = -7007; {Record already exists} + ecRecordNotFound = -7008; {Record not found in database} + ecMustHaveIdxVal = -7009; {Invalid index key name} + ecDatabaseFull = -7010; {Maximum database records (999) reached} + ecDatabaseEmpty = -7011; {No records in database} + ecDatabaseNotPrepared = -7012; {iPrepareIniDatabase not called} + ecBadFieldList = -7013; {Bad field list in INIDB} + ecBadFieldForIndex = -7014; {Bad field for index in INIDB} + +const {!!.04} + {State Machine} {!!.04} + ecNoStateMachine = -7500; {No state machine} {!!.04} + ecNoStartState = -7501; {StartState not set} {!!.04} + ecNoSapiEngine = -7502; {SAPI Engine not set} {!!.04} + +const + ecFaxBadFormat = -8001; {File is not an APF file} + ecBadGraphicsFormat = -8002; {Unsupported graphics file format} + ecConvertAbort = -8003; {User aborted fax conversion} + ecUnpackAbort = -8004; {User aborted fax unpack} + ecCantMakeBitmap = -8005; {CreateBitmapIndirect API failure} + ecNoImageLoaded = -8050; {no image loaded into viewer} + ecNoImageBlockMarked = -8051; {no block of image marked} + ecFontFileNotFound = -8052; {APFAX.FNT not found, or resource bad} + ecInvalidPageNumber = -8053; {Invalid page number specified for fax} + ecBmpTooBig = -8054; {BMP size exceeds Windows' maxheight of 32767} + ecEnhFontTooBig = -8055; {Font selected for enh text converter too large} + +const + ecFaxBadMachine = -8060; {Fax incompatible with remote fax} + ecFaxBadModemResult = -8061; {Bad response from modem} + ecFaxTrainError = -8062; {Modems failed to train} + ecFaxInitError = -8063; {Error while initializing modem} + ecFaxBusy = -8064; {Called fax number was busy} + ecFaxVoiceCall = -8065; {Called fax number answered with voice} + ecFaxDataCall = -8066; {Incoming data call} + ecFaxNoDialTone = -8067; {No dial tone} + ecFaxNoCarrier = -8068; {Failed to connect to remote fax} + ecFaxSessionError = -8069; {Fax failed in mid-session} + ecFaxPageError = -8070; {Fax failed at page end} + ecFaxGDIPrintError = -8071; {NextBand GDI error in fax print driver} + ecFaxMixedResolution = -8072; {Multiple resolutions in one session} + ecFaxConverterInitFail = -8073; {Initialization of fax converter failed} + ecNoAnswer = -8074; {Remote fax did not answer} + ecAlreadyMonitored = -8075; {MonitorDir already being used} + ecFaxMCFNoAnswer = -8076; {Remote disconnected after last page}{!!.06} + +const + ecUniAlreadyInstalled = -8080; {Unidrv support files already installed} + ecUniCannotGetSysDir = -8081; {Cannot determine windows system dir} + ecUniCannotGetWinDir = -8082; {Cannot determine windows dir} + ecUniUnknownLayout = -8083; {Cannot determine setup file layout} + ecUniCannotInstallFile = -8085; {Cannot install Unidrv files to system dir} + ecRasDDNotInstalled = -8086; {Cannot install RASDD files } {!!.05} + ecDrvCopyError = -8087; {Error copying printer driver} + ecCannotAddPrinter = -8088; {32-bit AddPrinter call failed} + ecDrvBadResources = -8089; {Bad/missing resources in driver} + ecDrvDriverNotFound = -8090; {Driver file not found} + ecUniCannotGetPrinterDriverDir + = -8091; {Cannot determine Win NT printer driver dir} + ecInstallDriverFailed = -8092; {AddPrinterDriver API failed} + + { TApdGSMPhone error codes } +const + ecSMSBusy = -8100; {Busy with another command} + ecSMSTimedOut = -8101; {Timed out, no response back} + ecSMSTooLong = -8102; {SMS message too long} + ecSMSUnknownStatus = -8103; {Status unknown} + ecSMSInvalidNumber = -8138; {Invalid Number or Network out of order} {!!.06} + ecMEFailure = -8300; {Mobile Equipment Failure} + ecServiceRes = -8301; {SMS service of ME reserved} + ecBadOperation = -8302; {Operation not allowed} + ecUnsupported = -8303; {Operation not supported} + ecInvalidPDU = -8304; {Invalid PDU mode parameter} + ecInvalidText = -8305; {Invalid Text mode parameter} + ecSIMInsert = -8310; {SIM card not inserted} + ecSIMPin = -8311; {SIM PIN required} + ecSIMPH = -8312; {PH-SIM PIN required} + ecSIMFailure = -8313; {SIM failure} + ecSIMBusy = -8314; {SIM busy} + ecSIMWrong = -8315; {SIM wrong} + ecSIMPUK = -8316; {SIM PUK required} + ecSIMPIN2 = -8317; {SIM PIN2 required} + ecSIMPUK2 = -8318; {SIM PUK2 required} + ecMemFail = -8320; {Memory failure} + ecInvalidMemIndex = -8321; {Invalid memory index} + ecMemFull = -8322; {Memory full} + ecSMSCAddUnknown = -8330; {SMS Center Address unknown} + ecNoNetwork = -8331; {No network service} + ecNetworkTimeout = -8332; {Network timeout} + ecCNMAAck = -8340; {No +CNMA acknowledgement expected} + aecUnknown = -8500; {Unknown error} + + +const + ecADWSERROR = 9001; + ecADWSLOADERROR = 9002; + ecADWSVERSIONERROR = 9003; + ecADWSNOTINIT = 9004; + ecADWSINVPORT = 9005; + ecADWSCANTCHANGE = 9006; + ecADWSCANTRESOLVE = 9007; + + { All Windows Sockets error constants are biased by 10000 from the "normal" } + wsaBaseErr = 10000; + + { Windows Sockets definitions of regular Microsoft C error constants } + wsaEIntr = 10004; + wsaEBadF = 10009; + wsaEAcces = 10013; + wsaEFault = 10014; + wsaEInVal = 10022; + wsaEMFile = 10024; + + { Windows Sockets definitions of regular Berkeley error constants } + wsaEWouldBlock = 10035; + wsaEInProgress = 10036; + wsaEAlReady = 10037; + wsaENotSock = 10038; + wsaEDestAddrReq = 10039; + wsaEMsgSize = 10040; + wsaEPrototype = 10041; + wsaENoProtoOpt = 10042; + wsaEProtoNoSupport = 10043; + wsaESocktNoSupport = 10044; + wsaEOpNotSupp = 10045; + wsaEPfNoSupport = 10046; + wsaEAfNoSupport = 10047; + wsaEAddrInUse = 10048; + wsaEAddrNotAvail = 10049; + wsaENetDown = 10050; + wsaENetUnreach = 10051; + wsaENetReset = 10052; + wsaEConnAborted = 10053; + wsaEConnReset = 10054; + wsaENoBufs = 10055; + wsaEIsConn = 10056; + wsaENotConn = 10057; + wsaEShutDown = 10058; + wsaETooManyRefs = 10059; + wsaETimedOut = 10060; + wsaEConnRefused = 10061; + wsaELoop = 10062; + wsaENameTooLong = 10063; + wsaEHostDown = 10064; + wsaEHostUnreach = 10065; + wsaENotEmpty = 10066; + wsaEProcLim = 10067; + wsaEUsers = 10068; + wsaEDQuot = 10069; + wsaEStale = 10070; + wsaERemote = 10071; + wsaEDiscOn = 10101; + + { Extended Windows Sockets error constant definitions } + + wsaSysNotReady = 10091; + wsaVerNotSupported = 10092; + wsaNotInitialised = 10093; + + { Error return codes from gethostbyname() and gethostbyaddr() (when using the } + { resolver). Note that these errors are retrieved via wsaGetLastError() and } + { must therefore follow the rules for avoiding clashes with error numbers from } + { specific implementations or language run-time systems. For this reason the } + { codes are based at 10000+1001. Note also that [wsa]No_Address is defined } + { only for compatibility purposes. } + { Authoritative Answer: Host not found } + wsaHost_Not_Found = 11001; + Host_Not_Found = wsaHost_Not_Found; + + { Non-Authoritative: Host not found, or ServerFAIL } + wsaTry_Again = 11002; + Try_Again = wsaTry_Again; + + { Non recoverable errors, FORMERR, REFUSED, NotIMP } + wsaNo_Recovery = 11003; + No_Recovery = wsaNo_Recovery; + + { Valid name, no data record of requested type } + wsaNo_Data = 11004; + No_Data = wsaNo_Data; + + { no address, look for MX record } + wsaNo_Address = wsaNo_Data; + No_Address = wsaNo_Address; + + { The string resource range 13500 - 13800 is used for TAPI } + { status messages, which do not require constants here } + +const + {Adjusted TAPI error codes} + ecAllocated = -13801; + ecBadDeviceID = -13802; + ecBearerModeUnavail = -13803; + ecCallUnavail = -13805; + ecCompletionOverrun = -13806; + ecConferenceFull = -13807; + ecDialBilling = -13808; + ecDialDialtone = -13809; + ecDialPrompt = -13810; + ecDialQuiet = -13811; + ecIncompatibleApiVersion = -13812; + ecIncompatibleExtVersion = -13813; + ecIniFileCorrupt = -13814; + ecInUse = -13815; + ecInvalAddress = -13816; + ecInvalAddressID = -13817; + ecInvalAddressMode = -13818; + ecInvalAddressState = -13819; + ecInvalAppHandle = -13820; + ecInvalAppName = -13821; + ecInvalBearerMode = -13822; + ecInvalCallComplMode = -13823; + ecInvalCallHandle = -13824; + ecInvalCallParams = -13825; + ecInvalCallPrivilege = -13826; + ecInvalCallSelect = -13827; + ecInvalCallState = -13828; + ecInvalCallStatelist = -13829; + ecInvalCard = -13830; + ecInvalCompletionID = -13831; + ecInvalConfCallHandle = -13832; + ecInvalConsultCallHandle = -13833; + ecInvalCountryCode = -13834; + ecInvalDeviceClass = -13835; + ecInvalDeviceHandle = -13836; + ecInvalDialParams = -13837; + ecInvalDigitList = -13838; + ecInvalDigitMode = -13839; + ecInvalDigits = -13840; + ecInvalExtVersion = -13841; + ecInvalGroupID = -13842; + ecInvalLineHandle = -13843; + ecInvalLineState = -13844; + ecInvalLocation = -13845; + ecInvalMediaList = -13846; + ecInvalMediaMode = -13847; + ecInvalMessageID = -13848; + ecInvalParam = -13850; + ecInvalParkID = -13851; + ecInvalParkMode = -13852; + ecInvalPointer = -13853; + ecInvalPrivSelect = -13854; + ecInvalRate = -13855; + ecInvalRequestMode = -13856; + ecInvalTerminalID = -13857; + ecInvalTerminalMode = -13858; + ecInvalTimeout = -13859; + ecInvalTone = -13860; + ecInvalToneList = -13861; + ecInvalToneMode = -13862; + ecInvalTransferMode = -13863; + ecLineMapperFailed = -13864; + ecNoConference = -13865; + ecNoDevice = -13866; + ecNoDriver = -13867; + ecNoMem = -13868; + ecNoRequest = -13869; + ecNotOwner = -13870; + ecNotRegistered = -13871; + ecOperationFailed = -13872; + ecOperationUnavail = -13873; + ecRateUnavail = -13874; + ecResourceUnavail = -13875; + ecRequestOverrun = -13876; + ecStructureTooSmall = -13877; + ecTargetNotFound = -13878; + ecTargetSelf = -13879; + ecUninitialized = -13880; + ecUserUserInfoTooBig = -13881; + ecReinit = -13882; + ecAddressBlocked = -13883; + ecBillingRejected = -13884; + ecInvalFeature = -13885; + ecNoMultipleInstance = -13886; + +const + {Apro encounters a few of its own TAPI errors, place these error + codes after the native TAPI error codes, but leave a little bit + of room for expansion of the TAPI error codes.} + ecTapiBusy = -13928; + ecTapiNotSet = -13929; + ecTapiNoSelect = -13930; + ecTapiLoadFail = -13931; + ecTapiGetAddrFail = -13932; + ecTapiUnexpected = -13934; + ecTapiVoiceNotSupported = -13935; + ecTapiWaveFail = -13936; + ecTapiCIDBlocked = -13937; + ecTapiCIDOutOfArea = -13938; + ecTapiWaveFormatError = -13939; + ecTapiWaveReadError = -13940; + ecTapiWaveBadFormat = -13941; + ecTapiTranslateFail = -13942; + ecTapiWaveDeviceInUse = -13943; + ecTapiWaveFileExists = -13944; + ecTapiWaveNoData = -13945; + + ecVoIPNotSupported = -13950; { TAPI3/H.323 not found } + ecVoIPCallBusy = -13951; { remote was busy } + ecVoIPBadAddress = -13952; { destination address bad } + ecVoIPNoAnswer = -13953; { remote did not answer } + ecVoIPCancelled = -13954; { cancelled } + ecVoIPRejected = -13955; { remote rejected the call } + ecVoIPFailed = -13956; { general failure } + ecVoIPTapi3NotInstalled = -13957; { ITTapi interface failure } {!!.01} + ecVoIPH323NotFound = -13958; { H.323 line not found } {!!.01} + ecVoIPTapi3EventFailure = -13959; { event notify failure } {!!.01} + + {RAS error codes} + ecRasLoadFail = -13980; + +const + {Convenient character constants (and aliases)} + cNul = #0; + cSoh = #1; + cStx = #2; + cEtx = #3; + cEot = #4; + cEnq = #5; + cAck = #6; + cBel = #7; + cBS = #8; + aacTab = #9; + acLF = #10; + cVT = #11; + cFF = #12; + acCR = #13; + cSO = #14; + cSI = #15; + cDle = #16; + cDC1 = #17; cXon = #17; + cDC2 = #18; + cDC3 = #19; cXoff = #19; + cDC4 = #20; + cNak = #21; + cSyn = #22; + cEtb = #23; + cCan = #24; + cEM = #25; + cSub = #26; + cEsc = #27; + cFS = #28; + cGS = #29; + cRS = #30; + cUS = #31; + +type + {Protocol status information record} + TProtocolInfo = record + piProtocolType : Cardinal; + piBlockErrors : Cardinal; + piTotalErrors : Cardinal; + piBlockSize : Cardinal; + piBlockNum : Cardinal; + piFileSize : Integer; + piBytesTransferred : Integer; + piBytesRemaining : Integer; + piInitFilePos : Integer; + piElapsedTicks : Integer; + piFlags : Integer; + piBlockCheck : Cardinal; + piFileName : TPathCharArrayA; + piError : Integer; + piStatus : Cardinal; + end; + +const + {Port options} + poUseEventWord = $04; {Set to use the event word} + + { APRO-specific flags used in InitPort} + ipAssertDTR = $00000001; + ipAssertRTS = $00000002; + ipAutoDTR = $00000010; + ipAutoRTS = $00000020; + + {Hardware flow control options} + hfUseDTR = $01; {Use DTR for receive flow control} + hfUseRTS = $02; {Use RTS for receive flow control} + hfRequireDSR = $04; {Require DSR before transmitting} + hfRequireCTS = $08; {Require CTS before transmitting} + + {Software flow control options} + sfTransmitFlow = $01; {Honor received Xon/Xoffs} + sfReceiveFlow = $02; {Send Xon/Xoff as required} + + {Define bits for TDCB Flags field} + adcb_Binary = $0001; + dcb_Parity = $0002; + adcb_OutxCTSFlow = $0004; + adcb_OutxDSRFlow = $0008; + dcb_DTRBit1 = $0010; + dcb_DTRBit2 = $0020; + dcb_DsrSensitivity = $0040; + adcb_TxContinueOnXoff = $0080; + adcb_OutX = $0100; + adcb_InX = $0200; + adcb_ErrorChar = $0400; + dcb_Null = $0800; + dcb_RTSBit1 = $1000; + dcb_RTSBit2 = $2000; + adcb_AbortOnError = $4000; + + dcb_DTR_CONTROL_ENABLE = dcb_DTRBit1; + dcb_DTR_CONTROL_HANDSHAKE = dcb_DTRBit2; + dcb_RTS_CONTROL_ENABLE = dcb_RTSBit1; + dcb_RTS_CONTROL_HANDSHAKE = dcb_RTSBit2; + dcb_RTS_CONTROL_TOGGLE = (dcb_RTSBit1 + dcb_RTSBit2); + + {For reporting flow states, note: no receive hardware flow status is provided} + fsOff = 1; {No flow control is in use} + fsOn = 2; {Flow control is but not transmit blocked} + fsDsrHold = 3; {Flow control is on and transmit blocked by low DSR} + fsCtsHold = 4; {Flow control is on and transmit blocked by low CTS} + fsDcdHold = 5; {Flow control is on and transmit blocked by low DCD} + fsXOutHold = 6; {Flow control is on and transmit blocked by Xoff} + fsXInHold = 7; {Flow control is on and receive blocked by Xoff} + fsXBothHold= 8; {Flow control is on and both are blocked by Xoff} + +const + {Emulator commands} + eNone = 0; {No command, ignore this char} + eChar = 1; {No command, process the char} + eGotoXY = 2; {X} {Absolute goto cursor position call} + eUp = 3; {X} {Cursor up} + eDown = 4; {X} {Cursor down} + eRight = 5; {X} {Cursor right} + eLeft = 6; {X} {Cursor left} + eClearBelow = 7; {R} {Clear screen below cursor} + eClearAbove = 8; {R} {Clear screen above cursor} + eClearScreen = 9; {R} {Clear entire screen} + eClearEndofLine = 10;{R} {Clear from cursor to end of line} + eClearStartOfLine= 11;{R} {Clear from cursor to the start of line} + eClearLine = 12;{R} {Clear entire line that cursor is on} + eSetMode = 13;{X} {Set video mode} + eSetBackground = 14; {Set background attribute} + eSetForeground = 15; {Set foreground attribute} + eSetAttribute = 16;{X} {Set video attribute (foreground and background)} + eSaveCursorPos = 17; {Save cursor position} + eRestoreCursorPos= 18; {Restore cursor position} + eDeviceStatusReport = 19;{X}{Report device status or cursor position} + eString = 20; {Pascal style string} + eHT = 21; {Horizontal Tab Character} + eError = 255; {indicates a parser error} + + eAPC { } = 30; {Application programming command} + eCBT {X} = 31; {Cursor backward tabulation} + eCCH { } = 32; {Cancel character} + eCHA {X} = 33; {Cursor horizontal absolute} + eCHT {X} = 34; {Cursor horizontal tabulation} + eCNL {X} = 35; {Cursor next line} + eCPL {X} = 36; {Cursor preceding line} + eCPR {X} = 37; {Cursor position report} + eCRM {.} = 38; {Control representation mode} + eCTC {X} = 39; {Cursor tabulation control} + eCUB {X} = eLeft; {Cursor backward} + eCUD {X} = eDown; {Cursor down} + eCUF {X} = eRight; {Cursor forward} + aeCUP {X} = eGotoXY; {Cursor position} + eCUU {X} = eUp; {Cursor up} + eCVT {X} = 40; {Cursor vertical tabulation} + eDA {X} = 41; {Device attributes} + eDAQ { } = 42; {Define area qualification} + eDCH {X} = 43; {Delete character} + eDCS { } = 44; {Device control string} + eDL {X} = 45; {Delete line} + eDMI { } = 46; {Disable manual input} + eDSR {X} = eDeviceStatusReport;{Device status report} + eEA { } = 47; {Erase in area} + eEBM { } = 48; {Editing boundry mode} + eECH {X} = 49; {Erase character} + eED {X} = 50; {Erase in Display} + eEF { } = 51; {Erase in field} + eEL {X} = 52; {Erase in line} + eEMI { } = 53; {Enable manual input} + eEPA { } = 54; {End of protected mode} + eERM { } = 55; {Erasure mode} + eESA { } = 56; {End of selected area} + eFEAM { } = 57; {Format effector action mode} + eFETM { } = 58; {Format effector transfer mode} + eFNT { } = 59; {Font selection} + eGATM { } = 60; {Guarded area transfer mode} + eGSM { } = 61; {Graphics size modification} + eGSS { } = 62; {Graphics size selection} + eHEM { } = 63; {Horizontal editing mode} + eHPA {X} = eCHA; {Horizontal position absolute} + eHPR {X} = eCUF; {Horizontal position relative} + eHTJ {X} = 64; {Horizontal tab with justification} + eHTS {X} = 65; {Horizontal tabulation set} + eHVP {X} = eCUP; {Horizontal and vertical position} + eICH {X} = 66; {Insert character} + eIL {X} = 67; {Insert line} + eIND {X} = eCUD; {Index} + eINT { } = 68; {Interrupt} + eIRM {.} = 69; {Inseration-Replacement mode} + eJFY { } = 70; {Justify} + eKAM {.} = 71; {Keyboard action mode} + eLNM {.} = 72; {Line feed new line mode} + eMATM { } = 73; {Multiple area transfer mode} + eMC {.} = 74; {Media copy} + eMW {.} = 75; {Message waiting} + eNEL {X} = 76; {Next line} + eNP {.} = 77; {Next page} + eOSC { } = 78; {Operating system command} + ePLD { } = 79; {Partial line down} + ePLU { } = 80; {Partial line up} + ePM { } = 81; {Privacy message} + ePP {.} = 82; {Preceding page} + ePU1 { } = 83; {Private use 1} + ePU2 { } = 84; {Private use 2} + ePUM { } = 85; {Positioning unit mode} + eQUAD { } = 86; {Quad} + eREP { } = 87; {Repeat} + eRI {X} = 88; {Reverse index} + eRIS {.} = 89; {Reset to initial state} + eRM {.} = 90; {Reset mode} + eSATM { } = 91; {Selected area transfer mode} + eSD { } = 92; {Scroll down} + eSEM { } = 93; {selected editing extent mode} + eSGR {X} = eSetAttribute;{Select graphics rendition} + eSL { } = 94; {Scroll left} + eSM {.} = eSetMode;{Set Mode} + eSPA { } = 95; {Start of protected area} + eSPI { } = 96; {Spacing increment} + eSR { } = 97; {Scroll right} + eSRM { } = 98; {Send-Receive mode} + eSRTM { } = 99; {Status report transfer mode} + eSS2 { } = 100; {Single shift 2} + eSS3 { } = 101; {Single shift 3} + eSSA { } = 102; {Start of selected area} + eST { } = 103; {String terminator} + eSTS { } = 104; {Set transmit state} + eSU { } = 105; {Scroll up} + eTBC {X} = 106; {Tabulation clear} + eTSM { } = 107; {Tabulation stop mode} + eTSS { } = 108; {Thin space specification} + eTTM { } = 109; {Transfer termination mode} + eVEM { } = 110; {Vertical editing mode} + eVPA {X} = 111; {Vertical position absolute} + eVPR {X} = eCUD; {Vertical position relative} + eVTS {X} = 112; {vertical tabulation set} + eDECSTBM = 113; {dec private-set Top/Bottom margin} + + eENQ {X} = 114; {enquiry request} + eBEL {X} = 115; {sound bell} + eBS {X} = 116; {backspace} + eLF {X} = 117; {line feed command} + eCR {X} = 118; {carriage return} + eSO {X} = 119; {invoke G1 charset} + eSI {X} = 120; {invoke G0 charset} + eIND2 {X} = 121; {corrected eIND (<> eCUD, eDown) new term only} + eDECALN = 122; {DEC PRIVATE-screen alignment display} + eDECDHL = 123; {DEC PRIVATE-Double height line} + eDECDWL = 124; {DEC PRIVATE-Double width line} + eDECLL = 125; {DEC PRIVATE-load LEDs} + eDECREQTPARM = 126; {DEC PRIVATE-request terminal parameters} + eDECSWL = 127; {DEC PRIVATE-single width line} + eDECTST = 128; {DEC PRIVATE-Invoke confidence test} + eDECSCS = 129; {DEC PRIVATE-select charset} + + {Extended attributes} + eattrBlink = $01; + eattrInverse = $02; + eattrIntense = $04; + eattrInvisible = $08; + eattrUnderline = $10; + + {ANSI color constants} + emBlack = 0; + emRed = 1; + emGreen = 2; + emYellow = 3; + emBlue = 4; + emMagenta = 5; + emCyan = 6; + emWhite = 7; + emBlackBold = 8; + emRedBold = 9; + emGreenBold = 10; + emYellowBold = 11; + emBlueBold = 12; + emMagentaBold = 13; + emCyanBold = 14; + emWhiteBold = 15; + + {AnsiEmulator option flags} + teMapVT100 = $0001; + + {Misc} + MaxParams = 5; {Maximum parameters for our interpreter} + MaxQueue = 20; {Maximum characters in queue} + MaxOther = 11; {Maximum other data} + MaxParamLength = 5; {Maximum parameter length for interpreter} + KeyMappingLen = 20; {Maximum length of a keymapping} + +type + {AnsiEmulator's parser states} + TAnsiParser = (GotNone, GotEscape, GotBracket, GotSemiColon, GotParam, + GotCommand, GotControlSeqIntro, GotLeftBrace, GotRightBrace, + GotSpace, GotQuestionMark, GotQuestionParam); + + {Array used for internal queue} + TApQueue = Array[1..MaxQueue] of AnsiChar; // SWB + + {Emulator for PC ANSI codes} + //PAnsiEmulator = ^TAnsiEmulator; + TAnsiEmulator = record + emuType : Cardinal; { Emulator Type } + emuFlags : Cardinal; + emuFirst : Bool; {True if first time thru} + emuAttr : Byte; + emuIndex : Cardinal; {Index into rcvd byte array} + emuParamIndex : Cardinal; {Parameter index} + emuQueue : TApQueue; {Queue of recvd bytes} // SWB + emuParamStr : array[1..MaxParams] of string; //[MaxParamLength]; + emuParamInt : array[1..MaxParams] of Integer; + emuParserState : TAnsiParser; {Current state} + emuOther : _Pointer; + end; + +const + {Terminal window Cardinal} + gwl_Terminal = 0; + + {Terminal options} + tws_WantTab = $0001; {Process tabs internally} + tws_IntHeight = $0002; {Integral height} + tws_IntWidth = $0004; {Integral width} + tws_AutoHScroll = $0008; {Add/remove horiz scroll automatically} + tws_AutoVScroll = $0010; {Add/remove vert scroll automatically} + +type + {For general typecasting} + LH = record + L,H : Word; + end; + + {IniDBase (deprecated) consts and types} +const + MaxDBRecs = 999; {Maximum number of database records} + MaxNameLen = 21; {Maximum length of a profile string key} + MaxIndexLen = 31; {Maximum length of an index string} + NonValue = '#'; {Value of DB fields SPECIFICALLY left blank} + dbIndex = 'Index'; {Item index section heading} + dbDefaults = 'Defaults'; {Default value section heading} + dbNumEntries = '_Entries'; {Number of entries key name} + dbBogus = 'None'; {Bogus key name for creating sections} + +type + //PIniDatabaseKey = ^TIniDatabaseKey; + TIniDatabaseKey = record + //KeyName : PAnsiChar; + DataSize : Cardinal; + StrType : Bool; + Index : Bool; + //Next : PIniDatabaseKey; + end; + + //PIniDatabase = ^TIniDatabase; + TIniDatabase = record + //FName : PAnsiChar; + //DictionaryHead : PIniDatabaseKey; + //DictionaryTail : PIniDatabaseKey; + NumRecords : Integer; + RecordSize : Cardinal; + DefaultRecord : _Pointer; + Prepared : Bool; + end; + +const + ApdMaxTags = 5; {Maximum number of err corr or data comp tags} + ApdTagSepChar = ','; {Character that separates tags in a profile string} + +const + ApdModemNameLen = 31; {Length of a modem name string} + ApdCmdLen = 41; {Maximum length of a modem command} + ApdRspLen = 21; {Maximum length of a modem response} + ApdTagLen = 21; {Maximum length of a tag string} + ApdTagProfLen = 105; {Maximum length of a tag profile string} + ApdBoolLen = 5; {Maximum length of a boolean string} + ApdBaudLen = 7; {Maximum length of a baud rate string} + ApdConfigLen = 255; {Maximum length of a configuration string} + +type + {where these same variables are declared as Strings.} + TModemNameZ = array[0..ApdModemNameLen] of AnsiChar; //SZ: must probably be Ansi + TCmdStringZ = array[0..ApdCmdLen] of AnsiChar; + TRspStringZ = array[0..ApdRspLen] of AnsiChar; + TTagStringZ = array[0..ApdTagLen] of AnsiChar; + TTagProfStringZ = array[0..ApdTagProfLen] of AnsiChar; + TConfigStringZ = array[0..ApdConfigLen] of AnsiChar; + TBoolStrZ = array[0..ApdBoolLen] of AnsiChar; + TBaudStrZ = array[0..ApdBaudLen] of AnsiChar; + + TTagArrayZ = array[1..ApdMaxTags] of TTagStringZ; + + //PModemBaseData = ^TModemBaseData; + TModemBaseData = record + Name : TModemNameZ; + InitCmd : TCmdStringZ; + DialCmd : TCmdStringZ; + DialTerm : TCmdStringZ; + DialCancel : TCmdStringZ; + HangupCmd : TCmdStringZ; + ConfigCmd : TConfigStringZ; + AnswerCmd : TCmdStringZ; + OkMsg : TRspStringZ; + ConnectMsg : TRspStringZ; + BusyMsg : TRspStringZ; + VoiceMsg : TRspStringZ; + NoCarrierMsg : TRspStringZ; + NoDialToneMsg : TRspStringZ; + ErrorMsg : TRspStringZ; + RingMsg : TRspStringZ; + end; + + //PModemData = ^TModemData; + TModemData = record + Data : TModemBaseData; + NumErrors : Cardinal; + Errors : TTagArrayZ; + NumComps : Cardinal; + Compression : TTagArrayZ; + LockDTE : Bool; + DefBaud : Integer; + end; + + //PModemXFer = ^TModemXFer; + TModemXFer = record + Data : TModemBaseData; + Errors : TTagProfStringZ; + Compress : TTagProfStringZ; + LockDTE : TBoolStrZ; + DefBaud : TBaudStrZ; + end; + + //PModemDatabase = ^TModemDatabase; + TModemDatabase = record + DB : {P}TIniDatabase; + end; + + +const + {keyboard shift state masks} + ksControl = $02; + ksAlt = $04; + ksShift = $08; + + {keyboard toggle state masks} + tsCapital = $02; + tsNumlock = $04; + tsScroll = $08; + + {keyboard INI file constants} + ApdKeyMapNameLen = 30; {Length of a KeyMap name string} + ApdMaxKeyMaps = 100; {Maximum possible key mapping per type} + + ApdKeyIndexName = 'EMULATOR'; + ApdKeyIndexMaxLen = 120; + +type + TKeyMapName = array[0..ApdKeyMapNameLen] of AnsiChar; + TKeyMapping = array[0..KeyMappingLen] of Ansichar; + TKeyMappingStr = string; //[KeyMappingLen]; + + + //PKeyMapXFerRec = ^TKeyMapXFerRec; + TKeyMapXFerRec = record + Name : TKeyMapName; + Keys : array[1..ApdMaxKeyMaps] of TKeyMapping; + end; + + //PVKeyMapRec = ^TVKeyMapRec; + TVKEyMapRec = record + KeyCode : Cardinal; + ShiftState: Cardinal; + Mapping : TKeyMappingStr; + end; + + //PKeyEmulator = ^TKeyEmulator; + TKeyEmulator = record + kbKeyFileName : PChar; { current file name } + kbKeyName : TKeyMapName; { current key index name } + kbProcessAll : Bool; + kbProcessExt : Bool; + kbKeyNameList : array[0..ApdKeyIndexMaxLen] of Ansichar; + kbKeyMap : array[1..ApdMaxKeyMaps] of TVKeyMapRec; + kbKeyDataBase : TIniDataBase; { pointer to the INI data base file } + end; + +const + {---- Option codes for protocols ----} + apIncludeDirectory = $0001; {Set to include directory in file names} + apHonorDirectory = $0002; {Set to honor directory in file names} + apRTSLowForWrite = $0004; {Set to lower RTS during disk writes} + apAbortNoCarrier = $0008; {Set to abort protocol on DCD loss} + apKermitLongPackets = $0010; {Set to support long packets} + apKermitSWC = $0020; {Set to support SWC} + apZmodem8K = $0040; {Set to support 8K blocks} + apBP2KTransmit = $0080; {Set to support 2K transmit blocks} + apAsciiSuppressCtrlZ = $0100; {Set to stop transmitting on ^Z} + + {---- Default options for protocols ----} + DefProtocolOptions = 0; + BadProtocolOptions = apKermitLongPackets+apKermitSWC+apZmodem8K; + + {Block check codes} + abcNone = 0; {No block checking} + bcChecksum1 = 1; {Basic checksum} + bcChecksum2 = 2; {Two byte checksum} + bcCrc16 = 3; {16 bit Crc} + bcCrc32 = 4; {32 bit Crc} + bcCrcK = 5; {Kermit style Crc} + + {Convenient blockcheck string constants} + bcsNone = 'No check'; + bcsChecksum1 = 'Checksum'; + bcsChecksum2 = 'Checksum2'; + bcsCrc16 = 'Crc16'; + bcsCrc32 = 'Crc32'; + bcsCrck = 'CrcKermit'; + + {Constants for supported protocol types} + NoProtocol = 0; + Xmodem = 1; + XmodemCRC = 2; + Xmodem1K = 3; + Xmodem1KG = 4; + Ymodem = 5; + YmodemG = 6; + Zmodem = 7; + Kermit = 8; + Ascii = 9; + BPlus = 10; + + {Zmodem attention string length} + MaxAttentionLen = 32; + + {Zmodem file management options} + zfWriteNewerLonger = 1; {Transfer if new, newer or longer} + zfWriteCrc = 2; {Not supported, same as WriteNewer} + zfWriteAppend = 3; {Transfer if new, append if exists} + zfWriteClobber = 4; {Transfer regardless} + zfWriteNewer = 5; {Transfer if new or newer} + zfWriteDifferent = 6; {Transfer if new or diff dates/lens} + zfWriteProtect = 7; {Transfer only if new} + + {Convenient protocol string constants} + var ProtocolString : array[NoProtocol..BPlus] of array[0..9] of AnsiChar; + {= ( + 'None', 'Xmodem', 'XmodemCRC', 'Xmodem1K', 'Xmodem1KG', + 'Ymodem', 'YmodemG', 'Zmodem', 'Kermit', 'Ascii', 'B+'); } + +type + {For holding lists of files to transmit} + //PFileList = ^TFileList; + TFileList = array[0..65535-1] of Char; + +{Fax conversion} + +const + rw1728 = 1; {standard width} + rw2048 = 2; {extra wide} + + {Fax pixel widths} + StandardWidth = 1728; {Standard width in pixels} + WideWidth = 2048; {Allowed higher resolution} + + {Option flags for FAX page header} + ffHighRes = $0001; {Image stored in high-res mode} + ffHighWidth = $0002; {Image uses option high-width mode} + ffLengthWords = $0004; {Set if raster lines include length Cardinal} + + {Options for fax conversion} + fcDoubleWidth = $0001; {Double the horizontal width in std res} + fcHalfHeight = $0002; {Halve the vertical height in std res} + fcCenterImage = $0004; {Center graphics images horizontally} + fcYield = $0008; {Have the converter yield while converting} + fcYieldOften = $0010; {Increases the number of yields} + + {Flags passed to status function} + csStarting = $0001; + csEnding = $0002; + + {Font handles, same value as bytes-per-char} + SmallFont = 16; + StandardFont = 48; + + {Maximum number of tree records} + MaxTreeRec = 306; + + {Max size of decompress buffer} + MaxData = 4096; + + {Text conversion limits} + MaxLineLen = 144; + + {encoding/decoding table limits} + MaxCodeTable = 63; + MaxMUCodeTable = 39; + + {default extensions} + DefTextExt = 'TXT'; + DefTiffExt = 'TIF'; + DefPcxExt = 'PCX'; + DefDcxExt = 'DCX'; + DefBmpExt = 'BMP'; + DefApfExt = 'APF'; + +type + {Compression code tables} + TCodeRec = record + Code : Word; + Sig : Word; + end; + + TTermCodeArray = array[0..MaxCodeTable] of TCodeRec; + TMakeUpCodeArray = array[0..MaxMUCodeTable] of TCodeRec; + + //PBufferedOutputFile = ^TBufferedOutputFile; + TBufferedOutputFile = record + BufPos : Word; + //Buffer : PByteArray; + OutFile : File; + end; + + {For storing station IDs} + Str20 = string; //[20]; + + {Stores information about our fonts} + TFontRecord = record + Bytes : Byte; {# of bytes per char in font} + PWidth : Byte; {width of font in pixels} + Width : Byte; {width of font in bytes (e.g. 16-pixel-wide = 2)} + Height : Byte; {height of font in raster lines} + end; + + {Fax file signature array} + TSigArray = Array[0..5] of AnsiChar; + +var + {Default fax file signature, first 6 chars in an APF} + DefAPFSig : TSigArray; // = 'APF10'#26; + +type + {APRO fax file header record} + TFaxHeaderRec = record + Signature : TSigArray; {APRO FAX signature} + FDateTime : Integer; {Date and time in DOS format} + SenderID : Str20; {Station ID of sender} + Filler : Byte; {Alignment byte, unused} + PageCount : Word; {Number of pages in this file} + PageOfs : Integer; {Offset in file of first page} + Padding : Array[39..64] of Byte; {Expansion room} + end; + + {APRO fax page header record} + TPageHeaderRec = record + ImgLength : Integer; {Bytes of image data in this page} + ImgFlags : Word; {Image flags for width, res, etc} + Padding : Array[7..16] of Byte; {Expansion room} + end; + + {APRO fax server job header} + TFaxJobHeaderRec = record + ID : Integer; {APRO fax job signature} + Status : Byte; {0=none sent, 1=some sent, 2=all sent, 3=paused} + JobName : Str20; {Friendly name of fax job} + Sender : String; //[40]; {Name of sender (same as HeaderSender)} + SchedDT : TDateTime; {TDateTime the first job should be sent} + NumJobs : Byte; {Number of FaxJobInfoRecs for this job} + NextJob : Byte; {The index of the next FaxJobInfo to send} + CoverOfs : Integer; {Offset in file of text CoverFile data} + FaxHdrOfs: Integer; {Offset in file of TFaxHeaderRec} + Padding : Array[86..128] of Byte; {Expansion room} + end; + + {APRO fax server job recipient record } + TFaxRecipientRec = record + Status : Byte; {0=not sent, 1=sending, 2=sent, 3=paused} + JobID : Byte; {Unique ID for this job} + SchedDT : TDateTime; {TDateTime this job should be sent} + AttemptNum : Byte; {Retry number for this recipient} + LastResult : Word; {Last ErrorCode for this fax} + PhoneNumber : String;//[50]; {Phone number to dial for this job} + HeaderLine : String;//[100]; {Header line} + HeaderRecipient: String;//[30]; {Recipient's name} + HeaderTitle : String;//[30]; {Title of fax} + Padding : Array[228..256] of Byte;{Expansion room} + end; + + {Pcx header} + TPcxPalArray = Array[0..47] of Byte; + TPcxHeaderRec = record + Mfgr : Byte; + Ver : Byte; + Encoding : Byte; + BitsPixel : Byte; + XMin : Word; + YMin : Word; + XMax : Word; + YMax : Word; + HRes : Word; + VRes : Word; + Palette : TPcxPalArray; + Reserved : Byte; + Planes : Byte; + BytesLine : Word; + PalType : Word; + Filler : Array[1..58] of Byte; {pad to 128 bytes} + end; + + TDcxOfsArray = array[1..1024] of Integer; + + //PDcxHeaderRec = ^TDcxHeaderRec; + TDcxHeaderRec = record + ID : Integer; + Offsets : TDcxOfsArray; + end; + + TTreeRec = record + Next0 : Integer; + Next1 : Integer; + end; + TTreeArray = array[0..MaxTreeRec] of TTreeRec; + //PTreeArray = ^TTreeArray; + + {$IFNDEF DrvInst} + //PAbsFaxCvt = ^TAbsFaxCvt; + + {callback function to open a converter input file} + (* TOpenFileCallback = function(Cvt : PAbsFaxCvt; FileName : string) : Integer; + + {callback function to close a converter input file} + TCloseFileCallback = procedure(Cvt : PAbsFaxCvt); + + {callback function converters use to get input raster} + TGetLineCallback = function(Cvt : PAbsFaxCvt; var Data; var Len : Integer; + var EndOfPage, MorePages : Bool) : Integer; + + {callback function converters use to output data} + TPutLineCallback = function(Cvt : PAbsFaxCvt; var Data; Len : Integer; + EndOfPage, MorePages : Bool) : Integer; + + + {callback function for status information} + TCvtStatusCallback = function(Cvt : PAbsFaxCvt; StatFlags : Word; + BytesRead, BytesToRead : Integer) : Bool; + + *) + + {base converter data} + TAbsFaxCvt = record + UseHighRes : Bool; {TRUE if for high-res mode} + DoubleWidth : Bool; {TRUE do double each pixel} + HalfHeight : Bool; {TRUE to discard each raster line} + Flags : Cardinal; {Options flags} + ByteOfs : Cardinal; {Byte offset in buffer} + BitOfs : Cardinal; {Bit offset in buffer} + ResWidth : Cardinal; {Width of current resolution in pels} + LeftMargin : Cardinal; {Left margin in pels} + TopMargin : Cardinal; {Top margin in pels} + CurrPage : Cardinal; {Current page being processed} + CurrLine : Cardinal; {Number of text/raster lines cvted} + LastPage : Cardinal; {Last page number used in file cvt} + CurPagePos : Integer; {file offset of current page} + CenterOfs : Cardinal; {Offset of center of bitmap} + UserData : _Pointer; {Data needed by higher level cvters} + OtherData : _Pointer; {Other, miscellaneous data} + BytesRead : Integer; + BytesToRead : Integer; + //DataLine : PByteArray; {Buffered line of compressed data} + //TmpBuffer : PByteArray; {Temp compression buffer} + //GetLine : TGetLineCallback; {Callback function to get a raster line} + //OpenCall : TOpenFileCallback; {To open the input file, if any} + //CloseCall : TCloseFileCallback; {To close the input file, if any} + //StatusFunc : TCvtStatusCallback; {Callback for status display} + StatusWnd : HWnd; {Handle of window receiving status msgs} + DefExt : string; // array[0..3] of AnsiChar; + InFileName : string; // array[0..255] of AnsiChar; + OutFileName : string; // array[0..255] of AnsiChar; + StationID : AnsiString; //array[0..20] of AnsiChar; + MainHeader : TFaxHeaderRec; {main header of fax output file} + PageHeader : TPageHeaderRec; {header for current output page} + //OutFile : PBufferedOutputFile;{Output file} + PadPage : Bool; {True to pad text conversion to full page}{!!.04} + {$IFNDEF PrnDrv} + InBitmap : {Graphics.}TBitmap; + {$ENDIF} + end; + +{$IFNDEF PrnDrv} + +type + { moved from AdWUtil } {!!.06} + SunB = record {!!.06} + s_b1, s_b2, s_b3, s_b4 : AnsiChar; {!!.06} + end; {!!.06} + { moved from AdWUtil } {!!.06} + SunW = record {!!.06} + s_w1, s_w2 : Word; {!!.06} + end; {!!.06} + + { moved from AdWnPort and AdWUtil } {!!.06} + //PInAddr = ^TInAddr; {!!.06} + (* aTInAddr = record {!!.06} + case Integer of {!!.06} + 0 : (S_un_b : SunB); {!!.06} + 1 : (S_un_w : SunW); {!!.06} + 2 : (S_addr : Integer); {!!.06} + end; *) {!!.06} + + { XML support } +//const + {The following constants are the tokens needed to parse an XML + document. The tokens are stored in UCS-4 format to reduce the + number of conversions needed by the filter.} +(* Xpc_BracketAngleLeft : array[0..0] of Integer = (60); {<} + Xpc_BracketAngleRight : array[0..0] of Integer = (62); {>} + Xpc_BracketSquareLeft : array[0..0] of Integer = (91); {[} + Xpc_BracketSquareRight : array[0..0] of Integer = (93); {]} + Xpc_CDATAStart : + array[0..5] of Integer = (67, 68, 65, 84, 65, 91); {CDATA[} + Xpc_CharacterRef : array[0..0] of Integer = (35); {#} + Xpc_CharacterRefHex : array[0..0] of Integer = (120); {x} + Xpc_CommentEnd : array[0..2] of Integer = (45, 45, 62); {-->} + Xpc_CommentStart : array[0..3] of Integer = (60, 33, 45, 45); { + + + +
program VCL4Python_Py_AnalyticsDemo;
+{
+ Most programmers are familiar with the inexactness of floating point 
+                                   calculations in a binary processor. 
+ https://downloads.blaisepascal.eu/BlaisePascalMagazine_99_100_UK.pdf
+ 
+ https://github.com/maxkleiner/DelphiVCL4Python
+}
+
+Const //PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
+PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; 
+      
+ VCLHOME = 
+  'r"C:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delphivcl\win64\delphivcl.pyd"';
+
+ 
+//{$I logo.p} 
+PROCEDURE logo;
+BEGIN
+ writeln('');
+ writeln('  .-------------------------------------------.');
+ writeln('  | The Clean Python Bank Society         |');
+ writeln('  | Task9                 1988-2022 M.K.     |');
+ writeln('  .-------------------------------------------.');
+ writeln('');
+END; {procedure logo}
+
+const LoadPy_VCLClass =
+
+  'class MainForm(Form):                            '+LF+
+  '                                                 '+LF+
+  '  def __init__(self, owner):                     '+LF+
+  '      self.Caption = "A VCL Form..."             '+LF+
+  '      self.SetBounds(10, 10, 500, 400)           '+LF+
+  '      self.Position = "poScreenCenter"           '+LF+
+  '                                                 '+LF+
+  '      self.lblHello = Label(self)                '+LF+
+  '      self.lblHello.SetProps(Parent=self,        '+LF+
+  '        Caption="Hello DelphiVCL maXbox4 Python")'+LF+
+  '      self.lblHello.SetBounds(10, 10, 300, 24)   '+LF+
+  '                                                 '+LF+
+  '      self.OnClose = self.__on_form_close        '+LF+
+  '                                                 '+LF+
+  '                                                 '+LF+
+  '  def __on_form_close(self, sender, action):     '+LF+
+  '     action.Value = caFree                       ';
+  
+ 
+ STARTMAIN =
+  'def main():                               '+LF+
+  '  Application.Initialize()                '+LF+
+  '  Application.Title = "Hello Python"      '+LF+
+  '  Main = MainForm(Application)            '+LF+
+  '  Main.Show()                             '+LF+
+  '  FreeConsole()                           '+LF+
+  '  Application.Run()                       '+LF+
+  '  Main.Destroy()                          ';
+  
+  
+ ANALYTICS='#from delphi_module import svg_image'+LF
+    +'from io import StringIO'+LF
+    +'import numpy as np'     +LF
+    +'import pandas as pd'    +LF
+    +'import matplotlib.pyplot as plt'+LF
+    +'from sklearn.linear_model import BayesianRidge'+LF
+    +'from sklearn.model_selection import RandomizedSearchCV, train_test_split'+LF
+    +'from sklearn.preprocessing import PolynomialFeatures'+LF
+    +'from sklearn.metrics import mean_squared_error, mean_absolute_error'+LF
+    +'from sklearn.utils import parallel_backend'+LF
+    +'parallel_backend('#39'threading'#39')'+LF
+    +'import datetime'+LF
+    +'import warnings'+LF
+    +'warnings.filterwarnings("ignore")'+LF
+    +''+LF
+    +'confirmed_df = pd.read_csv('#39'https://raw.githubusercontent.com/CS'+
+        'SEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_ti' +
+        'me_series/time_series_covid19_confirmed_global.csv'#39')'+LF
+    +''+LF
+    +'parallel_backend('#39'threading'#39')'+LF
+    +'cols = confirmed_df.keys()'+LF
+    +'confirmed = confirmed_df.loc[:, cols[4]:cols[-1]]'+LF
+    +'dates = confirmed.keys()'+LF
+    +'world_cases = []'+LF
+    +''+LF
+    +'for i in dates:'+LF
+    +'    confirmed_sum = confirmed[i].sum()'+LF
+    +'    world_cases.append(confirmed_sum)'+LF
+    +'# window size'+LF
+    +'window = 7'+LF
+    +''+LF
+    +'days_since_1_22 = np.array([i for i in range(len(dates))]).reshape(-1, 1)'+LF
+    +'world_cases = np.array(world_cases).reshape(-1, 1)'+LF
+    +''+LF
+    +'days_in_future = 10'+LF
+    +'future_forcast = np.array([i for i in range(len(dates)+days_in_f' +
+          'uture)]).reshape(-1, 1)' +LF
+    +''+LF
+    +'start = '#39'1/22/2020'#39+LF
+    +'start_date = datetime.datetime.strptime(start, '#39'%m/%d/%Y'#39')'+LF
+    +'future_forcast_dates = []' +LF
+    +'for i in range(len(future_forcast)):'+LF
+    +'  future_forcast_dates.append((start_date + datetime.timedelta' +
+        '(days=i)).strftime('#39'%m/%d/%Y'#39'))'+LF
+    +''+LF
+    +'X_train_confirmed, X_test_confirmed, y_train_confirmed, y_test_c' +
+        'onfirmed = train_test_split(days_since_1_22[50:], world_cases[50' +
+        ':], test_size=0.05, shuffle=False)'+LF
+    +''+LF
+    +'# transform our data for polynomial regression'+LF
+    +'bayesian_poly = PolynomialFeatures(degree=5)'+LF
+    +'bayesian_poly_X_train_confirmed = bayesian_poly.fit_transform(X_' +
+         'train_confirmed)'+LF
+    +'bayesian_poly_X_test_confirmed = bayesian_poly.fit_transform(X_t' +
+         'est_confirmed)'+LF
+    +'bayesian_poly_future_forcast= bayesian_poly.fit_transform(future_forcast)'+LF
+    +'' +LF
+    +'# bayesian ridge polynomial regression'    +LF
+    +'tol = [1e-6, 1e-5, 1e-4, 1e-3, 1e-2]'      +LF
+    +'alpha_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]'  +LF
+    +'alpha_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]'  +LF
+    +'lambda_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF
+    +'lambda_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF
+    +'normalize = [True, False]'                 +LF
+    +''                                          +LF
+    +'bayesian_grid={'#39'tol'#39':tol,'#39'alpha_1'#39':alpha_1,'#39'alpha_2'#39':alp'+
+    'ha_2, '#39'lambda_1'#39': lambda_1,'#39'lambda_2'#39' : lambda_2,'
+    +'                  '#39'normalize'#39' : normalize}' +LF
+    +''+LF
+    +'bayesian = BayesianRidge(fit_intercept=True)' +LF
+    +'bayesian_search = RandomizedSearchCV(bayesian, bayesian_grid, sc' +
+        'oring='#39'neg_mean_squared_error'#39', cv=3, return_train_score=True, n'+
+        '_jobs=-1, n_iter=40, verbose=1)'+LF
+    +'bayesian_search.fit(bayesian_poly_X_train_confirmed, y_train_confirmed)'+LF
+    +''+LF
+    +'print(bayesian_search.best_params_)'+LF
+    +''+LF
+    +'bayesian_confirmed = bayesian_search.best_estimator_' +LF
+    +  'test_bayesian_pred = bayesian_confirmed.predict(bayesian_poly_X_' +
+       'test_confirmed)'+LF
+    +'bayesian_pred = bayesian_confirmed.predict(bayesian_poly_future_forcast)'+LF
+    +'print('#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed))'+LF
+    +'print('#39'MSE:'#39',mean_squared_error(test_bayesian_pred,y_test_confirmed))' +LF
+    +'' +LF
+    +'plt.plot(y_test_confirmed)'+LF
+    +'plt.plot(test_bayesian_pred)'+LF
+    +'plt.legend(['#39'Test Data'#39','#39'Bayesian Ridge Polynomial Predictions'#39'])'+LF
+    +'' +LF
+    +'figfile = StringIO()'+LF
+    +'plt.savefig(figfile, format='#39'svg'#39')'+LF
+    +'figdata_svg = figfile.getvalue()' +LF
+    +'#svg_image.SvgText = figdata_svg'+LF
+    +''+LF
+    +'plt.show()';  
+
+
+procedure pyBank_VCL4Python;
+var eg: TPythonEngine; sw: TStopWatch;
+begin
+eg:= TPythonEngine.Create(Nil);
+  try
+    eg.pythonhome:= PYHOME;
+    eg.loadDLL;
+    println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)'));
+    println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); 
+    writeln('') 
+    //println(eg.EvalStr('__import__("faker").Faker()')); 
+    sw:= TStopWatch.Create();
+    sw.Start;
+    eg.execStr('import importlib.machinery, importlib.util');
+    eg.execStr('from decimal import Decimal, getcontext');
+    //eg.execStr('from delphivcl import *');
+    //eg.execStr('import delphivcl, os');
+    //eg.execStr('loader= importlib.machinery.ExtensionFileLoader("DelphiVCL",'+VCLHOME+')')
+    //println('loader test>>> '+eg.evalStr('loader'));
+    //eg.execStr(LoadPy_VCLClass);
+    //eg.execStr(STARTMAIN);
+    //eg.execStr('main()');
+    eg.execStr(ANALYTICS);
+    println(eg.evalStr(''#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed)'));
+    println(eg.evalStr(''#39'MSE:'#39',mean_squared_error(test_bayesian_pred, y_test_confirmed)'));
+    
+    //eg.execStr(pybankDEF)  
+    //"Bank balance after 25 years = ", bank(25)
+    // println('Bank balance after 25 years = '+
+     //               eg.evalStr('bank(25)'));
+    sw.Stop;
+    //sw.ElapsedMilliseconds;
+    writeln('Stop Analytics Tester1: '+sw.getValueStr)
+  except
+    eg.raiseError;
+    writeln(ExceptionToString(ExceptionType, ExceptionParam));  
+  finally
+    eg.Free;
+    sw.Free;
+    sw:= Nil;
+  end;
+end;   
+
+Const UPPERLIMIT = 100;
+var cnt,n, precision: NativeUint;
+
+begin //@main
+  logo;
+  pyBank_VCL4Python();
+End.
+
+ref: test import 0.1000000000000000055511151231257827021181583404541015625
+test import 0.1000000000000000055511151231257827021181583404541015625
+
+('MAE:', 40265042.8047044)
+('MSE:', 1686906953419077.5)
+Stop Analytics Tester1: 0:10:51.185
+
+
+Exception: <class 'NameError'>: name 'svg_image' is not defined.
+
+     0.03993872967323020890367053
+     0.03993872967323020890367053
+PY   0.03993872967323021
+
+ref install python.exe -m pip install delphivcl
+
+Exception: <class 'ValueError'>: DelphiVCL module not found. Try to reinstall the delphivcl package or check for support compatibility.
+
+import sys
+# the following is needed to use the newly allocated console!
+sys.stdout = sys.stderr= open('CONOUT$', 'wt')
+ 
+
+C:\maXbox\works2021\maxbox4>cd C:\Users\Max\AppData\Local\Programs\Python\Python36-32
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install
+ delphivcl
+Collecting delphivcl
+  Downloading https://files.pythonhosted.org/packages/15/6b/32729afd53807fe5b890
+dbe309da2ea3575f49f7fe21d15532672fc94763/delphivcl-0.1.29-cp36-cp36m-win32.whl (
+2.1MB)
+    100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 2.1MB 539kB/s
+Installing collected packages: delphivcl
+Successfully installed delphivcl-0.1.29
+You are using pip version 9.0.1, however version 21.3.1 is available.
+You should consider upgrading via the 'python -m pip install --upgrade pip' command.
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip uninsta
+ll delphivcl
+Uninstalling delphivcl-0.1.29:
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\installer
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\license.md
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\metadata
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\record
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\top_level.txt
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\wheel
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__init__.py
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__pycache__\__init__.cpython-36.pyc
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__pycache__\__version__.cpython-36.pyc
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__pycache__\moduledefs.cpython-36.pyc
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__version__.py
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\moduledefs.py
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\win64\delphivcl.pyd
+Proceed (y/n)? y
+  Successfully uninstalled delphivcl-0.1.29
+  
+Error log:
+  C:\Users\breitsch\Documents\Embarcadero\Studio\21.0\CatalogRepository\Delphi4PythonExporter-D104-1.2.1\Source;"C:\Program 
+  Files\Streaming\maxbox4\python4delphi\Source";"C:\Program Files\Streaming\maxbox4\python4delphi\Source\vcl" -K00400000 
+  -NBC:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp -NHC:\Users\Public\Documents\Embarcadero\Studio\21.0\hpp\Win32  Demo34.dpr   
+[dcc32 Fatal Error] Demo34.dpr(7): F2048 Bad unit format: 'Unit1.dcu' - Expected version: 34.0, Windows Unicode(x86) Found version: 34.0, Windows Unicode(x64)
+Failed
+Elapsed time: 00:00:01.0
+64bit build
+
+procedure TDynamicDll.DoOpenDll(const aDllName : string);
+{$IFDEF MSWINDOWS}
+const
+  LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = $00000100;
+  LOAD_LIBRARY_DEFAULT_DIRS = $00001000;
+Var
+  ExceptMask: TFPUExceptionMask;
+{$ENDIF}
+begin
+  if not IsHandleValid then
+  begin
+    FDllName := aDllName;
+    {$IFDEF MSWINDOWS}
+    ExceptMask := GetExceptionMask;
+    try
+      {$IFDEF FPC}
+      FDLLHandle := LoadLibraryExA(PAnsiChar(AnsiString(GetDllPath+DllName)),
+      {$ELSE}
+      /// [dcc64 Error] PythonEngine.pas(2965): E2010 Incompatible types: 'PWideChar' and 'PAnsiChar'
+      FDLLHandle := LoadLibraryEx(PWidechar(GetDllPath+DllName),
+      {$ENDIF}
+        0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR or LOAD_LIBRARY_DEFAULT_DIRS);
+    finally
+      SetExceptionMask(ExceptMask);
+    end;
+    {$ELSE}
+    //Linux: need here RTLD_GLOBAL, so Python can do "import ctypes"
+    FDLLHandle := THandle(dlopen(PAnsiChar(AnsiString(GetDllPath+DllName)),
+      RTLD_LAZY+RTLD_GLOBAL));
+    {$ENDIF}
+  end;
+end;
+
+function TMethodsContainer.AddMethod( AMethodName  : PAnsiChar;
+                                      AMethod  : PyCFunction;
+                                      ADocString : PAnsiChar ) : PPyMethodDef;
+begin
+  if FMethodCount = FAllocatedMethodCount then
+    ReallocMethods;
+  Result := Methods[ MethodCount ];
+  Result^.ml_name  := AMethodName;
+  Result^.ml_meth  := AMethod;
+  Result^.ml_flags := METH_VARARGS;
+  Result^.ml_doc   := ADocString;
+  Inc( FMethodCount );
+end;
+
+
+ \ No newline at end of file diff --git a/Tutorials/Webinar II/1096_P4D_AnalyticsDemo.pas b/Tutorials/Webinar II/1096_P4D_AnalyticsDemo.pas new file mode 100644 index 00000000..a86b6192 --- /dev/null +++ b/Tutorials/Webinar II/1096_P4D_AnalyticsDemo.pas @@ -0,0 +1,332 @@ +program VCL4Python_Py_AnalyticsDemo; +{ + Most programmers are familiar with the inexactness of floating point + calculations in a binary processor. + https://downloads.blaisepascal.eu/BlaisePascalMagazine_99_100_UK.pdf + + https://github.com/maxkleiner/DelphiVCL4Python +} + +Const //PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; +PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + + VCLHOME = + 'r"C:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delphivcl\win64\delphivcl.pyd"'; + + +//{$I logo.p} +PROCEDURE logo; +BEGIN + writeln(''); + writeln(' .-------------------------------------------.'); + writeln(' | The Clean Python Bank Society |'); + writeln(' | Task9 1988-2022 M.K. |'); + writeln(' .-------------------------------------------.'); + writeln(''); +END; {procedure logo} + +const LoadPy_VCLClass = + + 'class MainForm(Form): '+LF+ + ' '+LF+ + ' def __init__(self, owner): '+LF+ + ' self.Caption = "A VCL Form..." '+LF+ + ' self.SetBounds(10, 10, 500, 400) '+LF+ + ' self.Position = "poScreenCenter" '+LF+ + ' '+LF+ + ' self.lblHello = Label(self) '+LF+ + ' self.lblHello.SetProps(Parent=self, '+LF+ + ' Caption="Hello DelphiVCL maXbox4 Python")'+LF+ + ' self.lblHello.SetBounds(10, 10, 300, 24) '+LF+ + ' '+LF+ + ' self.OnClose = self.__on_form_close '+LF+ + ' '+LF+ + ' '+LF+ + ' def __on_form_close(self, sender, action): '+LF+ + ' action.Value = caFree '; + + + STARTMAIN = + 'def main(): '+LF+ + ' Application.Initialize() '+LF+ + ' Application.Title = "Hello Python" '+LF+ + ' Main = MainForm(Application) '+LF+ + ' Main.Show() '+LF+ + ' FreeConsole() '+LF+ + ' Application.Run() '+LF+ + ' Main.Destroy() '; + + + ANALYTICS='#from delphi_module import svg_image'+LF + +'from io import StringIO'+LF + +'import numpy as np' +LF + +'import pandas as pd' +LF + +'import matplotlib.pyplot as plt'+LF + +'from sklearn.linear_model import BayesianRidge'+LF + +'from sklearn.model_selection import RandomizedSearchCV, train_test_split'+LF + +'from sklearn.preprocessing import PolynomialFeatures'+LF + +'from sklearn.metrics import mean_squared_error, mean_absolute_error'+LF + +'from sklearn.utils import parallel_backend'+LF + +'parallel_backend('#39'threading'#39')'+LF + +'import datetime'+LF + +'import warnings'+LF + +'warnings.filterwarnings("ignore")'+LF + +''+LF + +'confirmed_df = pd.read_csv('#39'https://raw.githubusercontent.com/CS'+ + 'SEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_ti' + + 'me_series/time_series_covid19_confirmed_global.csv'#39')'+LF + +''+LF + +'parallel_backend('#39'threading'#39')'+LF + +'cols = confirmed_df.keys()'+LF + +'confirmed = confirmed_df.loc[:, cols[4]:cols[-1]]'+LF + +'dates = confirmed.keys()'+LF + +'world_cases = []'+LF + +''+LF + +'for i in dates:'+LF + +' confirmed_sum = confirmed[i].sum()'+LF + +' world_cases.append(confirmed_sum)'+LF + +'# window size'+LF + +'window = 7'+LF + +''+LF + +'days_since_1_22 = np.array([i for i in range(len(dates))]).reshape(-1, 1)'+LF + +'world_cases = np.array(world_cases).reshape(-1, 1)'+LF + +''+LF + +'days_in_future = 10'+LF + +'future_forcast = np.array([i for i in range(len(dates)+days_in_f' + + 'uture)]).reshape(-1, 1)' +LF + +''+LF + +'start = '#39'1/22/2020'#39+LF + +'start_date = datetime.datetime.strptime(start, '#39'%m/%d/%Y'#39')'+LF + +'future_forcast_dates = []' +LF + +'for i in range(len(future_forcast)):'+LF + +' future_forcast_dates.append((start_date + datetime.timedelta' + + '(days=i)).strftime('#39'%m/%d/%Y'#39'))'+LF + +''+LF + +'X_train_confirmed, X_test_confirmed, y_train_confirmed, y_test_c' + + 'onfirmed = train_test_split(days_since_1_22[50:], world_cases[50' + + ':], test_size=0.05, shuffle=False)'+LF + +''+LF + +'# transform our data for polynomial regression'+LF + +'bayesian_poly = PolynomialFeatures(degree=5)'+LF + +'bayesian_poly_X_train_confirmed = bayesian_poly.fit_transform(X_' + + 'train_confirmed)'+LF + +'bayesian_poly_X_test_confirmed = bayesian_poly.fit_transform(X_t' + + 'est_confirmed)'+LF + +'bayesian_poly_future_forcast= bayesian_poly.fit_transform(future_forcast)'+LF + +'' +LF + +'# bayesian ridge polynomial regression' +LF + +'tol = [1e-6, 1e-5, 1e-4, 1e-3, 1e-2]' +LF + +'alpha_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'alpha_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'lambda_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'lambda_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'normalize = [True, False]' +LF + +'' +LF + +'bayesian_grid={'#39'tol'#39':tol,'#39'alpha_1'#39':alpha_1,'#39'alpha_2'#39':alp'+ + 'ha_2, '#39'lambda_1'#39': lambda_1,'#39'lambda_2'#39' : lambda_2,' + +' '#39'normalize'#39' : normalize}' +LF + +''+LF + +'bayesian = BayesianRidge(fit_intercept=True)' +LF + +'bayesian_search = RandomizedSearchCV(bayesian, bayesian_grid, sc' + + 'oring='#39'neg_mean_squared_error'#39', cv=3, return_train_score=True, n'+ + '_jobs=-1, n_iter=40, verbose=1)'+LF + +'bayesian_search.fit(bayesian_poly_X_train_confirmed, y_train_confirmed)'+LF + +''+LF + +'print(bayesian_search.best_params_)'+LF + +''+LF + +'bayesian_confirmed = bayesian_search.best_estimator_' +LF + + 'test_bayesian_pred = bayesian_confirmed.predict(bayesian_poly_X_' + + 'test_confirmed)'+LF + +'bayesian_pred = bayesian_confirmed.predict(bayesian_poly_future_forcast)'+LF + +'print('#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed))'+LF + +'print('#39'MSE:'#39',mean_squared_error(test_bayesian_pred,y_test_confirmed))' +LF + +'' +LF + +'plt.plot(y_test_confirmed)'+LF + +'plt.plot(test_bayesian_pred)'+LF + +'plt.legend(['#39'Test Data'#39','#39'Bayesian Ridge Polynomial Predictions'#39'])'+LF + +'' +LF + +'figfile = StringIO()'+LF + +'plt.savefig(figfile, format='#39'svg'#39')'+LF + +'figdata_svg = figfile.getvalue()' +LF + +'#svg_image.SvgText = figdata_svg'+LF + +''+LF + +'plt.show()'; + + +procedure pyBank_VCL4Python; +var eg: TPythonEngine; sw: TStopWatch; +begin +eg:= TPythonEngine.Create(Nil); + try + eg.pythonhome:= PYHOME; + eg.loadDLL; + println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); + writeln('') + //println(eg.EvalStr('__import__("faker").Faker()')); + sw:= TStopWatch.Create(); + sw.Start; + eg.execStr('import importlib.machinery, importlib.util'); + eg.execStr('from decimal import Decimal, getcontext'); + //eg.execStr('from delphivcl import *'); + //eg.execStr('import delphivcl, os'); + //eg.execStr('loader= importlib.machinery.ExtensionFileLoader("DelphiVCL",'+VCLHOME+')') + //println('loader test>>> '+eg.evalStr('loader')); + //eg.execStr(LoadPy_VCLClass); + //eg.execStr(STARTMAIN); + //eg.execStr('main()'); + eg.execStr(ANALYTICS); + println(eg.evalStr(''#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed)')); + println(eg.evalStr(''#39'MSE:'#39',mean_squared_error(test_bayesian_pred, y_test_confirmed)')); + + //eg.execStr(pybankDEF) + //"Bank balance after 25 years = ", bank(25) + // println('Bank balance after 25 years = '+ + // eg.evalStr('bank(25)')); + sw.Stop; + //sw.ElapsedMilliseconds; + writeln('Stop Analytics Tester1: '+sw.getValueStr) + except + eg.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eg.Free; + sw.Free; + sw:= Nil; + end; +end; + +Const UPPERLIMIT = 100; +var cnt,n, precision: NativeUint; + +begin //@main + logo; + pyBank_VCL4Python(); +End. + +ref: test import 0.1000000000000000055511151231257827021181583404541015625 +test import 0.1000000000000000055511151231257827021181583404541015625 + +('MAE:', 40265042.8047044) +('MSE:', 1686906953419077.5) +Stop Analytics Tester1: 0:10:51.185 + + +Exception: : name 'svg_image' is not defined. + + 0.03993872967323020890367053 + 0.03993872967323020890367053 +PY 0.03993872967323021 + +ref install python.exe -m pip install delphivcl + +Exception: : DelphiVCL module not found. Try to reinstall the delphivcl package or check for support compatibility. + +import sys +# the following is needed to use the newly allocated console! +sys.stdout = sys.stderr= open('CONOUT$', 'wt') + + +C:\maXbox\works2021\maxbox4>cd C:\Users\Max\AppData\Local\Programs\Python\Python36-32 + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install + delphivcl +Collecting delphivcl + Downloading https://files.pythonhosted.org/packages/15/6b/32729afd53807fe5b890 +dbe309da2ea3575f49f7fe21d15532672fc94763/delphivcl-0.1.29-cp36-cp36m-win32.whl ( +2.1MB) + 100% |��������������������������������| 2.1MB 539kB/s +Installing collected packages: delphivcl +Successfully installed delphivcl-0.1.29 +You are using pip version 9.0.1, however version 21.3.1 is available. +You should consider upgrading via the 'python -m pip install --upgrade pip' command. + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32> + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip uninsta +ll delphivcl +Uninstalling delphivcl-0.1.29: + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\installer + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\license.md + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\metadata + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\record + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\top_level.txt + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\wheel + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__init__.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\__init__.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\__version__.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\moduledefs.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__version__.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\moduledefs.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\win64\delphivcl.pyd +Proceed (y/n)? y + Successfully uninstalled delphivcl-0.1.29 + +Error log: + C:\Users\breitsch\Documents\Embarcadero\Studio\21.0\CatalogRepository\Delphi4PythonExporter-D104-1.2.1\Source;"C:\Program + Files\Streaming\maxbox4\python4delphi\Source";"C:\Program Files\Streaming\maxbox4\python4delphi\Source\vcl" -K00400000 + -NBC:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp -NHC:\Users\Public\Documents\Embarcadero\Studio\21.0\hpp\Win32 Demo34.dpr +[dcc32 Fatal Error] Demo34.dpr(7): F2048 Bad unit format: 'Unit1.dcu' - Expected version: 34.0, Windows Unicode(x86) Found version: 34.0, Windows Unicode(x64) +Failed +Elapsed time: 00:00:01.0 +64bit build + +procedure TDynamicDll.DoOpenDll(const aDllName : string); +{$IFDEF MSWINDOWS} +const + LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = $00000100; + LOAD_LIBRARY_DEFAULT_DIRS = $00001000; +Var + ExceptMask: TFPUExceptionMask; +{$ENDIF} +begin + if not IsHandleValid then + begin + FDllName := aDllName; + {$IFDEF MSWINDOWS} + ExceptMask := GetExceptionMask; + try + {$IFDEF FPC} + FDLLHandle := LoadLibraryExA(PAnsiChar(AnsiString(GetDllPath+DllName)), + {$ELSE} + /// [dcc64 Error] PythonEngine.pas(2965): E2010 Incompatible types: 'PWideChar' and 'PAnsiChar' + FDLLHandle := LoadLibraryEx(PWidechar(GetDllPath+DllName), + {$ENDIF} + 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR or LOAD_LIBRARY_DEFAULT_DIRS); + finally + SetExceptionMask(ExceptMask); + end; + {$ELSE} + //Linux: need here RTLD_GLOBAL, so Python can do "import ctypes" + FDLLHandle := THandle(dlopen(PAnsiChar(AnsiString(GetDllPath+DllName)), + RTLD_LAZY+RTLD_GLOBAL)); + {$ENDIF} + end; +end; + +function TMethodsContainer.AddMethod( AMethodName : PAnsiChar; + AMethod : PyCFunction; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + if FMethodCount = FAllocatedMethodCount then + ReallocMethods; + Result := Methods[ MethodCount ]; + Result^.ml_name := AMethodName; + Result^.ml_meth := AMethod; + Result^.ml_flags := METH_VARARGS; + Result^.ml_doc := ADocString; + Inc( FMethodCount ); +end; diff --git a/Tutorials/Webinar II/1096_P4D_AnalyticsDemo_SVG.htm b/Tutorials/Webinar II/1096_P4D_AnalyticsDemo_SVG.htm new file mode 100644 index 00000000..6f4bc910 --- /dev/null +++ b/Tutorials/Webinar II/1096_P4D_AnalyticsDemo_SVG.htm @@ -0,0 +1,379 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000077750 +StartFragment:0000001053 +EndFragment:0000077734 + + + + +mXScriptasHTML + + + + + +
program VCL4Python_Py_AnalyticsDemo;
+{
+ Most programmers are familiar with the inexactness of floating point 
+                                   calculations in a binary processor. 
+ https://downloads.blaisepascal.eu/BlaisePascalMagazine_99_100_UK.pdf
+ 
+ https://github.com/maxkleiner/DelphiVCL4Python
+}
+
+Const //PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
+PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; 
+      
+ VCLHOME = 
+  'r"C:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delphivcl\win64\delphivcl.pyd"';
+
+ 
+//{$I logo.p} 
+PROCEDURE logo;
+BEGIN
+ writeln('');
+ writeln('  .-------------------------------------------.');
+ writeln('  | The Clean Python Bank Society         |');
+ writeln('  | Task9                 1988-2022 M.K.     |');
+ writeln('  .-------------------------------------------.');
+ writeln('');
+END; {procedure logo}
+
+const LoadPy_VCLClass =
+
+  'class MainForm(Form):                            '+LF+
+  '                                                 '+LF+
+  '  def __init__(self, owner):                     '+LF+
+  '      self.Caption = "A VCL Form..."             '+LF+
+  '      self.SetBounds(10, 10, 500, 400)           '+LF+
+  '      self.Position = "poScreenCenter"           '+LF+
+  '                                                 '+LF+
+  '      self.lblHello = Label(self)                '+LF+
+  '      self.lblHello.SetProps(Parent=self,        '+LF+
+  '        Caption="Hello DelphiVCL maXbox4 Python")'+LF+
+  '      self.lblHello.SetBounds(10, 10, 300, 24)   '+LF+
+  '                                                 '+LF+
+  '      self.OnClose = self.__on_form_close        '+LF+
+  '                                                 '+LF+
+  '                                                 '+LF+
+  '  def __on_form_close(self, sender, action):     '+LF+
+  '     action.Value = caFree                       ';
+  
+ 
+ STARTMAIN =
+  'def main():                               '+LF+
+  '  Application.Initialize()                '+LF+
+  '  Application.Title = "Hello Python"      '+LF+
+  '  Main = MainForm(Application)            '+LF+
+  '  Main.Show()                             '+LF+
+  '  FreeConsole()                           '+LF+
+  '  Application.Run()                       '+LF+
+  '  Main.Destroy()                          ';
+  
+  
+ ANALYTICS='#from delphi_module import svg_image'+LF
+    +'from io import StringIO'+LF
+    +'import numpy as np'     +LF
+    +'import pandas as pd'    +LF
+    +'import matplotlib.pyplot as plt'+LF
+    +'from sklearn.linear_model import BayesianRidge'+LF
+    +'from sklearn.model_selection import RandomizedSearchCV, train_test_split'+LF
+    +'from sklearn.preprocessing import PolynomialFeatures'+LF
+    +'from sklearn.metrics import mean_squared_error, mean_absolute_error'+LF
+    +'from sklearn.utils import parallel_backend'+LF
+    +'parallel_backend('#39'threading'#39')'+LF
+    +'import datetime'+LF
+    +'import warnings'+LF
+    +'warnings.filterwarnings("ignore")'+LF
+    +''+LF
+    +'confirmed_df = pd.read_csv('#39'https://raw.githubusercontent.com/CS'+
+        'SEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_ti' +
+        'me_series/time_series_covid19_confirmed_global.csv'#39')'+LF
+    +''+LF
+    +'parallel_backend('#39'threading'#39')'+LF
+    +'cols = confirmed_df.keys()'+LF
+    +'confirmed = confirmed_df.loc[:, cols[4]:cols[-1]]'+LF
+    +'dates = confirmed.keys()'+LF
+    +'world_cases = []'+LF
+    +''+LF
+    +'for i in dates:'+LF
+    +'    confirmed_sum = confirmed[i].sum()'+LF
+    +'    world_cases.append(confirmed_sum)'+LF
+    +'# window size'+LF
+    +'window = 7'+LF
+    +''+LF
+    +'days_since_1_22 = np.array([i for i in range(len(dates))]).reshape(-1, 1)'+LF
+    +'world_cases = np.array(world_cases).reshape(-1, 1)'+LF
+    +''+LF
+    +'days_in_future = 10'+LF
+    +'future_forcast = np.array([i for i in range(len(dates)+days_in_f' +
+          'uture)]).reshape(-1, 1)' +LF
+    +''+LF
+    +'start = '#39'1/22/2020'#39+LF
+    +'start_date = datetime.datetime.strptime(start, '#39'%m/%d/%Y'#39')'+LF
+    +'future_forcast_dates = []' +LF
+    +'for i in range(len(future_forcast)):'+LF
+    +'  future_forcast_dates.append((start_date + datetime.timedelta' +
+        '(days=i)).strftime('#39'%m/%d/%Y'#39'))'+LF
+    +''+LF
+    +'X_train_confirmed, X_test_confirmed, y_train_confirmed, y_test_c' +
+        'onfirmed = train_test_split(days_since_1_22[50:], world_cases[50' +
+        ':], test_size=0.05, shuffle=False)'+LF
+    +''+LF
+    +'# transform our data for polynomial regression'+LF
+    +'bayesian_poly = PolynomialFeatures(degree=5)'+LF
+    +'bayesian_poly_X_train_confirmed = bayesian_poly.fit_transform(X_' +
+         'train_confirmed)'+LF
+    +'bayesian_poly_X_test_confirmed = bayesian_poly.fit_transform(X_t' +
+         'est_confirmed)'+LF
+    +'bayesian_poly_future_forcast= bayesian_poly.fit_transform(future_forcast)'+LF
+    +'' +LF
+    +'# bayesian ridge polynomial regression'    +LF
+    +'tol = [1e-6, 1e-5, 1e-4, 1e-3, 1e-2]'      +LF
+    +'alpha_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]'  +LF
+    +'alpha_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]'  +LF
+    +'lambda_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF
+    +'lambda_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF
+    +'normalize = [True, False]'                 +LF
+    +''                                          +LF
+    +'bayesian_grid={'#39'tol'#39':tol,'#39'alpha_1'#39':alpha_1,'#39'alpha_2'#39':alp'+
+    'ha_2, '#39'lambda_1'#39': lambda_1,'#39'lambda_2'#39' : lambda_2,'
+    +'                  '#39'normalize'#39' : normalize}' +LF
+    +''+LF
+    +'bayesian = BayesianRidge(fit_intercept=True)' +LF
+    +'bayesian_search = RandomizedSearchCV(bayesian, bayesian_grid, sc' +
+        'oring='#39'neg_mean_squared_error'#39', cv=3, return_train_score=True, n'+
+        '_jobs=-1, n_iter=40, verbose=1)'+LF
+    +'bayesian_search.fit(bayesian_poly_X_train_confirmed, y_train_confirmed)'+LF
+    +''+LF
+    +'print(bayesian_search.best_params_)'+LF
+    +''+LF
+    +'bayesian_confirmed = bayesian_search.best_estimator_' +LF
+    +  'test_bayesian_pred = bayesian_confirmed.predict(bayesian_poly_X_' +
+       'test_confirmed)'+LF
+    +'bayesian_pred = bayesian_confirmed.predict(bayesian_poly_future_forcast)'+LF
+    +'print('#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed))'+LF
+    +'print('#39'MSE:'#39',mean_squared_error(test_bayesian_pred,y_test_confirmed))' +LF
+    +'' +LF
+    +'plt.plot(y_test_confirmed)'+LF
+    +'plt.plot(test_bayesian_pred)'+LF
+    +'plt.legend(['#39'Test Data'#39','#39'Bayesian Ridge Polynomial Predictions'#39'])'+LF
+    +'' +LF
+    +'figfile = StringIO()'+LF
+    +'plt.savefig(figfile, format='#39'svg'#39')'+LF
+    +'figdata_svg = figfile.getvalue()' +LF
+    +'#svg_image.SvgText = figdata_svg'+LF
+    +''+LF
+    +'plt.show()';  
+    
+    
+ ANALYTICSSVG='#from delphi_module import svg_image'+LF
+    +'from io import StringIO'+LF
+    +'import matplotlib.pyplot as plt'+LF
+    +'import seaborn as sns'+LF
+    +'df = sns.load_dataset("penguins")'+LF
+    +'sns.pairplot(df, hue="species")'+LF
+    +''+LF
+    +'figfile = StringIO()'+LF
+    +'plt.savefig(figfile, format="svg")'+LF
+    +''+LF
+    +'plt.show()'; 
+
+
+procedure pyBank_VCL4Python;
+var eg: TPythonEngine; sw: TStopWatch;
+begin
+eg:= TPythonEngine.Create(Nil);
+  try
+    eg.pythonhome:= PYHOME;
+    eg.loadDLL;
+    println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)'));
+    println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); 
+    writeln('') 
+    //println(eg.EvalStr('__import__("faker").Faker()')); 
+    sw:= TStopWatch.Create();
+    sw.Start;
+    eg.execStr('import importlib.machinery, importlib.util');
+    eg.execStr('from decimal import Decimal, getcontext');
+    //eg.execStr('from delphivcl import *');
+    //eg.execStr('import delphivcl, os');
+    //eg.execStr('loader= importlib.machinery.ExtensionFileLoader("DelphiVCL",'+VCLHOME+')')
+    //println('loader test>>> '+eg.evalStr('loader'));
+    //eg.execStr(LoadPy_VCLClass);
+    //eg.execStr(STARTMAIN);
+    //eg.execStr('main()');
+    eg.execStr(ANALYTICSSVG);
+    //println(eg.evalStr(''#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed)'));
+    //println(eg.evalStr(''#39'MSE:'#39',mean_squared_error(test_bayesian_pred, y_test_confirmed)'));
+    
+    //eg.execStr(pybankDEF)  
+    //"Bank balance after 25 years = ", bank(25)
+    // println('Bank balance after 25 years = '+
+     //               eg.evalStr('bank(25)'));
+    sw.Stop;
+    //sw.ElapsedMilliseconds;
+    writeln('Stop Analytics Tester1: '+sw.getValueStr)
+  except
+    eg.raiseError;
+    writeln(ExceptionToString(ExceptionType, ExceptionParam));  
+  finally
+    eg.Free;
+    sw.Free;
+    sw:= Nil;
+  end;
+end;   
+
+Const UPPERLIMIT = 100;
+var cnt,n, precision: NativeUint;
+
+begin //@main
+  logo;
+  pyBank_VCL4Python();
+End.
+
+ref: test import 0.1000000000000000055511151231257827021181583404541015625
+test import 0.1000000000000000055511151231257827021181583404541015625
+
+('MAE:', 40265042.8047044)
+('MSE:', 1686906953419077.5)
+Stop Analytics Tester1: 0:10:51.185
+
+
+Exception: <class 'NameError'>: name 'svg_image' is not defined.
+
+     0.03993872967323020890367053
+     0.03993872967323020890367053
+PY   0.03993872967323021
+
+ref install python.exe -m pip install delphivcl
+
+Exception: <class 'ValueError'>: DelphiVCL module not found. Try to reinstall the delphivcl package or check for support compatibility.
+
+import sys
+# the following is needed to use the newly allocated console!
+sys.stdout = sys.stderr= open('CONOUT$', 'wt')
+ 
+
+C:\maXbox\works2021\maxbox4>cd C:\Users\Max\AppData\Local\Programs\Python\Python36-32
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install
+ delphivcl
+Collecting delphivcl
+  Downloading https://files.pythonhosted.org/packages/15/6b/32729afd53807fe5b890
+dbe309da2ea3575f49f7fe21d15532672fc94763/delphivcl-0.1.29-cp36-cp36m-win32.whl (
+2.1MB)
+    100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 2.1MB 539kB/s
+Installing collected packages: delphivcl
+Successfully installed delphivcl-0.1.29
+You are using pip version 9.0.1, however version 21.3.1 is available.
+You should consider upgrading via the 'python -m pip install --upgrade pip' command.
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip uninsta
+ll delphivcl
+Uninstalling delphivcl-0.1.29:
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\installer
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\license.md
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\metadata
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\record
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\top_level.txt
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\wheel
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__init__.py
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__pycache__\__init__.cpython-36.pyc
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__pycache__\__version__.cpython-36.pyc
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__pycache__\moduledefs.cpython-36.pyc
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__version__.py
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\moduledefs.py
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\win64\delphivcl.pyd
+Proceed (y/n)? y
+  Successfully uninstalled delphivcl-0.1.29
+  
+Error log:
+  C:\Users\breitsch\Documents\Embarcadero\Studio\21.0\CatalogRepository\Delphi4PythonExporter-D104-1.2.1\Source;"C:\Program 
+  Files\Streaming\maxbox4\python4delphi\Source";"C:\Program Files\Streaming\maxbox4\python4delphi\Source\vcl" -K00400000 
+  -NBC:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp -NHC:\Users\Public\Documents\Embarcadero\Studio\21.0\hpp\Win32  Demo34.dpr   
+[dcc32 Fatal Error] Demo34.dpr(7): F2048 Bad unit format: 'Unit1.dcu' - Expected version: 34.0, Windows Unicode(x86) Found version: 34.0, Windows Unicode(x64)
+Failed
+Elapsed time: 00:00:01.0
+64bit build
+
+procedure TDynamicDll.DoOpenDll(const aDllName : string);
+{$IFDEF MSWINDOWS}
+const
+  LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = $00000100;
+  LOAD_LIBRARY_DEFAULT_DIRS = $00001000;
+Var
+  ExceptMask: TFPUExceptionMask;
+{$ENDIF}
+begin
+  if not IsHandleValid then
+  begin
+    FDllName := aDllName;
+    {$IFDEF MSWINDOWS}
+    ExceptMask := GetExceptionMask;
+    try
+      {$IFDEF FPC}
+      FDLLHandle := LoadLibraryExA(PAnsiChar(AnsiString(GetDllPath+DllName)),
+      {$ELSE}
+      /// [dcc64 Error] PythonEngine.pas(2965): E2010 Incompatible types: 'PWideChar' and 'PAnsiChar'
+      FDLLHandle := LoadLibraryEx(PWidechar(GetDllPath+DllName),
+      {$ENDIF}
+        0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR or LOAD_LIBRARY_DEFAULT_DIRS);
+    finally
+      SetExceptionMask(ExceptMask);
+    end;
+    {$ELSE}
+    //Linux: need here RTLD_GLOBAL, so Python can do "import ctypes"
+    FDLLHandle := THandle(dlopen(PAnsiChar(AnsiString(GetDllPath+DllName)),
+      RTLD_LAZY+RTLD_GLOBAL));
+    {$ENDIF}
+  end;
+end;
+
+function TMethodsContainer.AddMethod( AMethodName  : PAnsiChar;
+                                      AMethod  : PyCFunction;
+                                      ADocString : PAnsiChar ) : PPyMethodDef;
+begin
+  if FMethodCount = FAllocatedMethodCount then
+    ReallocMethods;
+  Result := Methods[ MethodCount ];
+  Result^.ml_name  := AMethodName;
+  Result^.ml_meth  := AMethod;
+  Result^.ml_flags := METH_VARARGS;
+  Result^.ml_doc   := ADocString;
+  Inc( FMethodCount );
+end;
+
+
+ \ No newline at end of file diff --git a/Tutorials/Webinar II/1096_P4D_AnalyticsDemo_SVG.pas b/Tutorials/Webinar II/1096_P4D_AnalyticsDemo_SVG.pas new file mode 100644 index 00000000..03c7ab63 --- /dev/null +++ b/Tutorials/Webinar II/1096_P4D_AnalyticsDemo_SVG.pas @@ -0,0 +1,345 @@ +program VCL4Python_Py_AnalyticsDemo; +{ + Most programmers are familiar with the inexactness of floating point + calculations in a binary processor. + https://downloads.blaisepascal.eu/BlaisePascalMagazine_99_100_UK.pdf + + https://github.com/maxkleiner/DelphiVCL4Python +} + +Const //PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; +PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + + VCLHOME = + 'r"C:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delphivcl\win64\delphivcl.pyd"'; + + +//{$I logo.p} +PROCEDURE logo; +BEGIN + writeln(''); + writeln(' .-------------------------------------------.'); + writeln(' | The Clean Python Bank Society |'); + writeln(' | Task9 1988-2022 M.K. |'); + writeln(' .-------------------------------------------.'); + writeln(''); +END; {procedure logo} + +const LoadPy_VCLClass = + + 'class MainForm(Form): '+LF+ + ' '+LF+ + ' def __init__(self, owner): '+LF+ + ' self.Caption = "A VCL Form..." '+LF+ + ' self.SetBounds(10, 10, 500, 400) '+LF+ + ' self.Position = "poScreenCenter" '+LF+ + ' '+LF+ + ' self.lblHello = Label(self) '+LF+ + ' self.lblHello.SetProps(Parent=self, '+LF+ + ' Caption="Hello DelphiVCL maXbox4 Python")'+LF+ + ' self.lblHello.SetBounds(10, 10, 300, 24) '+LF+ + ' '+LF+ + ' self.OnClose = self.__on_form_close '+LF+ + ' '+LF+ + ' '+LF+ + ' def __on_form_close(self, sender, action): '+LF+ + ' action.Value = caFree '; + + + STARTMAIN = + 'def main(): '+LF+ + ' Application.Initialize() '+LF+ + ' Application.Title = "Hello Python" '+LF+ + ' Main = MainForm(Application) '+LF+ + ' Main.Show() '+LF+ + ' FreeConsole() '+LF+ + ' Application.Run() '+LF+ + ' Main.Destroy() '; + + + ANALYTICS='#from delphi_module import svg_image'+LF + +'from io import StringIO'+LF + +'import numpy as np' +LF + +'import pandas as pd' +LF + +'import matplotlib.pyplot as plt'+LF + +'from sklearn.linear_model import BayesianRidge'+LF + +'from sklearn.model_selection import RandomizedSearchCV, train_test_split'+LF + +'from sklearn.preprocessing import PolynomialFeatures'+LF + +'from sklearn.metrics import mean_squared_error, mean_absolute_error'+LF + +'from sklearn.utils import parallel_backend'+LF + +'parallel_backend('#39'threading'#39')'+LF + +'import datetime'+LF + +'import warnings'+LF + +'warnings.filterwarnings("ignore")'+LF + +''+LF + +'confirmed_df = pd.read_csv('#39'https://raw.githubusercontent.com/CS'+ + 'SEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_ti' + + 'me_series/time_series_covid19_confirmed_global.csv'#39')'+LF + +''+LF + +'parallel_backend('#39'threading'#39')'+LF + +'cols = confirmed_df.keys()'+LF + +'confirmed = confirmed_df.loc[:, cols[4]:cols[-1]]'+LF + +'dates = confirmed.keys()'+LF + +'world_cases = []'+LF + +''+LF + +'for i in dates:'+LF + +' confirmed_sum = confirmed[i].sum()'+LF + +' world_cases.append(confirmed_sum)'+LF + +'# window size'+LF + +'window = 7'+LF + +''+LF + +'days_since_1_22 = np.array([i for i in range(len(dates))]).reshape(-1, 1)'+LF + +'world_cases = np.array(world_cases).reshape(-1, 1)'+LF + +''+LF + +'days_in_future = 10'+LF + +'future_forcast = np.array([i for i in range(len(dates)+days_in_f' + + 'uture)]).reshape(-1, 1)' +LF + +''+LF + +'start = '#39'1/22/2020'#39+LF + +'start_date = datetime.datetime.strptime(start, '#39'%m/%d/%Y'#39')'+LF + +'future_forcast_dates = []' +LF + +'for i in range(len(future_forcast)):'+LF + +' future_forcast_dates.append((start_date + datetime.timedelta' + + '(days=i)).strftime('#39'%m/%d/%Y'#39'))'+LF + +''+LF + +'X_train_confirmed, X_test_confirmed, y_train_confirmed, y_test_c' + + 'onfirmed = train_test_split(days_since_1_22[50:], world_cases[50' + + ':], test_size=0.05, shuffle=False)'+LF + +''+LF + +'# transform our data for polynomial regression'+LF + +'bayesian_poly = PolynomialFeatures(degree=5)'+LF + +'bayesian_poly_X_train_confirmed = bayesian_poly.fit_transform(X_' + + 'train_confirmed)'+LF + +'bayesian_poly_X_test_confirmed = bayesian_poly.fit_transform(X_t' + + 'est_confirmed)'+LF + +'bayesian_poly_future_forcast= bayesian_poly.fit_transform(future_forcast)'+LF + +'' +LF + +'# bayesian ridge polynomial regression' +LF + +'tol = [1e-6, 1e-5, 1e-4, 1e-3, 1e-2]' +LF + +'alpha_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'alpha_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'lambda_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'lambda_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'normalize = [True, False]' +LF + +'' +LF + +'bayesian_grid={'#39'tol'#39':tol,'#39'alpha_1'#39':alpha_1,'#39'alpha_2'#39':alp'+ + 'ha_2, '#39'lambda_1'#39': lambda_1,'#39'lambda_2'#39' : lambda_2,' + +' '#39'normalize'#39' : normalize}' +LF + +''+LF + +'bayesian = BayesianRidge(fit_intercept=True)' +LF + +'bayesian_search = RandomizedSearchCV(bayesian, bayesian_grid, sc' + + 'oring='#39'neg_mean_squared_error'#39', cv=3, return_train_score=True, n'+ + '_jobs=-1, n_iter=40, verbose=1)'+LF + +'bayesian_search.fit(bayesian_poly_X_train_confirmed, y_train_confirmed)'+LF + +''+LF + +'print(bayesian_search.best_params_)'+LF + +''+LF + +'bayesian_confirmed = bayesian_search.best_estimator_' +LF + + 'test_bayesian_pred = bayesian_confirmed.predict(bayesian_poly_X_' + + 'test_confirmed)'+LF + +'bayesian_pred = bayesian_confirmed.predict(bayesian_poly_future_forcast)'+LF + +'print('#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed))'+LF + +'print('#39'MSE:'#39',mean_squared_error(test_bayesian_pred,y_test_confirmed))' +LF + +'' +LF + +'plt.plot(y_test_confirmed)'+LF + +'plt.plot(test_bayesian_pred)'+LF + +'plt.legend(['#39'Test Data'#39','#39'Bayesian Ridge Polynomial Predictions'#39'])'+LF + +'' +LF + +'figfile = StringIO()'+LF + +'plt.savefig(figfile, format='#39'svg'#39')'+LF + +'figdata_svg = figfile.getvalue()' +LF + +'#svg_image.SvgText = figdata_svg'+LF + +''+LF + +'plt.show()'; + + + ANALYTICSSVG='#from delphi_module import svg_image'+LF + +'from io import StringIO'+LF + +'import matplotlib.pyplot as plt'+LF + +'import seaborn as sns'+LF + +'df = sns.load_dataset("penguins")'+LF + +'sns.pairplot(df, hue="species")'+LF + +''+LF + +'figfile = StringIO()'+LF + +'plt.savefig(figfile, format="svg")'+LF + +''+LF + +'plt.show()'; + + +procedure pyBank_VCL4Python; +var eg: TPythonEngine; sw: TStopWatch; +begin +eg:= TPythonEngine.Create(Nil); + try + eg.pythonhome:= PYHOME; + eg.loadDLL; + println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); + writeln('') + //println(eg.EvalStr('__import__("faker").Faker()')); + sw:= TStopWatch.Create(); + sw.Start; + eg.execStr('import importlib.machinery, importlib.util'); + eg.execStr('from decimal import Decimal, getcontext'); + //eg.execStr('from delphivcl import *'); + //eg.execStr('import delphivcl, os'); + //eg.execStr('loader= importlib.machinery.ExtensionFileLoader("DelphiVCL",'+VCLHOME+')') + //println('loader test>>> '+eg.evalStr('loader')); + //eg.execStr(LoadPy_VCLClass); + //eg.execStr(STARTMAIN); + //eg.execStr('main()'); + eg.execStr(ANALYTICSSVG); + //println(eg.evalStr(''#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed)')); + //println(eg.evalStr(''#39'MSE:'#39',mean_squared_error(test_bayesian_pred, y_test_confirmed)')); + + //eg.execStr(pybankDEF) + //"Bank balance after 25 years = ", bank(25) + // println('Bank balance after 25 years = '+ + // eg.evalStr('bank(25)')); + sw.Stop; + //sw.ElapsedMilliseconds; + writeln('Stop Analytics Tester1: '+sw.getValueStr) + except + eg.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eg.Free; + sw.Free; + sw:= Nil; + end; +end; + +Const UPPERLIMIT = 100; +var cnt,n, precision: NativeUint; + +begin //@main + logo; + pyBank_VCL4Python(); +End. + +ref: test import 0.1000000000000000055511151231257827021181583404541015625 +test import 0.1000000000000000055511151231257827021181583404541015625 + +('MAE:', 40265042.8047044) +('MSE:', 1686906953419077.5) +Stop Analytics Tester1: 0:10:51.185 + + +Exception: : name 'svg_image' is not defined. + + 0.03993872967323020890367053 + 0.03993872967323020890367053 +PY 0.03993872967323021 + +ref install python.exe -m pip install delphivcl + +Exception: : DelphiVCL module not found. Try to reinstall the delphivcl package or check for support compatibility. + +import sys +# the following is needed to use the newly allocated console! +sys.stdout = sys.stderr= open('CONOUT$', 'wt') + + +C:\maXbox\works2021\maxbox4>cd C:\Users\Max\AppData\Local\Programs\Python\Python36-32 + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install + delphivcl +Collecting delphivcl + Downloading https://files.pythonhosted.org/packages/15/6b/32729afd53807fe5b890 +dbe309da2ea3575f49f7fe21d15532672fc94763/delphivcl-0.1.29-cp36-cp36m-win32.whl ( +2.1MB) + 100% |��������������������������������| 2.1MB 539kB/s +Installing collected packages: delphivcl +Successfully installed delphivcl-0.1.29 +You are using pip version 9.0.1, however version 21.3.1 is available. +You should consider upgrading via the 'python -m pip install --upgrade pip' command. + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32> + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip uninsta +ll delphivcl +Uninstalling delphivcl-0.1.29: + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\installer + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\license.md + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\metadata + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\record + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\top_level.txt + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\wheel + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__init__.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\__init__.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\__version__.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\moduledefs.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__version__.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\moduledefs.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\win64\delphivcl.pyd +Proceed (y/n)? y + Successfully uninstalled delphivcl-0.1.29 + +Error log: + C:\Users\breitsch\Documents\Embarcadero\Studio\21.0\CatalogRepository\Delphi4PythonExporter-D104-1.2.1\Source;"C:\Program + Files\Streaming\maxbox4\python4delphi\Source";"C:\Program Files\Streaming\maxbox4\python4delphi\Source\vcl" -K00400000 + -NBC:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp -NHC:\Users\Public\Documents\Embarcadero\Studio\21.0\hpp\Win32 Demo34.dpr +[dcc32 Fatal Error] Demo34.dpr(7): F2048 Bad unit format: 'Unit1.dcu' - Expected version: 34.0, Windows Unicode(x86) Found version: 34.0, Windows Unicode(x64) +Failed +Elapsed time: 00:00:01.0 +64bit build + +procedure TDynamicDll.DoOpenDll(const aDllName : string); +{$IFDEF MSWINDOWS} +const + LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = $00000100; + LOAD_LIBRARY_DEFAULT_DIRS = $00001000; +Var + ExceptMask: TFPUExceptionMask; +{$ENDIF} +begin + if not IsHandleValid then + begin + FDllName := aDllName; + {$IFDEF MSWINDOWS} + ExceptMask := GetExceptionMask; + try + {$IFDEF FPC} + FDLLHandle := LoadLibraryExA(PAnsiChar(AnsiString(GetDllPath+DllName)), + {$ELSE} + /// [dcc64 Error] PythonEngine.pas(2965): E2010 Incompatible types: 'PWideChar' and 'PAnsiChar' + FDLLHandle := LoadLibraryEx(PWidechar(GetDllPath+DllName), + {$ENDIF} + 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR or LOAD_LIBRARY_DEFAULT_DIRS); + finally + SetExceptionMask(ExceptMask); + end; + {$ELSE} + //Linux: need here RTLD_GLOBAL, so Python can do "import ctypes" + FDLLHandle := THandle(dlopen(PAnsiChar(AnsiString(GetDllPath+DllName)), + RTLD_LAZY+RTLD_GLOBAL)); + {$ENDIF} + end; +end; + +function TMethodsContainer.AddMethod( AMethodName : PAnsiChar; + AMethod : PyCFunction; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + if FMethodCount = FAllocatedMethodCount then + ReallocMethods; + Result := Methods[ MethodCount ]; + Result^.ml_name := AMethodName; + Result^.ml_meth := AMethod; + Result^.ml_flags := METH_VARARGS; + Result^.ml_doc := ADocString; + Inc( FMethodCount ); +end; diff --git a/Tutorials/Webinar II/1096_P4D_AnalyticsDemo_SVG2.pas b/Tutorials/Webinar II/1096_P4D_AnalyticsDemo_SVG2.pas new file mode 100644 index 00000000..a655bf50 --- /dev/null +++ b/Tutorials/Webinar II/1096_P4D_AnalyticsDemo_SVG2.pas @@ -0,0 +1,363 @@ +program VCL4Python_Py_AnalyticsDemo; +{ + Most programmers are familiar with the inexactness of floating point + calculations in a binary processor. + https://downloads.blaisepascal.eu/BlaisePascalMagazine_99_100_UK.pdf + + https://github.com/maxkleiner/DelphiVCL4Python +} + +Const //PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; +PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + + VCLHOME = + 'r"C:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delphivcl\win64\delphivcl.pyd"'; + + +//{$I logo.p} +PROCEDURE logo; +BEGIN + writeln(''); + writeln(' .-------------------------------------------.'); + writeln(' | The Clean Python Bank Society |'); + writeln(' | Task9 1988-2022 M.K. |'); + writeln(' .-------------------------------------------.'); + writeln(''); +END; {procedure logo} + +const LoadPy_VCLClass = + + 'class MainForm(Form): '+LF+ + ' '+LF+ + ' def __init__(self, owner): '+LF+ + ' self.Caption = "A VCL Form..." '+LF+ + ' self.SetBounds(10, 10, 500, 400) '+LF+ + ' self.Position = "poScreenCenter" '+LF+ + ' '+LF+ + ' self.lblHello = Label(self) '+LF+ + ' self.lblHello.SetProps(Parent=self, '+LF+ + ' Caption="Hello DelphiVCL maXbox4 Python")'+LF+ + ' self.lblHello.SetBounds(10, 10, 300, 24) '+LF+ + ' '+LF+ + ' self.OnClose = self.__on_form_close '+LF+ + ' '+LF+ + ' '+LF+ + ' def __on_form_close(self, sender, action): '+LF+ + ' action.Value = caFree '; + + + STARTMAIN = + 'def main(): '+LF+ + ' Application.Initialize() '+LF+ + ' Application.Title = "Hello Python" '+LF+ + ' Main = MainForm(Application) '+LF+ + ' Main.Show() '+LF+ + ' FreeConsole() '+LF+ + ' Application.Run() '+LF+ + ' Main.Destroy() '; + + + ANALYTICS='#from delphi_module import svg_image'+LF + +'from io import StringIO'+LF + +'import numpy as np' +LF + +'import pandas as pd' +LF + +'import matplotlib.pyplot as plt'+LF + +'from sklearn.linear_model import BayesianRidge'+LF + +'from sklearn.model_selection import RandomizedSearchCV, train_test_split'+LF + +'from sklearn.preprocessing import PolynomialFeatures'+LF + +'from sklearn.metrics import mean_squared_error, mean_absolute_error'+LF + +'from sklearn.utils import parallel_backend'+LF + +'parallel_backend('#39'threading'#39')'+LF + +'import datetime'+LF + +'import warnings'+LF + +'warnings.filterwarnings("ignore")'+LF + +''+LF + +'confirmed_df = pd.read_csv('#39'https://raw.githubusercontent.com/CS'+ + 'SEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_ti' + + 'me_series/time_series_covid19_confirmed_global.csv'#39')'+LF + +''+LF + +'parallel_backend('#39'threading'#39')'+LF + +'cols = confirmed_df.keys()'+LF + +'confirmed = confirmed_df.loc[:, cols[4]:cols[-1]]'+LF + +'dates = confirmed.keys()'+LF + +'world_cases = []'+LF + +''+LF + +'for i in dates:'+LF + +' confirmed_sum = confirmed[i].sum()'+LF + +' world_cases.append(confirmed_sum)'+LF + +'# window size'+LF + +'window = 7'+LF + +''+LF + +'days_since_1_22 = np.array([i for i in range(len(dates))]).reshape(-1, 1)'+LF + +'world_cases = np.array(world_cases).reshape(-1, 1)'+LF + +''+LF + +'days_in_future = 10'+LF + +'future_forcast = np.array([i for i in range(len(dates)+days_in_f' + + 'uture)]).reshape(-1, 1)' +LF + +''+LF + +'start = '#39'1/22/2020'#39+LF + +'start_date = datetime.datetime.strptime(start, '#39'%m/%d/%Y'#39')'+LF + +'future_forcast_dates = []' +LF + +'for i in range(len(future_forcast)):'+LF + +' future_forcast_dates.append((start_date + datetime.timedelta' + + '(days=i)).strftime('#39'%m/%d/%Y'#39'))'+LF + +''+LF + +'X_train_confirmed, X_test_confirmed, y_train_confirmed, y_test_c' + + 'onfirmed = train_test_split(days_since_1_22[50:], world_cases[50' + + ':], test_size=0.05, shuffle=False)'+LF + +''+LF + +'# transform our data for polynomial regression'+LF + +'bayesian_poly = PolynomialFeatures(degree=5)'+LF + +'bayesian_poly_X_train_confirmed = bayesian_poly.fit_transform(X_' + + 'train_confirmed)'+LF + +'bayesian_poly_X_test_confirmed = bayesian_poly.fit_transform(X_t' + + 'est_confirmed)'+LF + +'bayesian_poly_future_forcast= bayesian_poly.fit_transform(future_forcast)'+LF + +'' +LF + +'# bayesian ridge polynomial regression' +LF + +'tol = [1e-6, 1e-5, 1e-4, 1e-3, 1e-2]' +LF + +'alpha_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'alpha_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'lambda_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'lambda_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'normalize = [True, False]' +LF + +'' +LF + +'bayesian_grid={'#39'tol'#39':tol,'#39'alpha_1'#39':alpha_1,'#39'alpha_2'#39':alp'+ + 'ha_2, '#39'lambda_1'#39': lambda_1,'#39'lambda_2'#39' : lambda_2,' + +' '#39'normalize'#39' : normalize}' +LF + +''+LF + +'bayesian = BayesianRidge(fit_intercept=True)' +LF + +'bayesian_search = RandomizedSearchCV(bayesian, bayesian_grid, sc' + + 'oring='#39'neg_mean_squared_error'#39', cv=3, return_train_score=True, n'+ + '_jobs=-1, n_iter=40, verbose=1)'+LF + +'bayesian_search.fit(bayesian_poly_X_train_confirmed, y_train_confirmed)'+LF + +''+LF + +'print(bayesian_search.best_params_)'+LF + +''+LF + +'bayesian_confirmed = bayesian_search.best_estimator_' +LF + + 'test_bayesian_pred = bayesian_confirmed.predict(bayesian_poly_X_' + + 'test_confirmed)'+LF + +'bayesian_pred = bayesian_confirmed.predict(bayesian_poly_future_forcast)'+LF + +'print('#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed))'+LF + +'print('#39'MSE:'#39',mean_squared_error(test_bayesian_pred,y_test_confirmed))' +LF + +'' +LF + +'plt.plot(y_test_confirmed)'+LF + +'plt.plot(test_bayesian_pred)'+LF + +'plt.legend(['#39'Test Data'#39','#39'Bayesian Ridge Polynomial Predictions'#39'])'+LF + +'' +LF + +'figfile = StringIO()'+LF + +'plt.savefig(figfile, format='#39'svg'#39')'+LF + +'figdata_svg = figfile.getvalue()' +LF + +'#svg_image.SvgText = figdata_svg'+LF + +''+LF + +'plt.show()'; + + + ANALYTICSSVG='#from delphi_module import svg_image'+LF + +'from io import StringIO'+LF + +'import matplotlib.pyplot as plt'+LF + +'import seaborn as sns'+LF + +'plt.rcParams["figure.figsize"] = 8, 5'+LF + +'df = sns.load_dataset("penguins")'+LF + +'sns.pairplot(df, hue="species")'+LF + +''+LF + +'figfile = StringIO()'+LF + +'plt.savefig(figfile, format="svg")'+LF + +''+LF + +'plt.show()'+LF + +'print(df.isnull().sum())'+LF + +'df = df.dropna()'+LF + +'X = df.drop("sex", axis=1)'+LF + +'y = df["sex"]'+LF + + +'from sklearn.cluster import KMeans'+LF + +'print("CLUSTERING ON CULMEN LENGTH AND CULMEN DEPTH")'+LF + +'X = df[["bill_length_mm","bill_depth_mm"]]'+LF + +'kmeans = KMeans(n_clusters=3)'+LF + +'kmeans.fit(X)'+LF + +'y_kmeans = kmeans.predict(X)'+LF + +'plt.scatter(X.loc[:,"bill_length_mm"], X.loc[:,"bill_depth_mm"],c=y_kmeans,s=50,cmap="viridis")'+LF + +'centers = kmeans.cluster_centers_'+LF + +'plt.scatter(centers[:, 0], centers[:, 1], c="black", s=200, alpha=0.5)'+LF + +'plt.show()'; + +//https://researchdatapod.com/python-valueerror-input-contains-nan-infinity-or-a-value-too-large-for-dtype-float64/ + + +procedure pyBank_VCL4Python; +var eg: TPythonEngine; sw: TStopWatch; +begin +eg:= TPythonEngine.Create(Nil); + try + eg.pythonhome:= PYHOME; + eg.loadDLL; + println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); + writeln('') + //println(eg.EvalStr('__import__("faker").Faker()')); + sw:= TStopWatch.Create(); + sw.Start; + eg.execStr('import importlib.machinery, importlib.util'); + eg.execStr('from decimal import Decimal, getcontext'); + //eg.execStr('from delphivcl import *'); + //eg.execStr('import delphivcl, os'); + //eg.execStr('loader= importlib.machinery.ExtensionFileLoader("DelphiVCL",'+VCLHOME+')') + //println('loader test>>> '+eg.evalStr('loader')); + //eg.execStr(LoadPy_VCLClass); + //eg.execStr(STARTMAIN); + //eg.execStr('main()'); + eg.execStr(ANALYTICSSVG); + //println(eg.evalStr(''#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed)')); + //println(eg.evalStr(''#39'MSE:'#39',mean_squared_error(test_bayesian_pred, y_test_confirmed)')); + + //eg.execStr(pybankDEF) + //"Bank balance after 25 years = ", bank(25) + // println('Bank balance after 25 years = '+ + // eg.evalStr('bank(25)')); + sw.Stop; + //sw.ElapsedMilliseconds; + writeln('Stop Analytics Tester1: '+sw.getValueStr) + except + eg.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eg.Free; + sw.Free; + sw:= Nil; + end; +end; + +Const UPPERLIMIT = 100; +var cnt,n, precision: NativeUint; + +begin //@main + logo; + pyBank_VCL4Python(); +End. + +ref: test import 0.1000000000000000055511151231257827021181583404541015625 +test import 0.1000000000000000055511151231257827021181583404541015625 + +('MAE:', 40265042.8047044) +('MSE:', 1686906953419077.5) +Stop Analytics Tester1: 0:10:51.185 + + +Exception: : name 'svg_image' is not defined. + + 0.03993872967323020890367053 + 0.03993872967323020890367053 +PY 0.03993872967323021 + +ref install python.exe -m pip install delphivcl + +Exception: : DelphiVCL module not found. Try to reinstall the delphivcl package or check for support compatibility. + +import sys +# the following is needed to use the newly allocated console! +sys.stdout = sys.stderr= open('CONOUT$', 'wt') + + +C:\maXbox\works2021\maxbox4>cd C:\Users\Max\AppData\Local\Programs\Python\Python36-32 + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install + delphivcl +Collecting delphivcl + Downloading https://files.pythonhosted.org/packages/15/6b/32729afd53807fe5b890 +dbe309da2ea3575f49f7fe21d15532672fc94763/delphivcl-0.1.29-cp36-cp36m-win32.whl ( +2.1MB) + 100% |��������������������������������| 2.1MB 539kB/s +Installing collected packages: delphivcl +Successfully installed delphivcl-0.1.29 +You are using pip version 9.0.1, however version 21.3.1 is available. +You should consider upgrading via the 'python -m pip install --upgrade pip' command. + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32> + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip uninsta +ll delphivcl +Uninstalling delphivcl-0.1.29: + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\installer + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\license.md + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\metadata + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\record + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\top_level.txt + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\wheel + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__init__.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\__init__.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\__version__.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\moduledefs.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__version__.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\moduledefs.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\win64\delphivcl.pyd +Proceed (y/n)? y + Successfully uninstalled delphivcl-0.1.29 + +Error log: + C:\Users\breitsch\Documents\Embarcadero\Studio\21.0\CatalogRepository\Delphi4PythonExporter-D104-1.2.1\Source;"C:\Program + Files\Streaming\maxbox4\python4delphi\Source";"C:\Program Files\Streaming\maxbox4\python4delphi\Source\vcl" -K00400000 + -NBC:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp -NHC:\Users\Public\Documents\Embarcadero\Studio\21.0\hpp\Win32 Demo34.dpr +[dcc32 Fatal Error] Demo34.dpr(7): F2048 Bad unit format: 'Unit1.dcu' - Expected version: 34.0, Windows Unicode(x86) Found version: 34.0, Windows Unicode(x64) +Failed +Elapsed time: 00:00:01.0 +64bit build + +procedure TDynamicDll.DoOpenDll(const aDllName : string); +{$IFDEF MSWINDOWS} +const + LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = $00000100; + LOAD_LIBRARY_DEFAULT_DIRS = $00001000; +Var + ExceptMask: TFPUExceptionMask; +{$ENDIF} +begin + if not IsHandleValid then + begin + FDllName := aDllName; + {$IFDEF MSWINDOWS} + ExceptMask := GetExceptionMask; + try + {$IFDEF FPC} + FDLLHandle := LoadLibraryExA(PAnsiChar(AnsiString(GetDllPath+DllName)), + {$ELSE} + /// [dcc64 Error] PythonEngine.pas(2965): E2010 Incompatible types: 'PWideChar' and 'PAnsiChar' + FDLLHandle := LoadLibraryEx(PWidechar(GetDllPath+DllName), + {$ENDIF} + 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR or LOAD_LIBRARY_DEFAULT_DIRS); + finally + SetExceptionMask(ExceptMask); + end; + {$ELSE} + //Linux: need here RTLD_GLOBAL, so Python can do "import ctypes" + FDLLHandle := THandle(dlopen(PAnsiChar(AnsiString(GetDllPath+DllName)), + RTLD_LAZY+RTLD_GLOBAL)); + {$ENDIF} + end; +end; + +function TMethodsContainer.AddMethod( AMethodName : PAnsiChar; + AMethod : PyCFunction; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + if FMethodCount = FAllocatedMethodCount then + ReallocMethods; + Result := Methods[ MethodCount ]; + Result^.ml_name := AMethodName; + Result^.ml_meth := AMethod; + Result^.ml_flags := METH_VARARGS; + Result^.ml_doc := ADocString; + Inc( FMethodCount ); +end; diff --git a/Tutorials/Webinar II/1096_trees_dataset_5_0_culmen.png b/Tutorials/Webinar II/1096_trees_dataset_5_0_culmen.png new file mode 100644 index 00000000..0fad6b4d Binary files /dev/null and b/Tutorials/Webinar II/1096_trees_dataset_5_0_culmen.png differ diff --git a/Tutorials/Webinar II/1096_trees_dataset_5_0_culmen_bodymass.png b/Tutorials/Webinar II/1096_trees_dataset_5_0_culmen_bodymass.png new file mode 100644 index 00000000..b19f4140 Binary files /dev/null and b/Tutorials/Webinar II/1096_trees_dataset_5_0_culmen_bodymass.png differ diff --git a/Tutorials/Webinar II/AnalyticsDemo/1096_P4D_AnalyticsDemo.htm b/Tutorials/Webinar II/AnalyticsDemo/1096_P4D_AnalyticsDemo.htm new file mode 100644 index 00000000..21ae4cc7 --- /dev/null +++ b/Tutorials/Webinar II/AnalyticsDemo/1096_P4D_AnalyticsDemo.htm @@ -0,0 +1,366 @@ +Version:0.9 +StartHTML:0000000105 +EndHTML:0000076517 +StartFragment:0000001053 +EndFragment:0000076501 + + + + +mXScriptasHTML + + + + + +
program VCL4Python_Py_AnalyticsDemo;
+{
+ Most programmers are familiar with the inexactness of floating point 
+                                   calculations in a binary processor. 
+ https://downloads.blaisepascal.eu/BlaisePascalMagazine_99_100_UK.pdf
+ 
+ https://github.com/maxkleiner/DelphiVCL4Python
+}
+
+Const //PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
+PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; 
+      
+ VCLHOME = 
+  'r"C:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delphivcl\win64\delphivcl.pyd"';
+
+ 
+//{$I logo.p} 
+PROCEDURE logo;
+BEGIN
+ writeln('');
+ writeln('  .-------------------------------------------.');
+ writeln('  | The Clean Python Bank Society         |');
+ writeln('  | Task9                 1988-2022 M.K.     |');
+ writeln('  .-------------------------------------------.');
+ writeln('');
+END; {procedure logo}
+
+const LoadPy_VCLClass =
+
+  'class MainForm(Form):                            '+LF+
+  '                                                 '+LF+
+  '  def __init__(self, owner):                     '+LF+
+  '      self.Caption = "A VCL Form..."             '+LF+
+  '      self.SetBounds(10, 10, 500, 400)           '+LF+
+  '      self.Position = "poScreenCenter"           '+LF+
+  '                                                 '+LF+
+  '      self.lblHello = Label(self)                '+LF+
+  '      self.lblHello.SetProps(Parent=self,        '+LF+
+  '        Caption="Hello DelphiVCL maXbox4 Python")'+LF+
+  '      self.lblHello.SetBounds(10, 10, 300, 24)   '+LF+
+  '                                                 '+LF+
+  '      self.OnClose = self.__on_form_close        '+LF+
+  '                                                 '+LF+
+  '                                                 '+LF+
+  '  def __on_form_close(self, sender, action):     '+LF+
+  '     action.Value = caFree                       ';
+  
+ 
+ STARTMAIN =
+  'def main():                               '+LF+
+  '  Application.Initialize()                '+LF+
+  '  Application.Title = "Hello Python"      '+LF+
+  '  Main = MainForm(Application)            '+LF+
+  '  Main.Show()                             '+LF+
+  '  FreeConsole()                           '+LF+
+  '  Application.Run()                       '+LF+
+  '  Main.Destroy()                          ';
+  
+  
+ ANALYTICS='#from delphi_module import svg_image'+LF
+    +'from io import StringIO'+LF
+    +'import numpy as np'     +LF
+    +'import pandas as pd'    +LF
+    +'import matplotlib.pyplot as plt'+LF
+    +'from sklearn.linear_model import BayesianRidge'+LF
+    +'from sklearn.model_selection import RandomizedSearchCV, train_test_split'+LF
+    +'from sklearn.preprocessing import PolynomialFeatures'+LF
+    +'from sklearn.metrics import mean_squared_error, mean_absolute_error'+LF
+    +'from sklearn.utils import parallel_backend'+LF
+    +'parallel_backend('#39'threading'#39')'+LF
+    +'import datetime'+LF
+    +'import warnings'+LF
+    +'warnings.filterwarnings("ignore")'+LF
+    +''+LF
+    +'confirmed_df = pd.read_csv('#39'https://raw.githubusercontent.com/CS'+
+        'SEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_ti' +
+        'me_series/time_series_covid19_confirmed_global.csv'#39')'+LF
+    +''+LF
+    +'parallel_backend('#39'threading'#39')'+LF
+    +'cols = confirmed_df.keys()'+LF
+    +'confirmed = confirmed_df.loc[:, cols[4]:cols[-1]]'+LF
+    +'dates = confirmed.keys()'+LF
+    +'world_cases = []'+LF
+    +''+LF
+    +'for i in dates:'+LF
+    +'    confirmed_sum = confirmed[i].sum()'+LF
+    +'    world_cases.append(confirmed_sum)'+LF
+    +'# window size'+LF
+    +'window = 7'+LF
+    +''+LF
+    +'days_since_1_22 = np.array([i for i in range(len(dates))]).reshape(-1, 1)'+LF
+    +'world_cases = np.array(world_cases).reshape(-1, 1)'+LF
+    +''+LF
+    +'days_in_future = 10'+LF
+    +'future_forcast = np.array([i for i in range(len(dates)+days_in_f' +
+          'uture)]).reshape(-1, 1)' +LF
+    +''+LF
+    +'start = '#39'1/22/2020'#39+LF
+    +'start_date = datetime.datetime.strptime(start, '#39'%m/%d/%Y'#39')'+LF
+    +'future_forcast_dates = []' +LF
+    +'for i in range(len(future_forcast)):'+LF
+    +'  future_forcast_dates.append((start_date + datetime.timedelta' +
+        '(days=i)).strftime('#39'%m/%d/%Y'#39'))'+LF
+    +''+LF
+    +'X_train_confirmed, X_test_confirmed, y_train_confirmed, y_test_c' +
+        'onfirmed = train_test_split(days_since_1_22[50:], world_cases[50' +
+        ':], test_size=0.05, shuffle=False)'+LF
+    +''+LF
+    +'# transform our data for polynomial regression'+LF
+    +'bayesian_poly = PolynomialFeatures(degree=5)'+LF
+    +'bayesian_poly_X_train_confirmed = bayesian_poly.fit_transform(X_' +
+         'train_confirmed)'+LF
+    +'bayesian_poly_X_test_confirmed = bayesian_poly.fit_transform(X_t' +
+         'est_confirmed)'+LF
+    +'bayesian_poly_future_forcast= bayesian_poly.fit_transform(future_forcast)'+LF
+    +'' +LF
+    +'# bayesian ridge polynomial regression'    +LF
+    +'tol = [1e-6, 1e-5, 1e-4, 1e-3, 1e-2]'      +LF
+    +'alpha_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]'  +LF
+    +'alpha_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]'  +LF
+    +'lambda_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF
+    +'lambda_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF
+    +'normalize = [True, False]'                 +LF
+    +''                                          +LF
+    +'bayesian_grid={'#39'tol'#39':tol,'#39'alpha_1'#39':alpha_1,'#39'alpha_2'#39':alp'+
+    'ha_2, '#39'lambda_1'#39': lambda_1,'#39'lambda_2'#39' : lambda_2,'
+    +'                  '#39'normalize'#39' : normalize}' +LF
+    +''+LF
+    +'bayesian = BayesianRidge(fit_intercept=True)' +LF
+    +'bayesian_search = RandomizedSearchCV(bayesian, bayesian_grid, sc' +
+        'oring='#39'neg_mean_squared_error'#39', cv=3, return_train_score=True, n'+
+        '_jobs=-1, n_iter=40, verbose=1)'+LF
+    +'bayesian_search.fit(bayesian_poly_X_train_confirmed, y_train_confirmed)'+LF
+    +''+LF
+    +'print(bayesian_search.best_params_)'+LF
+    +''+LF
+    +'bayesian_confirmed = bayesian_search.best_estimator_' +LF
+    +  'test_bayesian_pred = bayesian_confirmed.predict(bayesian_poly_X_' +
+       'test_confirmed)'+LF
+    +'bayesian_pred = bayesian_confirmed.predict(bayesian_poly_future_forcast)'+LF
+    +'print('#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed))'+LF
+    +'print('#39'MSE:'#39',mean_squared_error(test_bayesian_pred,y_test_confirmed))' +LF
+    +'' +LF
+    +'plt.plot(y_test_confirmed)'+LF
+    +'plt.plot(test_bayesian_pred)'+LF
+    +'plt.legend(['#39'Test Data'#39','#39'Bayesian Ridge Polynomial Predictions'#39'])'+LF
+    +'' +LF
+    +'figfile = StringIO()'+LF
+    +'plt.savefig(figfile, format='#39'svg'#39')'+LF
+    +'figdata_svg = figfile.getvalue()' +LF
+    +'#svg_image.SvgText = figdata_svg'+LF
+    +''+LF
+    +'plt.show()';  
+
+
+procedure pyBank_VCL4Python;
+var eg: TPythonEngine; sw: TStopWatch;
+begin
+eg:= TPythonEngine.Create(Nil);
+  try
+    eg.pythonhome:= PYHOME;
+    eg.loadDLL;
+    println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)'));
+    println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); 
+    writeln('') 
+    //println(eg.EvalStr('__import__("faker").Faker()')); 
+    sw:= TStopWatch.Create();
+    sw.Start;
+    eg.execStr('import importlib.machinery, importlib.util');
+    eg.execStr('from decimal import Decimal, getcontext');
+    //eg.execStr('from delphivcl import *');
+    //eg.execStr('import delphivcl, os');
+    //eg.execStr('loader= importlib.machinery.ExtensionFileLoader("DelphiVCL",'+VCLHOME+')')
+    //println('loader test>>> '+eg.evalStr('loader'));
+    //eg.execStr(LoadPy_VCLClass);
+    //eg.execStr(STARTMAIN);
+    //eg.execStr('main()');
+    eg.execStr(ANALYTICS);
+    println(eg.evalStr(''#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed)'));
+    println(eg.evalStr(''#39'MSE:'#39',mean_squared_error(test_bayesian_pred, y_test_confirmed)'));
+    
+    //eg.execStr(pybankDEF)  
+    //"Bank balance after 25 years = ", bank(25)
+    // println('Bank balance after 25 years = '+
+     //               eg.evalStr('bank(25)'));
+    sw.Stop;
+    //sw.ElapsedMilliseconds;
+    writeln('Stop Analytics Tester1: '+sw.getValueStr)
+  except
+    eg.raiseError;
+    writeln(ExceptionToString(ExceptionType, ExceptionParam));  
+  finally
+    eg.Free;
+    sw.Free;
+    sw:= Nil;
+  end;
+end;   
+
+Const UPPERLIMIT = 100;
+var cnt,n, precision: NativeUint;
+
+begin //@main
+  logo;
+  pyBank_VCL4Python();
+End.
+
+ref: test import 0.1000000000000000055511151231257827021181583404541015625
+test import 0.1000000000000000055511151231257827021181583404541015625
+
+('MAE:', 40265042.8047044)
+('MSE:', 1686906953419077.5)
+Stop Analytics Tester1: 0:10:51.185
+
+
+Exception: <class 'NameError'>: name 'svg_image' is not defined.
+
+     0.03993872967323020890367053
+     0.03993872967323020890367053
+PY   0.03993872967323021
+
+ref install python.exe -m pip install delphivcl
+
+Exception: <class 'ValueError'>: DelphiVCL module not found. Try to reinstall the delphivcl package or check for support compatibility.
+
+import sys
+# the following is needed to use the newly allocated console!
+sys.stdout = sys.stderr= open('CONOUT$', 'wt')
+ 
+
+C:\maXbox\works2021\maxbox4>cd C:\Users\Max\AppData\Local\Programs\Python\Python36-32
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install
+ delphivcl
+Collecting delphivcl
+  Downloading https://files.pythonhosted.org/packages/15/6b/32729afd53807fe5b890
+dbe309da2ea3575f49f7fe21d15532672fc94763/delphivcl-0.1.29-cp36-cp36m-win32.whl (
+2.1MB)
+    100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 2.1MB 539kB/s
+Installing collected packages: delphivcl
+Successfully installed delphivcl-0.1.29
+You are using pip version 9.0.1, however version 21.3.1 is available.
+You should consider upgrading via the 'python -m pip install --upgrade pip' command.
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>
+
+C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip uninsta
+ll delphivcl
+Uninstalling delphivcl-0.1.29:
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\installer
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\license.md
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\metadata
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\record
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\top_level.txt
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl-0.1.29.dist-info\wheel
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__init__.py
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__pycache__\__init__.cpython-36.pyc
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__pycache__\__version__.cpython-36.pyc
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__pycache__\moduledefs.cpython-36.pyc
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\__version__.py
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\moduledefs.py
+  c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph
+ivcl\win64\delphivcl.pyd
+Proceed (y/n)? y
+  Successfully uninstalled delphivcl-0.1.29
+  
+Error log:
+  C:\Users\breitsch\Documents\Embarcadero\Studio\21.0\CatalogRepository\Delphi4PythonExporter-D104-1.2.1\Source;"C:\Program 
+  Files\Streaming\maxbox4\python4delphi\Source";"C:\Program Files\Streaming\maxbox4\python4delphi\Source\vcl" -K00400000 
+  -NBC:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp -NHC:\Users\Public\Documents\Embarcadero\Studio\21.0\hpp\Win32  Demo34.dpr   
+[dcc32 Fatal Error] Demo34.dpr(7): F2048 Bad unit format: 'Unit1.dcu' - Expected version: 34.0, Windows Unicode(x86) Found version: 34.0, Windows Unicode(x64)
+Failed
+Elapsed time: 00:00:01.0
+64bit build
+
+procedure TDynamicDll.DoOpenDll(const aDllName : string);
+{$IFDEF MSWINDOWS}
+const
+  LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = $00000100;
+  LOAD_LIBRARY_DEFAULT_DIRS = $00001000;
+Var
+  ExceptMask: TFPUExceptionMask;
+{$ENDIF}
+begin
+  if not IsHandleValid then
+  begin
+    FDllName := aDllName;
+    {$IFDEF MSWINDOWS}
+    ExceptMask := GetExceptionMask;
+    try
+      {$IFDEF FPC}
+      FDLLHandle := LoadLibraryExA(PAnsiChar(AnsiString(GetDllPath+DllName)),
+      {$ELSE}
+      /// [dcc64 Error] PythonEngine.pas(2965): E2010 Incompatible types: 'PWideChar' and 'PAnsiChar'
+      FDLLHandle := LoadLibraryEx(PWidechar(GetDllPath+DllName),
+      {$ENDIF}
+        0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR or LOAD_LIBRARY_DEFAULT_DIRS);
+    finally
+      SetExceptionMask(ExceptMask);
+    end;
+    {$ELSE}
+    //Linux: need here RTLD_GLOBAL, so Python can do "import ctypes"
+    FDLLHandle := THandle(dlopen(PAnsiChar(AnsiString(GetDllPath+DllName)),
+      RTLD_LAZY+RTLD_GLOBAL));
+    {$ENDIF}
+  end;
+end;
+
+function TMethodsContainer.AddMethod( AMethodName  : PAnsiChar;
+                                      AMethod  : PyCFunction;
+                                      ADocString : PAnsiChar ) : PPyMethodDef;
+begin
+  if FMethodCount = FAllocatedMethodCount then
+    ReallocMethods;
+  Result := Methods[ MethodCount ];
+  Result^.ml_name  := AMethodName;
+  Result^.ml_meth  := AMethod;
+  Result^.ml_flags := METH_VARARGS;
+  Result^.ml_doc   := ADocString;
+  Inc( FMethodCount );
+end;
+
+
+ \ No newline at end of file diff --git a/Tutorials/Webinar II/AnalyticsDemo/1096_P4D_AnalyticsDemo.pas b/Tutorials/Webinar II/AnalyticsDemo/1096_P4D_AnalyticsDemo.pas new file mode 100644 index 00000000..a86b6192 --- /dev/null +++ b/Tutorials/Webinar II/AnalyticsDemo/1096_P4D_AnalyticsDemo.pas @@ -0,0 +1,332 @@ +program VCL4Python_Py_AnalyticsDemo; +{ + Most programmers are familiar with the inexactness of floating point + calculations in a binary processor. + https://downloads.blaisepascal.eu/BlaisePascalMagazine_99_100_UK.pdf + + https://github.com/maxkleiner/DelphiVCL4Python +} + +Const //PYHOME = 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\'; +PYHOME = 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\'; + + VCLHOME = + 'r"C:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delphivcl\win64\delphivcl.pyd"'; + + +//{$I logo.p} +PROCEDURE logo; +BEGIN + writeln(''); + writeln(' .-------------------------------------------.'); + writeln(' | The Clean Python Bank Society |'); + writeln(' | Task9 1988-2022 M.K. |'); + writeln(' .-------------------------------------------.'); + writeln(''); +END; {procedure logo} + +const LoadPy_VCLClass = + + 'class MainForm(Form): '+LF+ + ' '+LF+ + ' def __init__(self, owner): '+LF+ + ' self.Caption = "A VCL Form..." '+LF+ + ' self.SetBounds(10, 10, 500, 400) '+LF+ + ' self.Position = "poScreenCenter" '+LF+ + ' '+LF+ + ' self.lblHello = Label(self) '+LF+ + ' self.lblHello.SetProps(Parent=self, '+LF+ + ' Caption="Hello DelphiVCL maXbox4 Python")'+LF+ + ' self.lblHello.SetBounds(10, 10, 300, 24) '+LF+ + ' '+LF+ + ' self.OnClose = self.__on_form_close '+LF+ + ' '+LF+ + ' '+LF+ + ' def __on_form_close(self, sender, action): '+LF+ + ' action.Value = caFree '; + + + STARTMAIN = + 'def main(): '+LF+ + ' Application.Initialize() '+LF+ + ' Application.Title = "Hello Python" '+LF+ + ' Main = MainForm(Application) '+LF+ + ' Main.Show() '+LF+ + ' FreeConsole() '+LF+ + ' Application.Run() '+LF+ + ' Main.Destroy() '; + + + ANALYTICS='#from delphi_module import svg_image'+LF + +'from io import StringIO'+LF + +'import numpy as np' +LF + +'import pandas as pd' +LF + +'import matplotlib.pyplot as plt'+LF + +'from sklearn.linear_model import BayesianRidge'+LF + +'from sklearn.model_selection import RandomizedSearchCV, train_test_split'+LF + +'from sklearn.preprocessing import PolynomialFeatures'+LF + +'from sklearn.metrics import mean_squared_error, mean_absolute_error'+LF + +'from sklearn.utils import parallel_backend'+LF + +'parallel_backend('#39'threading'#39')'+LF + +'import datetime'+LF + +'import warnings'+LF + +'warnings.filterwarnings("ignore")'+LF + +''+LF + +'confirmed_df = pd.read_csv('#39'https://raw.githubusercontent.com/CS'+ + 'SEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_ti' + + 'me_series/time_series_covid19_confirmed_global.csv'#39')'+LF + +''+LF + +'parallel_backend('#39'threading'#39')'+LF + +'cols = confirmed_df.keys()'+LF + +'confirmed = confirmed_df.loc[:, cols[4]:cols[-1]]'+LF + +'dates = confirmed.keys()'+LF + +'world_cases = []'+LF + +''+LF + +'for i in dates:'+LF + +' confirmed_sum = confirmed[i].sum()'+LF + +' world_cases.append(confirmed_sum)'+LF + +'# window size'+LF + +'window = 7'+LF + +''+LF + +'days_since_1_22 = np.array([i for i in range(len(dates))]).reshape(-1, 1)'+LF + +'world_cases = np.array(world_cases).reshape(-1, 1)'+LF + +''+LF + +'days_in_future = 10'+LF + +'future_forcast = np.array([i for i in range(len(dates)+days_in_f' + + 'uture)]).reshape(-1, 1)' +LF + +''+LF + +'start = '#39'1/22/2020'#39+LF + +'start_date = datetime.datetime.strptime(start, '#39'%m/%d/%Y'#39')'+LF + +'future_forcast_dates = []' +LF + +'for i in range(len(future_forcast)):'+LF + +' future_forcast_dates.append((start_date + datetime.timedelta' + + '(days=i)).strftime('#39'%m/%d/%Y'#39'))'+LF + +''+LF + +'X_train_confirmed, X_test_confirmed, y_train_confirmed, y_test_c' + + 'onfirmed = train_test_split(days_since_1_22[50:], world_cases[50' + + ':], test_size=0.05, shuffle=False)'+LF + +''+LF + +'# transform our data for polynomial regression'+LF + +'bayesian_poly = PolynomialFeatures(degree=5)'+LF + +'bayesian_poly_X_train_confirmed = bayesian_poly.fit_transform(X_' + + 'train_confirmed)'+LF + +'bayesian_poly_X_test_confirmed = bayesian_poly.fit_transform(X_t' + + 'est_confirmed)'+LF + +'bayesian_poly_future_forcast= bayesian_poly.fit_transform(future_forcast)'+LF + +'' +LF + +'# bayesian ridge polynomial regression' +LF + +'tol = [1e-6, 1e-5, 1e-4, 1e-3, 1e-2]' +LF + +'alpha_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'alpha_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'lambda_1 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'lambda_2 = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3]' +LF + +'normalize = [True, False]' +LF + +'' +LF + +'bayesian_grid={'#39'tol'#39':tol,'#39'alpha_1'#39':alpha_1,'#39'alpha_2'#39':alp'+ + 'ha_2, '#39'lambda_1'#39': lambda_1,'#39'lambda_2'#39' : lambda_2,' + +' '#39'normalize'#39' : normalize}' +LF + +''+LF + +'bayesian = BayesianRidge(fit_intercept=True)' +LF + +'bayesian_search = RandomizedSearchCV(bayesian, bayesian_grid, sc' + + 'oring='#39'neg_mean_squared_error'#39', cv=3, return_train_score=True, n'+ + '_jobs=-1, n_iter=40, verbose=1)'+LF + +'bayesian_search.fit(bayesian_poly_X_train_confirmed, y_train_confirmed)'+LF + +''+LF + +'print(bayesian_search.best_params_)'+LF + +''+LF + +'bayesian_confirmed = bayesian_search.best_estimator_' +LF + + 'test_bayesian_pred = bayesian_confirmed.predict(bayesian_poly_X_' + + 'test_confirmed)'+LF + +'bayesian_pred = bayesian_confirmed.predict(bayesian_poly_future_forcast)'+LF + +'print('#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed))'+LF + +'print('#39'MSE:'#39',mean_squared_error(test_bayesian_pred,y_test_confirmed))' +LF + +'' +LF + +'plt.plot(y_test_confirmed)'+LF + +'plt.plot(test_bayesian_pred)'+LF + +'plt.legend(['#39'Test Data'#39','#39'Bayesian Ridge Polynomial Predictions'#39'])'+LF + +'' +LF + +'figfile = StringIO()'+LF + +'plt.savefig(figfile, format='#39'svg'#39')'+LF + +'figdata_svg = figfile.getvalue()' +LF + +'#svg_image.SvgText = figdata_svg'+LF + +''+LF + +'plt.show()'; + + +procedure pyBank_VCL4Python; +var eg: TPythonEngine; sw: TStopWatch; +begin +eg:= TPythonEngine.Create(Nil); + try + eg.pythonhome:= PYHOME; + eg.loadDLL; + println('test import '+GetPythonEngine.EvalStr('__import__("decimal").Decimal(0.1)')); + println('test import '+eg.EvalStr('__import__("decimal").Decimal(0.1)')); + writeln('') + //println(eg.EvalStr('__import__("faker").Faker()')); + sw:= TStopWatch.Create(); + sw.Start; + eg.execStr('import importlib.machinery, importlib.util'); + eg.execStr('from decimal import Decimal, getcontext'); + //eg.execStr('from delphivcl import *'); + //eg.execStr('import delphivcl, os'); + //eg.execStr('loader= importlib.machinery.ExtensionFileLoader("DelphiVCL",'+VCLHOME+')') + //println('loader test>>> '+eg.evalStr('loader')); + //eg.execStr(LoadPy_VCLClass); + //eg.execStr(STARTMAIN); + //eg.execStr('main()'); + eg.execStr(ANALYTICS); + println(eg.evalStr(''#39'MAE:'#39',mean_absolute_error(test_bayesian_pred,y_test_confirmed)')); + println(eg.evalStr(''#39'MSE:'#39',mean_squared_error(test_bayesian_pred, y_test_confirmed)')); + + //eg.execStr(pybankDEF) + //"Bank balance after 25 years = ", bank(25) + // println('Bank balance after 25 years = '+ + // eg.evalStr('bank(25)')); + sw.Stop; + //sw.ElapsedMilliseconds; + writeln('Stop Analytics Tester1: '+sw.getValueStr) + except + eg.raiseError; + writeln(ExceptionToString(ExceptionType, ExceptionParam)); + finally + eg.Free; + sw.Free; + sw:= Nil; + end; +end; + +Const UPPERLIMIT = 100; +var cnt,n, precision: NativeUint; + +begin //@main + logo; + pyBank_VCL4Python(); +End. + +ref: test import 0.1000000000000000055511151231257827021181583404541015625 +test import 0.1000000000000000055511151231257827021181583404541015625 + +('MAE:', 40265042.8047044) +('MSE:', 1686906953419077.5) +Stop Analytics Tester1: 0:10:51.185 + + +Exception: : name 'svg_image' is not defined. + + 0.03993872967323020890367053 + 0.03993872967323020890367053 +PY 0.03993872967323021 + +ref install python.exe -m pip install delphivcl + +Exception: : DelphiVCL module not found. Try to reinstall the delphivcl package or check for support compatibility. + +import sys +# the following is needed to use the newly allocated console! +sys.stdout = sys.stderr= open('CONOUT$', 'wt') + + +C:\maXbox\works2021\maxbox4>cd C:\Users\Max\AppData\Local\Programs\Python\Python36-32 + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install + delphivcl +Collecting delphivcl + Downloading https://files.pythonhosted.org/packages/15/6b/32729afd53807fe5b890 +dbe309da2ea3575f49f7fe21d15532672fc94763/delphivcl-0.1.29-cp36-cp36m-win32.whl ( +2.1MB) + 100% |��������������������������������| 2.1MB 539kB/s +Installing collected packages: delphivcl +Successfully installed delphivcl-0.1.29 +You are using pip version 9.0.1, however version 21.3.1 is available. +You should consider upgrading via the 'python -m pip install --upgrade pip' command. + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32> + +C:\Users\Max\AppData\Local\Programs\Python\Python36-32>python.exe -m pip uninsta +ll delphivcl +Uninstalling delphivcl-0.1.29: + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\installer + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\license.md + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\metadata + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\record + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\top_level.txt + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl-0.1.29.dist-info\wheel + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__init__.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\__init__.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\__version__.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__pycache__\moduledefs.cpython-36.pyc + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\__version__.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\moduledefs.py + c:\users\max\appdata\local\programs\python\python36-32\lib\site-packages\delph +ivcl\win64\delphivcl.pyd +Proceed (y/n)? y + Successfully uninstalled delphivcl-0.1.29 + +Error log: + C:\Users\breitsch\Documents\Embarcadero\Studio\21.0\CatalogRepository\Delphi4PythonExporter-D104-1.2.1\Source;"C:\Program + Files\Streaming\maxbox4\python4delphi\Source";"C:\Program Files\Streaming\maxbox4\python4delphi\Source\vcl" -K00400000 + -NBC:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp -NHC:\Users\Public\Documents\Embarcadero\Studio\21.0\hpp\Win32 Demo34.dpr +[dcc32 Fatal Error] Demo34.dpr(7): F2048 Bad unit format: 'Unit1.dcu' - Expected version: 34.0, Windows Unicode(x86) Found version: 34.0, Windows Unicode(x64) +Failed +Elapsed time: 00:00:01.0 +64bit build + +procedure TDynamicDll.DoOpenDll(const aDllName : string); +{$IFDEF MSWINDOWS} +const + LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = $00000100; + LOAD_LIBRARY_DEFAULT_DIRS = $00001000; +Var + ExceptMask: TFPUExceptionMask; +{$ENDIF} +begin + if not IsHandleValid then + begin + FDllName := aDllName; + {$IFDEF MSWINDOWS} + ExceptMask := GetExceptionMask; + try + {$IFDEF FPC} + FDLLHandle := LoadLibraryExA(PAnsiChar(AnsiString(GetDllPath+DllName)), + {$ELSE} + /// [dcc64 Error] PythonEngine.pas(2965): E2010 Incompatible types: 'PWideChar' and 'PAnsiChar' + FDLLHandle := LoadLibraryEx(PWidechar(GetDllPath+DllName), + {$ENDIF} + 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR or LOAD_LIBRARY_DEFAULT_DIRS); + finally + SetExceptionMask(ExceptMask); + end; + {$ELSE} + //Linux: need here RTLD_GLOBAL, so Python can do "import ctypes" + FDLLHandle := THandle(dlopen(PAnsiChar(AnsiString(GetDllPath+DllName)), + RTLD_LAZY+RTLD_GLOBAL)); + {$ENDIF} + end; +end; + +function TMethodsContainer.AddMethod( AMethodName : PAnsiChar; + AMethod : PyCFunction; + ADocString : PAnsiChar ) : PPyMethodDef; +begin + if FMethodCount = FAllocatedMethodCount then + ReallocMethods; + Result := Methods[ MethodCount ]; + Result^.ml_name := AMethodName; + Result^.ml_meth := AMethod; + Result^.ml_flags := METH_VARARGS; + Result^.ml_doc := ADocString; + Inc( FMethodCount ); +end; diff --git a/Tutorials/Webinar II/AnalyticsDemo/2022-11-11_analytics.png b/Tutorials/Webinar II/AnalyticsDemo/2022-11-11_analytics.png new file mode 100644 index 00000000..d2737f79 Binary files /dev/null and b/Tutorials/Webinar II/AnalyticsDemo/2022-11-11_analytics.png differ diff --git a/Tutorials/Webinar II/AnalyticsDemo/2022-11-11_analytics_script.png b/Tutorials/Webinar II/AnalyticsDemo/2022-11-11_analytics_script.png new file mode 100644 index 00000000..9772062b Binary files /dev/null and b/Tutorials/Webinar II/AnalyticsDemo/2022-11-11_analytics_script.png differ diff --git a/Tutorials/Webinar II/AnalyticsDemo/2022-11-11_exception.png b/Tutorials/Webinar II/AnalyticsDemo/2022-11-11_exception.png new file mode 100644 index 00000000..2f818f2b Binary files /dev/null and b/Tutorials/Webinar II/AnalyticsDemo/2022-11-11_exception.png differ diff --git a/Tutorials/Webinar II/AnalyticsDemo/AnalyticsDemo.dproj b/Tutorials/Webinar II/AnalyticsDemo/AnalyticsDemo.dproj index db0d9a61..3883c195 100644 --- a/Tutorials/Webinar II/AnalyticsDemo/AnalyticsDemo.dproj +++ b/Tutorials/Webinar II/AnalyticsDemo/AnalyticsDemo.dproj @@ -5,9 +5,9 @@ Debug VCL AnalyticsDemo.dpr - Win64 + Win32 {9AC7390B-64D2-47DD-8444-97F5B6123324} - 19.1 + 19.2 3 @@ -116,6 +116,10 @@
Form1
dfm + + Cfg_2 + Base + Base @@ -123,10 +127,6 @@ Cfg_1 Base - - Cfg_2 - Base - Delphi.Personality.12 diff --git a/Tutorials/Webinar II/VarPythDemo/1096_2022-11-12_develop_overview.png b/Tutorials/Webinar II/VarPythDemo/1096_2022-11-12_develop_overview.png new file mode 100644 index 00000000..1c2404cc Binary files /dev/null and b/Tutorials/Webinar II/VarPythDemo/1096_2022-11-12_develop_overview.png differ diff --git a/Tutorials/Webinar II/VarPythDemo/1096_2022-11-12_var_python.png b/Tutorials/Webinar II/VarPythDemo/1096_2022-11-12_var_python.png new file mode 100644 index 00000000..333ff4a7 Binary files /dev/null and b/Tutorials/Webinar II/VarPythDemo/1096_2022-11-12_var_python.png differ diff --git a/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_delphi_maxbox_seaborn3.png b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_delphi_maxbox_seaborn3.png new file mode 100644 index 00000000..d3ef6d69 Binary files /dev/null and b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_delphi_maxbox_seaborn3.png differ diff --git a/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python.png b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python.png new file mode 100644 index 00000000..077121c9 Binary files /dev/null and b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python.png differ diff --git a/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python2.png b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python2.png new file mode 100644 index 00000000..59970a33 Binary files /dev/null and b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python2.png differ diff --git a/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python2seaborn.png b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python2seaborn.png new file mode 100644 index 00000000..96d6d6d1 Binary files /dev/null and b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python2seaborn.png differ diff --git a/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python_delphi_scalable.png b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python_delphi_scalable.png new file mode 100644 index 00000000..350cf5cc Binary files /dev/null and b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_svg_python_delphi_scalable.png differ diff --git a/Tutorials/Webinar II/VizDemo/1096_2022-11-12_var_python.png b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_var_python.png new file mode 100644 index 00000000..333ff4a7 Binary files /dev/null and b/Tutorials/Webinar II/VizDemo/1096_2022-11-12_var_python.png differ diff --git a/Tutorials/Webinar II/maxbox_starter100.pdf b/Tutorials/Webinar II/maxbox_starter100.pdf new file mode 100644 index 00000000..089d9436 Binary files /dev/null and b/Tutorials/Webinar II/maxbox_starter100.pdf differ diff --git a/Tutorials/Webinar II/maxbox_starter100_1.pdf b/Tutorials/Webinar II/maxbox_starter100_1.pdf new file mode 100644 index 00000000..6089b3d8 Binary files /dev/null and b/Tutorials/Webinar II/maxbox_starter100_1.pdf differ diff --git a/Tutorials/Webinar II/pyscripter64bit.png b/Tutorials/Webinar II/pyscripter64bit.png new file mode 100644 index 00000000..96f68181 Binary files /dev/null and b/Tutorials/Webinar II/pyscripter64bit.png differ diff --git a/Tutorials/ekon25_pypas_wordpress.pdf b/Tutorials/ekon25_pypas_wordpress.pdf new file mode 100644 index 00000000..5ccb58e8 Binary files /dev/null and b/Tutorials/ekon25_pypas_wordpress.pdf differ diff --git a/Tutorials/mXStarter86_Python4maXbox_wordpress.pdf b/Tutorials/mXStarter86_Python4maXbox_wordpress.pdf new file mode 100644 index 00000000..633c6c94 Binary files /dev/null and b/Tutorials/mXStarter86_Python4maXbox_wordpress.pdf differ diff --git a/Tutorials/maXbox47580_UITests.xml b/Tutorials/maXbox47580_UITests.xml new file mode 100644 index 00000000..969d8988 --- /dev/null +++ b/Tutorials/maXbox47580_UITests.xml @@ -0,0 +1,3477 @@ + + + + + ControlType.Window:FocusedElement.1 + Verify that obtaining the AutomationElement.FocusedElement property does not throw any exception + Pri0 + Works + Microsoft Corp. + Generic + Step: Verify that one can call AutomationElement.FocusedElement without an exception + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestGetFocus1 + + + + + + + + + + + [23:46:08:34]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:GetRuntimeIdType.1 + Verify the format of the RuntimeId returned from the AutomationElement + Pri0 + Works + Microsoft Corp. + Generic + Verification: RuntimeId's should be of type int[] + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + RuntimeId + + + + + + + + + + + [23:46:08:39]:0: Verify that Type for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns System.Int32[] + [23:46:08:39]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property Type is System.Int32[] + [23:46:08:39]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:GetSupportedPatterns.1 + Verify that a call to GetSupportedPatterns succeeds without throwing an exception + Pri0 + Works + Microsoft Corp. + Generic + Verify success call to GetSupportedPatterns() + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestGetSupportedPatterns + + + + + + + + + + + [23:46:08:43]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:GetSupportedProperties.1 + Verify that a call to GetSupportedProperties succeeds without throwing an exception + Pri0 + Works + Microsoft Corp. + Generic + Verify success call to GetSupportedProperties() + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestGetSupportedProperties + + + + + + + + + + + [23:46:08:46]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:GetType.1 + Verify that a call to GetType succeeds without throwing an exception + Pri0 + Works + Microsoft Corp. + Generic + Verify success call to GetType() + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestGetType + + + + + + + + + + + [23:46:08:50]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:HwndWindowRect.1.MSAA + Verify MSAA rectangle is correct for Hwnd based window + Pri0 + Works + + Generic + Precondition: Element has a valid hwnd + Verification: Obtain the element's rectangle using IAccessible::get_accLocation() + Verification: Obtain the element's rectangle using Win32 GetWindowRect() + Verification: That the AutomationElement.GetBoundingRectangle is the same as IAccessible::get_accLocation() + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + HwndWindowRect1MSAA + + + + + + + + + + + [23:46:08:53]:0: Verify that AutomationElementIdentifiers.NativeWindowHandleProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does not returns 0 + [23:46:08:53]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.NativeWindowHandleProperty is 20647390 + [23:46:08:54]:3: UIA BoundingRectangle returned (Left=95, Top=50, Right=1422, Bottom=802 + [23:46:08:54]:3: Other rectangle was (Left=95, Top=50, Right=1422, Bottom=802 + [23:46:08:54]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:HwndWindowRect.2.UIA + Verify UIA rectangle available + Pri0 + Works + + Generic + Verification: Obtain AutomationElement.GetBoundingRectangle (regression for TitleBar / WindowsOSBug:1559184 + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + HwndWindowRect2UIA + + + + + + + + + + + [23:46:08:58]:0: UIA BoundingRectangle returned (Left=95, Top=50, Right=1422, Bottom=802 + [23:46:08:58]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:LocalizedControlType.1.8.1 + Test that an element has a non zero length string associated with the localized control type + Pri0 + Works + + Generic + Verify: LocalizedControlType != null + Verify: LocalizedControlType.Length != 0 + Verify: LocalizedControlType != string.Empty + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + LocalizedControlType181 + + + + + + + + + + + [23:46:08:63]:0: Verify that LocalizedControlType for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) returns null + [23:46:08:63]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property LocalizedControlType is window + [23:46:08:64]:1: Verify that LocalizedControlType for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does not returns 0 + [23:46:08:64]:1: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property LocalizedControlType is 6 + [23:46:08:64]:2: Verify that LocalizedControlType for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does not returns "" + [23:46:08:64]:2: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property LocalizedControlType is window + [23:46:08:64]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:ToString.1 + Verify that a call to ToString() succeeds without throwing an exception + Pri0 + Works + Microsoft Corp. + Generic + Verify success call to ToString() + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestToString1 + + + + + + + + + + + [23:46:08:68]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:AutomationIdProperty.1.7.1 + Test that the AutomationElement has no sibling with the same AutomationId + Pri1 + Works + + Generic + Precondition: This is not the RootElement and thus should have a parent + Verify: No siblings have the same AutomationIdProperty + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + AutomationIdProperty171 + + + + + + + + + + + [23:46:08:74]:0: Verify that AutomationElement.RootElement for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does not returns System.Windows.Automation.AutomationElement + [23:46:08:76]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElement.RootElement is System.Windows.Automation.AutomationElement + [23:46:08:98]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:AutomationIdProperty.1.7.8 + Test that items that have the ControlView = true, has an AutomationIdProperty that is not string.Empty + Pri1 + Works + + Generic + PreCondition: Element must support ControlType property to determine if supporting ControlType is required + Precondition: Element does not support the WindowPattern, thus is not a window + Precondition: IsControlElementProperty == true + Precondition: ControlType != ListItem (known item that does not support AutomationIdProperty) + Precondition: ControlType != DataItem (known item that does not support AutomationIdProperty) + Precondition: ControlType != TreeItem (known item that does not support AutomationIdProperty) + Precondition: ControlType != TabViewItem (known item that does not support AutomationIdProperty) + Precondition: ControlType != TitleBar (known item that does not support AutomationIdProperty) + Precondition: Parent's ControlType != ListItem(known item that does not support AutomationIdProperty) + Precondition: Parent's ControlType != DataItem(known item that does not support AutomationIdProperty) + Verify: AutomationIdProperty != string.Empty + Verify: AutomationIdProperty != 0 + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + AutomationIdProperty178 + + + + + + + + + + + [23:46:09:50]:0: AutomationIdProperty = + [23:46:09:50]:0: Verify that AutomationElementIdentifiers.ControlTypeProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) returns null + [23:46:09:50]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.ControlTypeProperty is System.Windows.Automation.ControlType + [23:46:09:50]:1: Verify that AutomationElementIdentifiers.IsWindowPatternAvailableProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns False + [23:46:09:50]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:BoundingRect.1 + Verify that BoundingRectangleProperty returns an acceptable value + Pri1 + Works + Microsoft Corp. + Generic + Precondition: AutomationElement.BoundingRectangleProperty != Rect.Empty + Verify: AutomationElement.BoundingRectangleProperty != AutomationElement.NotSupported + Verify: AutomationElement.BoundingRectangleProperty != null + Verify: AutomationElement.BoundingRectangleProperty != "" + Verify: AutomationElement.BoundingRectangle Top is less then Bottom + Verify: AutomationElement.BoundingRectangle left is less then Right + Verify: AutomationElement.BoundingRectangle Top != Infinity + Verify: AutomationElement.BoundingRectangle Left != Infinity + Verify: AutomationElement.BoundingRectangle Right != Infinity + Verify: AutomationElement.BoundingRectangle Bottom != Infinity + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestBoundingRect2 + + + + + + + + + + + [23:46:09:81]:0: GetCurrentPropertyValue(AutomationElement.BoundingRectangleProperty) returned 95,50,1327,752 + [23:46:09:81]:4: Fail if BoundingRect.Top (50) > BoundingRect.Bottom (802) + [23:46:09:81]:5: Fail if BoundingRect.Left (95) > BoundingRect.Right (1422) + [23:46:09:81]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:ClickablePointProperty.1 + Verify that AutomationElement.ClickablePointProperty returned a point withing the BoundingRectangle + Pri1 + Works + Microsoft Corp. + Generic + Verify if element is not off screen, AutomationElement.ClickablePointProperty is within the BoundingRectangle + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestClickablePointProperty2 + + + + + + + + + + + [23:46:09:11]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:ControlTypeProperty.1 + Verify that AutomationElement.ControlTypeProperty does not return null or AutomationElement.NotSupported + Pri1 + Works + Microsoft Corp. + Generic + Verify that GetCurrentPropertyValue(AutomationElement.ControlTypeProperty) does not return null + Verify that GetCurrentPropertyValue(AutomationElement.ControlTypeProperty) does not return AutomationElement.NotSupported + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestControlTypeProperty + + + + + + + + + + + [23:46:09:15]:0: Verify that ControlType for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) returns null + [23:46:09:16]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property ControlType is System.Windows.Automation.ControlType + [23:46:09:16]:1: Verify that ControlType for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does not returns System.__ComObject + [23:46:09:16]:1: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property ControlType is System.Windows.Automation.ControlType + [23:46:09:16]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:GetClickablePoint.2 + Verify that the point returned from GetClickablePoint() is within the boundaries returned from the element's BoundaryRectangleProperty + Pri1 + Works + Microsoft Corp. + Generic + Step: Call GetClickablePoint() + Step: If NoClickablePointException is not thrown, verify that pt returned from GetClickablePoint is within the AutomationElement's BoundingRectangle + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestGetClickablePoint2 + + + + + + + + + + + [23:46:09:26]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:GetHashCode.1 + Verify that a call to GetSupportedProperties succeeds without throwing an exception + Pri1 + Works + Microsoft Corp. + Generic + Verify success call to GetHashCode + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestGetHashCode + + + + + + + + + + + [23:46:09:30]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:IsKeyboardFocusable.1.1.1 + If IsKeyboardFocusable = false, call SetFocus() and verify that KeyboardFocusabe is still false and no events were fired + Pri1 + Works + + Generic + Precondition: Verify that this control supports SetFocus tests, some controls such as MenuItem's do not support SetFocus() + Precondition: IsKeyboardFocusable == false + Verify: Call SetFocus() and expect an exception to be thrown + Verify: IsKeyboardFocusable still false + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestKeyboardFocusable111 + + + + + + + + + + + [23:46:09:35]:1: Verify that AutomationElementIdentifiers.IsKeyboardFocusableProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns False + [23:46:09:35]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:IsPasswordProperty.1.3.2 + If IsPasswordProperty == true, Calling ValuePattern.Value throws an InvalidOperastionException + Pri1 + Works + + Generic + Precondition: AutomationElement.IsPasswordProperty == true + Verify: Calling ValuePattern.Value throws an InvalidOperationException + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestIsPasswordProperty132 + + + + + + + + + + + [23:46:09:38]:0: Verify that AutomationElementIdentifiers.IsKeyboardFocusableProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:09:38]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:KeyboardFocusable.1.1.2 + If KeyboardFocusable = true, call SetFocus() and verify that IsKeyboardFocusable is still true and PropertyChangedEvent was fired + Pri1 + Works + + Generic + Precondition: Verify that this control supports SetFocus tests, some controls such as MenuItem's do not support SetFocus() + Precondition: IsKeyboardFocusable == true + Verify: Call SetFocus() set focus to the element + Verify: IsKeyboardFocusable still true + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestKeyboardFocusable112 + + + + + + + + + + + [23:46:09:46]:1: Verify that AutomationElementIdentifiers.IsKeyboardFocusableProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:09:46]:1: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.IsKeyboardFocusableProperty is True + [23:46:09:46]:2: Setting focus to "Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:46:09:46]:2: Calling SetFocus("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:10:48]:2: Successfully called SetFocus() without an exception thrown + [23:46:10:48]:3: Verify that AutomationElementIdentifiers.IsKeyboardFocusableProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:10:48]:3: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.IsKeyboardFocusableProperty is True + [23:46:10:48]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.1 + If NextSibling != null, verify NextSiblings.PreviousSibling is current AutomationElement + Pri1 + Works + Microsoft Corp. + Generic + Precondition: AutomationElement's NextSibling != null + Verify that the NextSibling.PreviousSibling != null + Verify that my NextSibling's PreviousSibling is me + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation1 + + + + + + + + + + + [23:46:10:58]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.10 + Verify element's last child's previous sibling is not null + Pri1 + Works + Microsoft Corp. + Generic + Verify: The the element has children...AutomationElement.FirstChild != null + Verify: My LastChild.NextSibling == null + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation10 + + + + + + + + + + + [23:46:10:75]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.11 + Verify element's last childs parent equals elements first childs parent + Pri1 + Works + Microsoft Corp. + Generic + Verify: The the element has children...AutomationElement.FirstChild != null + Verify: My AutomationElement.LastChild.Parent == AutomationElement.FirstChild.Parent + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation11 + + + + + + + + + + + [23:46:10:85]:1: Both elements are equal + [23:46:10:85]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.2 + If GetPreviousSibling != null, verify GetPreviousSibling.NextSibling is current AutomationElement + Pri1 + Works + Microsoft Corp. + Generic + Precondition: AutomationElement's PreviousSibling != null + Verify: AutomattinElement's Previous Sibling's Next Sibling != null + Verify that my PreviousSibling's NextSibling is me + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation2 + + + + + + + + + + + [23:46:10:92]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.3 + If FirstChild != null, verify GetParent == parents FirstChild + Pri1 + Works + Microsoft Corp. + Generic + Precondition: AutomationElement's FirstChild != null + Verify that my FirstChild's Parent != null + Verify that my FirstChild's Parent is me + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation3 + + + + + + + + + + + [23:46:10:96]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.4 + If LastChild != null, verify elements LastChild's parent is element + Pri1 + Works + Microsoft Corp. + Generic + Precondition: AutomationElement's LastChild != null + Verify that my LastChild's Parent != null + Verify that my LastChild's Parent is me + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation4 + + + + + + + + + + + [23:46:11:53]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.5 + If element's parent != null, verify that element is child of parent element + Pri1 + Works + Microsoft Corp. + Generic + Precondition: This is not the RootElement and thus should have a parent + Verify that my Parent has siblings + Verify that I am a child of my Parent + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation5 + + + + + + + + + + + [23:46:11:10]:0: Verify that AutomationElement.RootElement for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does not returns System.Windows.Automation.AutomationElement + [23:46:11:10]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElement.RootElement is System.Windows.Automation.AutomationElement + [23:46:11:10]:1: Parent: "Pane" "Desktop 1" "" + [23:46:11:12]:1: Parent 1st child: "Pane" "1885 Cursor: 5 Mouse: 5" "" + [23:46:11:12]:2: Comparing sibling("Pane" "1885 Cursor: 5 Mouse: 5" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:12]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:12]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:13]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:13]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:13]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:13]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:13]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:13]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:15]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:15]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:15]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:15]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:15]:2: Comparing sibling("Pane" "" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:15]:2: Comparing sibling("Pane" "Taskbar" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:16]:2: Comparing sibling("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) with me("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:11:16]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.6 + Verify elements last sibling is element's parents last child + Pri1 + Works + Microsoft Corp. + Generic + Precondition: This is not the RootElement and thus should have a parent + Step: Get the last Sibling(me.NextSibling.NextSibling...) + Step: Verify that this element is the same as my Parent's LastChild + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation6 + + + + + + + + + + + [23:46:11:20]:0: Verify that AutomationElement.RootElement for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does not returns System.Windows.Automation.AutomationElement + [23:46:11:20]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElement.RootElement is System.Windows.Automation.AutomationElement + [23:46:11:22]:1: Navigating with NextSibling to "Window" "Visual UI Automation Verify : Client Side Provider" "MainWindow" + [23:46:11:22]:1: Navigating with NextSibling to "Window" "maxbox4" "" + [23:46:11:22]:1: Navigating with NextSibling to "Window" "UIAVerify" "" + [23:46:11:22]:1: Navigating with NextSibling to "Window" "source" "" + [23:46:11:23]:1: Navigating with NextSibling to "Window" "examples" "" + [23:46:11:23]:1: Navigating with NextSibling to "Window" "Import" "" + [23:46:11:23]:1: Navigating with NextSibling to "Window" "maxbox news — Mozilla Firefox" "" + [23:46:11:23]:1: Navigating with NextSibling to "Window" "readme_maxbox4.txt - Notepad" "" + [23:46:11:23]:1: Navigating with NextSibling to "Window" "REST" "" + [23:46:11:23]:1: Navigating with NextSibling to "Window" "maxbox36beta" "" + [23:46:11:25]:1: Navigating with NextSibling to "Pane" "Program Manager" "" + [23:46:11:80]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.7 + Verify elements first sibling is element's parents first child + Pri1 + Works + Microsoft Corp. + Generic + Precondition: This is not the RootElement and thus has a parent + Step: Get the AutomationElement's first Sibling(AutomationElement.PreviousSibling.PreviousSibling...) + Step: Verify that this element is the same as the AutomationElement's Parent.FirstChild + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation7 + + + + + + + + + + + [23:46:11:84]:0: Verify that AutomationElement.RootElement for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does not returns System.Windows.Automation.AutomationElement + [23:46:11:84]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElement.RootElement is System.Windows.Automation.AutomationElement + [23:46:11:85]:1: Navigating with PreviousSibling to "Pane" "Taskbar" "" + [23:46:11:87]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:87]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:87]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:88]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:88]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:88]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:88]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:90]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:90]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:90]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:90]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:90]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:90]:1: Navigating with PreviousSibling to "Pane" "" "" + [23:46:11:92]:1: Navigating with PreviousSibling to "Pane" "1885 Cursor: 5 Mouse: 5" "" + [23:46:11:92]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.8 + Verify elements oldest ancestor is the AutomationElement.RootElement + Pri1 + Works + Microsoft Corp. + Generic + Precondition: This is not the RootElement and thus has a parent + Step: Get my root element(me.Parent...) + Step: Verify that this element is the same AutomationElement.RootElement + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation8 + + + + + + + + + + + [23:46:11:95]:0: Verify that AutomationElement.RootElement for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does not returns System.Windows.Automation.AutomationElement + [23:46:11:95]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElement.RootElement is System.Windows.Automation.AutomationElement + [23:46:11:97]:1: Navigating with Parent to "Pane" "Desktop 1" "" + [23:46:11:97]:2: Comparing '"Pane" "Desktop 1" "" ' and '"Pane" "Desktop 1" "" ' + [23:46:11:97]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.9 + Verify elements first child's previous sibling is null + Pri1 + Works + Microsoft Corp. + Generic + Verify: The the element has children...AutomationElement.FirstChild != null + Verify: My FirstChild.PreviousSibling == null + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNavigation9 + + + + + + + + + + + [23:46:12:24]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.ControlFirstChild.1 + Verify no exceptions are not thrown when calling TreeWalker.ControlViewWalker.GetFirstChild + Pri1 + Works + Microsoft Corp. + Generic + Verify success call to FirstChild + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestFirstChild1 + + + + + + + + + + + [23:46:12:71]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.ControlLastChild.1 + Verify no exceptions are not thrown when calling TreeWalker.ControlViewWalker.GetLastChild + Pri1 + Works + Microsoft Corp. + Generic + Verify success call to LastChild + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestLastChild1 + + + + + + + + + + + [23:46:12:14]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.ControlNextSibling.1 + Verify no exceptions are not thrown when calling TreeWalker.ControlViewWalker.GetNextSibling + Pri1 + Works + Microsoft Corp. + Generic + Verify success call to NextSibling + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestNextSibling1 + + + + + + + + + + + [23:46:12:22]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.ControlParent.1 + Verify no exceptions are not thrown when calling TreeWalker.ControlViewWalker.GetParent + Pri1 + Works + Microsoft Corp. + Generic + Verify success call to Parent + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestParent1 + + + + + + + + + + + [23:46:12:27]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Navigation.ControlPreviousSibling.1 + Verify no exceptions are not thrown when calling TreeWalker.ControlViewWalker.GetPreviousSibling + Pri1 + Works + Microsoft Corp. + Generic + Verify success call to PreviousSibling + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestPreviousSibling1 + + + + + + + + + + + [23:46:12:30]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:SetFocus.1 + After removing the focus from an element, call SetFocus() programmatically and verify that the element receives the focus and the event is fired + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Some controls are not persisted after they loose focus (ie, Floating edit in Excel), don't tests these + Precondition: Verify that the element is enabled + Precondition: Verify that the element's IsOffScreen = false + Precondition: Verify that this control supports SetFocus tests + Precondition: Verify that the object's IsFocusableProperty == true + Step: Ensure the AutomationElement does not have focus by calling SetFocus(RANDOM) + Step: Verify that the AutomationElement's HasKeyboardFocusProperty == false + Precondition: Verify that the object's IsFocusableProperty is still true + Step: Add FocusChangedListener event on the AutomationElement + Step: Call SetFocus(AutomationElement) + Step: Verify that the element or one of it's children have the focus now + Step: Wait for events + Step: Verify that AutomationElement or one of it's children fired the FocusChangeEvent, or if the AutomationElement is a title bar, then the child in the application + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestSetFocus1a + + + + + + + + + + + [23:46:12:35]:2: Verify that AutomationElementIdentifiers.IsOffscreenProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns False + [23:46:12:35]:2: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.IsOffscreenProperty is False + [23:46:12:35]:4: Verify that AutomationElementIdentifiers.IsKeyboardFocusableProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:12:35]:4: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.IsKeyboardFocusableProperty is True + [23:46:12:55]:5: Setting focus to "Pane" "1885 Cursor: 5 Mouse: 5" "" + [23:46:12:55]:5: Calling SetFocus("Pane" "1885 Cursor: 5 Mouse: 5" "" ) + [23:46:13:57]:5: Successfully called SetFocus() without an exception thrown + [23:46:13:57]:6: Verify that AutomationElementIdentifiers.HasKeyboardFocusProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns False + [23:46:13:57]:6: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.HasKeyboardFocusProperty is False + [23:46:13:57]:7: Verify that AutomationElementIdentifiers.IsKeyboardFocusableProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:13:57]:7: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.IsKeyboardFocusableProperty is True + [23:46:13:58]:8: Adding FocusChangedListener + [23:46:13:58]: EVENTS: Adding AddAutomationFocusChangedEventHandler + [23:46:14:30]: EVENTS: Got event on...("Button" "" "ImmersiveBackground" ) + [23:46:15:30]: EVENTS: FIRED!! EVENT[0/1]("Button" "" "ImmersiveBackground" )...INFO(AutomationElementIdentifiers.AutomationFocusChangedEvent) Control Path = <ControlType><AutomationElement><ControlType>ControlType.Button</ControlType><AutomationId>ImmersiveBackground</AutomationId><Classname>ApplicationManager_ImmersiveShellWindow</Classname></AutomationElement></ControlType> + [23:46:15:42]:9: Setting focus to "Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:46:15:42]:9: Calling SetFocus("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:15:69]: EVENTS: Got event on...("Pane" "" "" ) + [23:46:16:44]:9: Successfully called SetFocus() without an exception thrown + [23:46:16:44]:10: <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></ControlType> has the focus + [23:46:16:70]: EVENTS: FIRED!! EVENT[1/2]("Pane" "" "" )...INFO(AutomationElementIdentifiers.AutomationFocusChangedEvent) Control Path = <ControlType><AutomationElement><ControlType>ControlType.Pane</ControlType><Classname>ForegroundStaging</Classname></AutomationElement></ControlType> + [23:46:16:74]: EVENTS: Got event on...("Button" "Cancel" "btnCancel" ) + [23:46:17:20]:10: _________ + [23:46:17:20]:10: Test Method = Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests.TestSetFocus1a + [23:46:17:20]:10: FailedStep Step = 10 + [23:46:17:20]:10: Issue Verification = Check_IsWindow + [23:46:17:20]:10: Path = + [23:46:17:20]:10: XML = <Issue Verification="Check_IsWindow"><Repro OS="6.2" ClientSideProvider="T" PS="TBD" ControlPath="" Error="Step 10 : There were no element or its children that had focus" CommandLine="" OSVersion="Microsoft Windows NT 6.2.9200.0" Date="27/07/2021 23:46:17" /></Issue> + [23:46:17:20]:10: _________ + [23:46:17:24]:10: FailedFilter.xml is saved. + + Step 10 : There were no element or it's children that had focus + at InternalHelper.Tests.TestObject.ThrowMe(CheckType checkType, Exception exceptionThrown, String format, Object[] args) + at Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests.TS_Focused(AutomationElement m_le, Boolean shouldbe, CheckType checkType) + at Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests.TestSetFocus1a(TestCaseAttribute testCaseAttribute) + + [23:46:17:24]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:SetFocus.10 + Setting focus to list that has no items selected should fire a focus change event + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: ControlType is ControlType.ListBox + Precondition: Verify that the element's IsOffScreen = false + Precondition: IsSelectionRequired = false + Precondition: Verify that the object's IsKeyboardFocusableProperty == true + Precondition: Make sure that there are no ListItems that are selected + Step: Ensure the AutomationElement does not have focus by calling SetFocus(AutomationElement.RootElement.FirstChild) + Step: Verify that the AutomationElement's HasKeyboardFocusProperty == false + Step: Add FocusChangedListener event on the AutomationElement + Step: Call and verify that SetFocus(AutomationElement) returns true + Step: Wait for events + Step: Verify that AutomationElement or child fired the FocusChangeEvent, or if the AutomationElement is a title bar, then the child in the application + Step: Verify that the AutomationElement's HasKeyboardFocusProperty == true + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestSetFocus10 + + + + + + + + + + + [23:46:17:36]:0: Verify that AutomationElementIdentifiers.ControlTypeProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns System.Windows.Automation.ControlType + [23:46:17:37]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:SetFocus.3 + If IsKeyboardFocusable == true, verify that when the element does not have the focus and you call SetFocus(), AutomationElement.HasKeyboardFocusProperty == true + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Some controls are not persisted after they loose focus (ie, Floating edit in Excel), don't tests these + Precondition: Verify that the element is enabled + Precondition: Verify that the element's IsOffScreen = false + Precondition: Verify that this control supports SetFocus tests + Precondition: Verify that the object's IsFocusableProperty == true + Step: Ensure the AutomationElement does not have focus by calling SetFocus(AutomationElement.RootElement.FirstChild) + Step: Verify that the AutomationElement's HasKeyboardFocusProperty == false + Step: Add FocusChangedListener event on the AutomationElement + Step: Call and verify that SetFocus(AutomationElement) returns true + Step: Wait for events + Step: Verify that AutomationElement or child fired the FocusChangeEvent, or if the AutomationElement is a title bar, then the child in the application + Step: Verify that the AutomationElement's HasKeyboardFocusProperty == true + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestSetFocus3 + + + + + + + + + + + [23:46:17:41]:2: Verify that AutomationElementIdentifiers.IsOffscreenProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns False + [23:46:17:41]:2: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.IsOffscreenProperty is False + [23:46:17:43]:4: Verify that AutomationElementIdentifiers.IsKeyboardFocusableProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:17:43]:4: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.IsKeyboardFocusableProperty is True + [23:46:17:64]:5: Setting focus to "Pane" "Taskbar" "" + [23:46:17:64]:5: Calling SetFocus("Pane" "Taskbar" "" ) + [23:46:17:74]: EVENTS: FIRED!! EVENT[0/1]("Button" "Cancel" "btnCancel" )...INFO(AutomationElementIdentifiers.AutomationFocusChangedEvent) Control Path = <ControlType><AutomationElement><NameProperty>Visual UI Automation Verify : Client Side Provider</NameProperty><ControlType>ControlType.Window</ControlType><AutomationId>MainWindow</AutomationId><Classname>WindowsForms10.Window.8.app.0.141b42a_r6_ad1</Classname><AutomationElement><NameProperty>Tests running</NameProperty><ControlType>ControlType.Window</ControlType><AutomationId>RunningTestsWindow</AutomationId><Classname>WindowsForms10.Window.8.app.0.141b42a_r6_ad1</Classname><AutomationElement><NameProperty>Cancel</NameProperty><ControlType>ControlType.Button</ControlType><AutomationId>btnCancel</AutomationId><Classname>WindowsForms10.BUTTON.app.0.141b42a_r6_ad1</Classname></AutomationElement></AutomationElement></AutomationElement></ControlType> + [23:46:18:66]:5: Successfully called SetFocus() without an exception thrown + [23:46:18:66]:6: Verify that AutomationElementIdentifiers.HasKeyboardFocusProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns False + [23:46:18:66]:6: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property AutomationElementIdentifiers.HasKeyboardFocusProperty is False + [23:46:18:66]:7: Adding FocusChangedListener + [23:46:18:66]: EVENTS: Adding AddAutomationFocusChangedEventHandler + [23:46:19:16]: EVENTS: Got event on...("Button" "" "ImmersiveBackground" ) + [23:46:20:16]: EVENTS: FIRED!! EVENT[1/2]("Button" "" "ImmersiveBackground" )...INFO(AutomationElementIdentifiers.AutomationFocusChangedEvent) Control Path = <ControlType><AutomationElement><ControlType>ControlType.Button</ControlType><AutomationId>ImmersiveBackground</AutomationId><Classname>ApplicationManager_ImmersiveShellWindow</Classname></AutomationElement></ControlType> + [23:46:20:28]:8: Setting focus to "Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:46:20:28]:8: Calling SetFocus("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:20:35]: EVENTS: Got event on...("Pane" " PROGRAM Extract_Functions_of_EXE_2; + +//depends on the debug, map and symbol options of the co mpiler +//don't stripe the symbols if you wanna see it! +//shows functions and procedures and constructors out of the EXE , #locs=250 +//#head:.txt Max: MAXBOX10: 27/07/2021 18:53:06 C:\maXbox\TestApp2\maxbox2\maxbox2\source_2007\maxbox29\maxbox36beta\256_findfunctions4_of_EXE_80_1.txt _EXE.txt + +CONST //s +//<Constant declarations> (loc's=42) + // AEXENAME = 'maXbox42sign.exe'; + AEXENAME = 'maXbox4.exe'; + + FUNCTIONLIST = 'maxbox_functions_sortlist47580.txt'; //maxbox_extract_funclist458_.txt'; + ONE_SUGAR_MASS = 3; + +{TYPE +<Type declarations> +<Variable declarations>} +//<PROCEDURE> +//http://4coder.org/delphi-source-code/?72 + +var + listbox1, listbox2: TListBox; + funclist, proclist, constrlist, destrlist: integer; + +Function EinsteinEnergyCube: extended; +// one sugar cube of 3 gram(m): E=mc^2 example +begin + //result:= 0.003 * Power(300000000, 2); + Result:= ONE_SUGAR_MASS/1000 * Power(MetersPerLightSecond, 2); + //writelegend +end; + +function FileToString(afilename: string): string; +begin + with TFileStream.Create(afilename, fmOpenRead or fmShareCompat) do begin + try + SetLength(result, Size); + Read(result, Size); + finally + Free; + end + end +end; + +procedure StringToFile(acontent, afilename:string); +begin + with TFileStream.Create(afilename, fmOpenWrite or fmCreate) do begin + try + Write(acontent, length(acontent)); + finally + Free; + end + end +end; + +function SearchAndGet(aStrList: TStrings; aSearchStr: string): string; +var i, TT1, TT2: integer; + s1, tmps, tmps2: string; +begin + for i:= 0 to aStrList.Count -1 do begin + s1:= aStrList[i]; + TT1:= pos(uppercase(aSearchStr), uppercase(s1)); + TT2:= pos(';',s1); + if (TT1 > 0) and (TT2 > 0) then begin + tmps:= Copy(s1, TT1, TT2-TT1+1); + tmps2:= tmps2 + tmps +#13#10; + end; + end; + result:= tmps2; +end; + + +function SearchAndGet3(s1: string; aSearchStr: string): TStringlist; +var i, T1, T2, T3, T4: integer; + tmps: string; +begin + result:= TStringlist.create; + result.Sorted:= true; //before dup! + result.duplicates:= dupIgnore; + Delete(s1,0,30) //skip header + for i:= 0 to length(s1) do begin + //writeln(itoa(length(s1))) + T1:= Pos(uppercase(aSearchStr), uppercase(s1)); + if (T1 > 0) then begin + Delete(s1,1,T1-1) //delete before + T2:= Pos('(',s1); // with params + T3:= Pos(':',s1); // no params + if (T2 > 0) or (T3 > 0) then begin + if T3 > 0 then + t4:= Pos(')',s1); + if t4 > 0 then + tmps:= Copy(s1, 0, t3+ t4+2); + result.add(tmps) + if (T3 > 0) and (T4 > 0) then + //Delete(s1,1,T3+ t4+2); + Delete(s1,1,T3+ 2); //delete found after + end; + end else Break; + end; + result.sort; +end; + +function SelectLine(Memo: TMemo; Zeile,Pos: integer): integer; +Var j: integer; +begin + Result:= 0; + If Zeile > 0 then + For j:= 0 To Zeile-1 do Result:= Result + Length(Memo.Lines[j])+ 2; + Result:= Result + Pos; +end; + +procedure MergeStrings(Dest, Source: TStrings); +var + I, DI: Integer; + begin + for I := 0 to Source.Count - 1 do begin + if Pos ('=', Source[I]) > 1 then begin + DI := Dest.IndexOfName(Source.Names[I]); + if DI > -1 then Dest[DI] := Source[I]; + end; + end; +end; + +procedure TForm1_Button1Click(Sender: TObject); +begin + MergeStrings(ListBox1.Items, ListBox2.Items); +end; + +procedure TForm1_FormCreate(Sender: TObject); +begin + ListBox1.Items.Add('Plants = 10'); + ListBox1.Items.Add('Animals = 20'); + ListBox1.Items.Add('Minerals = 15'); + ListBox2.Items.Add('Animals = 4'); + ListBox2.Items.Add('Plants = 3'); + ListBox2.Items.Add('Minerals = 778'); +end; + +var + myfile, listback: TStringList; + strback: string; + //mi: IStreamLoader; + //mm: TMemoryStream; + insize,i: integer; + +BEGIN //Main +//<Executable statements" "8326688" ) + [23:46:21:29]:8: Successfully called SetFocus() without an exception thrown + [23:46:21:29]:9: Waiting for 1 event(s) + [23:46:21:29]: EVENTS: Waiting for a period of 2000 milliseconds for no events to occur + [23:46:21:29]: EVENTS: FIRED!! EVENT[2/3]("Pane" " PROGRAM Extract_Functions_of_EXE_2; + +//depends on the debug, map and symbol options of the co mpiler +//don't stripe the symbols if you wanna see it! +//shows functions and procedures and constructors out of the EXE , #locs=250 +//#head:.txt Max: MAXBOX10: 27/07/2021 18:53:06 C:\maXbox\TestApp2\maxbox2\maxbox2\source_2007\maxbox29\maxbox36beta\256_findfunctions4_of_EXE_80_1.txt _EXE.txt + +CONST //s +//<Constant declarations> (loc's=42) + // AEXENAME = 'maXbox42sign.exe'; + AEXENAME = 'maXbox4.exe'; + + FUNCTIONLIST = 'maxbox_functions_sortlist47580.txt'; //maxbox_extract_funclist458_.txt'; + ONE_SUGAR_MASS = 3; + +[TYPE +<Type declarations> +<Variable declarations>] +//<PROCEDURE> +//http://4coder.org/delphi-source-code/?72 + +var + listbox1, listbox2: TListBox; + funclist, proclist, constrlist, destrlist: integer; + +Function EinsteinEnergyCube: extended; +// one sugar cube of 3 gram(m): E=mc^2 example +begin + //result:= 0.003 * Power(300000000, 2); + Result:= ONE_SUGAR_MASS/1000 * Power(MetersPerLightSecond, 2); + //writelegend +end; + +function FileToString(afilename: string): string; +begin + with TFileStream.Create(afilename, fmOpenRead or fmShareCompat) do begin + try + SetLength(result, Size); + Read(result, Size); + finally + Free; + end + end +end; + +procedure StringToFile(acontent, afilename:string); +begin + with TFileStream.Create(afilename, fmOpenWrite or fmCreate) do begin + try + Write(acontent, length(acontent)); + finally + Free; + end + end +end; + +function SearchAndGet(aStrList: TStrings; aSearchStr: string): string; +var i, TT1, TT2: integer; + s1, tmps, tmps2: string; +begin + for i:= 0 to aStrList.Count -1 do begin + s1:= aStrList[i]; + TT1:= pos(uppercase(aSearchStr), uppercase(s1)); + TT2:= pos(';',s1); + if (TT1 > 0) and (TT2 > 0) then begin + tmps:= Copy(s1, TT1, TT2-TT1+1); + tmps2:= tmps2 + tmps +#13#10; + end; + end; + result:= tmps2; +end; + + +function SearchAndGet3(s1: string; aSearchStr: string): TStringlist; +var i, T1, T2, T3, T4: integer; + tmps: string; +begin + result:= TStringlist.create; + result.Sorted:= true; //before dup! + result.duplicates:= dupIgnore; + Delete(s1,0,30) //skip header + for i:= 0 to length(s1) do begin + //writeln(itoa(length(s1))) + T1:= Pos(uppercase(aSearchStr), uppercase(s1)); + if (T1 > 0) then begin + Delete(s1,1,T1-1) //delete before + T2:= Pos('(',s1); // with params + T3:= Pos(':',s1); // no params + if (T2 > 0) or (T3 > 0) then begin + if T3 > 0 then + t4:= Pos(')',s1); + if t4 > 0 then + tmps:= Copy(s1, 0, t3+ t4+2); + result.add(tmps) + if (T3 > 0) and (T4 > 0) then + //Delete(s1,1,T3+ t4+2); + Delete(s1,1,T3+ 2); //delete found after + end; + end else Break; + end; + result.sort; +end; + +function SelectLine(Memo: TMemo; Zeile,Pos: integer): integer; +Var j: integer; +begin + Result:= 0; + If Zeile > 0 then + For j:= 0 To Zeile-1 do Result:= Result + Length(Memo.Lines[j])+ 2; + Result:= Result + Pos; +end; + +procedure MergeStrings(Dest, Source: TStrings); +var + I, DI: Integer; + begin + for I := 0 to Source.Count - 1 do begin + if Pos ('=', Source[I]) > 1 then begin + DI := Dest.IndexOfName(Source.Names[I]); + if DI > -1 then Dest[DI] := Source[I]; + end; + end; +end; + +procedure TForm1_Button1Click(Sender: TObject); +begin + MergeStrings(ListBox1.Items, ListBox2.Items); +end; + +procedure TForm1_FormCreate(Sender: TObject); +begin + ListBox1.Items.Add('Plants = 10'); + ListBox1.Items.Add('Animals = 20'); + ListBox1.Items.Add('Minerals = 15'); + ListBox2.Items.Add('Animals = 4'); + ListBox2.Items.Add('Plants = 3'); + ListBox2.Items.Add('Minerals = 778'); +end; + +var + myfile, listback: TStringList; + strback: string; + //mi: IStreamLoader; + //mm: TMemoryStream; + insize,i: integer; + +BEGIN //Main +//<Executable statements" "8326688" )...INFO(AutomationElementIdentifiers.AutomationFocusChangedEvent) Control Path = <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname><AutomationElement><NameProperty> PROGRAM Extract_Functions_of_EXE_2; + +//depends on the debug, map and symbol options of the co mpiler +//don't stripe the symbols if you wanna see it! +//shows functions and procedures and constructors out of the EXE , #locs=250 +//#head:.txt Max: MAXBOX10: 27/07/2021 18:53:06 C:\maXbox\TestApp2\maxbox2\maxbox2\source_2007\maxbox29\maxbox36beta\256_findfunctions4_of_EXE_80_1.txt _EXE.txt + +CONST //s +//&lt;Constant declarations&gt; (loc's=42) + // AEXENAME = 'maXbox42sign.exe'; + AEXENAME = 'maXbox4.exe'; + + FUNCTIONLIST = 'maxbox_functions_sortlist47580.txt'; //maxbox_extract_funclist458_.txt'; + ONE_SUGAR_MASS = 3; + +[TYPE +&lt;Type declarations&gt; +&lt;Variable declarations&gt;] +//&lt;PROCEDURE&gt; +//http://4coder.org/delphi-source-code/?72 + +var + listbox1, listbox2: TListBox; + funclist, proclist, constrlist, destrlist: integer; + +Function EinsteinEnergyCube: extended; +// one sugar cube of 3 gram(m): E=mc^2 example +begin + //result:= 0.003 * Power(300000000, 2); + Result:= ONE_SUGAR_MASS/1000 * Power(MetersPerLightSecond, 2); + //writelegend +end; + +function FileToString(afilename: string): string; +begin + with TFileStream.Create(afilename, fmOpenRead or fmShareCompat) do begin + try + SetLength(result, Size); + Read(result, Size); + finally + Free; + end + end +end; + +procedure StringToFile(acontent, afilename:string); +begin + with TFileStream.Create(afilename, fmOpenWrite or fmCreate) do begin + try + Write(acontent, length(acontent)); + finally + Free; + end + end +end; + +function SearchAndGet(aStrList: TStrings; aSearchStr: string): string; +var i, TT1, TT2: integer; + s1, tmps, tmps2: string; +begin + for i:= 0 to aStrList.Count -1 do begin + s1:= aStrList[i]; + TT1:= pos(uppercase(aSearchStr), uppercase(s1)); + TT2:= pos(';',s1); + if (TT1 &gt; 0) and (TT2 &gt; 0) then begin + tmps:= Copy(s1, TT1, TT2-TT1+1); + tmps2:= tmps2 + tmps +#13#10; + end; + end; + result:= tmps2; +end; + + +function SearchAndGet3(s1: string; aSearchStr: string): TStringlist; +var i, T1, T2, T3, T4: integer; + tmps: string; +begin + result:= TStringlist.create; + result.Sorted:= true; //before dup! + result.duplicates:= dupIgnore; + Delete(s1,0,30) //skip header + for i:= 0 to length(s1) do begin + //writeln(itoa(length(s1))) + T1:= Pos(uppercase(aSearchStr), uppercase(s1)); + if (T1 &gt; 0) then begin + Delete(s1,1,T1-1) //delete before + T2:= Pos('(',s1); // with params + T3:= Pos(':',s1); // no params + if (T2 &gt; 0) or (T3 &gt; 0) then begin + if T3 &gt; 0 then + t4:= Pos(')',s1); + if t4 &gt; 0 then + tmps:= Copy(s1, 0, t3+ t4+2); + result.add(tmps) + if (T3 &gt; 0) and (T4 &gt; 0) then + //Delete(s1,1,T3+ t4+2); + Delete(s1,1,T3+ 2); //delete found after + end; + end else Break; + end; + result.sort; +end; + +function SelectLine(Memo: TMemo; Zeile,Pos: integer): integer; +Var j: integer; +begin + Result:= 0; + If Zeile &gt; 0 then + For j:= 0 To Zeile-1 do Result:= Result + Length(Memo.Lines[j])+ 2; + Result:= Result + Pos; +end; + +procedure MergeStrings(Dest, Source: TStrings); +var + I, DI: Integer; + begin + for I := 0 to Source.Count - 1 do begin + if Pos ('=', Source[I]) &gt; 1 then begin + DI := Dest.IndexOfName(Source.Names[I]); + if DI &gt; -1 then Dest[DI] := Source[I]; + end; + end; +end; + +procedure TForm1_Button1Click(Sender: TObject); +begin + MergeStrings(ListBox1.Items, ListBox2.Items); +end; + +procedure TForm1_FormCreate(Sender: TObject); +begin + ListBox1.Items.Add('Plants = 10'); + ListBox1.Items.Add('Animals = 20'); + ListBox1.Items.Add('Minerals = 15'); + ListBox2.Items.Add('Animals = 4'); + ListBox2.Items.Add('Plants = 3'); + ListBox2.Items.Add('Minerals = 778'); +end; + +var + myfile, listback: TStringList; + strback: string; + //mi: IStreamLoader; + //mm: TMemoryStream; + insize,i: integer; + +BEGIN //Main +//&lt;Executable statements</NameProperty><ControlType>ControlType.Pane</ControlType><AutomationId>8326688</AutomationId><Classname>TSynMemo</Classname></AutomationElement></AutomationElement></ControlType> + [23:46:23:30]: EVENTS: Stop waiting for events. Found 3 event(s) + [23:46:23:30]:9: End waiting for events + [23:46:23:32]:10: Start: Looking for event that might have been fired + [23:46:23:32]: EVENTS: 3 was/were fired + [23:46:23:33]:10: End : Looking for event that might have been fired + [23:46:23:33]:10: Focus change event did get fired and was expected to be fired + [23:46:23:41]: EVENTS: Got event on...("Pane" "" "" ) + [23:46:23:41]: EVENTS: FIRED!! EVENT[3/4]("Pane" "" "" )...INFO(AutomationElementIdentifiers.AutomationFocusChangedEvent) Control Path = <ControlType><AutomationElement><ControlType>ControlType.Pane</ControlType><Classname>ForegroundStaging</Classname></AutomationElement></ControlType> + [23:46:23:54]: EVENTS: Got event on...("Button" "Cancel" "btnCancel" ) + [23:46:24:10]:11: _________ + [23:46:24:10]:11: Test Method = Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests.TestSetFocus3 + [23:46:24:10]:11: FailedStep Step = 11 + [23:46:24:10]:11: Issue Verification = Check_IsWindow + [23:46:24:10]:11: Path = + [23:46:24:10]:11: XML = <Issue Verification="Check_IsWindow"><Repro OS="6.2" ClientSideProvider="T" PS="TBD" ControlPath="" Error="Step 11 : Could not find any element or child whos property is &quot;AutomationElementIdentifiers.HasKeyboardFocusProperty&quot; is &quot;True&quot;" CommandLine="" OSVersion="Microsoft Windows NT 6.2.9200.0" Date="27/07/2021 23:46:24" /></Issue> + [23:46:24:10]:11: _________ + [23:46:24:10]:11: FailedFilter.xml is saved. + + Step 11 : Could not find any element or child whos property is "AutomationElementIdentifiers.HasKeyboardFocusProperty" is "True" + at InternalHelper.Tests.TestObject.ThrowMe(CheckType checkType, Exception exceptionThrown, String format, Object[] args) + at InternalHelper.Tests.TestObject.TS_VerifyOnElementOrChild(AutomationElement element, AutomationProperty property, Object compareValue, Boolean shouldBeEqual, CheckType checkType) + at Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests.TestSetFocus3(TestCaseAttribute testCaseAttribute) + + [23:46:24:10]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:AutomationElement.PropertyChange.Enabled.1 + Verify that PropertyChangeEvent is fired when disabled element is enabled + Pri2 + Works + + Generic, Scenario, Events + Precondition: Verify that this control supports testing PropertyChanges + Step: Reset the control to it's original state + Step: Display the current AutomationElement.IsEnabledProperty + Step: Add Property Change Listener + Step: Change the AutomationElement.IsEnabledProperty of the element + Step: Wait for 1 event + Step: Display the current AutomationElement.IsEnabledProperty + Verify: That a property change event was fired + Step: Reset the control to it's initial state + Step: Display the current AutomationElement.IsEnabledProperty + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + PropertyChangeEnabled1 + + + + + + + + + + + [23:46:24:15]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:AutomationElement.PropertyChange.Name.1 + Verify that PropertyChangeEvent is fired for AutomationElement.NameProperty + Pri2 + Works + + Generic, Scenario, Events + Precondition: Verify that this control supports testing PropertyChanges + Step: Reset the control to it's original state + Step: Display the current AutomationElement.NameProperty + Step: Add Property Change Listener + Step: Change the name of the element + Step: Wait for 1 event + Step: Display the current AutomationElement.NameProperty + Verify: That a property change event was fired + Step: Reset the control to it's initial state + Step: Display the current AutomationElement.NameProperty + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + PropertyChangeName1 + + + + + + + + + + + [23:46:24:18]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:GetCurrentPattern.1 + Enumerate through all the Automation.Pattern variables, and call GetCurrentPattern(). If the value of Is*PatternAvailableProperty true, verify that GetCurrentPattern() succeeds, else if Is*PatternAvailableProperty is false then InvalidOperationException is thrown + Pri2 + Works + + Generic + Verify success call to GetCurrentPattern(*Pattern.PatternObject) + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestAllPattern + + + + + + + + + + + [23:46:24:24]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:GetCurrentPropertyValue.1 + Enumerating through all AutomationProperties using reflection and call GetCurrentPropertyValue(). Verrify that no exception is thrown + Pri2 + Works + Microsoft Corp. + Generic + Verify success call to all GetCurrentPropertyValue(AutomationElement property) + Verify success call to all GetCurrentPropertyValue(AutomationPattern property) + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestProperty1 + + + + + + + + + + + [23:46:24:28]:0: Do the AutomationProperties off of the AutomationElement + [23:46:24:28]:0: Getting property value for (AcceleratorKeyProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.AcceleratorKeyProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.AcceleratorKeyProperty) + [23:46:24:28]:0: Getting property value for (AccessKeyProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.AccessKeyProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.AccessKeyProperty) + [23:46:24:28]:0: Getting property value for (AutomationIdProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.AutomationIdProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.AutomationIdProperty) + [23:46:24:28]:0: Getting property value for (BoundingRectangleProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.BoundingRectangleProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.BoundingRectangleProperty) + [23:46:24:28]:0: Getting property value for (ClassNameProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.ClassNameProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.ClassNameProperty) + [23:46:24:28]:0: Getting property value for (ClickablePointProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.ClickablePointProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.ClickablePointProperty) + [23:46:24:28]:0: Getting property value for (ControlTypeProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.ControlTypeProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.ControlTypeProperty) + [23:46:24:28]:0: Getting property value for (CultureProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.CultureProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.CultureProperty) + [23:46:24:28]:0: Getting property value for (FrameworkIdProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.FrameworkIdProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.FrameworkIdProperty) + [23:46:24:28]:0: Getting property value for (HasKeyboardFocusProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.HasKeyboardFocusProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.HasKeyboardFocusProperty) + [23:46:24:28]:0: Getting property value for (HelpTextProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.HelpTextProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.HelpTextProperty) + [23:46:24:28]:0: Getting property value for (IsContentElementProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsContentElementProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsContentElementProperty) + [23:46:24:28]:0: Getting property value for (IsControlElementProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsControlElementProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsControlElementProperty) + [23:46:24:28]:0: Getting property value for (IsDockPatternAvailableProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsDockPatternAvailableProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsDockPatternAvailableProperty) + [23:46:24:28]:0: Getting property value for (IsEnabledProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsEnabledProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsEnabledProperty) + [23:46:24:28]:0: Getting property value for (IsExpandCollapsePatternAvailableProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsExpandCollapsePatternAvailableProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsExpandCollapsePatternAvailableProperty) + [23:46:24:28]:0: Getting property value for (IsGridItemPatternAvailableProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsGridItemPatternAvailableProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsGridItemPatternAvailableProperty) + [23:46:24:28]:0: Getting property value for (IsGridPatternAvailableProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsGridPatternAvailableProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsGridPatternAvailableProperty) + [23:46:24:28]:0: Getting property value for (IsInvokePatternAvailableProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsInvokePatternAvailableProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsInvokePatternAvailableProperty) + [23:46:24:28]:0: Getting property value for (IsKeyboardFocusableProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsKeyboardFocusableProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsKeyboardFocusableProperty) + [23:46:24:28]:0: Getting property value for (IsMultipleViewPatternAvailableProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsMultipleViewPatternAvailableProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsMultipleViewPatternAvailableProperty) + [23:46:24:28]:0: Getting property value for (IsOffscreenProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsOffscreenProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsOffscreenProperty) + [23:46:24:28]:0: Getting property value for (IsPasswordProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsPasswordProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsPasswordProperty) + [23:46:24:28]:0: Getting property value for (IsRangeValuePatternAvailableProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsRangeValuePatternAvailableProperty) + [23:46:24:28]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsRangeValuePatternAvailableProperty) + [23:46:24:28]:0: Getting property value for (IsRequiredForFormProperty) + [23:46:24:28]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsRequiredForFormProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsRequiredForFormProperty) + [23:46:24:30]:0: Getting property value for (IsScrollItemPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsScrollItemPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsScrollItemPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsScrollPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsScrollPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsScrollPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsSelectionItemPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsSelectionItemPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsSelectionItemPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsSelectionPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsSelectionPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsSelectionPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsTableItemPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsTableItemPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsTableItemPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsTablePatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsTablePatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsTablePatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsTextPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsTextPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsTextPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsTogglePatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsTogglePatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsTogglePatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsTransformPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsTransformPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsTransformPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsValuePatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsValuePatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsValuePatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsWindowPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsWindowPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsWindowPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (ItemStatusProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.ItemStatusProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.ItemStatusProperty) + [23:46:24:30]:0: Getting property value for (ItemTypeProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.ItemTypeProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.ItemTypeProperty) + [23:46:24:30]:0: Getting property value for (LabeledByProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.LabeledByProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.LabeledByProperty) + [23:46:24:30]:0: Getting property value for (LocalizedControlTypeProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.LocalizedControlTypeProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.LocalizedControlTypeProperty) + [23:46:24:30]:0: Getting property value for (NameProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.NameProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.NameProperty) + [23:46:24:30]:0: Getting property value for (NativeWindowHandleProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.NativeWindowHandleProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.NativeWindowHandleProperty) + [23:46:24:30]:0: Getting property value for (OrientationProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.OrientationProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.OrientationProperty) + [23:46:24:30]:0: Getting property value for (ProcessIdProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.ProcessIdProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.ProcessIdProperty) + [23:46:24:30]:0: Getting property value for (RuntimeIdProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.RuntimeIdProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.RuntimeIdProperty) + [23:46:24:30]:0: Getting property value for (IsLegacyIAccessiblePatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsLegacyIAccessiblePatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsLegacyIAccessiblePatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsItemContainerPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsItemContainerPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsItemContainerPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsVirtualizedItemPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsVirtualizedItemPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsVirtualizedItemPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsSynchronizedInputPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsSynchronizedInputPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsSynchronizedInputPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (AriaRoleProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.AriaRoleProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.AriaRoleProperty) + [23:46:24:30]:0: Getting property value for (AriaPropertiesProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.AriaPropertiesProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.AriaPropertiesProperty) + [23:46:24:30]:0: Getting property value for (IsDataValidForFormProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsDataValidForFormProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsDataValidForFormProperty) + [23:46:24:30]:0: Getting property value for (ControllerForProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.ControllerForProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.ControllerForProperty) + [23:46:24:30]:0: Getting property value for (DescribedByProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.DescribedByProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.DescribedByProperty) + [23:46:24:30]:0: Getting property value for (FlowsToProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.FlowsToProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.FlowsToProperty) + [23:46:24:30]:0: Getting property value for (ProviderDescriptionProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.Property) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.Property) + [23:46:24:30]:0: Getting property value for (IsObjectModelPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsObjectModelPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsObjectModelPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsAnnotationPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsAnnotationPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsAnnotationPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsTextPattern2AvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsTextPattern2AvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsTextPattern2AvailableProperty) + [23:46:24:30]:0: Getting property value for (IsStylesPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsStylesPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsStylesPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsSpreadsheetPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsSpreadsheetPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsSpreadsheetPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsSpreadsheetItemPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsSpreadsheetItemPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsSpreadsheetItemPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsTransformPattern2AvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsTransformPattern2AvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsTransformPattern2AvailableProperty) + [23:46:24:30]:0: Getting property value for (IsTextChildPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsTextChildPatternAvailableProperty) + [23:46:24:30]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsTextChildPatternAvailableProperty) + [23:46:24:30]:0: Getting property value for (IsDragPatternAvailableProperty) + [23:46:24:30]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsDragPatternAvailableProperty) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsDragPatternAvailableProperty) + [23:46:24:31]:0: Getting property value for (IsDropTargetPatternAvailableProperty) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsDropTargetPatternAvailableProperty) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsDropTargetPatternAvailableProperty) + [23:46:24:31]:0: Getting property value for (OptimizeForVisualContentProperty) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.OptimizeForVisualContentProperty) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.OptimizeForVisualContentProperty) + [23:46:24:31]:0: Getting property value for (LiveSettingProperty) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.LiveSettingProperty) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.LiveSettingProperty) + [23:46:24:31]:0: Getting property value for (FlowsFromProperty) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.FlowsFromProperty) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.FlowsFromProperty) + [23:46:24:31]:0: Getting property value for (IsTextEditPatternAvailableProperty) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsTextEditPatternAvailable) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsTextEditPatternAvailable) + [23:46:24:31]:0: Getting property value for (IsPeripheralProperty) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsPeripheralProperty) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsPeripheralProperty) + [23:46:24:31]:0: Getting property value for (IsCustomNavigationPatternAvailableProperty) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.IsCustomNavigationPatternAvailable) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.IsCustomNavigationPatternAvailable) + [23:46:24:31]:0: Getting property value for (PositionInSetProperty) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.PositionInSet) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.PositionInSet) + [23:46:24:31]:0: Getting property value for (SizeOfSetProperty) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.SizeOfSet) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.SizeOfSet) + [23:46:24:31]:0: Getting property value for (LevelProperty) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.Level) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.Level) + [23:46:24:31]:0: Getting property value for (AnnotationTypes) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.AnnotationTypes) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.AnnotationTypes) + [23:46:24:31]:0: Getting property value for (AnnotationObjects) + [23:46:24:31]:0: Calling GetCurrentPropertyValue(AutomationElementIdentifiers.AnnotationObjects) + [23:46:24:31]:0: Obtained GetCurrentPropertyValue(AutomationElementIdentifiers.AnnotationObjects) + [23:46:24:31]:1: Do the AutomationProperties off of the Pattern objects + [23:46:24:31]:1: Getting property value for (AnnotationTypeIdProperty) + [23:46:24:31]:1: Calling GetCurrentPropertyValue(AnnotationPatternIdentifiers.AnnotationTypeIdProperty) + [23:46:24:31]:1: Obtained GetCurrentPropertyValue(AnnotationPatternIdentifiers.AnnotationTypeIdProperty) + [23:46:24:31]:1: Getting property value for (AnnotationTypeNameProperty) + [23:46:24:31]:1: Calling GetCurrentPropertyValue(AnnotationPatternIdentifiers.AnnotationTypeNameProperty) + [23:46:24:31]:1: Obtained GetCurrentPropertyValue(AnnotationPatternIdentifiers.AnnotationTypeNameProperty) + [23:46:24:31]:1: Getting property value for (AuthorProperty) + [23:46:24:31]:1: Calling GetCurrentPropertyValue(AnnotationPatternIdentifiers.AuthorProperty) + [23:46:24:31]:1: Obtained GetCurrentPropertyValue(AnnotationPatternIdentifiers.AuthorProperty) + [23:46:24:31]:1: Getting property value for (DateTimeProperty) + [23:46:24:31]:1: Calling GetCurrentPropertyValue(AnnotationPatternIdentifiers.DateTimeProperty) + [23:46:24:31]:1: Obtained GetCurrentPropertyValue(AnnotationPatternIdentifiers.DateTimeProperty) + [23:46:24:31]:1: Getting property value for (TargetProperty) + [23:46:24:31]:1: Calling GetCurrentPropertyValue(AnnotationPatternIdentifiers.TargetProperty) + [23:46:24:31]:1: Obtained GetCurrentPropertyValue(AnnotationPatternIdentifiers.TargetProperty) + [23:46:24:31]:1: Getting property value for (DockPositionProperty) + [23:46:24:31]:1: Calling GetCurrentPropertyValue(DockPatternIdentifiers.DockPositionProperty) + [23:46:24:31]:1: Obtained GetCurrentPropertyValue(DockPatternIdentifiers.DockPositionProperty) + [23:46:24:31]:1: Getting property value for (IsGrabbedProperty) + [23:46:24:31]:1: Calling GetCurrentPropertyValue(DragPatternIdentifiers.IsGrabbedProperty) + [23:46:24:31]:1: Obtained GetCurrentPropertyValue(DragPatternIdentifiers.IsGrabbedProperty) + [23:46:24:31]:1: Getting property value for (GrabbedItemsProperty) + [23:46:24:31]:1: Calling GetCurrentPropertyValue(DragPatternIdentifiers.GrabbedItemsProperty) + [23:46:24:31]:1: Obtained GetCurrentPropertyValue(DragPatternIdentifiers.GrabbedItemsProperty) + [23:46:24:31]:1: Getting property value for (DropEffectProperty) + [23:46:24:31]:1: Calling GetCurrentPropertyValue(DragPatternIdentifiers.DropEffectProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(DragPatternIdentifiers.DropEffectProperty) + [23:46:24:32]:1: Getting property value for (DropEffectsProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(DragPatternIdentifiers.DropEffectsProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(DragPatternIdentifiers.DropEffectsProperty) + [23:46:24:32]:1: Getting property value for (DropTargetEffectProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(DropTargetPatternIdentifiers.DropTargetEffectProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(DropTargetPatternIdentifiers.DropTargetEffectProperty) + [23:46:24:32]:1: Getting property value for (DropTargetEffectsProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(DropTargetPatternIdentifiers.DropTargetEffectsProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(DropTargetPatternIdentifiers.DropTargetEffectsProperty) + [23:46:24:32]:1: Getting property value for (ExpandCollapseStateProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty) + [23:46:24:32]:1: Getting property value for (ColumnCountProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(GridPatternIdentifiers.ColumnCountProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(GridPatternIdentifiers.ColumnCountProperty) + [23:46:24:32]:1: Getting property value for (RowCountProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(GridPatternIdentifiers.RowCountProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(GridPatternIdentifiers.RowCountProperty) + [23:46:24:32]:1: Getting property value for (ColumnProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(GridItemPatternIdentifiers.ColumnProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(GridItemPatternIdentifiers.ColumnProperty) + [23:46:24:32]:1: Getting property value for (ColumnSpanProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(GridItemPatternIdentifiers.ColumnSpanProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(GridItemPatternIdentifiers.ColumnSpanProperty) + [23:46:24:32]:1: Getting property value for (ContainingGridProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(GridItemPatternIdentifiers.ContainingGridProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(GridItemPatternIdentifiers.ContainingGridProperty) + [23:46:24:32]:1: Getting property value for (RowProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(GridItemPatternIdentifiers.RowProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(GridItemPatternIdentifiers.RowProperty) + [23:46:24:32]:1: Getting property value for (RowSpanProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(GridItemPatternIdentifiers.RowSpanProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(GridItemPatternIdentifiers.RowSpanProperty) + [23:46:24:32]:1: Getting property value for (ChildIdProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.ChildIdProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.ChildIdProperty) + [23:46:24:32]:1: Getting property value for (NameProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.NameProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.NameProperty) + [23:46:24:32]:1: Getting property value for (ValueProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.ValueProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.ValueProperty) + [23:46:24:32]:1: Getting property value for (DescriptionProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.DescriptionProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.DescriptionProperty) + [23:46:24:32]:1: Getting property value for (RoleProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.RoleProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.RoleProperty) + [23:46:24:32]:1: Getting property value for (StateProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.StateProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.StateProperty) + [23:46:24:32]:1: Getting property value for (HelpProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.HelpProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.HelpProperty) + [23:46:24:32]:1: Getting property value for (KeyboardShortcutProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.KeyboardShortcutProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.KeyboardShortcutProperty) + [23:46:24:32]:1: Getting property value for (SelectionProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.SelectionProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.SelectionProperty) + [23:46:24:32]:1: Getting property value for (DefaultActionProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.DefaultActionProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(LegacyIAccessiblePatternIdentifiers.DefaultActionProperty) + [23:46:24:32]:1: Getting property value for (CurrentViewProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(MultipleViewPatternIdentifiers.CurrentViewProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(MultipleViewPatternIdentifiers.CurrentViewProperty) + [23:46:24:32]:1: Getting property value for (SupportedViewsProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(MultipleViewPatternIdentifiers.SupportedViewsProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(MultipleViewPatternIdentifiers.SupportedViewsProperty) + [23:46:24:32]:1: Getting property value for (HorizontallyScrollableProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(ScrollPatternIdentifiers.HorizontallyScrollableProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(ScrollPatternIdentifiers.HorizontallyScrollableProperty) + [23:46:24:32]:1: Getting property value for (HorizontalScrollPercentProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(ScrollPatternIdentifiers.HorizontalScrollPercentProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(ScrollPatternIdentifiers.HorizontalScrollPercentProperty) + [23:46:24:32]:1: Getting property value for (HorizontalViewSizeProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(ScrollPatternIdentifiers.HorizontalViewSizeProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(ScrollPatternIdentifiers.HorizontalViewSizeProperty) + [23:46:24:32]:1: Getting property value for (VerticallyScrollableProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(ScrollPatternIdentifiers.VerticallyScrollableProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(ScrollPatternIdentifiers.VerticallyScrollableProperty) + [23:46:24:32]:1: Getting property value for (VerticalScrollPercentProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(ScrollPatternIdentifiers.VerticalScrollPercentProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(ScrollPatternIdentifiers.VerticalScrollPercentProperty) + [23:46:24:32]:1: Getting property value for (VerticalViewSizeProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(ScrollPatternIdentifiers.VerticalViewSizeProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(ScrollPatternIdentifiers.VerticalViewSizeProperty) + [23:46:24:32]:1: Getting property value for (CanSelectMultipleProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(SelectionPatternIdentifiers.CanSelectMultipleProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(SelectionPatternIdentifiers.CanSelectMultipleProperty) + [23:46:24:32]:1: Getting property value for (IsSelectionRequiredProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(SelectionPatternIdentifiers.IsSelectionRequiredProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(SelectionPatternIdentifiers.IsSelectionRequiredProperty) + [23:46:24:32]:1: Getting property value for (SelectionProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(SelectionPatternIdentifiers.SelectionProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(SelectionPatternIdentifiers.SelectionProperty) + [23:46:24:32]:1: Getting property value for (IsSelectedProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(SelectionItemPatternIdentifiers.IsSelectedProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(SelectionItemPatternIdentifiers.IsSelectedProperty) + [23:46:24:32]:1: Getting property value for (SelectionContainerProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(SelectionItemPatternIdentifiers.SelectionContainerProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(SelectionItemPatternIdentifiers.SelectionContainerProperty) + [23:46:24:32]:1: Getting property value for (FormulaProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(SpreadsheetItemPatternIdentifiers.FormulaProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(SpreadsheetItemPatternIdentifiers.FormulaProperty) + [23:46:24:32]:1: Getting property value for (AnnotationObjectsProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(SpreadsheetItemPatternIdentifiers.AnnotationObjectsProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(SpreadsheetItemPatternIdentifiers.AnnotationObjectsProperty) + [23:46:24:32]:1: Getting property value for (AnnotationTypesProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(SpreadsheetItemPatternIdentifiers.AnnotationTypesProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(SpreadsheetItemPatternIdentifiers.AnnotationTypesProperty) + [23:46:24:32]:1: Getting property value for (StyleIdProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(StylesPatternIdentifiers.StyleIdProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(StylesPatternIdentifiers.StyleIdProperty) + [23:46:24:32]:1: Getting property value for (StyleNameProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(StylesPatternIdentifiers.StyleNameProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(StylesPatternIdentifiers.StyleNameProperty) + [23:46:24:32]:1: Getting property value for (FillColorProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(StylesPatternIdentifiers.FillColorProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(StylesPatternIdentifiers.FillColorProperty) + [23:46:24:32]:1: Getting property value for (FillPatternStyleProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(StylesPatternIdentifiers.FillPatternStyleProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(StylesPatternIdentifiers.FillPatternStyleProperty) + [23:46:24:32]:1: Getting property value for (ShapeProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(StylesPatternIdentifiers.ShapeProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(StylesPatternIdentifiers.ShapeProperty) + [23:46:24:32]:1: Getting property value for (FillPatternColorProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(StylesPatternIdentifiers.FillPatternColorProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(StylesPatternIdentifiers.FillPatternColorProperty) + [23:46:24:32]:1: Getting property value for (ExtendedPropertiesProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(StylesPatternIdentifiers.ExtendedPropertiesProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(StylesPatternIdentifiers.ExtendedPropertiesProperty) + [23:46:24:32]:1: Getting property value for (ToggleStateProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(TogglePatternIdentifiers.ToggleStateProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(TogglePatternIdentifiers.ToggleStateProperty) + [23:46:24:32]:1: Getting property value for (CanMoveProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(TransformPatternIdentifiers.CanMoveProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(TransformPatternIdentifiers.CanMoveProperty) + [23:46:24:32]:1: Getting property value for (CanResizeProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(TransformPatternIdentifiers.CanResizeProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(TransformPatternIdentifiers.CanResizeProperty) + [23:46:24:32]:1: Getting property value for (CanRotateProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(TransformPatternIdentifiers.CanRotateProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(TransformPatternIdentifiers.CanRotateProperty) + [23:46:24:32]:1: Getting property value for (IsReadOnlyProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(RangeValuePatternIdentifiers.IsReadOnlyProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(RangeValuePatternIdentifiers.IsReadOnlyProperty) + [23:46:24:32]:1: Getting property value for (LargeChangeProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(RangeValuePatternIdentifiers.LargeChangeProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(RangeValuePatternIdentifiers.LargeChangeProperty) + [23:46:24:32]:1: Getting property value for (MaximumProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(RangeValuePatternIdentifiers.MaximumProperty) + [23:46:24:32]:1: Obtained GetCurrentPropertyValue(RangeValuePatternIdentifiers.MaximumProperty) + [23:46:24:32]:1: Getting property value for (MinimumProperty) + [23:46:24:32]:1: Calling GetCurrentPropertyValue(RangeValuePatternIdentifiers.MinimumProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(RangeValuePatternIdentifiers.MinimumProperty) + [23:46:24:34]:1: Getting property value for (SmallChangeProperty) + [23:46:24:34]:1: Calling GetCurrentPropertyValue(RangeValuePatternIdentifiers.SmallChangeProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(RangeValuePatternIdentifiers.SmallChangeProperty) + [23:46:24:34]:1: Getting property value for (ValueProperty) + [23:46:24:34]:1: Calling GetCurrentPropertyValue(RangeValuePatternIdentifiers.ValueProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(RangeValuePatternIdentifiers.ValueProperty) + [23:46:24:34]:1: Getting property value for (IsReadOnlyProperty) + [23:46:24:34]:1: Calling GetCurrentPropertyValue(ValuePatternIdentifiers.IsReadOnlyProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(ValuePatternIdentifiers.IsReadOnlyProperty) + [23:46:24:34]:1: Getting property value for (ValueProperty) + [23:46:24:34]:1: Calling GetCurrentPropertyValue(ValuePatternIdentifiers.ValueProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(ValuePatternIdentifiers.ValueProperty) + [23:46:24:34]:1: Getting property value for (CanMaximizeProperty) + [23:46:24:34]:1: Calling GetCurrentPropertyValue(WindowPatternIdentifiers.CanMaximizeProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(WindowPatternIdentifiers.CanMaximizeProperty) + [23:46:24:34]:1: Getting property value for (CanMinimizeProperty) + [23:46:24:34]:1: Calling GetCurrentPropertyValue(WindowPatternIdentifiers.CanMinimizeProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(WindowPatternIdentifiers.CanMinimizeProperty) + [23:46:24:34]:1: Getting property value for (IsModalProperty) + [23:46:24:34]:1: Calling GetCurrentPropertyValue(WindowPatternIdentifiers.IsModalProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(WindowPatternIdentifiers.IsModalProperty) + [23:46:24:34]:1: Getting property value for (IsTopmostProperty) + [23:46:24:34]:1: Calling GetCurrentPropertyValue(WindowPatternIdentifiers.IsTopmostProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(WindowPatternIdentifiers.IsTopmostProperty) + [23:46:24:34]:1: Getting property value for (WindowInteractionStateProperty) + [23:46:24:34]:1: Calling GetCurrentPropertyValue(WindowPatternIdentifiers.WindowInteractionStateProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(WindowPatternIdentifiers.WindowInteractionStateProperty) + [23:46:24:34]:1: Getting property value for (WindowVisualStateProperty) + [23:46:24:34]:1: Calling GetCurrentPropertyValue(WindowPatternIdentifiers.WindowVisualStateProperty) + [23:46:24:34]:1: Obtained GetCurrentPropertyValue(WindowPatternIdentifiers.WindowVisualStateProperty) + [23:46:24:34]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:SetFocus.4 + Verify that if IsKeyboardFocusableProperty = true, calling SetFocus() should not throw an exception. If IsKeyboardFocusableProperty = false, then SetFocus() should throw InvalidOperationException + Pri3 + Works + Microsoft Corp. + Generic + Precondition: Verify that this control supports SetFocus tests, some controls such as MenuItem's do not support SetFocus() + If IsKeyboardFocusableProperty == true, SetFocus() should not throw an exception, else it should throw InvalidOperationException + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.AutomationElementTests + TestSetFocus4 + + + + + + + + + + + [23:46:24:37]:1: IsKeyboardFocusableProperty("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) = True + [23:46:24:37]:1: Setting focus to "Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:46:24:38]:1: Calling SetFocus("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:24:54]: EVENTS: FIRED!! EVENT[0/1]("Button" "Cancel" "btnCancel" )...INFO(AutomationElementIdentifiers.AutomationFocusChangedEvent) Control Path = <ControlType><AutomationElement><NameProperty>Visual UI Automation Verify : Client Side Provider</NameProperty><ControlType>ControlType.Window</ControlType><AutomationId>MainWindow</AutomationId><Classname>WindowsForms10.Window.8.app.0.141b42a_r6_ad1</Classname><AutomationElement><NameProperty>Tests running</NameProperty><ControlType>ControlType.Window</ControlType><AutomationId>RunningTestsWindow</AutomationId><Classname>WindowsForms10.Window.8.app.0.141b42a_r6_ad1</Classname><AutomationElement><NameProperty>Cancel</NameProperty><ControlType>ControlType.Button</ControlType><AutomationId>btnCancel</AutomationId><Classname>WindowsForms10.BUTTON.app.0.141b42a_r6_ad1</Classname></AutomationElement></AutomationElement></AutomationElement></ControlType> + [23:46:25:39]:1: Successfully called SetFocus() without an exception thrown + [23:46:25:39]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:BulkAdd.1 + Add many items and verify that ChildrenBulkAdded is fired + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Determine if the application supports the custom interface callback for specific test applications + Precondition: Determine is this appliction supports driving structure changes + Precondition: Determine if the specific element supports structure change + Step: Add LogicalTreeStructureListener + Step: Bulk add elements, causing a StructureChangeType.ChildrenBulkAdded to occur + Step: Wait for the LogicalStructureChangedEvent to be fired + Step: That LogicalStructureChangedEvent was fired + Step: Reset the control to it's initial state + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + InternalHelper.Tests.ControlObject + TestBulkAdd + + + + + + + + + + + [23:46:25:45]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:BulkRemove.1 + Remove many items and verify that ChildrenBulkRemoved is fired + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Determine if the application supports the custom interface callback for specific test applications + Precondition: Determine is this appliction supports driving structure changes + Precondition: Determine if the specific element supports structure change + Step: Add LogicalTreeStructureListener + Step: Bulk remove elements, causing a StructureChangeType.ChildrenBulkRemoved to occur + Step: Wait for the LogicalStructureChangedEvent to be fired + Step: That LogicalStructureChangedEvent was fired + Step: Reset the control to it's initial state + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + InternalHelper.Tests.ControlObject + TestBulkRemove + + + + + + + + + + + [23:46:25:50]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:ChildAdd.1 + Add an item and verify that ChildAdded is fired + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Determine if the application supports the custom interface callback for specific test applications + Precondition: Determine is this appliction supports driving structure changes + Precondition: Determine if the specific element supports structure change + Step: Add LogicalTreeStructureListener + Step: Add element, causing a StructureChangeType.ChildAdded to occur + Step: Wait for the LogicalStructureChangedEvent to be fired + Step: That LogicalStructureChangedEvent was fired + Step: Reset the control to it's initial state + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + InternalHelper.Tests.ControlObject + TestChildAdd + + + + + + + + + + + [23:46:25:54]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:ChildRemove.1 + Remove an item and verify that ChildRemoved is fired + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Determine if the application supports the custom interface callback for specific test applications + Precondition: Determine is this appliction supports driving structure changes + Precondition: Determine if the specific element supports structure change + Step: Add LogicalTreeStructureListener + Step: Remove an element, causing a StructureChangeType.ChildRemoved to occur + Step: Wait for the LogicalStructureChangedEvent to be fired + Step: That LogicalStructureChangedEvent was fired + Step: Reset the control to it's initial state + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + InternalHelper.Tests.ControlObject + TestChildRemove + + + + + + + + + + + [23:46:25:57]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Invalidate.1 + Invalidate the combo box and verify that ChildrenInvalidated is fired + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Determine if the application supports the custom interface callback for specific test applications + Precondition: Determine is this appliction supports driving structure changes + Precondition: Determine if the specific element supports structure change + Step: Add LogicalTreeStructureListener + Step: Invalidate the elements, causing a StructureChangeType.ChildrenInvalidated to occur + Step: Wait for the LogicalStructureChangedEvent to be fired + Step: That LogicalStructureChangedEvent was fired + Step: Reset the control to it's initial state + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + InternalHelper.Tests.ControlObject + TestInvalidate + + + + + + + + + + + [23:46:25:60]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Reorder.1 + Remove the items and verify that ChildrenReordered is fired + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Determine if the application supports the custom interface callback for specific test applications + Precondition: Determine is this appliction supports driving structure changes + Precondition: Determine if the specific element supports structure change + Step: Add LogicalTreeStructureListener + Step: Reorder the elements, causing a StructureChangeType.ChildrenReordered to occur + Step: Wait for the LogicalStructureChangedEvent to be fired + Step: That LogicalStructureChangedEvent was fired + Step: Reset the control to it's initial state + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + InternalHelper.Tests.ControlObject + TestReorder + + + + + + + + + + + [23:46:25:65]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:TestContentView + + Pri2 + Works + Microsoft Corp. + Generic + Test the control's Content View + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + InternalHelper.Tests.ControlObject + TestContentView + + + + + + + + + + + [23:46:25:69]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:TestControlPatterns + + Pri2 + Works + Microsoft Corp. + Generic + Test the control's patterns + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + InternalHelper.Tests.ControlObject + TestControlPatterns + + + + + + + + + + + [23:46:25:72]:0: Found the following pattern(s) implemented on the control: + [23:46:25:72]:0: -WindowPattern + [23:46:25:72]:0: -TransformPattern + [23:46:25:72]:0: -LegacyIAccessiblePattern + [23:46:25:72]:0: Control is required to support the following patterns: + [23:46:25:72]:0: -TransformPattern + [23:46:25:72]:0: -WindowPattern + [23:46:25:72]:0: Control can optionally support the following patterns: + [23:46:25:72]:0: -DockPattern + [23:46:25:72]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:TestControlProperties + + Pri2 + Works + Microsoft Corp. + Generic + Test the control's properties + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + InternalHelper.Tests.ControlObject + TestControlProperties + + + + + + + + + + + [23:46:25:75]:0: Validating ControlType.Window.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty)=System.Windows.Automation.ControlType + [23:46:25:75]:0: Node validation is !NULL + [23:46:25:75]:0: Validating ControlType.Window.GetCurrentPropertyValue(AutomationElement.IsContentElementProperty)=True + [23:46:25:75]:0: Node validation is T + [23:46:25:75]:0: Validating ControlType.Window.GetCurrentPropertyValue(AutomationElement.IsControlElementProperty)=True + [23:46:25:75]:0: Node validation is T + [23:46:25:77]:0: Validating ControlType.Window.GetCurrentPropertyValue(AutomationElement.IsTransformPatternAvailableProperty)=True + [23:46:25:77]:0: Node validation is T + [23:46:25:77]:0: Validating ControlType.Window.GetCurrentPropertyValue(AutomationElement.IsWindowPatternAvailableProperty)=True + [23:46:25:77]:0: Node validation is T + [23:46:25:77]:0: Validating ControlType.Window.GetCurrentPropertyValue(AutomationElement.LabeledByProperty)= + [23:46:25:77]:0: Node validation is NULL + [23:46:25:77]:0: Validating ControlType.Window.GetCurrentPropertyValue(AutomationElement.LocalizedControlTypeProperty)=window + [23:46:25:77]:0: Node validation is S + [23:46:25:77]:0: Validating ControlType.Window.GetCurrentPropertyValue(AutomationElement.NameProperty)=maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt + [23:46:25:77]:0: Node validation is R + [23:46:25:77]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:TestControlView + + Pri2 + Works + Microsoft Corp. + Generic + Test the control's Control View + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + InternalHelper.Tests.ControlObject + TestControlView + + + + + + + + + + + [23:46:25:82]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:CanRotate.1.6 + If an element can rotate, call Transform.Rotate and verify that the BoundingRect property change event was fired + Pri0 + Works + Microsoft Corp. + Generic, Events + Precondition: TransformPattern.CanRotate == true + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Rotate with the random degree is called successfully + Verify: The BoundingRectangle PropertyChange event is fired + Step: Move the element back to it's orginal location + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + CanRotate16 + + + + + + + + + + + [23:46:25:85]:0: Verify that TransformPatternIdentifiers.CanRotateProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:25:87]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Move.2.1 + Move the element to position (0,0) which is not the current location + Pri0 + Works + Microsoft Corp. + Generic, Events + Precondition: TransformPattern.CanMove == true + Precondition: If the element is at position (0,0), then move it to (10,10) + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Move(0,0) is called successfully + Step: Wait for event to occur + Verify: The BoundingRectangle PropertyChange event is fired + Verify: Element's BoundingRectangle is correct + Step: Move the window back to it's original position + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + Move21 + + + + + + + + + + + [23:46:25:90]:0: Verify that TransformPatternIdentifiers.CanMoveProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:25:92]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property TransformPatternIdentifiers.CanMoveProperty is True + [23:46:25:92]:1: Element is not at position (0,0) + [23:46:25:92]:2: Adding PropertyChangedListener ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:46:25:92]: EVENTS: Adding AddAutomationPropertyChangedEventHandler("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" , TreeScope.Element, [AutomationElementIdentifiers.BoundingRectangleProperty]) ControlPath = <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></ControlType> + [23:46:25:92]:3: Calling TransformPattern.Move(0, 0) + [23:46:25:92]:3: Successfully called TransformPattern.Move(0, 0) without an exception thrown + [23:46:25:92]:4: Waiting for 2 event(s) + [23:46:25:92]: EVENTS: Waiting for a period of 4000 milliseconds for no events to occur + [23:46:25:92]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:25:92]: EVENTS: FIRED!! EVENT[0/1]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[0,0,1327,752] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></ControlType> + [23:46:25:94]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:25:94]: EVENTS: FIRED!! EVENT[1/2]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></ControlType> + [23:46:29:95]: EVENTS: Stop waiting for events. Found 2 event(s) + [23:46:29:95]:4: End waiting for events + [23:46:29:95]:5: Verifying property change "AutomationElementIdentifiers.BoundingRectangleProperty" event firing was True) + [23:46:29:95]:5: Start: Looking for event that might have been fired + [23:46:29:95]: EVENTS: 2 was/were fired + [23:46:29:96]: EVENTS: AutomationElementIdentifiers.BoundingRectangleProperty was fired on ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:29:96]:5: End : Looking for event that might have been fired + [23:46:29:96]:5: AutomationElementIdentifiers.BoundingRectangleProperty change event did get fired and was expected to be fired + [23:46:29:96]:7: Moving element back to it's original position + [23:46:29:96]:7: Calling TransformPattern.Move(95, 50) + [23:46:29:98]:7: Successfully called TransformPattern.Move(95, 50) without an exception thrown + [23:46:29:98]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Move.2.2 + Move the element to a random location on the desktop + Pri0 + Works + Microsoft Corp. + Generic, Events + Step: Obtain a random point on the desktop + Precondition: TransformPattern.CanMove == true + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Move() with the random point is called successfully + Step: Wait for event to get fired + Verify: The BoundingRectangle PropertyChange event is fired + Verify: Element was moved to the correct position by validating the BoundingRectangle + Step: Move the window back to it's original position + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + Move22 + + + + + + + + + + + [23:46:30:34]:0: Selection screen[0].WorkingArea = [X=0,Y=0,Width=1536,Height=824] + [23:46:30:34]:0: Random screen location = 1449,498 + [23:46:30:34]:1: Verify that TransformPatternIdentifiers.CanMoveProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:30:34]:1: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property TransformPatternIdentifiers.CanMoveProperty is True + [23:46:30:34]:2: Adding PropertyChangedListener ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:46:30:34]: EVENTS: Adding AddAutomationPropertyChangedEventHandler("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" , TreeScope.Element, [AutomationElementIdentifiers.BoundingRectangleProperty]) ControlPath = <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></ControlType> + [23:46:30:50]:3: Calling TransformPattern.Move(1449, 498) + [23:46:30:50]:3: Successfully called TransformPattern.Move(1449, 498) without an exception thrown + [23:46:30:50]:4: Waiting for 2 event(s) + [23:46:30:50]: EVENTS: Waiting for a period of 4000 milliseconds for no events to occur + [23:46:30:65]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:30:65]: EVENTS: FIRED!! EVENT[0/1]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[1449,498,1327,752] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></ControlType> + [23:46:30:65]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:30:65]: EVENTS: FIRED!! EVENT[1/2]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></ControlType> + [23:46:34:69]: EVENTS: Stop waiting for events. Found 2 event(s) + [23:46:34:69]:4: End waiting for events + [23:46:34:69]:5: Verifying property change "AutomationElementIdentifiers.BoundingRectangleProperty" event firing was True) + [23:46:34:69]:5: Start: Looking for event that might have been fired + [23:46:34:69]: EVENTS: 2 was/were fired + [23:46:34:84]: EVENTS: AutomationElementIdentifiers.BoundingRectangleProperty was fired on ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:34:84]:5: End : Looking for event that might have been fired + [23:46:34:84]:5: AutomationElementIdentifiers.BoundingRectangleProperty change event did get fired and was expected to be fired + [23:46:34:84]:7: Moving window back to it's original position + [23:46:34:84]:7: Calling TransformPattern.Move(95, 50) + [23:46:34:11]:7: Successfully called TransformPattern.Move(95, 50) without an exception thrown + [23:46:34:11]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Move.2.8 + Non-movable element, call Move and verify that it does not move + Pri0 + Works + Microsoft Corp. + Generic, Events + Precondition: Obtain a random position on the desktop + Precondition: TransformPattern.CanMove == false + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Move() with the random point throws InvalidOperationException + Step: Wait for event to get fired + Verify: The BoundingRectangle PropertyChange event is not fired + Verify: Element has not moved + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + Move28 + + + + + + + + + + + [23:46:34:16]:0: Selection screen[0].WorkingArea = [X=0,Y=0,Width=1536,Height=824] + [23:46:34:16]:0: Random screen location = 679,91 + [23:46:34:18]:1: Verify that TransformPatternIdentifiers.CanMoveProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns False + [23:46:34:18]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Move.2.13 + Element does not have the focus + Pri1 + Works + Microsoft Corp. + Generic, Events + Step: Obtain a random location on the screen other than current location + Step: Ensure the AutomationElement does not have focus by calling SetFocus(AutomationElement.RootElement.FirstChild) - OS's Start Button + Precondition: TransformPattern.CanMove == true + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Move() with the random point is called successfully + Step: Wait for event to get fired + Verify: The BoundingRectangle PropertyChange event is fired + Verify: Element has moved to the new location + Step: Move the element back to it's original position + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + Move213 + + + + + + + + + + + [23:46:34:21]:0: Selection screen[0].WorkingArea = [X=0,Y=0,Width=1536,Height=824] + [23:46:34:21]:0: Random screen location = 18,422 + [23:46:34:21]:1: Verify that TransformPatternIdentifiers.CanMoveProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:34:23]:1: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property TransformPatternIdentifiers.CanMoveProperty is True + [23:46:34:23]:2: Adding AutomationFocusChangedEventHandler + [23:46:34:43]:2: Calling SetFocus() on "Pane" "" "" + [23:46:34:43]:2: Wait 1 second for event to happen + [23:46:34:48]:2: Stopped waiting for event to happen + [23:46:34:48]:2: Calling RemoveAutomationFocusChangedEventHandler() + [23:46:34:50]:2: Called RemoveAutomationFocusChangedEventHandler() + [23:46:34:50]:2: History of events fired: + [23:46:34:50]:2: History of events fired: + [23:46:34:50]:3: Adding PropertyChangedListener ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:46:34:50]: EVENTS: Adding AddAutomationPropertyChangedEventHandler("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" , TreeScope.Element, [AutomationElementIdentifiers.BoundingRectangleProperty]) ControlPath = <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></ControlType> + [23:46:34:51]:4: Calling TransformPattern.Move(18, 422) + [23:46:34:53]:4: Successfully called TransformPattern.Move(18, 422) without an exception thrown + [23:46:34:53]:5: Waiting for 2 event(s) + [23:46:34:53]: EVENTS: Waiting for a period of 4000 milliseconds for no events to occur + [23:46:34:53]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:34:53]: EVENTS: FIRED!! EVENT[0/1]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[18,422,1327,752] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></ControlType> + [23:46:34:55]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:34:55]: EVENTS: FIRED!! EVENT[1/2]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></ControlType> + [23:46:38:56]: EVENTS: Stop waiting for events. Found 2 event(s) + [23:46:38:56]:5: End waiting for events + [23:46:38:56]:6: Verifying property change "AutomationElementIdentifiers.BoundingRectangleProperty" event firing was True) + [23:46:38:56]:6: Start: Looking for event that might have been fired + [23:46:38:56]: EVENTS: 2 was/were fired + [23:46:38:57]: EVENTS: AutomationElementIdentifiers.BoundingRectangleProperty was fired on ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:38:57]:6: End : Looking for event that might have been fired + [23:46:38:57]:6: AutomationElementIdentifiers.BoundingRectangleProperty change event did get fired and was expected to be fired + [23:46:38:57]:8: Moving window back to it's original position + [23:46:38:57]:8: Calling TransformPattern.Move(95, 50) + [23:46:38:59]:8: Successfully called TransformPattern.Move(95, 50) without an exception thrown + [23:46:38:59]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Move.2.17 + Move a minimized non-movable element(ie. window minimized to task bar) + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Verify that window supports minimizing + Step: Obtain a random location on the screen other than current location + Step: Miminimize the element + Verify: TransformPattern.CanMove == false + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Move() with the random point is called successfully + Step: Wait for event to get fired + Verify: The BoundingRectangle PropertyChange event is not fired + Verify: Element has not moved to the new location + Step: Move the element back to it's original position if previous steps failed + Step: Set the element's WindowVisualState back to it's original state + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + Move217 + + + + + + + + + + + [23:46:38:67]:0: Verify that WindowPatternIdentifiers.CanMinimizeProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:38:67]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property WindowPatternIdentifiers.CanMinimizeProperty is True + [23:46:38:67]:1: Selection screen[0].WorkingArea = [X=0,Y=0,Width=1536,Height=824] + [23:46:38:67]:1: Random screen location = 907,555 + [23:46:43:69]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Move.2.18 + Move a minimized movable element(ie. MDI window minimized) + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Verify that window supports minimizing + Step: Obtain a random location on the screen other than current location + Step: Miminimize the element + Verify: TransformPattern.CanMove == true + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Move() with the random point is called successfully + Step: Wait for event to get fired + Verify: The BoundingRectangle PropertyChange event is fired + Verify: Element has moved to the new location + Step: Move the element back to it's original position + Step: Set the element's WindowVisualState back to it's original state + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + Move218 + + + + + + + + + + + + + [23:46:43:76]:0: Verify that WindowPatternIdentifiers.CanMinimizeProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:43:76]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property WindowPatternIdentifiers.CanMinimizeProperty is True + [23:46:43:76]:1: Selection screen[0].WorkingArea = [X=0,Y=0,Width=1536,Height=824] + [23:46:43:76]:1: Random screen location = 184,527 + [23:46:48:79]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Move.2.19 + Element is maximized, and covers entire screen + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Verify that window supports maximizing + Precondition: Call WindowPattern.SetWindowVisualState(WindowVisualState.Maximize) + Verify: WindowVisualState = WindowVisualState.Maximize + Precondition: Element does cover enitire current screen + Verify: TransformPattern.CanMove == false + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Move() with the random point throws InvalidOperationException + Step: Wait for event to get fired + Verify: The BoundingRectangle PropertyChange event is not fired + Verify: Element has not moved + Step: Move the element back to it's original position + Step: Set the element's WindowVisualState back to it's original state + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + Move219 + + + + + + + + + + + + + [23:46:48:88]:0: Verify that WindowPatternIdentifiers.CanMaximizeProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:48:88]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property WindowPatternIdentifiers.CanMaximizeProperty is True + [23:46:49:95]:4: Verify that TransformPatternIdentifiers.CanMoveProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns False + [23:46:49:95]:4: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property TransformPatternIdentifiers.CanMoveProperty is False + [23:46:49:95]:5: Adding PropertyChangedListener ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:46:49:95]: EVENTS: Adding AddAutomationPropertyChangedEventHandler("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" , TreeScope.Element, [AutomationElementIdentifiers.BoundingRectangleProperty]) ControlPath = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:46:49:95]:6: Calling TransformPattern.Move(0, 0) + [23:46:49:95]:6: Successfully called TransformPattern.Move(0, 0) with exception thrown as expected + [23:46:49:95]:7: Waiting for 2 event(s) + [23:46:49:95]: EVENTS: Waiting for a period of 4000 milliseconds for no events to occur + [23:46:53:97]: EVENTS: Stop waiting for events. Found 0 event(s) + [23:46:53:97]:7: End waiting for events + [23:46:53:97]:8: Verifying property change "AutomationElementIdentifiers.BoundingRectangleProperty" event firing was False) + [23:46:53:97]:8: Start: Looking for event that might have been fired + [23:46:53:97]: EVENTS: 0 was/were fired + [23:46:53:97]: EVENTS: AutomationElementIdentifiers.BoundingRectangleProperty was not fired + [23:46:53:97]:8: End : Looking for event that might have been fired + [23:46:53:97]:8: AutomationElementIdentifiers.BoundingRectangleProperty event was not fired and was not expected to be fired + [23:46:53:98]:10: Moving window back to it's original position + [23:46:55:52]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Move.2.3 + Move the element to it's current location + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: TransformPattern.CanMove == true + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Move() with the current location is called successfully + Step: Wait for event to get fired + Verify: The BoundingRectangle PropertyChange event is not fired + Verify: Element was still at the current location + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + Move23 + + + + + + + + + + + + + [23:46:55:10]:0: Verify that TransformPatternIdentifiers.CanMoveProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:55:10]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property TransformPatternIdentifiers.CanMoveProperty is True + [23:46:55:10]:1: Adding PropertyChangedListener ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:46:55:12]: EVENTS: Adding AddAutomationPropertyChangedEventHandler("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" , TreeScope.Element, [AutomationElementIdentifiers.BoundingRectangleProperty]) ControlPath = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:46:55:12]:2: Calling TransformPattern.Move(95, 50) + [23:46:55:12]:2: Successfully called TransformPattern.Move(95, 50) without an exception thrown + [23:46:55:12]:3: Waiting for 2 event(s) + [23:46:55:12]: EVENTS: Waiting for a period of 4000 milliseconds for no events to occur + [23:46:59:12]: EVENTS: Stop waiting for events. Found 0 event(s) + [23:46:59:12]:3: End waiting for events + [23:46:59:12]:4: Verifying property change "AutomationElementIdentifiers.BoundingRectangleProperty" event firing was False) + [23:46:59:12]:4: Start: Looking for event that might have been fired + [23:46:59:12]: EVENTS: 0 was/were fired + [23:46:59:12]: EVENTS: AutomationElementIdentifiers.BoundingRectangleProperty was not fired + [23:46:59:12]:4: End : Looking for event that might have been fired + [23:46:59:12]:4: AutomationElementIdentifiers.BoundingRectangleProperty event was not fired and was not expected to be fired + [23:46:59:12]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Move.2.4 + Move to point where the element results in partially outside of screen and partially inside screen + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Obtain a position on the screen where the element will be partially off the parent's viewport + Precondition: TransformPattern.CanMove == true + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Move() with the the current locations is called successfully + Step: Wait for event to get fired + Verify: The BoundingRectangle PropertyChange event is fired + Verify: Element has moved to the desired location + Step: Move the element back to it's original position + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + Move24 + + + + + + + + + + + + + [23:46:59:19]:0: Element.BoundingRectangle = 95,50,1327,752 + [23:46:59:19]:0: Selection screen[0].WorkingArea = [X=0,Y=0,Width=1536,Height=824] + [23:46:59:19]:0: Found random location overlapping parent viewport : 394,146,1327,752 + [23:46:59:19]:1: Verify that TransformPatternIdentifiers.CanMoveProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:46:59:19]:1: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property TransformPatternIdentifiers.CanMoveProperty is True + [23:46:59:20]:2: Adding PropertyChangedListener ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:46:59:20]: EVENTS: Adding AddAutomationPropertyChangedEventHandler("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" , TreeScope.Element, [AutomationElementIdentifiers.BoundingRectangleProperty]) ControlPath = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:46:59:22]:3: Calling TransformPattern.Move(394, 146) + [23:46:59:22]:3: Successfully called TransformPattern.Move(394, 146) without an exception thrown + [23:46:59:22]:4: Waiting for 2 event(s) + [23:46:59:22]: EVENTS: Waiting for a period of 4000 milliseconds for no events to occur + [23:46:59:23]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:59:23]: EVENTS: FIRED!! EVENT[0/1]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[394,146,1327,752] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:46:59:23]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:46:59:23]: EVENTS: FIRED!! EVENT[1/2]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:47:03:25]: EVENTS: Stop waiting for events. Found 2 event(s) + [23:47:03:25]:4: End waiting for events + [23:47:03:25]:5: Verifying property change "AutomationElementIdentifiers.BoundingRectangleProperty" event firing was True) + [23:47:03:26]:5: Start: Looking for event that might have been fired + [23:47:03:26]: EVENTS: 2 was/were fired + [23:47:03:26]: EVENTS: AutomationElementIdentifiers.BoundingRectangleProperty was fired on ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:47:03:26]:5: End : Looking for event that might have been fired + [23:47:03:26]:5: AutomationElementIdentifiers.BoundingRectangleProperty change event did get fired and was expected to be fired + [23:47:03:26]:7: Moving window back to it's original position + [23:47:03:26]:7: Calling TransformPattern.Move(95, 50) + [23:47:03:29]:7: Successfully called TransformPattern.Move(95, 50) without an exception thrown + [23:47:03:29]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Move.2.5 + Move to point where the element is entirely outside of screen + Pri1 + Works + Microsoft Corp. + Generic, Events + Precondition: Obtain a random position where the element intirely off the screen + Precondition: TransformPattern.CanMove == true + Step: Setup a BoundingRectangle PropertyChange event + Step: Verify that Move() with the random point is called successfully + Step: Wait for event to get fired + Verify: The BoundingRectangle PropertyChange event is fired if the element is moved + Verify: Element is within the screen cordinates + Step: Move the element back to it's original position + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.TransformTests + Move25 + + + + + + + + + + + + + [23:47:03:36]:0: Element.BoundingRectangle = 95,50,1327,752 + [23:47:03:36]:0: Union of all screen working areas is = ([X=0,Y=0,Width=1536,Height=824]) + [23:47:03:36]:0: Random screen area returned is (-1238866913,2134134612,1327,752) + [23:47:03:36]:1: Verify that TransformPatternIdentifiers.CanMoveProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:47:03:37]:1: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property TransformPatternIdentifiers.CanMoveProperty is True + [23:47:03:37]:2: Adding PropertyChangedListener ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:47:03:37]: EVENTS: Adding AddAutomationPropertyChangedEventHandler("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" , TreeScope.Element, [AutomationElementIdentifiers.BoundingRectangleProperty]) ControlPath = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:47:03:37]:3: Calling TransformPattern.Move(-1238866913, 2134134612) + [23:47:03:39]:3: Successfully called TransformPattern.Move(-1238866913, 2134134612) without an exception thrown + [23:47:03:39]:4: Waiting for 2 event(s) + [23:47:03:39]: EVENTS: Waiting for a period of 4000 milliseconds for no events to occur + [23:47:03:42]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:47:03:42]: EVENTS: FIRED!! EVENT[0/1]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[0,72,1327,752] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:47:03:44]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:47:03:44]: EVENTS: FIRED!! EVENT[1/2]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:47:03:44]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:47:03:44]: EVENTS: FIRED!! EVENT[2/3]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(AutomationElementIdentifiers.BoundingRectangleProperty Property[System.Windows.Automation.AutomationProperty] NewValue[] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:47:07:44]: EVENTS: Stop waiting for events. Found 3 event(s) + [23:47:07:44]:4: End waiting for events + [23:47:07:44]:5: Verifying property change "AutomationElementIdentifiers.BoundingRectangleProperty" event firing was True) + [23:47:07:44]:5: Start: Looking for event that might have been fired + [23:47:07:44]: EVENTS: 3 was/were fired + [23:47:07:46]: EVENTS: AutomationElementIdentifiers.BoundingRectangleProperty was fired on ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:47:07:46]:5: End : Looking for event that might have been fired + [23:47:07:46]:5: AutomationElementIdentifiers.BoundingRectangleProperty change event did get fired and was expected to be fired + [23:47:07:46]:6: Verify element is withing working area + [23:47:07:46]:7: Moving window back to it's original position + [23:47:07:46]:7: Calling TransformPattern.Move(95, 50) + [23:47:07:46]:7: Successfully called TransformPattern.Move(95, 50) without an exception thrown + [23:47:07:46]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Window.MaximizableProperty.S.6.1 + + Pri1 + Works + Microsoft Corp. + Generic, Events + Verify that Current.CanMaximize is true + Verify that Current.CanMinimize is true + Step: Setup WindowPattern.WindowVisualStateProperty property change event listener + Step: Set WindowVisualState = WindowVisualState.Minimized + Wait for WindowVisualState(Minimized) event + Verify that Current.CanMaximize is true + Set the WindowVisualState = WindowVisualState.Maximized + Wait for WindowVisualState(Maximized) to fire + Verify: WindowPattern.WindowVisualStateProperty property change event was fired + Verify that the WindowVisualState = WindowVisualState.Maximized after setting the property + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.WindowTests + TestMaximizeS61 + + + + + + + + + + + + + [23:47:07:52]:0: Verify that WindowPatternIdentifiers.CanMaximizeProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:47:07:54]:0: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property WindowPatternIdentifiers.CanMaximizeProperty is True + [23:47:07:54]:1: Verify that WindowPatternIdentifiers.CanMinimizeProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:47:07:54]:1: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property WindowPatternIdentifiers.CanMinimizeProperty is True + [23:47:07:54]:2: Adding PropertyChangedListener ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" + [23:47:07:54]: EVENTS: Adding AddAutomationPropertyChangedEventHandler("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" , TreeScope.Element, [WindowPatternIdentifiers.WindowVisualStateProperty]) ControlPath = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:47:07:54]:3: Successfully called SetWindowVisualState(Minimized) without an exception thrown + [23:47:07:54]:4: Waiting for 1 event(s) + [23:47:07:54]: EVENTS: Waiting for a period of 2000 milliseconds for no events to occur + [23:47:09:54]: EVENTS: Stop waiting for events. Found 0 event(s) + [23:47:09:54]:4: End waiting for events + [23:47:09:54]:5: Purging stored test event queue + [23:47:09:54]: EVENTS: Clearing 0 items from the queue + [23:47:09:54]:5: Done purging stored test event queue + [23:47:09:54]:5: Verify that WindowPatternIdentifiers.CanMaximizeProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:47:09:54]:5: Element("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )'s property WindowPatternIdentifiers.CanMaximizeProperty is True + [23:47:09:54]:6: Successfully called SetWindowVisualState(Maximized) without an exception thrown + [23:47:09:54]:7: Waiting for 1 event(s) + [23:47:09:54]: EVENTS: Waiting for a period of 2000 milliseconds for no events to occur + [23:47:10:57]: EVENTS: Got event on...("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:47:10:57]: EVENTS: FIRED!! EVENT[0/1]("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" )...INFO(WindowPatternIdentifiers.WindowVisualStateProperty Property[System.Windows.Automation.AutomationProperty] NewValue[Maximized] OldValue[]) Control Path = <ControlType><AutomationElement><NameProperty>Pascal_maXbox</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TApplication</Classname><AutomationElement><NameProperty>maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt</NameProperty><ControlType>ControlType.Window</ControlType><Classname>TMaxForm1</Classname></AutomationElement></AutomationElement></ControlType> + [23:47:12:59]: EVENTS: Stop waiting for events. Found 1 event(s) + [23:47:12:59]:7: End waiting for events + [23:47:12:59]:8: Verifying property change "WindowPatternIdentifiers.WindowVisualStateProperty" event firing was True) + [23:47:12:59]:8: Start: Looking for event that might have been fired + [23:47:12:59]: EVENTS: 1 was/were fired + [23:47:12:60]: EVENTS: WindowPatternIdentifiers.WindowVisualStateProperty was fired on ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) + [23:47:12:60]:8: End : Looking for event that might have been fired + [23:47:12:60]:8: WindowPatternIdentifiers.WindowVisualStateProperty change event did get fired and was expected to be fired + [23:47:12:60]:9: WindowVisualState = ReadyForUserInteraction + [23:47:12:60]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Window.MaximizableProperty.S.6.2 + + Pri1 + Works + Microsoft Corp. + Generic + Precondition: Maximizable property is false + Verify that setting the VisualState property to WindowVisualState.Maximizable returns false + Verify that the WindowVisualState is not WindowVisualState.Maximizable after setting the property + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.WindowTests + TestMaximizeS62 + + + + + + + + + + + + + [23:47:12:67]:0: Verify that WindowPatternIdentifiers.CanMaximizeProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns False + [23:47:12:67]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Window.MinimizableProperty.S.7.2 + + Pri1 + Works + Microsoft Corp. + Generic + Precondition: Minimizable property is false + Verify that you cannot set the VisualState property to WindowVisualState.Minimized and that SetVisualStats returns false + Verify that the WindowVisualState is not WindowVisualState.MinimizableProperty after setting the VisualState property + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.WindowTests + TestMinimizePropertyS72 + + + + + + + + + + + + + [23:47:12:72]:0: Verify that WindowPatternIdentifiers.CanMinimizeProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns False + [23:47:12:72]: EVENTS: RemoveAllEvents + + + + + + ControlType.Window:Window.ModalProperty.S.10.1 + + Pri1 + Works + Microsoft Corp. + Generic + Precondition: Modal property is true + + WUIATestLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null + Microsoft.Test.UIAutomation.Tests.Patterns.WindowTests + TestWindowModalS101 + + + + + + + + + + + + + [23:47:12:77]:0: Verify that WindowPatternIdentifiers.IsModalProperty for element ("Window" "maXbox4 ScriptStudio 256_findfunctions4_of_EXE_80_1.txt" "" ) does returns True + [23:47:12:79]: EVENTS: RemoveAllEvents + + + + + + Configuration + + Pri0 + Works + Microsoft Corp. + Generic + This test logs Machine Configuration + + + + + + + + + WORKGROUP + Max + MAXBOX10 + false + 96 + 96 + + + 0 + 0 + + + 1536 + 864 + + 0 + 0 + 1536 + 864 + + + + 0 + 0 + + + 1536 + 864 + + 0 + 0 + 1536 + 864 + + true + false + false + MSX + NormalColor + + + Aero style + true + true + + true + + + + + + + + \ No newline at end of file diff --git a/Tutorials/maXbox_starter86_Intro2P4D_wordpress.pdf b/Tutorials/maXbox_starter86_Intro2P4D_wordpress.pdf new file mode 100644 index 00000000..efd3ef0d Binary files /dev/null and b/Tutorials/maXbox_starter86_Intro2P4D_wordpress.pdf differ diff --git a/Tutorials/maXbox_starter86_Introduction2P4D.pdf b/Tutorials/maXbox_starter86_Introduction2P4D.pdf new file mode 100644 index 00000000..ca6c46b8 Binary files /dev/null and b/Tutorials/maXbox_starter86_Introduction2P4D.pdf differ diff --git a/Tutorials/maxbox_starter85signed.pdf b/Tutorials/maxbox_starter85signed.pdf new file mode 100644 index 00000000..79b69f90 Binary files /dev/null and b/Tutorials/maxbox_starter85signed.pdf differ diff --git a/Tutorials/maxbox_starter86_1.pdf b/Tutorials/maxbox_starter86_1.pdf new file mode 100644 index 00000000..f16fbbe9 Binary files /dev/null and b/Tutorials/maxbox_starter86_1.pdf differ diff --git a/Tutorials/maxbox_starter86_2.pdf b/Tutorials/maxbox_starter86_2.pdf new file mode 100644 index 00000000..8046a445 Binary files /dev/null and b/Tutorials/maxbox_starter86_2.pdf differ diff --git a/Tutorials/maxbox_starter86_2_P4D.pdf b/Tutorials/maxbox_starter86_2_P4D.pdf new file mode 100644 index 00000000..b191f7e0 Binary files /dev/null and b/Tutorials/maxbox_starter86_2_P4D.pdf differ diff --git a/Tutorials/maxbox_starter86_3.pdf b/Tutorials/maxbox_starter86_3.pdf new file mode 100644 index 00000000..9ec650b1 Binary files /dev/null and b/Tutorials/maxbox_starter86_3.pdf differ diff --git a/Tutorials/maxbox_starter86_4.pdf b/Tutorials/maxbox_starter86_4.pdf new file mode 100644 index 00000000..0558b9bc Binary files /dev/null and b/Tutorials/maxbox_starter86_4.pdf differ diff --git a/Tutorials/maxbox_starter86_germany.pdf b/Tutorials/maxbox_starter86_germany.pdf new file mode 100644 index 00000000..f105f2e1 Binary files /dev/null and b/Tutorials/maxbox_starter86_germany.pdf differ diff --git a/Tutorials/maxbox_starter87_bpmagazine99_100_ml_with_lazarus.pdf b/Tutorials/maxbox_starter87_bpmagazine99_100_ml_with_lazarus.pdf new file mode 100644 index 00000000..fa92e9c3 Binary files /dev/null and b/Tutorials/maxbox_starter87_bpmagazine99_100_ml_with_lazarus.pdf differ diff --git a/Tutorials/maxboxpython47580.png b/Tutorials/maxboxpython47580.png new file mode 100644 index 00000000..e76a1b67 Binary files /dev/null and b/Tutorials/maxboxpython47580.png differ diff --git a/Tutorials/maxboxpython47580_git.png b/Tutorials/maxboxpython47580_git.png new file mode 100644 index 00000000..9339fba1 Binary files /dev/null and b/Tutorials/maxboxpython47580_git.png differ diff --git a/super_resolution_train_max.ipynb b/super_resolution_train_max.ipynb new file mode 100644 index 00000000..ba4c4d1c --- /dev/null +++ b/super_resolution_train_max.ipynb @@ -0,0 +1,4203 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "vnHO0dWgtXDS" + }, + "outputs": [], + "source": [ + "has_plant_leaf_disease = False\n", + "has_tiny_imagenet_200 = False\n", + "has_cifar_10 = True" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "soFlxRB4tXDZ", + "outputId": "5be3fccd-96a8-4a22-9852-42f4bdec0320" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\r0% [Working]\r \rGet:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]\n", + "\r0% [Connecting to archive.ubuntu.com (91.189.91.39)] [1 InRelease 14.2 kB/88.7 \r \rGet:2 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic InRelease [15.9 kB]\n", + "\r0% [Connecting to archive.ubuntu.com (91.189.91.39)] [1 InRelease 14.2 kB/88.7 \r0% [Connecting to archive.ubuntu.com (91.189.91.39)] [1 InRelease 88.7 kB/88.7 \r \rGet:3 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ InRelease [3,626 B]\n", + "\r \rHit:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease\n", + "\r0% [Connecting to archive.ubuntu.com (91.189.91.39)] [Waiting for headers] [Wai\r0% [2 InRelease gpgv 15.9 kB] [Connecting to archive.ubuntu.com (91.189.91.39)]\r \rHit:5 http://ppa.launchpad.net/cran/libgit2/ubuntu bionic InRelease\n", + "\r0% [2 InRelease gpgv 15.9 kB] [Connecting to archive.ubuntu.com (91.189.91.39)]\r \rHit:6 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease\n", + "\r0% [2 InRelease gpgv 15.9 kB] [Connecting to archive.ubuntu.com (91.189.91.39)]\r \rGet:7 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease [21.3 kB]\n", + "Hit:8 http://archive.ubuntu.com/ubuntu bionic InRelease\n", + "Get:9 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]\n", + "Ign:10 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 InRelease\n", + "Hit:11 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 Release\n", + "Get:12 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic/main Sources [2,054 kB]\n", + "Get:13 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic/main amd64 Packages [1,052 kB]\n", + "Get:14 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]\n", + "Get:15 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1,521 kB]\n", + "Get:16 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [22.8 kB]\n", + "Get:17 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [1,013 kB]\n", + "Get:18 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [2,866 kB]\n", + "Get:19 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main amd64 Packages [47.8 kB]\n", + "Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [1,047 kB]\n", + "Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [29.8 kB]\n", + "Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2,297 kB]\n", + "Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [3,298 kB]\n", + "Get:25 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [12.2 kB]\n", + "Fetched 15.6 MB in 4s (4,230 kB/s)\n", + "Reading package lists... Done\n", + "Reading package lists... Done\n", + "Building dependency tree \n", + "Reading state information... Done\n", + "zip is already the newest version (3.0-11build1).\n", + "git is already the newest version (1:2.17.1-1ubuntu0.11).\n", + "unzip is already the newest version (6.0-21ubuntu1.1).\n", + "The following package was automatically installed and is no longer required:\n", + " libnvidia-common-460\n", + "Use 'apt autoremove' to remove it.\n", + "The following additional packages will be installed:\n", + " autoconf automake autopoint autotools-dev debhelper dh-autoreconf\n", + " dh-strip-nondeterminism file fp-compiler-3.0.4 fp-docs-3.0.4 fp-ide-3.0.4\n", + " fp-units-base-3.0.4 fp-units-db-3.0.4 fp-units-fcl-3.0.4 fp-units-fv-3.0.4\n", + " fp-units-gfx-3.0.4 fp-units-gtk2-3.0.4 fp-units-math-3.0.4\n", + " fp-units-misc-3.0.4 fp-units-multimedia-3.0.4 fp-units-net-3.0.4\n", + " fp-units-rtl-3.0.4 fp-utils-3.0.4 fpc-3.0.4 fpc-source-3.0.4 gdb gdbserver\n", + " gettext gettext-base gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0\n", + " gir1.2-gtk-2.0 gir1.2-pango-1.0 intltool-debian lazarus-1.8 lazarus-doc-1.8\n", + " lazarus-ide lazarus-ide-1.8 lazarus-ide-gtk2-1.8 lazarus-src-1.8 lcl-1.8\n", + " lcl-gtk2-1.8 lcl-nogui-1.8 lcl-units-1.8 lcl-utils-1.8 liba52-0.7.4\n", + " liba52-0.7.4-dev libapr1 libaprutil1 libarchive-cpio-perl\n", + " libarchive-zip-perl libatk1.0-dev libbabeltrace1 libc6-dbg libcaca-dev\n", + " libcairo-script-interpreter2 libcairo2-dev libdca-dev libdca0 libdts-dev\n", + " libdw1 libfile-stripnondeterminism-perl libfluidsynth1 libforms-dev\n", + " libforms2 libgail-common libgail18 libgd-dev libgdk-pixbuf2.0-dev libgmp-dev\n", + " libgmpxx4ldbl libgraphviz-dev libgtk2.0-0 libgtk2.0-bin libgtk2.0-common\n", + " libgtk2.0-dev libgvc6-plugins-gtk libmad0 libmad0-dev libmagic-mgc libmagic1\n", + " libmail-sendmail-perl libmikmod-config libmikmod-dev libmikmod3\n", + " libmodplug-dev libmodplug1 libpango1.0-dev libpangoxft-1.0-0 libpixman-1-dev\n", + " libproxy-tools libpulse-dev libpulse-mainloop-glib0 libsdl-mixer1.2\n", + " libsdl-mixer1.2-dev libsdl1.2-dev libsdl1.2debian libserf-1-1 libsigsegv2\n", + " libslang2-dev libsvn1 libsys-hostname-long-perl libtimedate-perl libtool\n", + " libvlc-bin libvlc-dev libvlc5 libvlccore9 libvpx-dev libxcb-shm0-dev\n", + " libxcomposite-dev libxcursor-dev libxdot4 libxinerama-dev libxml2-utils\n", + " libxpm-dev libxrandr-dev libxxf86dga-dev libxxf86dga1 m4 po-debconf\n", + " timgm6mb-soundfont x11proto-composite-dev x11proto-randr-dev\n", + " x11proto-xf86dga-dev x11proto-xinerama-dev\n", + "Suggested packages:\n", + " autoconf-archive gnu-standards autoconf-doc dh-make dwz firebird-dev\n", + " freetds-dev libgdbm-dev pxlib-dev gdb-doc gettext-doc libasprintf-dev\n", + " libgettextpo-dev libcairo2-doc libforms-bin libforms-doc gmp-doc\n", + " libgmp10-doc libmpfr-dev gvfs libgtk2.0-doc imagemagick libpango1.0-doc\n", + " libtool-doc gcj-jdk m4-doc libmail-box-perl db5.3-util libapache2-mod-svn\n", + " subversion-tools fluid-soundfont-gm fluidsynth timidity musescore\n", + "Recommended packages:\n", + " libggi2-dev\n", + "The following NEW packages will be installed:\n", + " autoconf automake autopoint autotools-dev debhelper dh-autoreconf\n", + " dh-strip-nondeterminism file fp-compiler-3.0.4 fp-docs-3.0.4 fp-ide-3.0.4\n", + " fp-units-base-3.0.4 fp-units-db-3.0.4 fp-units-fcl-3.0.4 fp-units-fv-3.0.4\n", + " fp-units-gfx-3.0.4 fp-units-gtk2-3.0.4 fp-units-math-3.0.4\n", + " fp-units-misc-3.0.4 fp-units-multimedia-3.0.4 fp-units-net-3.0.4\n", + " fp-units-rtl-3.0.4 fp-utils-3.0.4 fpc fpc-3.0.4 fpc-source fpc-source-3.0.4\n", + " gdb gdbserver gettext gettext-base gir1.2-atk-1.0 gir1.2-freedesktop\n", + " gir1.2-gdkpixbuf-2.0 gir1.2-gtk-2.0 gir1.2-pango-1.0 intltool-debian lazarus\n", + " lazarus-1.8 lazarus-doc-1.8 lazarus-ide lazarus-ide-1.8 lazarus-ide-gtk2-1.8\n", + " lazarus-src-1.8 lcl-1.8 lcl-gtk2-1.8 lcl-nogui-1.8 lcl-units-1.8\n", + " lcl-utils-1.8 liba52-0.7.4 liba52-0.7.4-dev libapr1 libaprutil1\n", + " libarchive-cpio-perl libarchive-zip-perl libatk1.0-dev libbabeltrace1\n", + " libc6-dbg libcaca-dev libcairo-script-interpreter2 libcairo2-dev libdca-dev\n", + " libdca0 libdts-dev libdw1 libfile-stripnondeterminism-perl libfluidsynth1\n", + " libforms-dev libforms2 libgail-common libgail18 libgd-dev\n", + " libgdk-pixbuf2.0-dev libgmp-dev libgmpxx4ldbl libgraphviz-dev libgtk2.0-0\n", + " libgtk2.0-bin libgtk2.0-common libgtk2.0-dev libgvc6-plugins-gtk libmad0\n", + " libmad0-dev libmagic-mgc libmagic1 libmail-sendmail-perl libmikmod-config\n", + " libmikmod-dev libmikmod3 libmodplug-dev libmodplug1 libpango1.0-dev\n", + " libpangoxft-1.0-0 libpixman-1-dev libproxy-tools libpulse-dev\n", + " libpulse-mainloop-glib0 libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl1.2-dev\n", + " libsdl1.2debian libserf-1-1 libsigsegv2 libslang2-dev libsvn1\n", + " libsys-hostname-long-perl libtimedate-perl libtool libvlc-bin libvlc-dev\n", + " libvlc5 libvlccore9 libvpx-dev libxcb-shm0-dev libxcomposite-dev\n", + " libxcursor-dev libxdot4 libxinerama-dev libxml2-utils libxpm-dev\n", + " libxrandr-dev libxxf86dga-dev libxxf86dga1 m4 po-debconf subversion\n", + " timgm6mb-soundfont x11proto-composite-dev x11proto-randr-dev\n", + " x11proto-xf86dga-dev x11proto-xinerama-dev\n", + "0 upgraded, 131 newly installed, 0 to remove and 61 not upgraded.\n", + "Need to get 166 MB of archives.\n", + "After this operation, 1,259 MB of additional disk space will be used.\n", + "Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxxf86dga1 amd64 2:1.1.4-1 [13.7 kB]\n", + "Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic-mgc amd64 1:5.32-2ubuntu0.4 [184 kB]\n", + "Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.4 [68.6 kB]\n", + "Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 file amd64 1:5.32-2ubuntu0.4 [22.1 kB]\n", + "Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gettext-base amd64 0.19.8.1-6ubuntu0.3 [113 kB]\n", + "Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsigsegv2 amd64 2.12-1 [14.7 kB]\n", + "Get:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 m4 amd64 1.4.18-1 [197 kB]\n", + "Get:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 autoconf all 2.69-11 [322 kB]\n", + "Get:9 http://archive.ubuntu.com/ubuntu bionic/main amd64 autotools-dev all 20180224.1 [39.6 kB]\n", + "Get:10 http://archive.ubuntu.com/ubuntu bionic/main amd64 automake all 1:1.15.1-3ubuntu2 [509 kB]\n", + "Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 autopoint all 0.19.8.1-6ubuntu0.3 [426 kB]\n", + "Get:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtool all 2.4.6-2 [194 kB]\n", + "Get:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 dh-autoreconf all 17 [15.8 kB]\n", + "Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libarchive-zip-perl all 1.60-1ubuntu0.1 [84.6 kB]\n", + "Get:15 http://archive.ubuntu.com/ubuntu bionic/main amd64 libfile-stripnondeterminism-perl all 0.040-1.1~build1 [13.8 kB]\n", + "Get:16 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB]\n", + "Get:17 http://archive.ubuntu.com/ubuntu bionic/main amd64 dh-strip-nondeterminism all 0.040-1.1~build1 [5,208 B]\n", + "Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gettext amd64 0.19.8.1-6ubuntu0.3 [1,293 kB]\n", + "Get:19 http://archive.ubuntu.com/ubuntu bionic/main amd64 intltool-debian all 0.35.0+20060710.4 [24.9 kB]\n", + "Get:20 http://archive.ubuntu.com/ubuntu bionic/main amd64 po-debconf all 1.0.20 [232 kB]\n", + "Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 debhelper all 11.1.6ubuntu2 [902 kB]\n", + "Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-rtl-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [2,039 kB]\n", + "Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-compiler-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,949 kB]\n", + "Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-docs-3.0.4 all 3.0.4+dfsg-18ubuntu2 [882 kB]\n", + "Get:25 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-ide-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,453 kB]\n", + "Get:26 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-base-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,050 kB]\n", + "Get:27 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-db-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [745 kB]\n", + "Get:28 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-fcl-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [4,798 kB]\n", + "Get:29 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-fv-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [297 kB]\n", + "Get:30 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-gfx-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,099 kB]\n", + "Get:31 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-common all 2.24.32-1ubuntu1 [125 kB]\n", + "Get:32 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-0 amd64 2.24.32-1ubuntu1 [1,769 kB]\n", + "Get:33 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-atk-1.0 amd64 2.28.1-1 [17.8 kB]\n", + "Get:34 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-freedesktop amd64 1.56.1-1 [9,080 B]\n", + "Get:35 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-gdkpixbuf-2.0 amd64 2.36.11-2 [7,748 B]\n", + "Get:36 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpangoxft-1.0-0 amd64 1.40.14-1ubuntu0.1 [15.0 kB]\n", + "Get:37 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gir1.2-pango-1.0 amd64 1.40.14-1ubuntu0.1 [21.6 kB]\n", + "Get:38 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-gtk-2.0 amd64 2.24.32-1ubuntu1 [172 kB]\n", + "Get:39 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgdk-pixbuf2.0-dev amd64 2.36.11-2 [46.8 kB]\n", + "Get:40 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcairo-script-interpreter2 amd64 1.15.10-2ubuntu0.1 [53.5 kB]\n", + "Get:41 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpixman-1-dev amd64 0.34.0-2 [244 kB]\n", + "Get:42 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxcb-shm0-dev amd64 1.13-2~ubuntu18.04 [6,684 B]\n", + "Get:43 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcairo2-dev amd64 1.15.10-2ubuntu0.1 [626 kB]\n", + "Get:44 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpango1.0-dev amd64 1.40.14-1ubuntu0.1 [288 kB]\n", + "Get:45 http://archive.ubuntu.com/ubuntu bionic/main amd64 libatk1.0-dev amd64 2.28.1-1 [79.9 kB]\n", + "Get:46 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-xinerama-dev all 2018.4-4 [2,628 B]\n", + "Get:47 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxinerama-dev amd64 2:1.1.3-1 [8,404 B]\n", + "Get:48 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-randr-dev all 2018.4-4 [2,620 B]\n", + "Get:49 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxrandr-dev amd64 2:1.5.1-1 [24.0 kB]\n", + "Get:50 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxcursor-dev amd64 1:1.1.15-1 [26.5 kB]\n", + "Get:51 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-composite-dev all 1:2018.4-4 [2,620 B]\n", + "Get:52 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxcomposite-dev amd64 1:0.4.4-2 [9,136 B]\n", + "Get:53 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxml2-utils amd64 2.9.4+dfsg1-6.1ubuntu1.6 [35.9 kB]\n", + "Get:54 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-dev amd64 2.24.32-1ubuntu1 [2,652 kB]\n", + "Get:55 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-gtk2-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,013 kB]\n", + "Get:56 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-math-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [344 kB]\n", + "Get:57 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-misc-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [1,087 kB]\n", + "Get:58 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-multimedia-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [208 kB]\n", + "Get:59 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-units-net-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [5,416 kB]\n", + "Get:60 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc-source-3.0.4 all 3.0.4+dfsg-18ubuntu2 [17.0 MB]\n", + "Get:61 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fp-utils-3.0.4 amd64 3.0.4+dfsg-18ubuntu2 [2,758 kB]\n", + "Get:62 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc-3.0.4 all 3.0.4+dfsg-18ubuntu2 [24.4 kB]\n", + "Get:63 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc all 3.0.4+dfsg-18ubuntu2 [23.9 kB]\n", + "Get:64 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fpc-source all 3.0.4+dfsg-18ubuntu2 [23.9 kB]\n", + "Get:65 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdw1 amd64 0.170-0.4ubuntu0.1 [203 kB]\n", + "Get:66 http://archive.ubuntu.com/ubuntu bionic/main amd64 libbabeltrace1 amd64 1.5.5-1 [154 kB]\n", + "Get:67 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gdb amd64 8.1.1-0ubuntu1 [2,937 kB]\n", + "Get:68 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gdbserver amd64 8.1.1-0ubuntu1 [282 kB]\n", + "Get:69 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-ide-1.8 amd64 1.8.2+dfsg-3 [8,386 kB]\n", + "Get:70 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-ide-gtk2-1.8 amd64 1.8.2+dfsg-3 [14.1 MB]\n", + "Get:71 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-ide all 1.8.2+dfsg-3 [28.9 kB]\n", + "Get:72 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-src-1.8 all 1.8.2+dfsg-3 [15.6 MB]\n", + "Get:73 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-nogui-1.8 amd64 1.8.2+dfsg-3 [6,637 kB]\n", + "Get:74 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-gtk2-1.8 amd64 1.8.2+dfsg-3 [8,523 kB]\n", + "Get:75 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-units-1.8 amd64 1.8.2+dfsg-3 [14.3 MB]\n", + "Get:76 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-utils-1.8 amd64 1.8.2+dfsg-3 [6,694 kB]\n", + "Get:77 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lcl-1.8 amd64 1.8.2+dfsg-3 [28.9 kB]\n", + "Get:78 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-1.8 all 1.8.2+dfsg-3 [29.4 kB]\n", + "Get:79 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus all 1.8.2+dfsg-3 [28.8 kB]\n", + "Get:80 http://archive.ubuntu.com/ubuntu bionic/universe amd64 lazarus-doc-1.8 all 1.8.2+dfsg-3 [15.1 MB]\n", + "Get:81 http://archive.ubuntu.com/ubuntu bionic/universe amd64 liba52-0.7.4 amd64 0.7.4-19 [35.2 kB]\n", + "Get:82 http://archive.ubuntu.com/ubuntu bionic/universe amd64 liba52-0.7.4-dev amd64 0.7.4-19 [47.5 kB]\n", + "Get:83 http://archive.ubuntu.com/ubuntu bionic/main amd64 libapr1 amd64 1.6.3-2 [90.9 kB]\n", + "Get:84 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1 amd64 1.6.1-2 [84.4 kB]\n", + "Get:85 http://archive.ubuntu.com/ubuntu bionic/main amd64 libarchive-cpio-perl all 0.10-1 [9,644 B]\n", + "Get:86 http://archive.ubuntu.com/ubuntu bionic/main amd64 libslang2-dev amd64 2.3.1a-3ubuntu1 [393 kB]\n", + "Get:87 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcaca-dev amd64 0.99.beta19-2ubuntu0.18.04.3 [747 kB]\n", + "Get:88 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libfluidsynth1 amd64 1.1.9-1 [137 kB]\n", + "Get:89 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libforms2 amd64 1.2.3-1.3 [327 kB]\n", + "Get:90 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxpm-dev amd64 1:3.5.12-1 [87.4 kB]\n", + "Get:91 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libforms-dev amd64 1.2.3-1.3 [692 kB]\n", + "Get:92 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgail18 amd64 2.24.32-1ubuntu1 [14.2 kB]\n", + "Get:93 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgail-common amd64 2.24.32-1ubuntu1 [112 kB]\n", + "Get:94 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libvpx-dev amd64 1.7.0-3ubuntu0.18.04.1 [932 kB]\n", + "Get:95 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgd-dev amd64 2.2.5-4ubuntu0.5 [246 kB]\n", + "Get:96 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgmpxx4ldbl amd64 2:6.1.2+dfsg-2 [8,964 B]\n", + "Get:97 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgmp-dev amd64 2:6.1.2+dfsg-2 [316 kB]\n", + "Get:98 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libxdot4 amd64 2.40.1-2 [15.7 kB]\n", + "Get:99 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libgvc6-plugins-gtk amd64 2.40.1-2 [18.2 kB]\n", + "Get:100 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libgraphviz-dev amd64 2.40.1-2 [57.3 kB]\n", + "Get:101 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-bin amd64 2.24.32-1ubuntu1 [7,536 B]\n", + "Get:102 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libmad0 amd64 0.15.1b-9ubuntu18.04.1 [64.6 kB]\n", + "Get:103 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libmad0-dev amd64 0.15.1b-9ubuntu18.04.1 [64.4 kB]\n", + "Get:104 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsys-hostname-long-perl all 1.5-1 [11.7 kB]\n", + "Get:105 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmail-sendmail-perl all 0.80-1 [22.6 kB]\n", + "Get:106 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmikmod-config amd64 3.3.11.1-3 [5,184 B]\n", + "Get:107 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmikmod3 amd64 3.3.11.1-3 [113 kB]\n", + "Get:108 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmikmod-dev amd64 3.3.11.1-3 [196 kB]\n", + "Get:109 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmodplug1 amd64 1:0.8.9.0-1 [150 kB]\n", + "Get:110 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmodplug-dev amd64 1:0.8.9.0-1 [14.6 kB]\n", + "Get:111 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libproxy-tools amd64 0.4.15-1ubuntu0.2 [5,320 B]\n", + "Get:112 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpulse-mainloop-glib0 amd64 1:11.1-1ubuntu7.11 [22.1 kB]\n", + "Get:113 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpulse-dev amd64 1:11.1-1ubuntu7.11 [81.5 kB]\n", + "Get:114 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsdl1.2debian amd64 1.2.15+dfsg2-0.1ubuntu0.2 [175 kB]\n", + "Get:115 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl-mixer1.2 amd64 1.2.12-14 [72.0 kB]\n", + "Get:116 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsdl1.2-dev amd64 1.2.15+dfsg2-0.1ubuntu0.2 [706 kB]\n", + "Get:117 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl-mixer1.2-dev amd64 1.2.12-14 [90.6 kB]\n", + "Get:118 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libserf-1-1 amd64 1.3.9-6 [44.4 kB]\n", + "Get:119 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsvn1 amd64 1.9.7-4ubuntu1.1 [1,181 kB]\n", + "Get:120 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlccore9 amd64 3.0.8-0ubuntu18.04.1 [434 kB]\n", + "Get:121 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlc5 amd64 3.0.8-0ubuntu18.04.1 [68.0 kB]\n", + "Get:122 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlc-bin amd64 3.0.8-0ubuntu18.04.1 [17.1 kB]\n", + "Get:123 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libvlc-dev amd64 3.0.8-0ubuntu18.04.1 [60.1 kB]\n", + "Get:124 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-xf86dga-dev all 2018.4-4 [2,624 B]\n", + "Get:125 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxxf86dga-dev amd64 2:1.1.4-1 [17.6 kB]\n", + "Get:126 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 subversion amd64 1.9.7-4ubuntu1.1 [834 kB]\n", + "Get:127 http://archive.ubuntu.com/ubuntu bionic/universe amd64 timgm6mb-soundfont all 1.3-2 [5,423 kB]\n", + "Get:128 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libc6-dbg amd64 2.27-3ubuntu1.6 [5,162 kB]\n", + "Get:129 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libdca0 amd64 0.0.5-10 [100.0 kB]\n", + "Get:130 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libdca-dev amd64 0.0.5-10 [90.2 kB]\n", + "Get:131 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libdts-dev amd64 0.0.5-10 [3,068 B]\n", + "Fetched 166 MB in 7s (22.8 MB/s)\n", + "Extracting templates from packages: 100%\n", + "Preconfiguring packages ...\n", + "Selecting previously unselected package libxxf86dga1:amd64.\n", + "(Reading database ... 155639 files and directories currently installed.)\n", + "Preparing to unpack .../000-libxxf86dga1_2%3a1.1.4-1_amd64.deb ...\n", + "Unpacking libxxf86dga1:amd64 (2:1.1.4-1) ...\n", + "Selecting previously unselected package libmagic-mgc.\n", + "Preparing to unpack .../001-libmagic-mgc_1%3a5.32-2ubuntu0.4_amd64.deb ...\n", + "Unpacking libmagic-mgc (1:5.32-2ubuntu0.4) ...\n", + "Selecting previously unselected package libmagic1:amd64.\n", + "Preparing to unpack .../002-libmagic1_1%3a5.32-2ubuntu0.4_amd64.deb ...\n", + "Unpacking libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\n", + "Selecting previously unselected package file.\n", + "Preparing to unpack .../003-file_1%3a5.32-2ubuntu0.4_amd64.deb ...\n", + "Unpacking file (1:5.32-2ubuntu0.4) ...\n", + "Selecting previously unselected package gettext-base.\n", + "Preparing to unpack .../004-gettext-base_0.19.8.1-6ubuntu0.3_amd64.deb ...\n", + "Unpacking gettext-base (0.19.8.1-6ubuntu0.3) ...\n", + "Selecting previously unselected package libsigsegv2:amd64.\n", + "Preparing to unpack .../005-libsigsegv2_2.12-1_amd64.deb ...\n", + "Unpacking libsigsegv2:amd64 (2.12-1) ...\n", + "Selecting previously unselected package m4.\n", + "Preparing to unpack .../006-m4_1.4.18-1_amd64.deb ...\n", + "Unpacking m4 (1.4.18-1) ...\n", + "Selecting previously unselected package autoconf.\n", + "Preparing to unpack .../007-autoconf_2.69-11_all.deb ...\n", + "Unpacking autoconf (2.69-11) ...\n", + "Selecting previously unselected package autotools-dev.\n", + "Preparing to unpack .../008-autotools-dev_20180224.1_all.deb ...\n", + "Unpacking autotools-dev (20180224.1) ...\n", + "Selecting previously unselected package automake.\n", + "Preparing to unpack .../009-automake_1%3a1.15.1-3ubuntu2_all.deb ...\n", + "Unpacking automake (1:1.15.1-3ubuntu2) ...\n", + "Selecting previously unselected package autopoint.\n", + "Preparing to unpack .../010-autopoint_0.19.8.1-6ubuntu0.3_all.deb ...\n", + "Unpacking autopoint (0.19.8.1-6ubuntu0.3) ...\n", + "Selecting previously unselected package libtool.\n", + "Preparing to unpack .../011-libtool_2.4.6-2_all.deb ...\n", + "Unpacking libtool (2.4.6-2) ...\n", + "Selecting previously unselected package dh-autoreconf.\n", + "Preparing to unpack .../012-dh-autoreconf_17_all.deb ...\n", + "Unpacking dh-autoreconf (17) ...\n", + "Selecting previously unselected package libarchive-zip-perl.\n", + "Preparing to unpack .../013-libarchive-zip-perl_1.60-1ubuntu0.1_all.deb ...\n", + "Unpacking libarchive-zip-perl (1.60-1ubuntu0.1) ...\n", + "Selecting previously unselected package libfile-stripnondeterminism-perl.\n", + "Preparing to unpack .../014-libfile-stripnondeterminism-perl_0.040-1.1~build1_all.deb ...\n", + "Unpacking libfile-stripnondeterminism-perl (0.040-1.1~build1) ...\n", + "Selecting previously unselected package libtimedate-perl.\n", + "Preparing to unpack .../015-libtimedate-perl_2.3000-2_all.deb ...\n", + "Unpacking libtimedate-perl (2.3000-2) ...\n", + "Selecting previously unselected package dh-strip-nondeterminism.\n", + "Preparing to unpack .../016-dh-strip-nondeterminism_0.040-1.1~build1_all.deb ...\n", + "Unpacking dh-strip-nondeterminism (0.040-1.1~build1) ...\n", + "Selecting previously unselected package gettext.\n", + "Preparing to unpack .../017-gettext_0.19.8.1-6ubuntu0.3_amd64.deb ...\n", + "Unpacking gettext (0.19.8.1-6ubuntu0.3) ...\n", + "Selecting previously unselected package intltool-debian.\n", + "Preparing to unpack .../018-intltool-debian_0.35.0+20060710.4_all.deb ...\n", + "Unpacking intltool-debian (0.35.0+20060710.4) ...\n", + "Selecting previously unselected package po-debconf.\n", + "Preparing to unpack .../019-po-debconf_1.0.20_all.deb ...\n", + "Unpacking po-debconf (1.0.20) ...\n", + "Selecting previously unselected package debhelper.\n", + "Preparing to unpack .../020-debhelper_11.1.6ubuntu2_all.deb ...\n", + "Unpacking debhelper (11.1.6ubuntu2) ...\n", + "Selecting previously unselected package fp-units-rtl-3.0.4:amd64.\n", + "Preparing to unpack .../021-fp-units-rtl-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-rtl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-compiler-3.0.4:amd64.\n", + "Preparing to unpack .../022-fp-compiler-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-compiler-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-docs-3.0.4.\n", + "Preparing to unpack .../023-fp-docs-3.0.4_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fp-docs-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-ide-3.0.4.\n", + "Preparing to unpack .../024-fp-ide-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-ide-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-base-3.0.4:amd64.\n", + "Preparing to unpack .../025-fp-units-base-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-base-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-db-3.0.4:amd64.\n", + "Preparing to unpack .../026-fp-units-db-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-db-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-fcl-3.0.4:amd64.\n", + "Preparing to unpack .../027-fp-units-fcl-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-fcl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-fv-3.0.4:amd64.\n", + "Preparing to unpack .../028-fp-units-fv-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-fv-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-gfx-3.0.4:amd64.\n", + "Preparing to unpack .../029-fp-units-gfx-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-gfx-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package libgtk2.0-common.\n", + "Preparing to unpack .../030-libgtk2.0-common_2.24.32-1ubuntu1_all.deb ...\n", + "Unpacking libgtk2.0-common (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libgtk2.0-0:amd64.\n", + "Preparing to unpack .../031-libgtk2.0-0_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgtk2.0-0:amd64 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package gir1.2-atk-1.0:amd64.\n", + "Preparing to unpack .../032-gir1.2-atk-1.0_2.28.1-1_amd64.deb ...\n", + "Unpacking gir1.2-atk-1.0:amd64 (2.28.1-1) ...\n", + "Selecting previously unselected package gir1.2-freedesktop:amd64.\n", + "Preparing to unpack .../033-gir1.2-freedesktop_1.56.1-1_amd64.deb ...\n", + "Unpacking gir1.2-freedesktop:amd64 (1.56.1-1) ...\n", + "Selecting previously unselected package gir1.2-gdkpixbuf-2.0:amd64.\n", + "Preparing to unpack .../034-gir1.2-gdkpixbuf-2.0_2.36.11-2_amd64.deb ...\n", + "Unpacking gir1.2-gdkpixbuf-2.0:amd64 (2.36.11-2) ...\n", + "Selecting previously unselected package libpangoxft-1.0-0:amd64.\n", + "Preparing to unpack .../035-libpangoxft-1.0-0_1.40.14-1ubuntu0.1_amd64.deb ...\n", + "Unpacking libpangoxft-1.0-0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Selecting previously unselected package gir1.2-pango-1.0:amd64.\n", + "Preparing to unpack .../036-gir1.2-pango-1.0_1.40.14-1ubuntu0.1_amd64.deb ...\n", + "Unpacking gir1.2-pango-1.0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Selecting previously unselected package gir1.2-gtk-2.0.\n", + "Preparing to unpack .../037-gir1.2-gtk-2.0_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking gir1.2-gtk-2.0 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libgdk-pixbuf2.0-dev.\n", + "Preparing to unpack .../038-libgdk-pixbuf2.0-dev_2.36.11-2_amd64.deb ...\n", + "Unpacking libgdk-pixbuf2.0-dev (2.36.11-2) ...\n", + "Selecting previously unselected package libcairo-script-interpreter2:amd64.\n", + "Preparing to unpack .../039-libcairo-script-interpreter2_1.15.10-2ubuntu0.1_amd64.deb ...\n", + "Unpacking libcairo-script-interpreter2:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Selecting previously unselected package libpixman-1-dev:amd64.\n", + "Preparing to unpack .../040-libpixman-1-dev_0.34.0-2_amd64.deb ...\n", + "Unpacking libpixman-1-dev:amd64 (0.34.0-2) ...\n", + "Selecting previously unselected package libxcb-shm0-dev:amd64.\n", + "Preparing to unpack .../041-libxcb-shm0-dev_1.13-2~ubuntu18.04_amd64.deb ...\n", + "Unpacking libxcb-shm0-dev:amd64 (1.13-2~ubuntu18.04) ...\n", + "Selecting previously unselected package libcairo2-dev:amd64.\n", + "Preparing to unpack .../042-libcairo2-dev_1.15.10-2ubuntu0.1_amd64.deb ...\n", + "Unpacking libcairo2-dev:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Selecting previously unselected package libpango1.0-dev.\n", + "Preparing to unpack .../043-libpango1.0-dev_1.40.14-1ubuntu0.1_amd64.deb ...\n", + "Unpacking libpango1.0-dev (1.40.14-1ubuntu0.1) ...\n", + "Selecting previously unselected package libatk1.0-dev:amd64.\n", + "Preparing to unpack .../044-libatk1.0-dev_2.28.1-1_amd64.deb ...\n", + "Unpacking libatk1.0-dev:amd64 (2.28.1-1) ...\n", + "Selecting previously unselected package x11proto-xinerama-dev.\n", + "Preparing to unpack .../045-x11proto-xinerama-dev_2018.4-4_all.deb ...\n", + "Unpacking x11proto-xinerama-dev (2018.4-4) ...\n", + "Selecting previously unselected package libxinerama-dev:amd64.\n", + "Preparing to unpack .../046-libxinerama-dev_2%3a1.1.3-1_amd64.deb ...\n", + "Unpacking libxinerama-dev:amd64 (2:1.1.3-1) ...\n", + "Selecting previously unselected package x11proto-randr-dev.\n", + "Preparing to unpack .../047-x11proto-randr-dev_2018.4-4_all.deb ...\n", + "Unpacking x11proto-randr-dev (2018.4-4) ...\n", + "Selecting previously unselected package libxrandr-dev:amd64.\n", + "Preparing to unpack .../048-libxrandr-dev_2%3a1.5.1-1_amd64.deb ...\n", + "Unpacking libxrandr-dev:amd64 (2:1.5.1-1) ...\n", + "Selecting previously unselected package libxcursor-dev:amd64.\n", + "Preparing to unpack .../049-libxcursor-dev_1%3a1.1.15-1_amd64.deb ...\n", + "Unpacking libxcursor-dev:amd64 (1:1.1.15-1) ...\n", + "Selecting previously unselected package x11proto-composite-dev.\n", + "Preparing to unpack .../050-x11proto-composite-dev_1%3a2018.4-4_all.deb ...\n", + "Unpacking x11proto-composite-dev (1:2018.4-4) ...\n", + "Selecting previously unselected package libxcomposite-dev:amd64.\n", + "Preparing to unpack .../051-libxcomposite-dev_1%3a0.4.4-2_amd64.deb ...\n", + "Unpacking libxcomposite-dev:amd64 (1:0.4.4-2) ...\n", + "Selecting previously unselected package libxml2-utils.\n", + "Preparing to unpack .../052-libxml2-utils_2.9.4+dfsg1-6.1ubuntu1.6_amd64.deb ...\n", + "Unpacking libxml2-utils (2.9.4+dfsg1-6.1ubuntu1.6) ...\n", + "Selecting previously unselected package libgtk2.0-dev.\n", + "Preparing to unpack .../053-libgtk2.0-dev_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgtk2.0-dev (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package fp-units-gtk2-3.0.4:amd64.\n", + "Preparing to unpack .../054-fp-units-gtk2-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-gtk2-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-math-3.0.4:amd64.\n", + "Preparing to unpack .../055-fp-units-math-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-math-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-misc-3.0.4:amd64.\n", + "Preparing to unpack .../056-fp-units-misc-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-misc-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-multimedia-3.0.4:amd64.\n", + "Preparing to unpack .../057-fp-units-multimedia-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-multimedia-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-units-net-3.0.4:amd64.\n", + "Preparing to unpack .../058-fp-units-net-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-units-net-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc-source-3.0.4.\n", + "Preparing to unpack .../059-fpc-source-3.0.4_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc-source-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fp-utils-3.0.4.\n", + "Preparing to unpack .../060-fp-utils-3.0.4_3.0.4+dfsg-18ubuntu2_amd64.deb ...\n", + "Unpacking fp-utils-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc-3.0.4.\n", + "Preparing to unpack .../061-fpc-3.0.4_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc.\n", + "Preparing to unpack .../062-fpc_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package fpc-source.\n", + "Preparing to unpack .../063-fpc-source_3.0.4+dfsg-18ubuntu2_all.deb ...\n", + "Unpacking fpc-source (3.0.4+dfsg-18ubuntu2) ...\n", + "Selecting previously unselected package libdw1:amd64.\n", + "Preparing to unpack .../064-libdw1_0.170-0.4ubuntu0.1_amd64.deb ...\n", + "Unpacking libdw1:amd64 (0.170-0.4ubuntu0.1) ...\n", + "Selecting previously unselected package libbabeltrace1:amd64.\n", + "Preparing to unpack .../065-libbabeltrace1_1.5.5-1_amd64.deb ...\n", + "Unpacking libbabeltrace1:amd64 (1.5.5-1) ...\n", + "Selecting previously unselected package gdb.\n", + "Preparing to unpack .../066-gdb_8.1.1-0ubuntu1_amd64.deb ...\n", + "Unpacking gdb (8.1.1-0ubuntu1) ...\n", + "Selecting previously unselected package gdbserver.\n", + "Preparing to unpack .../067-gdbserver_8.1.1-0ubuntu1_amd64.deb ...\n", + "Unpacking gdbserver (8.1.1-0ubuntu1) ...\n", + "Selecting previously unselected package lazarus-ide-1.8.\n", + "Preparing to unpack .../068-lazarus-ide-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lazarus-ide-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-ide-gtk2-1.8.\n", + "Preparing to unpack .../069-lazarus-ide-gtk2-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lazarus-ide-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-ide.\n", + "Preparing to unpack .../070-lazarus-ide_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-ide (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-src-1.8.\n", + "Preparing to unpack .../071-lazarus-src-1.8_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-src-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-nogui-1.8.\n", + "Preparing to unpack .../072-lcl-nogui-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-nogui-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-gtk2-1.8.\n", + "Preparing to unpack .../073-lcl-gtk2-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-units-1.8.\n", + "Preparing to unpack .../074-lcl-units-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-units-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-utils-1.8.\n", + "Preparing to unpack .../075-lcl-utils-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-utils-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lcl-1.8.\n", + "Preparing to unpack .../076-lcl-1.8_1.8.2+dfsg-3_amd64.deb ...\n", + "Unpacking lcl-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-1.8.\n", + "Preparing to unpack .../077-lazarus-1.8_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus.\n", + "Preparing to unpack .../078-lazarus_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package lazarus-doc-1.8.\n", + "Preparing to unpack .../079-lazarus-doc-1.8_1.8.2+dfsg-3_all.deb ...\n", + "Unpacking lazarus-doc-1.8 (1.8.2+dfsg-3) ...\n", + "Selecting previously unselected package liba52-0.7.4:amd64.\n", + "Preparing to unpack .../080-liba52-0.7.4_0.7.4-19_amd64.deb ...\n", + "Unpacking liba52-0.7.4:amd64 (0.7.4-19) ...\n", + "Selecting previously unselected package liba52-0.7.4-dev.\n", + "Preparing to unpack .../081-liba52-0.7.4-dev_0.7.4-19_amd64.deb ...\n", + "Unpacking liba52-0.7.4-dev (0.7.4-19) ...\n", + "Selecting previously unselected package libapr1:amd64.\n", + "Preparing to unpack .../082-libapr1_1.6.3-2_amd64.deb ...\n", + "Unpacking libapr1:amd64 (1.6.3-2) ...\n", + "Selecting previously unselected package libaprutil1:amd64.\n", + "Preparing to unpack .../083-libaprutil1_1.6.1-2_amd64.deb ...\n", + "Unpacking libaprutil1:amd64 (1.6.1-2) ...\n", + "Selecting previously unselected package libarchive-cpio-perl.\n", + "Preparing to unpack .../084-libarchive-cpio-perl_0.10-1_all.deb ...\n", + "Unpacking libarchive-cpio-perl (0.10-1) ...\n", + "Selecting previously unselected package libslang2-dev:amd64.\n", + "Preparing to unpack .../085-libslang2-dev_2.3.1a-3ubuntu1_amd64.deb ...\n", + "Unpacking libslang2-dev:amd64 (2.3.1a-3ubuntu1) ...\n", + "Selecting previously unselected package libcaca-dev.\n", + "Preparing to unpack .../086-libcaca-dev_0.99.beta19-2ubuntu0.18.04.3_amd64.deb ...\n", + "Unpacking libcaca-dev (0.99.beta19-2ubuntu0.18.04.3) ...\n", + "Selecting previously unselected package libfluidsynth1:amd64.\n", + "Preparing to unpack .../087-libfluidsynth1_1.1.9-1_amd64.deb ...\n", + "Unpacking libfluidsynth1:amd64 (1.1.9-1) ...\n", + "Selecting previously unselected package libforms2.\n", + "Preparing to unpack .../088-libforms2_1.2.3-1.3_amd64.deb ...\n", + "Unpacking libforms2 (1.2.3-1.3) ...\n", + "Selecting previously unselected package libxpm-dev:amd64.\n", + "Preparing to unpack .../089-libxpm-dev_1%3a3.5.12-1_amd64.deb ...\n", + "Unpacking libxpm-dev:amd64 (1:3.5.12-1) ...\n", + "Selecting previously unselected package libforms-dev.\n", + "Preparing to unpack .../090-libforms-dev_1.2.3-1.3_amd64.deb ...\n", + "Unpacking libforms-dev (1.2.3-1.3) ...\n", + "Selecting previously unselected package libgail18:amd64.\n", + "Preparing to unpack .../091-libgail18_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgail18:amd64 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libgail-common:amd64.\n", + "Preparing to unpack .../092-libgail-common_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgail-common:amd64 (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libvpx-dev:amd64.\n", + "Preparing to unpack .../093-libvpx-dev_1.7.0-3ubuntu0.18.04.1_amd64.deb ...\n", + "Unpacking libvpx-dev:amd64 (1.7.0-3ubuntu0.18.04.1) ...\n", + "Selecting previously unselected package libgd-dev:amd64.\n", + "Preparing to unpack .../094-libgd-dev_2.2.5-4ubuntu0.5_amd64.deb ...\n", + "Unpacking libgd-dev:amd64 (2.2.5-4ubuntu0.5) ...\n", + "Selecting previously unselected package libgmpxx4ldbl:amd64.\n", + "Preparing to unpack .../095-libgmpxx4ldbl_2%3a6.1.2+dfsg-2_amd64.deb ...\n", + "Unpacking libgmpxx4ldbl:amd64 (2:6.1.2+dfsg-2) ...\n", + "Selecting previously unselected package libgmp-dev:amd64.\n", + "Preparing to unpack .../096-libgmp-dev_2%3a6.1.2+dfsg-2_amd64.deb ...\n", + "Unpacking libgmp-dev:amd64 (2:6.1.2+dfsg-2) ...\n", + "Selecting previously unselected package libxdot4.\n", + "Preparing to unpack .../097-libxdot4_2.40.1-2_amd64.deb ...\n", + "Unpacking libxdot4 (2.40.1-2) ...\n", + "Selecting previously unselected package libgvc6-plugins-gtk.\n", + "Preparing to unpack .../098-libgvc6-plugins-gtk_2.40.1-2_amd64.deb ...\n", + "Unpacking libgvc6-plugins-gtk (2.40.1-2) ...\n", + "Selecting previously unselected package libgraphviz-dev.\n", + "Preparing to unpack .../099-libgraphviz-dev_2.40.1-2_amd64.deb ...\n", + "Unpacking libgraphviz-dev (2.40.1-2) ...\n", + "Selecting previously unselected package libgtk2.0-bin.\n", + "Preparing to unpack .../100-libgtk2.0-bin_2.24.32-1ubuntu1_amd64.deb ...\n", + "Unpacking libgtk2.0-bin (2.24.32-1ubuntu1) ...\n", + "Selecting previously unselected package libmad0:amd64.\n", + "Preparing to unpack .../101-libmad0_0.15.1b-9ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libmad0:amd64 (0.15.1b-9ubuntu18.04.1) ...\n", + "Selecting previously unselected package libmad0-dev.\n", + "Preparing to unpack .../102-libmad0-dev_0.15.1b-9ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libmad0-dev (0.15.1b-9ubuntu18.04.1) ...\n", + "Selecting previously unselected package libsys-hostname-long-perl.\n", + "Preparing to unpack .../103-libsys-hostname-long-perl_1.5-1_all.deb ...\n", + "Unpacking libsys-hostname-long-perl (1.5-1) ...\n", + "Selecting previously unselected package libmail-sendmail-perl.\n", + "Preparing to unpack .../104-libmail-sendmail-perl_0.80-1_all.deb ...\n", + "Unpacking libmail-sendmail-perl (0.80-1) ...\n", + "Selecting previously unselected package libmikmod-config.\n", + "Preparing to unpack .../105-libmikmod-config_3.3.11.1-3_amd64.deb ...\n", + "Unpacking libmikmod-config (3.3.11.1-3) ...\n", + "Selecting previously unselected package libmikmod3:amd64.\n", + "Preparing to unpack .../106-libmikmod3_3.3.11.1-3_amd64.deb ...\n", + "Unpacking libmikmod3:amd64 (3.3.11.1-3) ...\n", + "Selecting previously unselected package libmikmod-dev:amd64.\n", + "Preparing to unpack .../107-libmikmod-dev_3.3.11.1-3_amd64.deb ...\n", + "Unpacking libmikmod-dev:amd64 (3.3.11.1-3) ...\n", + "Selecting previously unselected package libmodplug1:amd64.\n", + "Preparing to unpack .../108-libmodplug1_1%3a0.8.9.0-1_amd64.deb ...\n", + "Unpacking libmodplug1:amd64 (1:0.8.9.0-1) ...\n", + "Selecting previously unselected package libmodplug-dev:amd64.\n", + "Preparing to unpack .../109-libmodplug-dev_1%3a0.8.9.0-1_amd64.deb ...\n", + "Unpacking libmodplug-dev:amd64 (1:0.8.9.0-1) ...\n", + "Selecting previously unselected package libproxy-tools.\n", + "Preparing to unpack .../110-libproxy-tools_0.4.15-1ubuntu0.2_amd64.deb ...\n", + "Unpacking libproxy-tools (0.4.15-1ubuntu0.2) ...\n", + "Selecting previously unselected package libpulse-mainloop-glib0:amd64.\n", + "Preparing to unpack .../111-libpulse-mainloop-glib0_1%3a11.1-1ubuntu7.11_amd64.deb ...\n", + "Unpacking libpulse-mainloop-glib0:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Selecting previously unselected package libpulse-dev:amd64.\n", + "Preparing to unpack .../112-libpulse-dev_1%3a11.1-1ubuntu7.11_amd64.deb ...\n", + "Unpacking libpulse-dev:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Selecting previously unselected package libsdl1.2debian:amd64.\n", + "Preparing to unpack .../113-libsdl1.2debian_1.2.15+dfsg2-0.1ubuntu0.2_amd64.deb ...\n", + "Unpacking libsdl1.2debian:amd64 (1.2.15+dfsg2-0.1ubuntu0.2) ...\n", + "Selecting previously unselected package libsdl-mixer1.2:amd64.\n", + "Preparing to unpack .../114-libsdl-mixer1.2_1.2.12-14_amd64.deb ...\n", + "Unpacking libsdl-mixer1.2:amd64 (1.2.12-14) ...\n", + "Selecting previously unselected package libsdl1.2-dev.\n", + "Preparing to unpack .../115-libsdl1.2-dev_1.2.15+dfsg2-0.1ubuntu0.2_amd64.deb ...\n", + "Unpacking libsdl1.2-dev (1.2.15+dfsg2-0.1ubuntu0.2) ...\n", + "Selecting previously unselected package libsdl-mixer1.2-dev:amd64.\n", + "Preparing to unpack .../116-libsdl-mixer1.2-dev_1.2.12-14_amd64.deb ...\n", + "Unpacking libsdl-mixer1.2-dev:amd64 (1.2.12-14) ...\n", + "Selecting previously unselected package libserf-1-1:amd64.\n", + "Preparing to unpack .../117-libserf-1-1_1.3.9-6_amd64.deb ...\n", + "Unpacking libserf-1-1:amd64 (1.3.9-6) ...\n", + "Selecting previously unselected package libsvn1:amd64.\n", + "Preparing to unpack .../118-libsvn1_1.9.7-4ubuntu1.1_amd64.deb ...\n", + "Unpacking libsvn1:amd64 (1.9.7-4ubuntu1.1) ...\n", + "Selecting previously unselected package libvlccore9:amd64.\n", + "Preparing to unpack .../119-libvlccore9_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlccore9:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package libvlc5:amd64.\n", + "Preparing to unpack .../120-libvlc5_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlc5:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package libvlc-bin:amd64.\n", + "Preparing to unpack .../121-libvlc-bin_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlc-bin:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package libvlc-dev:amd64.\n", + "Preparing to unpack .../122-libvlc-dev_3.0.8-0ubuntu18.04.1_amd64.deb ...\n", + "Unpacking libvlc-dev:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Selecting previously unselected package x11proto-xf86dga-dev.\n", + "Preparing to unpack .../123-x11proto-xf86dga-dev_2018.4-4_all.deb ...\n", + "Unpacking x11proto-xf86dga-dev (2018.4-4) ...\n", + "Selecting previously unselected package libxxf86dga-dev:amd64.\n", + "Preparing to unpack .../124-libxxf86dga-dev_2%3a1.1.4-1_amd64.deb ...\n", + "Unpacking libxxf86dga-dev:amd64 (2:1.1.4-1) ...\n", + "Selecting previously unselected package subversion.\n", + "Preparing to unpack .../125-subversion_1.9.7-4ubuntu1.1_amd64.deb ...\n", + "Unpacking subversion (1.9.7-4ubuntu1.1) ...\n", + "Selecting previously unselected package timgm6mb-soundfont.\n", + "Preparing to unpack .../126-timgm6mb-soundfont_1.3-2_all.deb ...\n", + "Unpacking timgm6mb-soundfont (1.3-2) ...\n", + "Selecting previously unselected package libc6-dbg:amd64.\n", + "Preparing to unpack .../127-libc6-dbg_2.27-3ubuntu1.6_amd64.deb ...\n", + "Unpacking libc6-dbg:amd64 (2.27-3ubuntu1.6) ...\n", + "Selecting previously unselected package libdca0:amd64.\n", + "Preparing to unpack .../128-libdca0_0.0.5-10_amd64.deb ...\n", + "Unpacking libdca0:amd64 (0.0.5-10) ...\n", + "Selecting previously unselected package libdca-dev:amd64.\n", + "Preparing to unpack .../129-libdca-dev_0.0.5-10_amd64.deb ...\n", + "Unpacking libdca-dev:amd64 (0.0.5-10) ...\n", + "Selecting previously unselected package libdts-dev:amd64.\n", + "Preparing to unpack .../130-libdts-dev_0.0.5-10_amd64.deb ...\n", + "Unpacking libdts-dev:amd64 (0.0.5-10) ...\n", + "Setting up libapr1:amd64 (1.6.3-2) ...\n", + "Setting up libxcursor-dev:amd64 (1:1.1.15-1) ...\n", + "Setting up libforms2 (1.2.3-1.3) ...\n", + "Setting up gir1.2-atk-1.0:amd64 (2.28.1-1) ...\n", + "Setting up libgtk2.0-common (2.24.32-1ubuntu1) ...\n", + "Setting up libxdot4 (2.40.1-2) ...\n", + "Setting up libc6-dbg:amd64 (2.27-3ubuntu1.6) ...\n", + "Setting up libpulse-mainloop-glib0:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Setting up libpulse-dev:amd64 (1:11.1-1ubuntu7.11) ...\n", + "Setting up libarchive-zip-perl (1.60-1ubuntu0.1) ...\n", + "Setting up libmodplug1:amd64 (1:0.8.9.0-1) ...\n", + "Setting up libdw1:amd64 (0.170-0.4ubuntu0.1) ...\n", + "Setting up libtimedate-perl (2.3000-2) ...\n", + "Setting up libcairo-script-interpreter2:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Setting up libsigsegv2:amd64 (2.12-1) ...\n", + "Setting up gir1.2-freedesktop:amd64 (1.56.1-1) ...\n", + "Setting up libproxy-tools (0.4.15-1ubuntu0.2) ...\n", + "Setting up libxpm-dev:amd64 (1:3.5.12-1) ...\n", + "Setting up libxcb-shm0-dev:amd64 (1.13-2~ubuntu18.04) ...\n", + "Setting up libpangoxft-1.0-0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Setting up libxml2-utils (2.9.4+dfsg1-6.1ubuntu1.6) ...\n", + "Setting up libarchive-cpio-perl (0.10-1) ...\n", + "Setting up gir1.2-gdkpixbuf-2.0:amd64 (2.36.11-2) ...\n", + "Setting up libatk1.0-dev:amd64 (2.28.1-1) ...\n", + "Setting up libsdl1.2debian:amd64 (1.2.15+dfsg2-0.1ubuntu0.2) ...\n", + "Setting up gettext-base (0.19.8.1-6ubuntu0.3) ...\n", + "Setting up m4 (1.4.18-1) ...\n", + "Setting up fp-docs-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libmagic-mgc (1:5.32-2ubuntu0.4) ...\n", + "Setting up gir1.2-pango-1.0:amd64 (1.40.14-1ubuntu0.1) ...\n", + "Setting up libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\n", + "Setting up libsys-hostname-long-perl (1.5-1) ...\n", + "Setting up libmikmod3:amd64 (3.3.11.1-3) ...\n", + "Setting up liba52-0.7.4:amd64 (0.7.4-19) ...\n", + "Setting up libvpx-dev:amd64 (1.7.0-3ubuntu0.18.04.1) ...\n", + "Setting up libgdk-pixbuf2.0-dev (2.36.11-2) ...\n", + "Setting up libgd-dev:amd64 (2.2.5-4ubuntu0.5) ...\n", + "Setting up fp-units-rtl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libmail-sendmail-perl (0.80-1) ...\n", + "Setting up libxxf86dga1:amd64 (2:1.1.4-1) ...\n", + "Setting up lazarus-src-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up libvlccore9:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up x11proto-xinerama-dev (2018.4-4) ...\n", + "Setting up fpc-source-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up autotools-dev (20180224.1) ...\n", + "Setting up libpixman-1-dev:amd64 (0.34.0-2) ...\n", + "Setting up libaprutil1:amd64 (1.6.1-2) ...\n", + "Setting up x11proto-randr-dev (2018.4-4) ...\n", + "Setting up libxinerama-dev:amd64 (2:1.1.3-1) ...\n", + "Setting up liba52-0.7.4-dev (0.7.4-19) ...\n", + "Setting up x11proto-xf86dga-dev (2018.4-4) ...\n", + "Setting up libmikmod-config (3.3.11.1-3) ...\n", + "Setting up libxxf86dga-dev:amd64 (2:1.1.4-1) ...\n", + "Setting up gdbserver (8.1.1-0ubuntu1) ...\n", + "Setting up timgm6mb-soundfont (1.3-2) ...\n", + "Setting up libmad0:amd64 (0.15.1b-9ubuntu18.04.1) ...\n", + "Setting up libgmpxx4ldbl:amd64 (2:6.1.2+dfsg-2) ...\n", + "Setting up libdca0:amd64 (0.0.5-10) ...\n", + "Setting up libmodplug-dev:amd64 (1:0.8.9.0-1) ...\n", + "Setting up fp-utils-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "update-alternatives: using /usr/lib/x86_64-linux-gnu/fpc/3.0.4 to provide /usr/lib/x86_64-linux-gnu/fpc/default (fp-utils) in auto mode\n", + "Setting up libslang2-dev:amd64 (2.3.1a-3ubuntu1) ...\n", + "Setting up libfluidsynth1:amd64 (1.1.9-1) ...\n", + "Setting up x11proto-composite-dev (1:2018.4-4) ...\n", + "Setting up lazarus-doc-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up fp-ide-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "update-alternatives: using /usr/bin/fp-3.0.4 to provide /usr/bin/fp (fp) in auto mode\n", + "Setting up libbabeltrace1:amd64 (1.5.5-1) ...\n", + "Setting up autopoint (0.19.8.1-6ubuntu0.3) ...\n", + "Setting up fpc-source (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libfile-stripnondeterminism-perl (0.040-1.1~build1) ...\n", + "Setting up fp-units-base-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgmp-dev:amd64 (2:6.1.2+dfsg-2) ...\n", + "Setting up fp-units-multimedia-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up fp-units-math-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libmad0-dev (0.15.1b-9ubuntu18.04.1) ...\n", + "Setting up libforms-dev (1.2.3-1.3) ...\n", + "Setting up libdca-dev:amd64 (0.0.5-10) ...\n", + "Setting up libgtk2.0-0:amd64 (2.24.32-1ubuntu1) ...\n", + "Setting up libvlc5:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up libgail18:amd64 (2.24.32-1ubuntu1) ...\n", + "Setting up libxrandr-dev:amd64 (2:1.5.1-1) ...\n", + "Setting up libcairo2-dev:amd64 (1.15.10-2ubuntu0.1) ...\n", + "Setting up gettext (0.19.8.1-6ubuntu0.3) ...\n", + "Setting up libxcomposite-dev:amd64 (1:0.4.4-2) ...\n", + "Setting up fp-units-fv-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up fp-compiler-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "update-alternatives: using /usr/bin/x86_64-linux-gnu-fpc-3.0.4 to provide /usr/bin/fpc (fpc) in auto mode\n", + "update-alternatives: using /etc/fpc-3.0.4.cfg to provide /etc/fpc.cfg (fpc.cfg) in auto mode\n", + "update-alternatives: using /usr/bin/fpc to provide /usr/bin/pc (pc) in auto mode\n", + "Setting up fp-units-gfx-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libsdl-mixer1.2:amd64 (1.2.12-14) ...\n", + "Setting up fp-units-fcl-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgail-common:amd64 (2.24.32-1ubuntu1) ...\n", + "Setting up autoconf (2.69-11) ...\n", + "Setting up libmikmod-dev:amd64 (3.3.11.1-3) ...\n", + "Setting up fp-units-misc-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgvc6-plugins-gtk (2.40.1-2) ...\n", + "Setting up fp-units-net-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up file (1:5.32-2ubuntu0.4) ...\n", + "Setting up fp-units-db-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up libgraphviz-dev (2.40.1-2) ...\n", + "Setting up intltool-debian (0.35.0+20060710.4) ...\n", + "Setting up libcaca-dev (0.99.beta19-2ubuntu0.18.04.3) ...\n", + "Setting up libserf-1-1:amd64 (1.3.9-6) ...\n", + "Setting up libvlc-bin:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up lcl-utils-1.8 (1.8.2+dfsg-3) ...\n", + "update-alternatives: using /usr/lib/lazarus/1.8.2 to provide /usr/lib/lazarus/default (lazarus) in auto mode\n", + "Setting up libsdl1.2-dev (1.2.15+dfsg2-0.1ubuntu0.2) ...\n", + "Setting up automake (1:1.15.1-3ubuntu2) ...\n", + "update-alternatives: using /usr/bin/automake-1.15 to provide /usr/bin/automake (automake) in auto mode\n", + "Setting up libvlc-dev:amd64 (3.0.8-0ubuntu18.04.1) ...\n", + "Setting up libdts-dev:amd64 (0.0.5-10) ...\n", + "Setting up libsvn1:amd64 (1.9.7-4ubuntu1.1) ...\n", + "Setting up libpango1.0-dev (1.40.14-1ubuntu0.1) ...\n", + "Setting up gdb (8.1.1-0ubuntu1) ...\n", + "Setting up libsdl-mixer1.2-dev:amd64 (1.2.12-14) ...\n", + "Setting up gir1.2-gtk-2.0 (2.24.32-1ubuntu1) ...\n", + "Setting up libgtk2.0-bin (2.24.32-1ubuntu1) ...\n", + "Setting up libtool (2.4.6-2) ...\n", + "Setting up lazarus-ide-1.8 (1.8.2+dfsg-3) ...\n", + "update-alternatives: using /usr/lib/lazarus/1.8.2/startlazarus to provide /usr/bin/lazarus-ide (lazarus-ide) in auto mode\n", + "Setting up po-debconf (1.0.20) ...\n", + "Setting up lcl-nogui-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up libgtk2.0-dev (2.24.32-1ubuntu1) ...\n", + "Setting up lazarus-ide-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "update-alternatives: using /usr/lib/lazarus/1.8.2/lazarus-gtk2 to provide /usr/lib/lazarus/1.8.2/lazarus (lazarus-1.8.2) in auto mode\n", + "Setting up subversion (1.9.7-4ubuntu1.1) ...\n", + "Setting up fp-units-gtk2-3.0.4:amd64 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up lazarus-ide (1.8.2+dfsg-3) ...\n", + "Setting up fpc-3.0.4 (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up lcl-gtk2-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up lcl-units-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up fpc (3.0.4+dfsg-18ubuntu2) ...\n", + "Setting up lcl-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up lazarus-1.8 (1.8.2+dfsg-3) ...\n", + "Setting up lazarus (1.8.2+dfsg-3) ...\n", + "Setting up dh-autoreconf (17) ...\n", + "Setting up debhelper (11.1.6ubuntu2) ...\n", + "Setting up dh-strip-nondeterminism (0.040-1.1~build1) ...\n", + "Processing triggers for libc-bin (2.27-3ubuntu1.3) ...\n", + "/sbin/ldconfig.real: /usr/local/lib/python3.7/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link\n", + "\n", + "Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n", + "Processing triggers for mime-support (3.60ubuntu1) ...\n", + "Processing triggers for libvlc-bin:amd64 (3.0.8-0ubuntu18.04.1) ...\n" + ] + } + ], + "source": [ + "!apt-get update\n", + "!apt-get install -y fpc fpc-source lazarus git subversion zip unzip" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "KG8FLb8otXDe", + "outputId": "e6f619f0-d0e1-4774-870f-3a999030fbf1" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "A mtprocs/examples\n", + "A mtprocs/examples/parallelloop1.lpr\n", + "A mtprocs/examples/parallelloop_nested1.lpi\n", + "A mtprocs/examples/parallelloop_nested1.lpr\n", + "A mtprocs/examples/recursivemtp1.lpr\n", + "A mtprocs/examples/simplemtp1.lpr\n", + "A mtprocs/examples/parallelloop1.lpi\n", + "A mtprocs/examples/recursivemtp1.lpi\n", + "A mtprocs/examples/simplemtp1.lpi\n", + "A mtprocs/examples/testmtp1.lpi\n", + "A mtprocs/examples/testmtp1.lpr\n", + "A mtprocs/Readme.txt\n", + "A mtprocs/mtprocs.pas\n", + "A mtprocs/mtpcpu.pas\n", + "A mtprocs/multithreadprocslaz.lpk\n", + "A mtprocs/mtputils.pas\n", + "A mtprocs/multithreadprocslaz.pas\n", + "Checked out revision 8330.\n" + ] + } + ], + "source": [ + "!svn checkout https://svn.code.sf.net/p/lazarus-ccr/svn/components/multithreadprocs mtprocs" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "3jYzXKwItXDi", + "outputId": "48e46636-e403-44bf-f5b6-ae4676871769" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Cloning into 'k'...\n", + "remote: Enumerating objects: 1751, done.\u001b[K\n", + "remote: Counting objects: 100% (163/163), done.\u001b[K\n", + "remote: Compressing objects: 100% (115/115), done.\u001b[K\n", + "remote: Total 1751 (delta 106), reused 98 (delta 48), pack-reused 1588\u001b[K\n", + "Receiving objects: 100% (1751/1751), 15.62 MiB | 20.50 MiB/s, done.\n", + "Resolving deltas: 100% (1219/1219), done.\n", + "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n", + "Processing /content/k\n", + "\u001b[33m DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.\n", + " pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.\u001b[0m\n", + "Requirement already satisfied: pandas>=0.22.0 in /usr/local/lib/python3.7/dist-packages (from cai==0.1.7) (1.3.5)\n", + "Requirement already satisfied: scikit-image>=0.15.0 in /usr/local/lib/python3.7/dist-packages (from cai==0.1.7) (0.18.3)\n", + "Requirement already satisfied: opencv-python>=4.1.2.30 in /usr/local/lib/python3.7/dist-packages (from cai==0.1.7) (4.1.2.30)\n", + "Requirement already satisfied: scikit-learn>=0.21.0numpy in /usr/local/lib/python3.7/dist-packages (from cai==0.1.7) (1.0.2)\n", + "Requirement already satisfied: numpy>=1.14.5 in /usr/local/lib/python3.7/dist-packages (from opencv-python>=4.1.2.30->cai==0.1.7) (1.21.6)\n", + "Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.22.0->cai==0.1.7) (2.8.2)\n", + "Requirement already satisfied: pytz>=2017.3 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.22.0->cai==0.1.7) (2022.1)\n", + "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.7.3->pandas>=0.22.0->cai==0.1.7) (1.15.0)\n", + "Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.15.0->cai==0.1.7) (2.6.3)\n", + "Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.15.0->cai==0.1.7) (2021.11.2)\n", + "Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.15.0->cai==0.1.7) (3.2.2)\n", + "Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.15.0->cai==0.1.7) (2.4.1)\n", + "Requirement already satisfied: pillow!=7.1.0,!=7.1.1,>=4.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.15.0->cai==0.1.7) (7.1.2)\n", + "Requirement already satisfied: scipy>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.15.0->cai==0.1.7) (1.4.1)\n", + "Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.15.0->cai==0.1.7) (1.3.0)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image>=0.15.0->cai==0.1.7) (0.11.0)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image>=0.15.0->cai==0.1.7) (1.4.3)\n", + "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image>=0.15.0->cai==0.1.7) (3.0.9)\n", + "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from kiwisolver>=1.0.1->matplotlib!=3.0.0,>=2.0.0->scikit-image>=0.15.0->cai==0.1.7) (4.1.1)\n", + "Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn>=0.21.0numpy->cai==0.1.7) (1.1.0)\n", + "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn>=0.21.0numpy->cai==0.1.7) (3.1.0)\n", + "Building wheels for collected packages: cai\n", + " Building wheel for cai (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for cai: filename=cai-0.1.7-py3-none-any.whl size=60924 sha256=be448a3c2afc0d8c64dbd2d39ede8a5a4755c39ad7f049b82f604a88a4ba1362\n", + " Stored in directory: /tmp/pip-ephem-wheel-cache-jbgb3mkw/wheels/c1/8a/57/56dbba25eff58e52e5365435c4fa102ad8d6f9787d3b4db13a\n", + "Successfully built cai\n", + "Installing collected packages: cai\n", + "Successfully installed cai-0.1.7\n" + ] + } + ], + "source": [ + "import os\n", + "import urllib.request\n", + "\n", + "if not os.path.isdir('k'):\n", + " !git clone https://github.com/joaopauloschuler/k-neural-api.git k\n", + "else:\n", + " !cd k && git pull\n", + "\n", + "!cd k && pip install ." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "id": "Ei8Tkp3KtXDm" + }, + "outputs": [], + "source": [ + "import cai.layers\n", + "import cai.datasets\n", + "import cai.models" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "oV0vobjAtXDn", + "outputId": "ef570caa-2089-4f20-ab35-096ade9408a0" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Downloading CIFAR-10 Files\n", + "cifar-10-batches-bin/\n", + "cifar-10-batches-bin/data_batch_1.bin\n", + "cifar-10-batches-bin/batches.meta.txt\n", + "cifar-10-batches-bin/data_batch_3.bin\n", + "cifar-10-batches-bin/data_batch_4.bin\n", + "cifar-10-batches-bin/test_batch.bin\n", + "cifar-10-batches-bin/readme.html\n", + "cifar-10-batches-bin/data_batch_5.bin\n", + "cifar-10-batches-bin/data_batch_2.bin\n", + "Copying CIFAR-10 files to current folder\n" + ] + } + ], + "source": [ + "if (has_cifar_10):\n", + " if not os.path.isfile('cifar-10-batches-bin/data_batch_1.bin'):\n", + " print(\"Downloading CIFAR-10 Files\")\n", + " url = 'https://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz'\n", + " urllib.request.urlretrieve(url, './file.tar')\n", + " !tar -xvf ./file.tar\n", + " if not os.path.isfile('./data_batch_1.bin'):\n", + " print(\"Copying CIFAR-10 files to current folder\")\n", + " !cp ./cifar-10-batches-bin/* ./" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "id": "8qQifzbMtXDq" + }, + "outputs": [], + "source": [ + "if (has_tiny_imagenet_200):\n", + " url_zip_file=\"http://cs231n.stanford.edu/tiny-imagenet-200.zip/"\n", + " local_zip_file=\"tiny-imagenet-200.zip\"\n", + " expected_folder_name=\"download-tiny-imagenet-200\"\n", + " Verbose=True\n", + " cai.datasets.download_zip_and_extract(\n", + " url_zip_file=url_zip_file, local_zip_file=local_zip_file, \n", + " expected_folder_name=expected_folder_name, Verbose=Verbose)\n", + " if os.path.isdir('download-tiny-imagenet-200/tiny-imagenet-200'):\n", + " !mv download-tiny-imagenet-200/tiny-imagenet-200 tiny-imagenet-200" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "id": "hk_1-NcntXDt" + }, + "outputs": [], + "source": [ + "if (has_plant_leaf_disease):\n", + " url_zip_file=\"https://data.mendeley.com/datasets/tywbtsjrjv/1/files/d5652a28-c1d8-4b76-97f3-72fb80f94efc/Plant_leaf_diseases_dataset_without_augmentation.zip?dl=1\"\n", + " local_zip_file=\"plant_leaf.zip\"\n", + " expected_folder_name=\"plant_leaf\"\n", + " Verbose=True\n", + " cai.datasets.download_zip_and_extract(\n", + " url_zip_file=url_zip_file, local_zip_file=local_zip_file, \n", + " expected_folder_name=expected_folder_name, Verbose=Verbose)\n", + " if os.path.isdir('plant_leaf/Plant_leave_diseases_dataset_without_augmentation'):\n", + " !mv plant_leaf/Plant_leave_diseases_dataset_without_augmentation plant" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "eUs8CJjqtXDu", + "outputId": "d8795909-dc0f-485c-8ed2-89e424e47eae" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "A neural-api/neural\n", + "A neural-api/examples\n", + "A neural-api/examples/ResNet\n", + "A neural-api/examples/ResNet/results\n", + "A neural-api/examples/XorAndOr\n", + "A neural-api/examples/SimpleImageClassifier\n", + "A neural-api/examples/SimpleImageClassifier/results\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifierPadCropSwishChannelShift1pc20211015.csv\n", + "A neural-api/examples/ResNet/CaiResNet20.lpi\n", + "A neural-api/examples/ResNet/ResNet20.lpr\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifierPaddingCropping20210323.csv\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifierResize48-20200423.csv\n", + "A neural-api/examples/XorAndOr/XorAndOr.lpr\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpr\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifier20211111.csv\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifierSwish20211014.csv\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifier20191012.csv\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifierSharedWeights20201203.csv\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifier20191102.csv\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierPaddingCroppingSwish.lpr\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierPaddingCroppingSwish.lpi\n", + "A neural-api/neural/neuralfit.pas\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierSwish.lpi\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierReLU6.lpr\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierGroupedConv.lpr\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierGroupedConv.lpi\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierSharedWeights.lpi\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierPaddingCropping.lpi\n", + "A neural-api/neural/neuralvolume.pas\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierResize64.lpr\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierResize48.lpr\n", + "A neural-api/examples/Hypotenuse\n", + "A neural-api/examples/HypotenuseFitLoading\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierResize48.lpi\n", + "A neural-api/neural/neuralnetwork.pas\n", + "A neural-api/neural/neuraldatasets.pas\n", + "A neural-api/neural/neuralasm.inc\n", + "A neural-api/neural/neuralgeneric.pas\n", + "A neural-api/examples/CaiOptimizedDenseNet\n", + "A neural-api/examples/CaiOptimizedDenseNet/results\n", + "A neural-api/neural/neuralbyteprediction.pas\n", + "A neural-api/neural/neuralcache.pas\n", + "A neural-api/neural/neuralabfun.pas\n", + "A neural-api/examples/Hypotenuse/Hypotenuse.lpr\n", + "A neural-api/neural/neuralab.pas\n", + "A neural-api/examples/SelfTest\n", + "A neural-api/examples/HypotenuseFitLoading/HypotenuseFitLoading.lpi\n", + "A neural-api/neural/neuralthread.pas\n", + "A neural-api/neural/neuralnetwork.inc\n", + "A neural-api/neural/neural.cl\n", + "A neural-api/examples/CaiOptimizedDenseNet/results/CaiOptimizedDenseNet20211117.csv\n", + "A neural-api/examples/VisualGANTinyImagenet\n", + "A neural-api/neural/neuralopencl.pas\n", + "A neural-api/examples/CaiOptimizedDenseNet/kOptimizedDenseNet.lpi\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierCPUResize48.ipynb\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifier.lpi\n", + "A neural-api/examples/HypotenuseFitLoading/HypotenuseFitLoading.lpr\n", + "A neural-api/neural/neuraldatasetsv.pas\n", + "A neural-api/neural/neuralvolumev.pas\n", + "A neural-api/neural/neuralbit.pas\n", + "A neural-api/examples/CaiOptimizedDenseNet/results/CaiOptimizedDenseNet20211030.csv\n", + "A neural-api/neural/neuralevolutionary.pas\n", + "A neural-api/neural/neuralopenclv.pas\n", + "A neural-api/examples/CaiOptimizedDenseNet/CaiOptimizedDenseNet.lpr\n", + "A neural-api/examples/CaiOptimizedDenseNet/CaiOptimizedDenseNet48.lpr\n", + "A neural-api/examples/SelfTest/SelfTest.lpi\n", + "A neural-api/neural/neuralplanbuilder.pas\n", + "A neural-api/examples/VisualGANTinyImagenet/uvisualgantinyimagenetbirds2.lfm\n", + "A neural-api/neural/readme.txt\n", + "A neural-api/examples/ResNet/CaiResNet20Cifar100Digits.lpi\n", + "A neural-api/examples/ResNet/CaiResNet20Cifar100Digits.lpr\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetBirds2.lpr\n", + "A neural-api/examples/ResNet/results/CaiResNet20-20212512.csv\n", + "A neural-api/examples/ResNet/results/ResNet20-20212512.csv\n", + "A neural-api/examples/VisualGANTinyImagenet/uvisualgantinyimagenetbirds.pas\n", + "A neural-api/examples/ResNet/CaiResNet20.lpr\n", + "A neural-api/examples/LearnDigital\n", + "A neural-api/examples/Cifar10Resize\n", + "A neural-api/examples/ResNet/ResNet20.lpi\n", + "A neural-api/examples/XorAndOr/XorAndOr.lpi\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifierPaddingCroppingSwish20211111.csv\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifierPaddingCroppingSwish20211014.csv\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetBirds.lpr\n", + "A neural-api/examples/MiningAgent\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifierPaddingCropping20210318.csv\n", + "A neural-api/examples/VisualGANTinyImagenet/uvisualgantinyimagenet.pas\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifierResize64-20200423.csv\n", + "A neural-api/examples/SimpleImageClassifier/results/SimpleImageClassifier20191111.csv\n", + "A neural-api/examples/VisualGANTinyImagenet/uvisualgantinyimagenettiled.pas\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierReLU6.lpi\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetTiled.res\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierSwish.lpr\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierPaddingCropping.lpr\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierSharedWeights.lpr\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierResize64.lpi\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenet.lpr\n", + "A neural-api/examples/SimpleImageClassifier/SimpleImageClassifierCPU.ipynb\n", + "A neural-api/examples/SimplePlantLeafDisease\n", + "A neural-api/examples/SimplePlantLeafDisease/results\n", + "A neural-api/examples/Hypotenuse/Hypotenuse.lpi\n", + "A neural-api/examples/CaiOptimizedDenseNet/kOptimizedDenseNet.lpr\n", + "A neural-api/examples/Cifar10Resize/Cifar10Resize.lpr\n", + "A neural-api/examples/MiningAgent/PMinera.res\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetTiled.ico\n", + "A neural-api/examples/CaiOptimizedDenseNet/CaiOptimizedDenseNet.ipynb\n", + "A neural-api/examples/SelfTest/SelfTest.lpr\n", + "A neural-api/examples/CaiOptimizedDenseNet/results/CaiOptimizedDenseNet20191018.csv\n", + "A neural-api/examples/CaiOptimizedDenseNet/CaiOptimizedDenseNet48.lpi\n", + "A neural-api/examples/CaiOptimizedDenseNet/CaiOptimizedDenseNet.lpi\n", + "A neural-api/examples/GradientAscent\n", + "A neural-api/examples/MiningAgent/UForOptMin.lfm\n", + "A neural-api/examples/MiningAgent/UVPlan.lfm\n", + "A neural-api/examples/VisualGANTinyImagenet/uvisualgantinyimagenetbirds2.pas\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetBirds2.lpi\n", + "A neural-api/examples/VisualGANTinyImagenet/uvisualgantinyimagenetbirds.lfm\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetBirds.lpi\n", + "A neural-api/examples/SimpleImageClassifierParallel\n", + "A neural-api/examples/SimpleImageClassifierParallel/results\n", + "A neural-api/examples/VisualAutoencoder\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetBirds2.ico\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetBirds2.res\n", + "A neural-api/examples/VisualGANTinyImagenet/uvisualgantinyimagenet.lfm\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetTiled.lpr\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetBirds.ico\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenet.lpi\n", + "A neural-api/examples/LearnDigital/LearnDigitalSumSub.lpr\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetBirds.res\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenetTiled.lpi\n", + "A neural-api/examples/VisualGANTinyImagenet/uvisualgantinyimagenettiled.lfm\n", + "A neural-api/examples/SuperResolution\n", + "A neural-api/examples/SuperResolution/results\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenet.res\n", + "A neural-api/examples/Cifar10Resize/Cifar10Resize.lpi\n", + "A neural-api/examples/MiningAgent/PMinera.ico\n", + "A neural-api/examples/MiningAgent/UForOptMin.pas\n", + "A neural-api/examples/MiningAgent/UVPlan.pas\n", + "A neural-api/examples/SimplePlantLeafDisease/SimplePlantLeafDiseaseLoading.lpi\n", + "A neural-api/examples/MiningAgent/PMinera.lpi\n", + "A neural-api/examples/MiningAgent/UFRob1.lfm\n", + "A neural-api/examples/VisualGANTinyImagenet/VisualGANTinyImagenet.ico\n", + "A neural-api/examples/LearnDigital/LearnDigitalSumSub.lpi\n", + "A neural-api/examples/SimplePlantLeafDisease/SimplePlantLeafDiseaseLoading.pas\n", + "A neural-api/examples/MiningAgent/UFRob1.pas\n", + "A neural-api/examples/MiningAgent/PMinera.lpr\n", + "A neural-api/examples/MiningAgent/URobMin.pas\n", + "A neural-api/examples/SimplePlantLeafDisease/SimplePlantLeafDiseaseLoadingAPI.pas\n", + "A neural-api/examples/SimplePlantLeafDisease/SimplePlantLeafDiseaseParallel.pas\n", + "A neural-api/examples/SimplePlantLeafDisease/results/SimplePlantLeafDisease-20200412.csv\n", + "A neural-api/examples/SimpleImageClassifierGPU\n", + "A neural-api/examples/SimpleImageClassifierGPU/results\n", + "A neural-api/examples/MiningAgent/URobMin2.pas\n", + "A neural-api/examples/SimplePlantLeafDisease/SimplePlantLeafDiseaseParallel.lpi\n", + "A neural-api/examples/SimplePlantLeafDisease/SimplePlantLeafDisease.pas\n", + "A neural-api/examples/SimplePlantLeafDisease/SimplePlantLeafDiseaseLoadingAPI.lpi\n", + "A neural-api/examples/SimplePlantLeafDisease/SimplePlantLeafDisease.lpi\n", + "A neural-api/examples/VisualGAN\n", + "A neural-api/examples/SimplePlantLeafDisease/results/SimplePlantLeafDiseaseParallel-20200811.csv\n", + "A neural-api/examples/GradientAscent/ugradientascent.pas\n", + "A neural-api/examples/SimplePlantLeafDisease/SimplePlantLeafDisease.ipynb\n", + "A neural-api/examples/GradientAscent/ugradientascent.lfm\n", + "A neural-api/examples/GradientAscent/GradientAscent.lpr\n", + "A neural-api/examples/SimpleTinyImageNet\n", + "A neural-api/examples/SimpleTinyImageNet/results\n", + "A neural-api/examples/GradientAscent/GradientAscent.lpi\n", + "A neural-api/examples/GradientAscent/GradientAscent.ico\n", + "A neural-api/examples/GradientAscent/GradientAscent.res\n", + "A neural-api/examples/SimpleImageClassifierParallel/SimpleImageClassifierParallel.pas\n", + "A neural-api/examples/SimpleImageClassifierParallel/SimpleImageClassifierParallel.lpi\n", + "A neural-api/examples/SimpleFashionMNIST\n", + "A neural-api/examples/SimpleFashionMNIST/results\n", + "A neural-api/examples/SimpleImageClassifierParallel/results/SimpleImageClassifierParallel.csv\n", + "A neural-api/examples/VisualAutoencoder/uvisualautoencodertinyimagenet.lfm\n", + "A neural-api/examples/VisualAutoencoder/VisualAutoencoder.lpi\n", + "A neural-api/examples/VisualAutoencoder/uvisualautoencodertinyimagenet.pas\n", + "A neural-api/examples/VisualAutoencoder/VisualAutoencoder.ico\n", + "A neural-api/examples/ViewInnerPatterns\n", + "A neural-api/examples/VisualAutoencoder/VisualAutoencoder.lpr\n", + "A neural-api/examples/SuperResolution/SuperResolution.lpr\n", + "A neural-api/examples/VisualAutoencoder/VisualAutoencoder.res\n", + "A neural-api/examples/SuperResolution/results/stealth.png\n", + "A neural-api/examples/SuperResolution/results/building_result.png\n", + "A neural-api/examples/ImageClassifierSELU\n", + "A neural-api/examples/ImageClassifierSELU/results\n", + "A neural-api/examples/SuperResolution/usuperresolutionexample.pas\n", + "A neural-api/examples/SuperResolution/results/SuperResolutionImageClassifierResize64-20200420.csv\n", + "A neural-api/examples/SuperResolution/results/street_result.png\n", + "A neural-api/examples/SuperResolution/SuperResolution.lpi\n", + "A neural-api/examples/SuperResolution/Cifar10ImageClassifierSuperResolution.lpr\n", + "A neural-api/examples/DenseNetBCL40\n", + "A neural-api/examples/DenseNetBCL40/results\n", + "A neural-api/examples/SuperResolution/SuperResolutionApp.lpr\n", + "A neural-api/examples/SuperResolution/SuperResolutionApp.res\n", + "A neural-api/examples/SuperResolution/super-resolution-train.ipynb\n", + "A neural-api/examples/SuperResolution/SuperResolutionTrain.lpi\n", + "A neural-api/examples/SimpleImageClassifierGPU/SimpleImageClassifierGPU.ipynb\n", + "A neural-api/examples/DenseNetFashionMNIST\n", + "A neural-api/examples/DenseNetFashionMNIST/results\n", + "A neural-api/examples/SimpleImageClassifierGPU/SimpleImageClassifierGPU.lpr\n", + "A neural-api/examples/SuperResolution/super-resolution-7-64-sep.nn\n", + "A neural-api/examples/SuperResolution/results/bird.png\n", + "A neural-api/examples/VisualGAN/uvisualgan.lfm\n", + "A neural-api/examples/Cifar100CaiDenseNet\n", + "A neural-api/examples/Cifar100CaiDenseNet/results\n", + "A neural-api/examples/SimpleMNist\n", + "A neural-api/examples/VisualGAN/VisualGAN.lpi\n", + "A neural-api/examples/SuperResolution/SuperResolutionApp.ico\n", + "A neural-api/examples/SuperResolution/usuperesolutionapp.lfm\n", + "A neural-api/examples/SuperResolution/Cifar10ImageClassifierSuperResolution.lpi\n", + "A neural-api/examples/SimpleImageClassifierGPU/SimpleImageClassifierGPU.lpi\n", + "A neural-api/examples/SimpleMNist/results\n", + "A neural-api/examples/IdentityShortcutConnection\n", + "A neural-api/examples/SuperResolution/results/SuperResolutionImageClassifierResize64-20200423.csv\n", + "A neural-api/examples/SuperResolution/SuperResolutionTrain.lpr\n", + "A neural-api/examples/SimpleTinyImageNet/results/SimpleTinyImageNet200.csv\n", + "A neural-api/examples/SuperResolution/SuperResolutionApp.lpi\n", + "A neural-api/examples/SeparableConvolution\n", + "A neural-api/experiments\n", + "A neural-api/experiments/supersimple\n", + "A neural-api/examples/SuperResolution/usuperesolutionapp.pas\n", + "A neural-api/examples/VisualGAN/VisualGAN.res\n", + "A neural-api/examples/SimpleFashionMNIST/SimpleFashionMNIST.lpr\n", + "A neural-api/examples/SimpleTinyImageNet/SimpleTinyImageNet.lpi\n", + "A neural-api/experiments/mining\n", + "A neural-api/examples/SimpleImageClassifierGPU/results/SimpleImageClassifierGPU-20200525.csv\n", + "A neural-api/examples/VisualGAN/VisualGAN.ico\n", + "A neural-api/examples/VisualGAN/uvisualgan.pas\n", + "A neural-api/examples/VisualGAN/VisualGAN.lpr\n", + "A neural-api/examples/ViewInnerPatterns/uviewinnerpatterns.pas\n", + "A neural-api/examples/SimpleTinyImageNet/SimpleTinyImageNet.pas\n", + "A neural-api/examples/ViewInnerPatterns/uviewinnerpatterns.lfm\n", + "A neural-api/examples/SimpleFashionMNIST/results/SimpleFashionMNIST20191018.csv\n", + "A neural-api/examples/ViewInnerPatterns/ViewInnerPatterns.lpr\n", + "A neural-api/examples/ViewInnerPatterns/ViewInnerPatterns.res\n", + "A neural-api/examples/ImageClassifierSELU/ImageClassifierSELU.ipynb\n", + "A neural-api/examples/ViewInnerPatterns/ViewInnerPatterns.lpi\n", + "A neural-api/examples/ImageClassifierSELU/ImageClassifierSELU.lpr\n", + "A neural-api/experiments/IncreaseResolution\n", + "A neural-api/examples/ImageClassifierSELU/results/ImageClassifierSELU20191102.csv\n", + "A neural-api/examples/DenseNetBCL40/results/DenseNetBLC40-SELU.csv\n", + "A neural-api/examples/DenseNetBCL40/results/DenseNetBLC40-I0.5-20191028.csv\n", + "A neural-api/examples/DenseNetBCL40/results/DenseNetBLC40-20191024.csv\n", + "A neural-api/examples/DenseNetFashionMNIST/results/DenseNetFashionMNIST-20191025.csv\n", + "A neural-api/examples/DenseNetFashionMNIST/DenseNetFashionMNIST.lpr\n", + "A neural-api/examples/DenseNetBCL40/DenseNetBCL40.lpi\n", + "A neural-api/examples/Cifar100CaiDenseNet/Cifar100CaiDenseNet.lpi\n", + "A neural-api/examples/SimpleTinyImageNet/tiny-imagenet-200.ipynb\n", + "A neural-api/examples/SimpleFashionMNIST/SimpleFashionMNIST.lpi\n", + "A neural-api/examples/Cifar100CaiDenseNet/Cifar100CaiDenseNet.lpr\n", + "A neural-api/experiments/tinyImageNet200\n", + "A neural-api/examples/Cifar100CaiDenseNet/results/Cifar100CaiDenseNet20191020.csv\n", + "A neural-api/examples/SimpleMNist/SimpleMNist.lpi\n", + "A neural-api/examples/ViewInnerPatterns/ViewInnerPatterns.ico\n", + "A neural-api/examples/ImageClassifierSELU/results/ImageClassifierSELU20191109.csv\n", + "A neural-api/examples/ImageClassifierSELU/ImageClassifierSELU.lpi\n", + "A neural-api/examples/DenseNetBCL40/DenseNetBCL40.lpr\n", + "A neural-api/examples/DenseNetFashionMNIST/DenseNetFashionMNIST.lpi\n", + "A neural-api/examples/SimpleMNist/SimpleMNist.lpr\n", + "A neural-api/experiments/visualCifar10BatchUpdate\n", + "A neural-api/examples/SimpleMNist/results/SimpleMNist20191014.png\n", + "A neural-api/examples/IdentityShortcutConnection/IdentityShortcutConnection.lpi\n", + "A neural-api/examples/SeparableConvolution/SeparableConvolution.lpr\n", + "A neural-api/experiments/testcnnalgo\n", + "A neural-api/examples/SimpleMNist/results/SimpleMNist20191014.csv\n", + "A neural-api/examples/IdentityShortcutConnection/IdentityShortcutConnection.ipynb\n", + "A neural-api/examples/SeparableConvolution/SeparableConvolution.lpi\n", + "A neural-api/experiments/mining/PMinera.lpi\n", + "A neural-api/experiments/mining/PMinera.res\n", + "A neural-api/experiments/supersimple/supersimple.lpi\n", + "A neural-api/experiments/visualCifar10AnimalMachine\n", + "A neural-api/examples/IdentityShortcutConnection/IdentityShortcutConnection.pas\n", + "A neural-api/experiments/supersimple/supersimple.lpr\n", + "A neural-api/experiments/mining/UFRob1.pas\n", + "A neural-api/experiments/mining/UFRob1.lfm\n", + "A neural-api/experiments/mining/UForOptMin.lfm\n", + "A neural-api/experiments/visualCifar10OpenCL\n", + "A neural-api/experiments/mining/PMinera.lpr\n", + "A neural-api/experiments/mining/UForOptMin.pas\n", + "A neural-api/experiments/mining/PMinera.ico\n", + "A neural-api/experiments/mining/URobMin2.pas\n", + "A neural-api/experiments/IncreaseResolution/uincreaseresolutionapp.lfm\n", + "A neural-api/experiments/visualCifar10learning\n", + "A neural-api/experiments/mining/UVPlan.pas\n", + "A neural-api/experiments/mining/URobMin.pas\n", + "A neural-api/experiments/mining/UVPlan.lfm\n", + "A neural-api/experiments/IncreaseResolution/IncreaseResolutionApp.lpr\n", + "A neural-api/experiments/IncreaseResolution/IncreaseResolutionApp.lpi\n", + "A neural-api/experiments/visualCifar10learning2\n", + "A neural-api/experiments/IncreaseResolution/IncreaseResolutionApp.ico\n", + "A neural-api/experiments/IncreaseResolution/IncreaseResolutionLearning.ico\n", + "A neural-api/experiments/IncreaseResolution/IncreaseResolutionLearning.lpi\n", + "A neural-api/experiments/IncreaseResolution/uincreaseresolutionapp.pas\n", + "A neural-api/experiments/IncreaseResolution/IncreaseResolutionApp.res\n", + "A neural-api/experiments/IncreaseResolution/IncreaseResolutionLearning.res\n", + "A neural-api/experiments/visualCifar10test\n", + "A neural-api/experiments/IncreaseResolution/uincreaseresolutionlearn.lfm\n", + "A neural-api/experiments/IncreaseResolution/uresizeutil.pas\n", + "A neural-api/experiments/tinyImageNet200/utinyimagenet200.lfm\n", + "A neural-api/experiments/tinyImageNet200/utinyimagenet200.pas\n", + "A neural-api/experiments/tinyImageNet200/tinyImageNet200Update.res\n", + "A neural-api/experiments/3dCellularAutomata\n", + "A neural-api/experiments/visualCifar10BatchUpdate/visualCifar10learningBatchUpdate.lpr\n", + "A neural-api/experiments/visualCifar10BatchUpdate/visualCifar10learningBatchUpdate.ico\n", + "A neural-api/experiments/visualCifar10AnimalMachine/uvisualcifar10animalmachine.pas\n", + "A neural-api/experiments/tinyImageNet200/tinyImageNet200Update.lpr\n", + "A neural-api/experiments/tinyImageNet200/tinyImageNet200Update.ico\n", + "A neural-api/experiments/IncreaseResolution/IncreaseResolutionLearning.lpr\n", + "A neural-api/experiments/IncreaseResolution/uincreaseresolutionlearn.pas\n", + "A neural-api/experiments/tinyImageNet200/tinyImageNet200Update.lpi\n", + "A neural-api/experiments/visualCifar10BatchUpdate/visualCifar10learningBatchUpdate.lpi\n", + "A neural-api/experiments/ConwayGameOfLife\n", + "A neural-api/experiments/visualCifar10BatchUpdate/uvisualcifar10learningbatchupdate.pas\n", + "A neural-api/experiments/testcnnalgo/testcnnalgo.lpi\n", + "A neural-api/experiments/visualCifar10AnimalMachine/visualCifar10AnimalMachine.lpi\n", + "A neural-api/experiments/visualCifar10AnimalMachine/visualCifar10AnimalMachine.lpr\n", + "A neural-api/experiments/visualCifar10BatchUpdate/visualCifar10learningBatchUpdate.res\n", + "A neural-api/experiments/testcnnalgo/testcnnalgo.lpr\n", + "A neural-api/experiments/visualCifar10OpenCL/uvisualcifar10learningopencl.pas\n", + "A neural-api/experiments/visualCifar10BatchUpdate/uvisualcifar10learningbatchupdate.lfm\n", + "A neural-api/experiments/visualCifar10OpenCL/visualCifar10learningOpenCL.ico\n", + "A neural-api/experiments/LifeAppearance\n", + "A neural-api/experiments/visualCifar10AnimalMachine/visualCifar10AnimalMachine.res\n", + "A neural-api/experiments/visualCifar10OpenCL/uvisualcifar10learningopencl.lfm\n", + "A neural-api/experiments/visualCifar10OpenCL/visualCifar10learningOpenCL.lpi\n", + "A neural-api/experiments/visualCifar10learning/visualCifar10learning.lpi\n", + "A neural-api/experiments/visualCifar10learning/uvisualcifar10learning.pas\n", + "A neural-api/experiments/MagicSquare\n", + "A neural-api/experiments/visualCifar10learning/visualCifar10learning.lpr\n", + "A neural-api/experiments/visualCifar10AnimalMachine/uvisualcifar10animalmachine.lfm\n", + "A neural-api/experiments/visualCifar10learning2/visualCifar10learning2.res\n", + "A neural-api/experiments/visualCifar10test/uvisualcifar10test.pas\n", + "A neural-api/experiments/visualCifar10AnimalMachine/visualCifar10AnimalMachine.ico\n", + "A neural-api/experiments/visualCifar10OpenCL/visualCifar10learningOpenCL.res\n", + "A neural-api/experiments/visualCifar10learning2/uvisualcifar10learning.lfm\n", + "A neural-api/experiments/visualCifar10learning/uvisualcifar10learning.lfm\n", + "A neural-api/experiments/visualCifar10learning2/visualCifar10learning2.ico\n", + "A neural-api/experiments/visualCifar10test/visualCifar10test.lpi\n", + "A neural-api/experiments/3dCellularAutomata/CellularAutomata3d.ico\n", + "A neural-api/experiments/3dCellularAutomata/Unit1.lfm\n", + "A neural-api/experiments/visualCifar10test/visualCifar10test.lpr\n", + "A neural-api/experiments/NeuralWebServer\n", + "A neural-api/experiments/visualCifar10learning/visualCifar10learning.ico\n", + "A neural-api/experiments/3dCellularAutomata/CellularAutomata3d.res\n", + "A neural-api/experiments/visualCifar10learning2/visualCifar10learning2.lpi\n", + "A neural-api/experiments/visualCifar10test/uvisualcifar10test.lfm\n", + "A neural-api/experiments/ConwayGameOfLife/JHC_GameOfLife.lpi\n", + "A neural-api/experiments/NineMensMorris\n", + "A neural-api/experiments/ConwayGameOfLife/JHC_GameOfLife.lpr\n", + "A neural-api/experiments/ConwayGameOfLife/UNIT1.DFM\n", + "A neural-api/experiments/visualCifar10OpenCL/visualCifar10learningOpenCL.lpr\n", + "A neural-api/experiments/ConwayGameOfLife/UNIT1.PAS\n", + "A neural-api/experiments/visualCifar10learning/visualCifar10learning.res\n", + "A neural-api/experiments/visualCifar10learning2/uvisualcifar10learning.pas\n", + "A neural-api/experiments/ConwayGameOfLife/lifeai.pas\n", + "A neural-api/experiments/visualCifar10learning2/visualCifar10learning2.lpr\n", + "A neural-api/experiments/LifeAppearance/LifeAppearance.res\n", + "A neural-api/experiments/visualCifar10test/visualCifar10test.res\n", + "A neural-api/experiments/MagicSquare/MagicSquare.ico\n", + "A neural-api/experiments/3dCellularAutomata/CellularAutomata3d.lpi\n", + "A neural-api/experiments/visualCifar10test/visualCifar10test.ico\n", + "A neural-api/experiments/3dCellularAutomata/CellularAutomata3d.lpr\n", + "A neural-api/experiments/ConwayGameOfLife/JHC_GameOfLife.ico\n", + "A neural-api/experiments/ConwayGameOfLife/LIFE2.ico\n", + "A neural-api/experiments/ConwayGameOfLife/about.pas\n", + "A neural-api/experiments/LifeAppearance/LifeAppearance.lpi\n", + "A neural-api/experiments/LifeAppearance/Unit1.pas\n", + "A neural-api/experiments/SOM-NeuralNetwork\n", + "A neural-api/experiments/3dCellularAutomata/Unit1.pas\n", + "A neural-api/experiments/ConwayGameOfLife/JHC_GameOfLife.res\n", + "A neural-api/experiments/ConwayGameOfLife/about.lfm\n", + "A neural-api/experiments/LifeAppearance/LifeAppearance.ico\n", + "A neural-api/experiments/MagicSquare/MagicSquare.lpr\n", + "A neural-api/experiments/MagicSquare/UDARR.PAS\n", + "A neural-api/experiments/supersimplecorrelation\n", + "A neural-api/experiments/supersimplehyperbolictangent\n", + "A neural-api/experiments/LifeAppearance/Unit1.lfm\n", + "A neural-api/experiments/MagicSquare/quada6g.lfm\n", + "A neural-api/experiments/MagicSquare/MagicSquare.lpi\n", + "A neural-api/experiments/MagicSquare/magic2.ico\n", + "A neural-api/experiments/MagicSquare/uabout.pas\n", + "A neural-api/experiments/visualCifar10MT\n", + "A neural-api/experiments/MagicSquare/uabout.dfm\n", + "A neural-api/experiments/NeuralWebServer/README.txt\n", + "A neural-api/experiments/NeuralWebServer/SimpleNeuralWebServer.ico\n", + "A neural-api/experiments/NeuralWebServer/SimpleNeuralWebServer.lpi\n", + "A neural-api/experiments/NeuralWebServer/SimpleNeuralWebServer.lpr\n", + "A neural-api/experiments/visualCifar10NTL\n", + "A neural-api/experiments/NeuralWebServer/usimpleneuralwebserver.lfm\n", + "A neural-api/experiments/NineMensMorris/MOINHO.ico\n", + "A neural-api/experiments/NeuralWebServer/usimpleneuralwebserver.pas\n", + "A neural-api/experiments/NineMensMorris/MOINHO.res\n", + "A neural-api/experiments/NineMensMorris/MOINHO.lpr\n", + "A neural-api/opencl\n", + "A neural-api/opencl/dot-product-test\n", + "A neural-api/experiments/NineMensMorris/UAUX.pas\n", + "A neural-api/experiments/NineMensMorris/TAB1.BMP\n", + "A neural-api/experiments/NineMensMorris/UVence.pas\n", + "A neural-api/experiments/NineMensMorris/UMOINHO.PAS\n", + "A neural-api/experiments/NineMensMorris/UIA.PAS\n", + "A neural-api/opencl/easy-trillion-test\n", + "A neural-api/experiments/NineMensMorris/dialog.pas\n", + "A neural-api/experiments/NineMensMorris/dialog.lfm\n", + "A neural-api/experiments/SOM-NeuralNetwork/PSOM1.lpi\n", + "A neural-api/experiments/SOM-NeuralNetwork/PSOM1.lpr\n", + "A neural-api/experiments/NineMensMorris/princ.pas\n", + "A neural-api/experiments/SOM-NeuralNetwork/USOM1.lfm\n", + "A neural-api/opencl/trillion-test\n", + "A neural-api/experiments/SOM-NeuralNetwork/URSOM.PAS\n", + "A neural-api/experiments/SOM-NeuralNetwork/USOM1.pas\n", + "A neural-api/experiments/supersimplehyperbolictangent/supersimplehyperbolictangent.lpi\n", + "A neural-api/experiments/supersimplehyperbolictangent/supersimplehyperbolictangent.lpr\n", + "A neural-api/experiments/supersimplecorrelation/supersimplecorrelation.lpi\n", + "A neural-api/experiments/visualCifar10MT/uvisualcifar10learningmt.lfm\n", + "A neural-api/experiments/visualCifar10MT/uvisualcifar10learningmt.pas\n", + "A neural-api/experiments/visualCifar10MT/visualCifar10learningMT.res\n", + "A neural-api/experiments/visualCifar10NTL/uvisualcifar10learningmt.pas\n", + "A neural-api/experiments/visualCifar10NTL/uvisualcifar10learningmt.lfm\n", + "A neural-api/experiments/visualCifar10MT/visualCifar10learningMT.ico\n", + "A neural-api/experiments/visualCifar10NTL/visualCifar10learningMT2.lpr\n", + "A neural-api/docs\n", + "A neural-api/experiments/visualCifar10NTL/visualCifar10learningMT2.lpi\n", + "A neural-api/experiments/visualCifar10NTL/visualCifar10learningMT2.res\n", + "A neural-api/opencl/dot-product-test/dot_product_test.res\n", + "A neural-api/opencl/dot-product-test/dot_product_test.lpr\n", + "A neural-api/opencl/dot-product-test/dot_product_test.lpi\n", + "A neural-api/libs\n", + "A neural-api/opencl/easy-trillion-test/easy_trillion_test.lpi\n", + "A neural-api/opencl/easy-trillion-test/ueasy_trillion_test_form.pas\n", + "A neural-api/opencl/dot-product-test/dot_product_test.ico\n", + "A neural-api/opencl/trillion-test/opencl_trillion_test.lpr\n", + "A neural-api/opencl/easy-trillion-test/ueasy_trillion_test_form.lfm\n", + "A neural-api/opencl/trillion-test/opencl_trillion_test.lpi\n", + "A neural-api/opencl/trillion-test/evolve_billion.cl\n", + "A neural-api/opencl/trillion-test/README.TXT\n", + "A neural-api/experiments/ConwayGameOfLife/lifeai.lfm\n", + "A neural-api/experiments/LifeAppearance/LifeAppearance.lpr\n", + "A neural-api/experiments/MagicSquare/MAGIC.ICO\n", + "A neural-api/experiments/MagicSquare/MagicSquare.res\n", + "A neural-api/opencl/easy-trillion-test/easy_trillion_test.lpr\n", + "A neural-api/opencl/easy-trillion-test/evolve_easy.cl\n", + "A neural-api/opencl/trillion-test/opencl_trillion_test.res\n", + "A neural-api/opencl/trillion-test/evolve_trillion.cl\n", + "A neural-api/docs/autoencoder_small.png\n", + "A neural-api/readme.txt\n", + "A neural-api/libs/ueasyopencl.pas\n", + "A neural-api/experiments/MagicSquare/quada6g.pas\n", + "A neural-api/libs/backup\n", + "A neural-api/thirdpartylibs\n", + "A neural-api/opencl/trillion-test/Frm_OpenCLTestMain.pas\n", + "A neural-api/libs/uab.pas\n", + "A neural-api/opencl/trillion-test/opencl_trillion_test.ico\n", + "A neural-api/LICENSE-EXCEPTION.LGPL\n", + "A neural-api/LICENSE\n", + "A neural-api/libs/uconvolutionneuralnetwork.pas\n", + "A neural-api/thirdpartylibs/synapse\n", + "A neural-api/bin\n", + "A neural-api/bin/x86_64-win64\n", + "A neural-api/bin/x86_64-win64/bin\n", + "A neural-api/libs/uvolume.pas\n", + "A neural-api/libs/ucifar10lcl.pas\n", + "A neural-api/libs/udum.pas\n", + "A neural-api/libs/ucifar10.pas\n", + "A neural-api/libs/cai_dot_product.cl\n", + "A neural-api/libs/ubyteprediction.pas\n", + "A neural-api/libs/COPYING.txt\n", + "A neural-api/libs/ubackpropagation.pas\n", + "A neural-api/libs/ntl.pas\n", + "A neural-api/libs/ugeneric.pas\n", + "A neural-api/experiments/NeuralWebServer/SimpleNeuralWebServer.exe\n", + "A neural-api/experiments/NeuralWebServer/SimpleNeuralWebServer.res\n", + "A neural-api/experiments/NineMensMorris/MOINHO.lpi\n", + "A neural-api/experiments/NineMensMorris/UAUX.lfm\n", + "A neural-api/experiments/NineMensMorris/UVence.lfm\n", + "A neural-api/experiments/NineMensMorris/princ.lfm\n", + "A neural-api/experiments/SOM-NeuralNetwork/PSOM1.res\n", + "A neural-api/experiments/supersimplecorrelation/supersimplecorrelation.lpr\n", + "A neural-api/experiments/visualCifar10MT/visualCifar10learningMT.lpi\n", + "A neural-api/experiments/visualCifar10MT/visualCifar10learningMT.lpr\n", + "A neural-api/experiments/visualCifar10NTL/visualCifar10learningMT2.ico\n", + "A neural-api/opencl/dot-product-test/dot_product_test_form.pas\n", + "A neural-api/opencl/dot-product-test/dot_product_test_form.lfm\n", + "A neural-api/opencl/easy-trillion-test/easy_trillion_test.res\n", + "A neural-api/opencl/easy-trillion-test/easy_trillion_test.ico\n", + "A neural-api/opencl/trillion-test/uopencl_trillion_test.pas\n", + "A neural-api/opencl/trillion-test/uopencl_trillion_test.lfm\n", + "A neural-api/libs/neuralnetwork.inc\n", + "A neural-api/docs/cai.png\n", + "A neural-api/libs/readme.txt\n", + "A neural-api/libs/neuralasm.inc\n", + "A neural-api/libs/ubit.pas\n", + "A neural-api/libs/uvolumelcl.pas\n", + "A neural-api/libs/uarraycache.pas\n", + "A neural-api/libs/ueasyopenclcl.pas\n", + "A neural-api/thirdpartylibs/synapse/README.txt\n", + "A neural-api/libs/not_in_use_kernels.cl\n", + "A neural-api/libs/uabfun.pas\n", + "A neural-api/libs/uplanbuilder.pas\n", + "A neural-api/libs/uevolutionary.pas\n", + "A neural-api/bin/readme.txt\n", + "Checked out revision 1718.\n" + ] + } + ], + "source": [ + "!svn checkout https://svn.code.sf.net/p/cai/svncode/trunk/lazarus neural-api" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "wzz89qRctXDw", + "outputId": "e9468b10-efdd-455a-c81b-e4c131b018ce" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "CopySecondaryConfigFile /etc/lazarus/environmentoptions.xml -> /root/.lazarus/environmentoptions.xml\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"compilertest.pas\"\n", + "Hint: (lazarus) Missing state file of MultiThreadProcsLaz 1.2.1: /content/mtprocs/lib/x86_64-linux/MultiThreadProcsLaz.compiled\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\" \"-Px86_64\" \"-Tlinux\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"-Px86_64\" \"-Tlinux\" \"compilertest.pas\"\n", + "Info: (lazarus) Execute Title=\"Compile package MultiThreadProcsLaz 1.2.1\"\n", + "Info: (lazarus) Working Directory=\"/content/mtprocs/\"\n", + "Info: (lazarus) Executable=\"/usr/bin/fpc\"\n", + "Info: (lazarus) Param[0]=\"-B\"\n", + "Info: (lazarus) Param[1]=\"-MObjFPC\"\n", + "Info: (lazarus) Param[2]=\"-Scghi\"\n", + "Info: (lazarus) Param[3]=\"-Cg\"\n", + "Info: (lazarus) Param[4]=\"-O1\"\n", + "Info: (lazarus) Param[5]=\"-g\"\n", + "Info: (lazarus) Param[6]=\"-gl\"\n", + "Info: (lazarus) Param[7]=\"-l\"\n", + "Info: (lazarus) Param[8]=\"-vewnhibq\"\n", + "Info: (lazarus) Param[9]=\"-Fu/usr/lib/lazarus/1.8.2/packager/units/x86_64-linux\"\n", + "Info: (lazarus) Param[10]=\"-Fu/content/mtprocs/\"\n", + "Info: (lazarus) Param[11]=\"-FU/content/mtprocs/lib/x86_64-linux/\"\n", + "Info: (lazarus) Param[12]=\"multithreadprocslaz.pas\"\n", + "Hint: (11030) Start of reading config file /etc/fpc.cfg\n", + "Hint: (11031) End of reading config file /etc/fpc.cfg\n", + "Free Pascal Compiler version 3.0.4+dfsg-18ubuntu2 [2018/08/29] for x86_64\n", + "Copyright (c) 1993-2017 by Florian Klaempfl and others\n", + "(1002) Target OS: Linux for x86-64\n", + "(3104) Compiling multithreadprocslaz.pas\n", + "(3104) Compiling mtprocs.pas\n", + "(3104) Compiling mtpcpu.pas\n", + "(3104) Compiling mtputils.pas\n", + "/content/mtprocs/mtputils.pas(40,43) Hint: (5024) Parameter \"Data\" not used\n", + "/content/mtprocs/multithreadprocslaz.pas(10,10) Hint: (5023) Unit \"MTPUtils\" not used in MultiThreadProcsLaz\n", + "/content/mtprocs/multithreadprocslaz.pas(10,20) Hint: (5023) Unit \"MTPCPU\" not used in MultiThreadProcsLaz\n", + "(1008) 1215 lines compiled, 0.1 sec\n", + "(1022) 5 hint(s) issued\n" + ] + } + ], + "source": [ + "!lazbuild mtprocs/multithreadprocslaz.lpk" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "wcsEq1bAtXDx", + "outputId": "7f24f30b-98c9-403b-d1fe-f58217c9baa7" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"compilertest.pas\"\n", + "TProject.DoLoadStateFile Statefile not found: /content/neural-api/bin/x86_64-linux/units/SuperResolutionTrain.compiled\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\" \"-Px86_64\" \"-Tlinux\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"-Px86_64\" \"-Tlinux\" \"compilertest.pas\"\n", + "Info: (lazarus) Execute Title=\"Compile Project, Mode: Default, Target: /content/neural-api/bin/x86_64-linux/bin/SuperResolutionTrain\"\n", + "Info: (lazarus) Working Directory=\"/content/neural-api/examples/SuperResolution/\"\n", + "Info: (lazarus) Executable=\"/usr/bin/fpc\"\n", + "Info: (lazarus) Param[0]=\"-B\"\n", + "Info: (lazarus) Param[1]=\"-MObjFPC\"\n", + "Info: (lazarus) Param[2]=\"-Scghi\"\n", + "Info: (lazarus) Param[3]=\"-Cg\"\n", + "Info: (lazarus) Param[4]=\"-O3\"\n", + "Info: (lazarus) Param[5]=\"-l\"\n", + "Info: (lazarus) Param[6]=\"-vewnhibq\"\n", + "Info: (lazarus) Param[7]=\"-Fi/content/neural-api/neural\"\n", + "Info: (lazarus) Param[8]=\"-Fi/content/neural-api/bin/x86_64-linux/units\"\n", + "Info: (lazarus) Param[9]=\"-Fu/content/neural-api/neural\"\n", + "Info: (lazarus) Param[10]=\"-Fu/usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux\"\n", + "Info: (lazarus) Param[11]=\"-Fu/usr/lib/lazarus/1.8.2/components/lazutils/lib/x86_64-linux\"\n", + "Info: (lazarus) Param[12]=\"-Fu/content/mtprocs/lib/x86_64-linux\"\n", + "Info: (lazarus) Param[13]=\"-Fu/usr/lib/lazarus/1.8.2/packager/units/x86_64-linux\"\n", + "Info: (lazarus) Param[14]=\"-Fu/content/neural-api/examples/SuperResolution/\"\n", + "Info: (lazarus) Param[15]=\"-FU/content/neural-api/bin/x86_64-linux/units/\"\n", + "Info: (lazarus) Param[16]=\"-FE/content/neural-api/bin/x86_64-linux/bin/\"\n", + "Info: (lazarus) Param[17]=\"-dUseCThreads\"\n", + "Info: (lazarus) Param[18]=\"-dAVX\"\n", + "Info: (lazarus) Param[19]=\"-dRelease\"\n", + "Info: (lazarus) Param[20]=\"SuperResolutionTrain.lpr\"\n", + "Hint: (11030) Start of reading config file /etc/fpc.cfg\n", + "Compiling Release Version\n", + "Hint: (11031) End of reading config file /etc/fpc.cfg\n", + "Free Pascal Compiler version 3.0.4+dfsg-18ubuntu2 [2018/08/29] for x86_64\n", + "Copyright (c) 1993-2017 by Florian Klaempfl and others\n", + "(1002) Target OS: Linux for x86-64\n", + "(3104) Compiling SuperResolutionTrain.lpr\n", + "(3104) Compiling /content/neural-api/neural/neuralnetwork.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralvolume.pas\n", + "/content/neural-api/neural/neuralnetwork.inc(34,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralnetwork.inc(38,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralvolume.pas(469,19) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt;LongInt;LongInt;Boolean=\"TRUE\");\"\n", + "(3104) Compiling /content/neural-api/neural/neuralbit.pas\n", + "/content/neural-api/neural/neuralbit.pas(722,19) Hint: (5058) Variable \"VARS\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(565,31) Hint: (5024) Parameter \"x\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(1991,3) Note: (5025) Local variable \"AuxVolume\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(2005,3) Note: (5025) Local variable \"AuxVolume\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(2121,37) Hint: (5058) Variable \"V\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(401,43) Hint: (5024) Parameter \"S\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(2374,19) Hint: (5058) Variable \"pInput\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(2380,21) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(2398,27) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(3479,16) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(4944,3) Note: (5027) Local variable \"version\" is assigned but never used\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "(3104) Compiling /content/neural-api/neural/neuralgeneric.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralbyteprediction.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralabfun.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralab.pas\n", + "/content/neural-api/neural/neuralabfun.pas(615,71) Hint: (5057) Local variable \"predictState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(702,32) Note: (5027) Local variable \"NonZeroErrorsCount\" is assigned but never used\n", + "/content/neural-api/neural/neuralabfun.pas(1027,9) Warning: (5036) Local variable \"PermissibleErrors\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(1021,83) Hint: (5057) Local variable \"efeito\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(669,3) Note: (5025) Local variable \"csUnitaryTests\" not used\n", + "/content/neural-api/neural/neuralabfun.pas(670,3) Note: (5025) Local variable \"csBinaryTests\" not used\n", + "(3104) Compiling /content/neural-api/neural/neuralcache.pas\n", + "/content/neural-api/neural/neuralcache.pas(206,1) Warning: (5059) Function result variable does not seem to initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(370,1) Warning: (5059) Function result variable does not seem to initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(373,49) Hint: (5058) Variable \"pState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(429,111) Hint: (5057) Local variable \"Effect\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(540,69) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(522,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(724,21) Warning: (5036) Local variable \"idxCache\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(760,43) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(780,69) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(863,3) Note: (5027) Local variable \"version\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(864,3) Note: (5027) Local variable \"evaluation\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(865,3) Note: (5027) Local variable \"pActionLen\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(866,3) Note: (5027) Local variable \"pStatelen\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(965,23) Hint: (5057) Local variable \"PredictedState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(978,36) Hint: (5058) Variable \"NG\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(980,29) Hint: (5057) Local variable \"Effect\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1081,42) Hint: (5024) Parameter \"PredictedBytePos\" not used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1126,35) Hint: (5058) Variable \"PNextStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1129,43) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1129,27) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1126,22) Hint: (5058) Variable \"pred\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1292,35) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1247,37) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1248,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1329,65) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1316,41) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1316,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(50,32) Hint: (5023) Unit \"neuralvolume\" not used in neuralbyteprediction\n", + "/content/neural-api/neural/neuralnetwork.pas(1047,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1114,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1120,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1126,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1658,17) Warning: (3057) An inherited method is hidden by \"constructor Create(TNNet;Word;Word;LongInt);\"\n", + "/content/neural-api/neural/neuralnetwork.pas(6495,3) Note: (5025) Local variable \"I\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7337,3) Note: (5025) Local variable \"OutX\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7337,9) Note: (5025) Local variable \"OutY\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7528,3) Note: (5027) Local variable \"Len\" is assigned but never used\n", + "/content/neural-api/neural/neuralnetwork.pas(9889,65) Warning: (5089) Local variable \"aL\" of a managed type does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(9890,77) Warning: (5089) Local variable \"aIdx\" of a managed type does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(11064,3) Note: (5027) Local variable \"LayerMul\" is assigned but never used\n", + "/content/neural-api/neural/neuralnetwork.pas(13130,21) Warning: (5036) Local variable \"idxCache\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(13149,34) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "/content/neural-api/neural/neuralnetwork.pas(87,28) Hint: (5023) Unit \"syncobjs\" not used in neuralnetwork\n", + "(3104) Compiling /content/neural-api/neural/neuraldatasets.pas\n", + "/content/neural-api/neural/neuralnetwork.inc(34,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralnetwork.inc(38,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "(3104) Compiling /content/neural-api/neural/neuralthread.pas\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "/content/neural-api/neural/neuraldatasets.pas(151,46) Hint: (5024) Parameter \"FolderName\" not used\n", + "/content/neural-api/neural/neuraldatasets.pas(577,3) Note: (5025) Local variable \"SourceVolume\" not used\n", + "(3104) Compiling /content/neural-api/neural/neuralfit.pas\n", + "/content/neural-api/neural/neuralfit.pas(293,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(294,46) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(295,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(296,44) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(254,33) Hint: (5024) Parameter \"Idx\" not used\n", + "/content/neural-api/neural/neuralfit.pas(255,49) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(256,43) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(188,72) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(230,32) Hint: (5024) Parameter \"Idx\" not used\n", + "/content/neural-api/neural/neuralfit.pas(230,46) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(231,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(232,42) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(205,36) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(206,37) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(289,36) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(290,37) Hint: (5024) Parameter \"threadnum\" not used\n", + "(3104) Compiling usuperresolutionexample.pas\n", + "/content/neural-api/examples/SuperResolution/SuperResolutionTrain.lpr(25,31) Hint: (5024) Parameter \"Idx\" not used\n", + "/content/neural-api/examples/SuperResolution/SuperResolutionTrain.lpr(25,45) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/examples/SuperResolution/SuperResolutionTrain.lpr(26,47) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/examples/SuperResolution/SuperResolutionTrain.lpr(27,41) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/examples/SuperResolution/SuperResolutionTrain.lpr(12,60) Hint: (5023) Unit \"math\" not used in SuperResolutionTrain\n", + "(9015) Linking /content/neural-api/bin/x86_64-linux/bin/SuperResolutionTrain\n", + "/usr/bin/ld.bfd: warning: /content/neural-api/bin/x86_64-linux/bin/link.res contains output sections; did you forget -T?\n", + "(1008) 36121 lines compiled, 2.0 sec\n", + "(1021) 17 warning(s) issued\n", + "(1022) 165 hint(s) issued\n", + "(1023) 16 note(s) issued\n" + ] + } + ], + "source": [ + "!lazbuild neural-api/examples/SuperResolution/SuperResolutionTrain.lpi" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "wtJV363ltXDz", + "outputId": "5ab4bd31-9f1f-49db-91e5-68e66a9c8bf6" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"compilertest.pas\"\n", + "TProject.DoLoadStateFile Statefile not found: /content/neural-api/bin/x86_64-linux/units/Cifar10ImageClassifierSuperResolution.compiled\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-iWTOTP\" \"-Px86_64\" \"-Tlinux\"\n", + "Hint: (lazarus) [RunTool] /usr/bin/fpc \"-va\" \"-Px86_64\" \"-Tlinux\" \"compilertest.pas\"\n", + "Info: (lazarus) Execute Title=\"Compile Project, Mode: Default, Target: /content/neural-api/bin/x86_64-linux/bin/Cifar10ImageClassifierSuperResolution\"\n", + "Info: (lazarus) Working Directory=\"/content/neural-api/examples/SuperResolution/\"\n", + "Info: (lazarus) Executable=\"/usr/bin/fpc\"\n", + "Info: (lazarus) Param[0]=\"-B\"\n", + "Info: (lazarus) Param[1]=\"-MObjFPC\"\n", + "Info: (lazarus) Param[2]=\"-Scghi\"\n", + "Info: (lazarus) Param[3]=\"-Cg\"\n", + "Info: (lazarus) Param[4]=\"-O3\"\n", + "Info: (lazarus) Param[5]=\"-l\"\n", + "Info: (lazarus) Param[6]=\"-vewnhibq\"\n", + "Info: (lazarus) Param[7]=\"-Fi/content/neural-api/neural\"\n", + "Info: (lazarus) Param[8]=\"-Fi/content/neural-api/bin/x86_64-linux/units\"\n", + "Info: (lazarus) Param[9]=\"-Fu/content/neural-api/neural\"\n", + "Info: (lazarus) Param[10]=\"-Fu/usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux\"\n", + "Info: (lazarus) Param[11]=\"-Fu/usr/lib/lazarus/1.8.2/components/lazutils/lib/x86_64-linux\"\n", + "Info: (lazarus) Param[12]=\"-Fu/content/mtprocs/lib/x86_64-linux\"\n", + "Info: (lazarus) Param[13]=\"-Fu/usr/lib/lazarus/1.8.2/packager/units/x86_64-linux\"\n", + "Info: (lazarus) Param[14]=\"-Fu/content/neural-api/examples/SuperResolution/\"\n", + "Info: (lazarus) Param[15]=\"-FU/content/neural-api/bin/x86_64-linux/units/\"\n", + "Info: (lazarus) Param[16]=\"-FE/content/neural-api/bin/x86_64-linux/bin/\"\n", + "Info: (lazarus) Param[17]=\"-dUseCThreads\"\n", + "Info: (lazarus) Param[18]=\"-dAVX\"\n", + "Info: (lazarus) Param[19]=\"-dRelease\"\n", + "Info: (lazarus) Param[20]=\"Cifar10ImageClassifierSuperResolution.lpr\"\n", + "Hint: (11030) Start of reading config file /etc/fpc.cfg\n", + "Compiling Release Version\n", + "Hint: (11031) End of reading config file /etc/fpc.cfg\n", + "Free Pascal Compiler version 3.0.4+dfsg-18ubuntu2 [2018/08/29] for x86_64\n", + "Copyright (c) 1993-2017 by Florian Klaempfl and others\n", + "(1002) Target OS: Linux for x86-64\n", + "(3104) Compiling Cifar10ImageClassifierSuperResolution.lpr\n", + "(3104) Compiling /content/neural-api/neural/neuralnetwork.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralvolume.pas\n", + "/content/neural-api/neural/neuralnetwork.inc(34,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralnetwork.inc(38,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralvolume.pas(469,19) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt;LongInt;LongInt;Boolean=\"TRUE\");\"\n", + "(3104) Compiling /content/neural-api/neural/neuralbit.pas\n", + "/content/neural-api/neural/neuralbit.pas(722,19) Hint: (5058) Variable \"VARS\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(565,31) Hint: (5024) Parameter \"x\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(1991,3) Note: (5025) Local variable \"AuxVolume\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(2005,3) Note: (5025) Local variable \"AuxVolume\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(2121,37) Hint: (5058) Variable \"V\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(401,43) Hint: (5024) Parameter \"S\" not used\n", + "/content/neural-api/neural/neuralvolume.pas(2374,19) Hint: (5058) Variable \"pInput\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(2380,21) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(2398,27) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(3479,16) Hint: (5058) Variable \"Original\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralvolume.pas(4944,3) Note: (5027) Local variable \"version\" is assigned but never used\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "(3104) Compiling /content/neural-api/neural/neuralgeneric.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralbyteprediction.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralabfun.pas\n", + "(3104) Compiling /content/neural-api/neural/neuralab.pas\n", + "/content/neural-api/neural/neuralabfun.pas(615,71) Hint: (5057) Local variable \"predictState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(702,32) Note: (5027) Local variable \"NonZeroErrorsCount\" is assigned but never used\n", + "/content/neural-api/neural/neuralabfun.pas(1027,9) Warning: (5036) Local variable \"PermissibleErrors\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(1021,83) Hint: (5057) Local variable \"efeito\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralabfun.pas(669,3) Note: (5025) Local variable \"csUnitaryTests\" not used\n", + "/content/neural-api/neural/neuralabfun.pas(670,3) Note: (5025) Local variable \"csBinaryTests\" not used\n", + "(3104) Compiling /content/neural-api/neural/neuralcache.pas\n", + "/content/neural-api/neural/neuralcache.pas(206,1) Warning: (5059) Function result variable does not seem to initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(370,1) Warning: (5059) Function result variable does not seem to initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(373,49) Hint: (5058) Variable \"pState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(429,111) Hint: (5057) Local variable \"Effect\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(540,69) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(522,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(724,21) Warning: (5036) Local variable \"idxCache\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(760,43) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(780,69) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(863,3) Note: (5027) Local variable \"version\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(864,3) Note: (5027) Local variable \"evaluation\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(865,3) Note: (5027) Local variable \"pActionLen\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(866,3) Note: (5027) Local variable \"pStatelen\" is assigned but never used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(965,23) Hint: (5057) Local variable \"PredictedState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(978,36) Hint: (5058) Variable \"NG\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(980,29) Hint: (5057) Local variable \"Effect\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1081,42) Hint: (5024) Parameter \"PredictedBytePos\" not used\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1126,35) Hint: (5058) Variable \"PNextStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1129,43) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1129,27) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1126,22) Hint: (5058) Variable \"pred\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1292,35) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1247,37) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1248,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1329,65) Hint: (5057) Local variable \"NextState\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1316,41) Hint: (5058) Variable \"PCurrentStates\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(1316,25) Hint: (5058) Variable \"PActions\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralbyteprediction.pas(50,32) Hint: (5023) Unit \"neuralvolume\" not used in neuralbyteprediction\n", + "/content/neural-api/neural/neuralnetwork.pas(1047,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1114,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1120,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1126,17) Warning: (3057) An inherited method is hidden by \"constructor Create(LongInt;LongInt=\"0\");\"\n", + "/content/neural-api/neural/neuralnetwork.pas(1658,17) Warning: (3057) An inherited method is hidden by \"constructor Create(TNNet;Word;Word;LongInt);\"\n", + "/content/neural-api/neural/neuralnetwork.pas(6495,3) Note: (5025) Local variable \"I\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7337,3) Note: (5025) Local variable \"OutX\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7337,9) Note: (5025) Local variable \"OutY\" not used\n", + "/content/neural-api/neural/neuralnetwork.pas(7528,3) Note: (5027) Local variable \"Len\" is assigned but never used\n", + "/content/neural-api/neural/neuralnetwork.pas(9889,65) Warning: (5089) Local variable \"aL\" of a managed type does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(9890,77) Warning: (5089) Local variable \"aIdx\" of a managed type does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(11064,3) Note: (5027) Local variable \"LayerMul\" is assigned but never used\n", + "/content/neural-api/neural/neuralnetwork.pas(13130,21) Warning: (5036) Local variable \"idxCache\" does not seem to be initialized\n", + "/content/neural-api/neural/neuralnetwork.pas(13149,34) Hint: (5058) Variable \"stateFound\" does not seem to be initialized\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "/content/neural-api/neural/neuralnetwork.pas(87,28) Hint: (5023) Unit \"syncobjs\" not used in neuralnetwork\n", + "(3104) Compiling /content/neural-api/neural/neuraldatasets.pas\n", + "/content/neural-api/neural/neuralnetwork.inc(34,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "/content/neural-api/neural/neuralnetwork.inc(38,4) Warning: (2010) Misplaced global compiler switch, ignored\n", + "(3104) Compiling /content/neural-api/neural/neuralthread.pas\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "Hint: (3123) \"inherited\" not yet supported inside inline procedure/function\n", + "Hint: (3124) Inlining disabled\n", + "/content/neural-api/neural/neuraldatasets.pas(151,46) Hint: (5024) Parameter \"FolderName\" not used\n", + "/content/neural-api/neural/neuraldatasets.pas(577,3) Note: (5025) Local variable \"SourceVolume\" not used\n", + "(3104) Compiling /content/neural-api/neural/neuralfit.pas\n", + "/content/neural-api/neural/neuralfit.pas(293,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(294,46) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(295,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(296,44) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(254,33) Hint: (5024) Parameter \"Idx\" not used\n", + "/content/neural-api/neural/neuralfit.pas(255,49) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(256,43) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(188,72) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(230,32) Hint: (5024) Parameter \"Idx\" not used\n", + "/content/neural-api/neural/neuralfit.pas(230,46) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(231,48) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(232,42) Hint: (5024) Parameter \"ThreadId\" not used\n", + "/content/neural-api/neural/neuralfit.pas(205,36) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(206,37) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(289,36) Hint: (5024) Parameter \"threadnum\" not used\n", + "/content/neural-api/neural/neuralfit.pas(290,37) Hint: (5024) Parameter \"threadnum\" not used\n", + "(3104) Compiling usuperresolutionexample.pas\n", + "/content/neural-api/examples/SuperResolution/Cifar10ImageClassifierSuperResolution.lpr(10,60) Hint: (5023) Unit \"math\" not used in Cifar10ImageClassifierSuperResolution\n", + "(9015) Linking /content/neural-api/bin/x86_64-linux/bin/Cifar10ImageClassifierSuperResolution\n", + "/usr/bin/ld.bfd: warning: /content/neural-api/bin/x86_64-linux/bin/link.res contains output sections; did you forget -T?\n", + "(1008) 36089 lines compiled, 1.9 sec\n", + "(1021) 17 warning(s) issued\n", + "(1022) 161 hint(s) issued\n", + "(1023) 16 note(s) issued\n" + ] + } + ], + "source": [ + "!lazbuild neural-api/examples/SuperResolution/Cifar10ImageClassifierSuperResolution.lpi" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": false, + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "4HlQx4wqtXDz", + "outputId": "8df6d91c-b425-45f5-c146-677fa60ad4e2" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Creating Neural Network...\n", + " Layers: 26\n", + " Neurons:473\n", + " Weights:22820 Sum: 2.307921\n", + "Layer 0 Neurons: 0 Weights: 0 TNNetInput(16,16,3,1,0) Output:16,16,3 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Branches:2\n", + "Layer 1 Neurons: 1 Weights: 27 TNNetDepthwiseConvLinear(1,3,1,1,0) Output:16,16,3 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.2985 Parent:0 Branches:1\n", + "Layer 2 Neurons: 64 Weights: 192 TNNetPointwiseConvReLU(64,1,0,1,0) Output:16,16,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: -5.4822 Parent:1 Branches:1\n", + "Layer 3 Neurons: 0 Weights: 0 TNNetDeepConcat(0,0,0,0,0) Output:16,16,67 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:2 Branches:2\n", + "Layer 4 Neurons: 16 Weights: 1072 TNNetConvolutionLinear(16,1,0,1,0) Output:16,16,16 Learning Rate:0.0100 Inertia:0.90 Weight Sum: -0.5408 Parent:3 Branches:1\n", + "Layer 5 Neurons: 1 Weights: 144 TNNetDepthwiseConvLinear(1,3,1,1,0) Output:16,16,16 Learning Rate:0.0100 Inertia:0.90 Weight Sum: -4.2827 Parent:4 Branches:1\n", + "Layer 6 Neurons: 64 Weights: 1024 TNNetPointwiseConvReLU(64,1,0,1,0) Output:16,16,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.4878 Parent:5 Branches:1\n", + "Layer 7 Neurons: 0 Weights: 0 TNNetDeepConcat(0,0,0,0,0) Output:16,16,131 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:6 Branches:2\n", + "Layer 8 Neurons: 16 Weights: 2096 TNNetConvolutionLinear(16,1,0,1,0) Output:16,16,16 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0586 Parent:7 Branches:1\n", + "Layer 9 Neurons: 1 Weights: 144 TNNetDepthwiseConvLinear(1,3,1,1,0) Output:16,16,16 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 6.0628 Parent:8 Branches:1\n", + "Layer 10 Neurons: 64 Weights: 1024 TNNetPointwiseConvReLU(64,1,0,1,0) Output:16,16,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 5.3430 Parent:9 Branches:1\n", + "Layer 11 Neurons: 0 Weights: 0 TNNetDeepConcat(0,0,0,0,0) Output:16,16,195 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:10 Branches:1\n", + "Layer 12 Neurons: 0 Weights: 0 TNNetDeAvgPool(2,2,0,0,0) Output:32,32,195 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:11 Branches:2\n", + "Layer 13 Neurons: 16 Weights: 3120 TNNetConvolutionLinear(16,1,0,1,0) Output:32,32,16 Learning Rate:0.0100 Inertia:0.90 Weight Sum: -0.8367 Parent:12 Branches:1\n", + "Layer 14 Neurons: 1 Weights: 144 TNNetDepthwiseConvLinear(1,3,1,1,0) Output:32,32,16 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 7.3765 Parent:13 Branches:1\n", + "Layer 15 Neurons: 64 Weights: 1024 TNNetPointwiseConvReLU(64,1,0,1,0) Output:32,32,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: -4.8580 Parent:14 Branches:1\n", + "Layer 16 Neurons: 0 Weights: 0 TNNetDeepConcat(0,0,0,0,0) Output:32,32,259 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:15 Branches:2\n", + "Layer 17 Neurons: 16 Weights: 4144 TNNetConvolutionLinear(16,1,0,1,0) Output:32,32,16 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.1908 Parent:16 Branches:1\n", + "Layer 18 Neurons: 1 Weights: 144 TNNetDepthwiseConvLinear(1,3,1,1,0) Output:32,32,16 Learning Rate:0.0100 Inertia:0.90 Weight Sum: -3.9607 Parent:17 Branches:1\n", + "Layer 19 Neurons: 64 Weights: 1024 TNNetPointwiseConvReLU(64,1,0,1,0) Output:32,32,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 5.4027 Parent:18 Branches:1\n", + "Layer 20 Neurons: 0 Weights: 0 TNNetDeepConcat(0,0,0,0,0) Output:32,32,323 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:19 Branches:2\n", + "Layer 21 Neurons: 16 Weights: 5168 TNNetConvolutionLinear(16,1,0,1,0) Output:32,32,16 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 3.4280 Parent:20 Branches:1\n", + "Layer 22 Neurons: 1 Weights: 144 TNNetDepthwiseConvLinear(1,3,1,1,0) Output:32,32,16 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 6.2392 Parent:21 Branches:1\n", + "Layer 23 Neurons: 64 Weights: 1024 TNNetPointwiseConvReLU(64,1,0,1,0) Output:32,32,64 Learning Rate:0.0100 Inertia:0.90 Weight Sum:-13.2860 Parent:22 Branches:1\n", + "Layer 24 Neurons: 0 Weights: 0 TNNetDeepConcat(0,0,0,0,0) Output:32,32,387 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.0000 Parent:23 Branches:1\n", + "Layer 25 Neurons: 3 Weights: 1161 TNNetConvolutionLinear(3,1,0,0,0) Output:32,32,3 Learning Rate:0.0100 Inertia:0.90 Weight Sum: 0.6671 Parent:24 Branches:0\n", + "Loading 10K images from file \"data_batch_1.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_2.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_3.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_4.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"data_batch_5.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "Loading 10K images from file \"test_batch.bin\" ... GLOBAL MIN MAX -2.0000 1.9844 -2.0000 1.9844 -2.0000 1.9844 Done.\n", + "1000 processed.\n", + "2000 processed.\n", + "3000 processed.\n", + "4000 processed.\n", + "5000 processed.\n", + "6000 processed.\n", + "7000 processed.\n", + "8000 processed.\n", + "9000 processed.\n", + "10000 processed.\n", + "11000 processed.\n", + "12000 processed.\n", + "13000 processed.\n", + "14000 processed.\n", + "15000 processed.\n", + "16000 processed.\n", + "17000 processed.\n", + "18000 processed.\n", + "19000 processed.\n", + "20000 processed.\n", + "21000 processed.\n", + "22000 processed.\n", + "23000 processed.\n", + "24000 processed.\n", + "25000 processed.\n", + "26000 processed.\n", + "27000 processed.\n", + "28000 processed.\n", + "29000 processed.\n", + "30000 processed.\n", + "31000 processed.\n", + "32000 processed.\n", + "33000 processed.\n", + "34000 processed.\n", + "35000 processed.\n", + "36000 processed.\n", + "37000 processed.\n", + "38000 processed.\n", + "39000 processed.\n", + "40000 processed.\n", + "41000 processed.\n", + "42000 processed.\n", + "43000 processed.\n", + "44000 processed.\n", + "45000 processed.\n", + "46000 processed.\n", + "47000 processed.\n", + "1000 processed.\n", + "1000 processed.\n", + "2000 processed.\n", + "3000 processed.\n", + "4000 processed.\n", + "5000 processed.\n", + "6000 processed.\n", + "7000 processed.\n", + "8000 processed.\n", + "9000 processed.\n", + "File name is: super-resolution-7-64-sep\n", + "Learning rate:0.000001 L2 decay:0.000000 Inertia:0.900000 Batch size:64 Step size:64 Staircase ephocs:10\n", + "Training volumes: 48000\n", + "Validation volumes: 2000\n", + "Test volumes: 10000\n", + "Computing...\n", + "640 Examples seen. Accuracy: 0.0001 Error: 1292.98169 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.25s Step time: 13.73s\n", + "1280 Examples seen. Accuracy: 0.0003 Error: 974.59827 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.58s\n", + "1920 Examples seen. Accuracy: 0.0008 Error: 858.41699 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.59s\n", + "2560 Examples seen. Accuracy: 0.0010 Error: 800.29431 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.14s Step time: 13.54s\n", + "3200 Examples seen. Accuracy: 0.0011 Error: 743.54553 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.13s Step time: 13.57s\n", + "3840 Examples seen. Accuracy: 0.0013 Error: 717.44861 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.20s Step time: 14.57s\n", + "4480 Examples seen. Accuracy: 0.0015 Error: 696.33215 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.53s\n", + "5120 Examples seen. Accuracy: 0.0018 Error: 655.19489 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.48s\n", + "5760 Examples seen. Accuracy: 0.0019 Error: 693.48199 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.09s Step time: 13.55s\n", + "6400 Examples seen. Accuracy: 0.0019 Error: 669.76160 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.08s Step time: 13.56s\n", + "7040 Examples seen. Accuracy: 0.0020 Error: 637.36542 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.13s Step time: 13.57s\n", + "7680 Examples seen. Accuracy: 0.0020 Error: 676.95477 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.19s Step time: 13.59s\n", + "8320 Examples seen. Accuracy: 0.0021 Error: 647.02100 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.09s Step time: 13.53s\n", + "8960 Examples seen. Accuracy: 0.0027 Error: 631.61566 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.18s Step time: 13.52s\n", + "9600 Examples seen. Accuracy: 0.0028 Error: 592.49982 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.04s Step time: 13.45s\n", + "10240 Examples seen. Accuracy: 0.0035 Error: 622.71515 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.05s Step time: 13.47s\n", + "10880 Examples seen. Accuracy: 0.0036 Error: 614.40356 Loss: 0.00000 Threads: 2 Forward time: 2.91s Backward time: 4.58s Step time: 14.51s\n", + "11520 Examples seen. Accuracy: 0.0036 Error: 638.55371 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.03s Step time: 15.07s\n", + "12160 Examples seen. Accuracy: 0.0035 Error: 617.55084 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.52s\n", + "12800 Examples seen. Accuracy: 0.0040 Error: 604.48047 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.56s\n", + "13440 Examples seen. Accuracy: 0.0042 Error: 618.04443 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.50s\n", + "14080 Examples seen. Accuracy: 0.0040 Error: 571.69775 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.48s\n", + "14720 Examples seen. Accuracy: 0.0038 Error: 598.72070 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.49s\n", + "15360 Examples seen. Accuracy: 0.0036 Error: 607.94128 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.51s\n", + "16000 Examples seen. Accuracy: 0.0038 Error: 627.09998 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.10s Step time: 13.49s\n", + "16640 Examples seen. Accuracy: 0.0037 Error: 591.33948 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.22s Step time: 13.53s\n", + "17280 Examples seen. Accuracy: 0.0040 Error: 608.89001 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.05s Step time: 13.48s\n", + "17920 Examples seen. Accuracy: 0.0043 Error: 560.60449 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.55s\n", + "18560 Examples seen. Accuracy: 0.0044 Error: 591.30627 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.11s Step time: 14.54s\n", + "19200 Examples seen. Accuracy: 0.0043 Error: 579.71411 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.10s Step time: 13.49s\n", + "19840 Examples seen. Accuracy: 0.0046 Error: 550.08105 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.10s Step time: 13.51s\n", + "20480 Examples seen. Accuracy: 0.0045 Error: 580.14532 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.51s\n", + "21120 Examples seen. Accuracy: 0.0044 Error: 575.35675 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.05s Step time: 13.60s\n", + "21760 Examples seen. Accuracy: 0.0040 Error: 559.80725 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.22s Step time: 13.55s\n", + "22400 Examples seen. Accuracy: 0.0042 Error: 583.03101 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.05s Step time: 13.52s\n", + "23040 Examples seen. Accuracy: 0.0041 Error: 547.38770 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.06s Step time: 13.50s\n", + "23680 Examples seen. Accuracy: 0.0039 Error: 578.40698 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.63s\n", + "24320 Examples seen. Accuracy: 0.0037 Error: 571.82153 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.14s Step time: 13.60s\n", + "24960 Examples seen. Accuracy: 0.0037 Error: 535.56628 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.59s\n", + "25600 Examples seen. Accuracy: 0.0034 Error: 541.51624 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.56s\n", + "26240 Examples seen. Accuracy: 0.0039 Error: 577.12195 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.52s\n", + "26880 Examples seen. Accuracy: 0.0042 Error: 560.11682 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.16s Step time: 13.51s\n", + "27520 Examples seen. Accuracy: 0.0043 Error: 581.04718 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.11s Step time: 13.49s\n", + "28160 Examples seen. Accuracy: 0.0047 Error: 589.82544 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.47s\n", + "28800 Examples seen. Accuracy: 0.0050 Error: 572.55408 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.14s Step time: 13.47s\n", + "29440 Examples seen. Accuracy: 0.0047 Error: 577.11279 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.06s Step time: 13.46s\n", + "30080 Examples seen. Accuracy: 0.0047 Error: 569.32434 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.06s Step time: 13.47s\n", + "30720 Examples seen. Accuracy: 0.0045 Error: 551.76660 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.46s\n", + "31360 Examples seen. Accuracy: 0.0047 Error: 558.82098 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.47s\n", + "32000 Examples seen. Accuracy: 0.0051 Error: 523.33972 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.20s Step time: 13.45s\n", + "32640 Examples seen. Accuracy: 0.0048 Error: 536.74274 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.17s Step time: 13.50s\n", + "33280 Examples seen. Accuracy: 0.0050 Error: 541.07190 Loss: 0.00000 Threads: 2 Forward time: 2.72s Backward time: 4.40s Step time: 14.60s\n", + "33920 Examples seen. Accuracy: 0.0053 Error: 509.90540 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.45s\n", + "34560 Examples seen. Accuracy: 0.0051 Error: 573.19861 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.56s\n", + "35200 Examples seen. Accuracy: 0.0053 Error: 532.81885 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.10s Step time: 13.52s\n", + "35840 Examples seen. Accuracy: 0.0055 Error: 524.67468 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.13s Step time: 13.53s\n", + "36480 Examples seen. Accuracy: 0.0055 Error: 550.85291 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.14s Step time: 13.58s\n", + "37120 Examples seen. Accuracy: 0.0051 Error: 530.93347 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.57s\n", + "37760 Examples seen. Accuracy: 0.0051 Error: 515.68396 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.06s Step time: 13.46s\n", + "38400 Examples seen. Accuracy: 0.0051 Error: 548.60492 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.14s Step time: 13.56s\n", + "39040 Examples seen. Accuracy: 0.0049 Error: 537.45605 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.06s Step time: 13.51s\n", + "39680 Examples seen. Accuracy: 0.0054 Error: 536.77600 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.08s Step time: 13.47s\n", + "40320 Examples seen. Accuracy: 0.0057 Error: 574.34497 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.50s\n", + "40960 Examples seen. Accuracy: 0.0056 Error: 549.29388 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.50s\n", + "41600 Examples seen. Accuracy: 0.0060 Error: 546.83154 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 13.48s\n", + "42240 Examples seen. Accuracy: 0.0057 Error: 550.98553 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.16s Step time: 13.48s\n", + "42880 Examples seen. Accuracy: 0.0056 Error: 547.11249 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.53s\n", + "43520 Examples seen. Accuracy: 0.0053 Error: 530.26740 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.18s Step time: 13.51s\n", + "44160 Examples seen. Accuracy: 0.0054 Error: 537.98145 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.08s Step time: 13.51s\n", + "44800 Examples seen. Accuracy: 0.0056 Error: 550.61108 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.18s Step time: 13.50s\n", + "45440 Examples seen. Accuracy: 0.0060 Error: 546.33142 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.50s\n", + "46080 Examples seen. Accuracy: 0.0056 Error: 538.33545 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.08s Step time: 13.54s\n", + "46720 Examples seen. Accuracy: 0.0056 Error: 517.38080 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.14s Step time: 13.48s\n", + "47360 Examples seen. Accuracy: 0.0055 Error: 526.65314 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.53s\n", + "48000 Examples seen. Accuracy: 0.0053 Error: 544.58203 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 14.57s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at super-resolution-7-64-sep.nn\n", + "Epochs: 1 Examples seen:48000 Validation Accuracy: 0.0100 Validation Error: 537.9672 Validation Loss: 0.0000 Total time: 17.28min\n", + "Epoch time: 18.2063 minutes. 50 epochs: 15.1719 hours.\n", + "Epochs: 1. Working time: 0.29 hours.\n", + "48640 Examples seen. Accuracy: 0.0054 Error: 525.76093 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.21s Step time: 13.54s\n", + "49280 Examples seen. Accuracy: 0.0057 Error: 532.32056 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.11s Step time: 13.51s\n", + "49920 Examples seen. Accuracy: 0.0055 Error: 571.86450 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.50s\n", + "50560 Examples seen. Accuracy: 0.0055 Error: 548.80151 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.53s\n", + "51200 Examples seen. Accuracy: 0.0058 Error: 526.05640 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.58s\n", + "51840 Examples seen. Accuracy: 0.0054 Error: 545.34509 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.23s Step time: 13.56s\n", + "52480 Examples seen. Accuracy: 0.0052 Error: 524.22986 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.50s\n", + "53120 Examples seen. Accuracy: 0.0053 Error: 544.85730 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.57s\n", + "53760 Examples seen. Accuracy: 0.0049 Error: 573.59241 Loss: 0.00000 Threads: 2 Forward time: 3.00s Backward time: 4.76s Step time: 13.78s\n", + "54400 Examples seen. Accuracy: 0.0047 Error: 539.20074 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.15s Step time: 13.67s\n", + "55040 Examples seen. Accuracy: 0.0046 Error: 544.42676 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.51s\n", + "55680 Examples seen. Accuracy: 0.0048 Error: 548.35742 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.49s\n", + "56320 Examples seen. Accuracy: 0.0051 Error: 512.86743 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.13s Step time: 13.54s\n", + "56960 Examples seen. Accuracy: 0.0052 Error: 508.87677 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.55s\n", + "57600 Examples seen. Accuracy: 0.0055 Error: 556.13391 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.22s Step time: 13.58s\n", + "58240 Examples seen. Accuracy: 0.0057 Error: 554.00592 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.10s Step time: 13.53s\n", + "58880 Examples seen. Accuracy: 0.0053 Error: 527.87433 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.18s Step time: 13.56s\n", + "59520 Examples seen. Accuracy: 0.0052 Error: 561.33801 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.34s Step time: 13.55s\n", + "60160 Examples seen. Accuracy: 0.0055 Error: 550.20520 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.21s Step time: 13.52s\n", + "60800 Examples seen. Accuracy: 0.0062 Error: 558.53772 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.20s Step time: 13.47s\n", + "61440 Examples seen. Accuracy: 0.0060 Error: 542.78040 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 14.56s\n", + "62080 Examples seen. Accuracy: 0.0057 Error: 514.27399 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.10s Step time: 13.50s\n", + "62720 Examples seen. Accuracy: 0.0059 Error: 518.23474 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.55s\n", + "63360 Examples seen. Accuracy: 0.0062 Error: 547.50708 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.58s\n", + "64000 Examples seen. Accuracy: 0.0061 Error: 518.53131 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.54s\n", + "64640 Examples seen. Accuracy: 0.0058 Error: 542.55847 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.11s Step time: 13.54s\n", + "65280 Examples seen. Accuracy: 0.0056 Error: 519.97693 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.08s Step time: 13.57s\n", + "65920 Examples seen. Accuracy: 0.0056 Error: 557.16614 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.58s\n", + "66560 Examples seen. Accuracy: 0.0058 Error: 527.58289 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.53s\n", + "67200 Examples seen. Accuracy: 0.0058 Error: 518.08838 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 13.51s\n", + "67840 Examples seen. Accuracy: 0.0057 Error: 524.95300 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.08s Step time: 13.48s\n", + "68480 Examples seen. Accuracy: 0.0057 Error: 506.45288 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.48s\n", + "69120 Examples seen. Accuracy: 0.0056 Error: 526.73956 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.10s Step time: 13.50s\n", + "69760 Examples seen. Accuracy: 0.0058 Error: 499.59415 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.11s Step time: 13.50s\n", + "70400 Examples seen. Accuracy: 0.0056 Error: 514.15100 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.19s Step time: 13.53s\n", + "71040 Examples seen. Accuracy: 0.0060 Error: 505.72586 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.46s\n", + "71680 Examples seen. Accuracy: 0.0055 Error: 560.64783 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.51s\n", + "72320 Examples seen. Accuracy: 0.0052 Error: 508.51251 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.13s Step time: 13.48s\n", + "72960 Examples seen. Accuracy: 0.0053 Error: 509.31912 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.19s Step time: 13.50s\n", + "73600 Examples seen. Accuracy: 0.0060 Error: 500.94525 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.14s Step time: 13.48s\n", + "74240 Examples seen. Accuracy: 0.0063 Error: 525.38757 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 13.50s\n", + "74880 Examples seen. Accuracy: 0.0066 Error: 492.52032 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.50s\n", + "75520 Examples seen. Accuracy: 0.0063 Error: 539.00696 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.18s Step time: 13.47s\n", + "76160 Examples seen. Accuracy: 0.0063 Error: 547.28113 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.46s\n", + "76800 Examples seen. Accuracy: 0.0064 Error: 494.30658 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.20s Step time: 14.54s\n", + "77440 Examples seen. Accuracy: 0.0063 Error: 523.09094 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.16s Step time: 13.48s\n", + "78080 Examples seen. Accuracy: 0.0062 Error: 510.25800 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.49s\n", + "78720 Examples seen. Accuracy: 0.0062 Error: 498.88873 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.08s Step time: 13.52s\n", + "79360 Examples seen. Accuracy: 0.0064 Error: 500.33209 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.03s Step time: 13.50s\n", + "80000 Examples seen. Accuracy: 0.0067 Error: 513.51636 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.47s\n", + "80640 Examples seen. Accuracy: 0.0070 Error: 480.17877 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.24s Step time: 13.51s\n", + "81280 Examples seen. Accuracy: 0.0064 Error: 529.94281 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 13.57s\n", + "81920 Examples seen. Accuracy: 0.0063 Error: 513.47797 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.13s Step time: 13.62s\n", + "82560 Examples seen. Accuracy: 0.0061 Error: 505.02567 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.11s Step time: 13.50s\n", + "83200 Examples seen. Accuracy: 0.0060 Error: 482.71210 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.16s Step time: 13.56s\n", + "83840 Examples seen. Accuracy: 0.0060 Error: 520.76282 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.26s Step time: 13.54s\n", + "84480 Examples seen. Accuracy: 0.0061 Error: 494.17361 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.12s Step time: 13.51s\n", + "85120 Examples seen. Accuracy: 0.0060 Error: 496.43866 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.52s\n", + "85760 Examples seen. Accuracy: 0.0063 Error: 527.03058 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.15s Step time: 13.51s\n", + "86400 Examples seen. Accuracy: 0.0065 Error: 524.21753 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.09s Step time: 13.53s\n", + "87040 Examples seen. Accuracy: 0.0069 Error: 525.47803 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.22s Step time: 13.66s\n", + "87680 Examples seen. Accuracy: 0.0070 Error: 503.78790 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.19s Step time: 13.52s\n", + "88320 Examples seen. Accuracy: 0.0065 Error: 494.58304 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.19s Step time: 13.50s\n", + "88960 Examples seen. Accuracy: 0.0065 Error: 508.10187 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.61s\n", + "89600 Examples seen. Accuracy: 0.0063 Error: 494.74753 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.10s Step time: 13.53s\n", + "90240 Examples seen. Accuracy: 0.0062 Error: 495.91168 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.12s Step time: 13.50s\n", + "90880 Examples seen. Accuracy: 0.0067 Error: 498.18542 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.18s Step time: 14.62s\n", + "91520 Examples seen. Accuracy: 0.0071 Error: 500.43909 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.54s\n", + "92160 Examples seen. Accuracy: 0.0070 Error: 520.12158 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.13s Step time: 13.59s\n", + "92800 Examples seen. Accuracy: 0.0068 Error: 486.55774 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.09s Step time: 13.54s\n", + "93440 Examples seen. Accuracy: 0.0067 Error: 520.21069 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.52s\n", + "94080 Examples seen. Accuracy: 0.0068 Error: 512.10822 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.51s\n", + "94720 Examples seen. Accuracy: 0.0063 Error: 518.74976 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.24s Step time: 13.57s\n", + "95360 Examples seen. Accuracy: 0.0071 Error: 476.51086 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.51s\n", + "96000 Examples seen. Accuracy: 0.0075 Error: 483.15509 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.09s Step time: 13.55s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at super-resolution-7-64-sep.nn\n", + "Epochs: 2 Examples seen:96000 Validation Accuracy: 0.0115 Validation Error: 501.8504 Validation Loss: 0.0000 Total time: 34.51min\n", + "Layer 0 Max Output: 1.109 Min Output: -1.750 TNNetInput 16,16,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 1 Max Weight: 0.516 Min Weight: -0.610 Max Output: 1.480 Min Output: -1.512 TNNetDepthwiseConvLinear 16,16,3 Times: 0.07s 0.01s Parent:0\n", + "Layer 2 Neurons: 64 Max Weight: 0.986 Min Weight: -0.987 Max Output: 2.477 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.30s 0.05s Parent:1\n", + "Layer 3 Max Output: 2.477 Min Output: -1.750 TNNetDeepConcat 16,16,67 Times: 0.03s 0.00s Parent:2\n", + "Layer 4 Neurons: 16 Max Weight: 0.221 Min Weight: -0.222 Max Output: 1.697 Min Output: -1.570 TNNetConvolutionLinear 16,16,16 Times: 0.15s 0.02s Parent:3\n", + "Layer 5 Neurons: 1 Max Weight: 0.571 Min Weight: -0.572 Max Output: 1.266 Min Output: -1.070 TNNetDepthwiseConvLinear 16,16,16 Times: 0.08s 0.01s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.431 Min Weight: -0.434 Max Output: 1.267 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.41s 0.05s Parent:5\n", + "Layer 7 Max Output: 2.477 Min Output: -1.750 TNNetDeepConcat 16,16,131 Times: 0.07s 0.00s Parent:6\n", + "Layer 8 Neurons: 16 Max Weight: 0.155 Min Weight: -0.167 Max Output: 1.057 Min Output: -1.054 TNNetConvolutionLinear 16,16,16 Times: 0.24s 0.03s Parent:7\n", + "Layer 9 Neurons: 1 Max Weight: 0.564 Min Weight: -0.565 Max Output: 0.715 Min Output: -1.345 TNNetDepthwiseConvLinear 16,16,16 Times: 0.06s 0.01s Parent:8\n", + "Layer 10 Neurons: 64 Max Weight: 0.444 Min Weight: -0.440 Max Output: 0.898 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.42s 0.04s Parent:9\n", + "Layer 11 Max Output: 2.477 Min Output: -1.750 TNNetDeepConcat 16,16,195 Times: 0.08s 0.00s Parent:10\n", + "Layer 12 Max Output: 2.477 Min Output: -1.750 TNNetDeAvgPool 32,32,195 Times: 3.13s 0.10s Parent:11\n", + "Layer 13 Neurons: 16 Max Weight: 0.221 Min Weight: -0.175 Max Output: 1.316 Min Output: -1.307 TNNetConvolutionLinear 32,32,16 Times: 1.00s 0.15s Parent:12\n", + "Layer 14 Neurons: 1 Max Weight: 0.574 Min Weight: -0.550 Max Output: 1.263 Min Output: -1.334 TNNetDepthwiseConvLinear 32,32,16 Times: 0.30s 0.03s Parent:13\n", + "Layer 15 Neurons: 64 Max Weight: 0.435 Min Weight: -0.439 Max Output: 1.672 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.59s 0.17s Parent:14\n", + "Layer 16 Max Output: 2.477 Min Output: -1.750 TNNetDeepConcat 32,32,259 Times: 0.54s 0.02s Parent:15\n", + "Layer 17 Neurons: 16 Max Weight: 0.206 Min Weight: -0.228 Max Output: 1.414 Min Output: -1.428 TNNetConvolutionLinear 32,32,16 Times: 1.24s 0.18s Parent:16\n", + "Layer 18 Neurons: 1 Max Weight: 0.533 Min Weight: -0.567 Max Output: 2.693 Min Output: -2.489 TNNetDepthwiseConvLinear 32,32,16 Times: 0.30s 0.03s Parent:17\n", + "Layer 19 Neurons: 64 Max Weight: 0.456 Min Weight: -0.436 Max Output: 2.023 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.61s 0.17s Parent:18\n", + "Layer 20 Max Output: 2.477 Min Output: -1.750 TNNetDeepConcat 32,32,323 Times: 0.65s 0.03s Parent:19\n", + "Layer 21 Neurons: 16 Max Weight: 0.182 Min Weight: -0.229 Max Output: 1.006 Min Output: -1.068 TNNetConvolutionLinear 32,32,16 Times: 1.48s 0.21s Parent:20\n", + "Layer 22 Neurons: 1 Max Weight: 0.583 Min Weight: -0.566 Max Output: 1.077 Min Output: -1.279 TNNetDepthwiseConvLinear 32,32,16 Times: 0.28s 0.03s Parent:21\n", + "Layer 23 Neurons: 64 Max Weight: 0.432 Min Weight: -0.431 Max Output: 1.058 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.62s 0.18s Parent:22\n", + "Layer 24 Max Output: 2.477 Min Output: -1.750 TNNetDeepConcat 32,32,387 Times: 0.74s 0.02s Parent:23\n", + "Layer 25 Neurons: 3 Max Weight: 0.560 Min Weight: -0.204 Max Output: 1.061 Min Output: -1.930 TNNetConvolutionLinear 32,32,3 Times: 0.33s 0.05s Parent:24\n", + "Epoch time: 16.9400 minutes. 50 epochs: 14.1167 hours.\n", + "Epochs: 2. Working time: 0.58 hours.\n", + "96640 Examples seen. Accuracy: 0.0076 Error: 516.71710 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.09s Step time: 13.50s\n", + "97280 Examples seen. Accuracy: 0.0075 Error: 523.63635 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.14s Step time: 13.50s\n", + "97920 Examples seen. Accuracy: 0.0075 Error: 508.32220 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.21s Step time: 13.51s\n", + "98560 Examples seen. Accuracy: 0.0074 Error: 497.54352 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.50s\n", + "99200 Examples seen. Accuracy: 0.0075 Error: 542.18402 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.10s Step time: 13.50s\n", + "99840 Examples seen. Accuracy: 0.0074 Error: 490.26617 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.53s\n", + "100480 Examples seen. Accuracy: 0.0070 Error: 503.01917 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.55s\n", + "101120 Examples seen. Accuracy: 0.0071 Error: 503.23889 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.49s\n", + "101760 Examples seen. Accuracy: 0.0068 Error: 499.90753 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.51s\n", + "102400 Examples seen. Accuracy: 0.0066 Error: 503.32068 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.11s Step time: 13.51s\n", + "103040 Examples seen. Accuracy: 0.0061 Error: 506.62970 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.07s Step time: 13.51s\n", + "103680 Examples seen. Accuracy: 0.0060 Error: 503.32239 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.18s Step time: 13.54s\n", + "104320 Examples seen. Accuracy: 0.0064 Error: 528.30927 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.51s\n", + "104960 Examples seen. Accuracy: 0.0071 Error: 503.03436 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.10s Step time: 14.56s\n", + "105600 Examples seen. Accuracy: 0.0071 Error: 503.08496 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.57s\n", + "106240 Examples seen. Accuracy: 0.0072 Error: 472.67468 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.07s Step time: 13.51s\n", + "106880 Examples seen. Accuracy: 0.0071 Error: 484.07269 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.14s Step time: 13.51s\n", + "107520 Examples seen. Accuracy: 0.0069 Error: 510.15106 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.52s\n", + "108160 Examples seen. Accuracy: 0.0067 Error: 480.72421 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.13s Step time: 13.54s\n", + "108800 Examples seen. Accuracy: 0.0068 Error: 488.10437 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.06s Step time: 13.59s\n", + "109440 Examples seen. Accuracy: 0.0072 Error: 532.90295 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.09s Step time: 13.51s\n", + "110080 Examples seen. Accuracy: 0.0067 Error: 483.97739 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.07s Step time: 13.51s\n", + "110720 Examples seen. Accuracy: 0.0069 Error: 486.88147 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.19s Step time: 13.60s\n", + "111360 Examples seen. Accuracy: 0.0071 Error: 504.96417 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.17s Step time: 13.54s\n", + "112000 Examples seen. Accuracy: 0.0072 Error: 482.95364 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.59s\n", + "112640 Examples seen. Accuracy: 0.0078 Error: 507.52612 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.54s\n", + "113280 Examples seen. Accuracy: 0.0079 Error: 505.55130 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.21s Step time: 13.56s\n", + "113920 Examples seen. Accuracy: 0.0081 Error: 499.32159 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.20s Step time: 13.61s\n", + "114560 Examples seen. Accuracy: 0.0077 Error: 495.02670 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.54s\n", + "115200 Examples seen. Accuracy: 0.0072 Error: 478.87927 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.52s\n", + "115840 Examples seen. Accuracy: 0.0074 Error: 496.22247 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.56s\n", + "116480 Examples seen. Accuracy: 0.0069 Error: 485.15167 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.51s\n", + "117120 Examples seen. Accuracy: 0.0074 Error: 486.97391 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.09s Step time: 13.49s\n", + "117760 Examples seen. Accuracy: 0.0074 Error: 498.34589 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.07s Step time: 13.53s\n", + "118400 Examples seen. Accuracy: 0.0074 Error: 508.39993 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.22s Step time: 13.57s\n", + "119040 Examples seen. Accuracy: 0.0070 Error: 517.28033 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 14.58s\n", + "119680 Examples seen. Accuracy: 0.0075 Error: 486.10840 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.03s Step time: 13.72s\n", + "120320 Examples seen. Accuracy: 0.0074 Error: 508.80341 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.52s\n", + "120960 Examples seen. Accuracy: 0.0077 Error: 517.86462 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.57s\n", + "121600 Examples seen. Accuracy: 0.0080 Error: 480.33502 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.58s\n", + "122240 Examples seen. Accuracy: 0.0075 Error: 485.93387 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.23s Step time: 13.55s\n", + "122880 Examples seen. Accuracy: 0.0071 Error: 493.99777 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.07s Step time: 13.53s\n", + "123520 Examples seen. Accuracy: 0.0069 Error: 494.83261 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.18s Step time: 13.55s\n", + "124160 Examples seen. Accuracy: 0.0065 Error: 493.68994 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.20s Step time: 13.57s\n", + "124800 Examples seen. Accuracy: 0.0065 Error: 493.31250 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.17s Step time: 13.56s\n", + "125440 Examples seen. Accuracy: 0.0061 Error: 507.49170 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.55s\n", + "126080 Examples seen. Accuracy: 0.0061 Error: 497.49390 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.55s\n", + "126720 Examples seen. Accuracy: 0.0062 Error: 506.81738 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.57s\n", + "127360 Examples seen. Accuracy: 0.0062 Error: 488.54327 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.11s Step time: 13.65s\n", + "128000 Examples seen. Accuracy: 0.0065 Error: 498.62079 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.20s Step time: 13.66s\n", + "128640 Examples seen. Accuracy: 0.0066 Error: 475.50769 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.14s Step time: 13.56s\n", + "129280 Examples seen. Accuracy: 0.0066 Error: 484.14783 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.23s Step time: 13.60s\n", + "129920 Examples seen. Accuracy: 0.0062 Error: 477.45953 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.19s Step time: 13.65s\n", + "130560 Examples seen. Accuracy: 0.0064 Error: 534.78625 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.18s Step time: 13.59s\n", + "131200 Examples seen. Accuracy: 0.0059 Error: 493.70996 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.56s\n", + "131840 Examples seen. Accuracy: 0.0058 Error: 483.39581 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.60s\n", + "132480 Examples seen. Accuracy: 0.0060 Error: 501.05029 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.06s Step time: 13.48s\n", + "133120 Examples seen. Accuracy: 0.0060 Error: 488.04279 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.10s Step time: 13.47s\n", + "133760 Examples seen. Accuracy: 0.0058 Error: 503.44647 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.06s Step time: 14.53s\n", + "134400 Examples seen. Accuracy: 0.0056 Error: 473.49048 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.07s Step time: 13.50s\n", + "135040 Examples seen. Accuracy: 0.0056 Error: 485.50995 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.08s Step time: 13.47s\n", + "135680 Examples seen. Accuracy: 0.0054 Error: 492.20837 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.52s\n", + "136320 Examples seen. Accuracy: 0.0052 Error: 487.89072 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.25s Step time: 13.64s\n", + "136960 Examples seen. Accuracy: 0.0048 Error: 498.83362 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.52s\n", + "137600 Examples seen. Accuracy: 0.0050 Error: 460.76373 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.09s Step time: 13.54s\n", + "138240 Examples seen. Accuracy: 0.0049 Error: 511.34378 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.23s Step time: 13.59s\n", + "138880 Examples seen. Accuracy: 0.0048 Error: 497.20361 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.13s Step time: 13.58s\n", + "139520 Examples seen. Accuracy: 0.0046 Error: 538.12708 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.20s Step time: 13.62s\n", + "140160 Examples seen. Accuracy: 0.0047 Error: 490.77383 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.23s Step time: 13.59s\n", + "140800 Examples seen. Accuracy: 0.0050 Error: 539.01440 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.29s Step time: 13.65s\n", + "141440 Examples seen. Accuracy: 0.0051 Error: 485.47424 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.11s Step time: 13.61s\n", + "142080 Examples seen. Accuracy: 0.0056 Error: 501.47046 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.58s\n", + "142720 Examples seen. Accuracy: 0.0056 Error: 489.04999 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.28s Step time: 13.64s\n", + "143360 Examples seen. Accuracy: 0.0057 Error: 506.66907 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.54s\n", + "144000 Examples seen. Accuracy: 0.0056 Error: 479.70071 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.64s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at super-resolution-7-64-sep.nn\n", + "Epochs: 3 Examples seen:144000 Validation Accuracy: 0.0130 Validation Error: 487.8206 Validation Loss: 0.0000 Total time: 51.78min\n", + "Epoch time: 17.0487 minutes. 50 epochs: 14.2073 hours.\n", + "Epochs: 3. Working time: 0.86 hours.\n", + "144640 Examples seen. Accuracy: 0.0058 Error: 482.84253 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.22s Step time: 13.63s\n", + "145280 Examples seen. Accuracy: 0.0057 Error: 479.87518 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.18s Step time: 13.62s\n", + "145920 Examples seen. Accuracy: 0.0053 Error: 467.61798 Loss: 0.00000 Threads: 2 Forward time: 2.71s Backward time: 4.14s Step time: 13.60s\n", + "146560 Examples seen. Accuracy: 0.0062 Error: 480.10669 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.32s Step time: 13.61s\n", + "147200 Examples seen. Accuracy: 0.0060 Error: 496.09613 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 14.57s\n", + "147840 Examples seen. Accuracy: 0.0059 Error: 469.50922 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.09s Step time: 13.54s\n", + "148480 Examples seen. Accuracy: 0.0058 Error: 485.76593 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.62s\n", + "149120 Examples seen. Accuracy: 0.0061 Error: 481.53918 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.54s\n", + "149760 Examples seen. Accuracy: 0.0058 Error: 511.47128 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.26s Step time: 13.61s\n", + "150400 Examples seen. Accuracy: 0.0059 Error: 518.06702 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.54s\n", + "151040 Examples seen. Accuracy: 0.0061 Error: 479.96924 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.05s Step time: 13.55s\n", + "151680 Examples seen. Accuracy: 0.0065 Error: 479.63501 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.14s Step time: 13.59s\n", + "152320 Examples seen. Accuracy: 0.0065 Error: 483.24252 Loss: 0.00000 Threads: 2 Forward time: 2.69s Backward time: 4.12s Step time: 13.67s\n", + "152960 Examples seen. Accuracy: 0.0065 Error: 481.83936 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.61s\n", + "153600 Examples seen. Accuracy: 0.0065 Error: 472.81470 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.56s\n", + "154240 Examples seen. Accuracy: 0.0065 Error: 489.83881 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.19s Step time: 13.58s\n", + "154880 Examples seen. Accuracy: 0.0063 Error: 487.60333 Loss: 0.00000 Threads: 2 Forward time: 2.70s Backward time: 4.16s Step time: 13.61s\n", + "155520 Examples seen. Accuracy: 0.0062 Error: 476.33081 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.71s\n", + "156160 Examples seen. Accuracy: 0.0065 Error: 483.24850 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.11s Step time: 13.56s\n", + "156800 Examples seen. Accuracy: 0.0065 Error: 465.00970 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.10s Step time: 13.55s\n", + "157440 Examples seen. Accuracy: 0.0067 Error: 500.15936 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.57s\n", + "158080 Examples seen. Accuracy: 0.0071 Error: 505.68365 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.18s Step time: 13.64s\n", + "158720 Examples seen. Accuracy: 0.0068 Error: 489.68347 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.05s Step time: 13.55s\n", + "159360 Examples seen. Accuracy: 0.0064 Error: 510.78091 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.19s Step time: 13.57s\n", + "160000 Examples seen. Accuracy: 0.0059 Error: 500.01358 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.09s Step time: 13.51s\n", + "160640 Examples seen. Accuracy: 0.0060 Error: 506.80701 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.19s Step time: 13.54s\n", + "161280 Examples seen. Accuracy: 0.0063 Error: 492.36169 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.08s Step time: 13.56s\n", + "161920 Examples seen. Accuracy: 0.0060 Error: 484.02966 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.16s Step time: 14.57s\n", + "162560 Examples seen. Accuracy: 0.0064 Error: 484.25906 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.06s Step time: 13.55s\n", + "163200 Examples seen. Accuracy: 0.0061 Error: 512.24640 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.54s\n", + "163840 Examples seen. Accuracy: 0.0065 Error: 484.00150 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.18s Step time: 13.61s\n", + "164480 Examples seen. Accuracy: 0.0066 Error: 495.19022 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.54s\n", + "165120 Examples seen. Accuracy: 0.0064 Error: 478.40109 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.57s\n", + "165760 Examples seen. Accuracy: 0.0066 Error: 454.86572 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.09s Step time: 13.57s\n", + "166400 Examples seen. Accuracy: 0.0062 Error: 476.02429 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.58s\n", + "167040 Examples seen. Accuracy: 0.0065 Error: 495.01764 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.14s Step time: 13.62s\n", + "167680 Examples seen. Accuracy: 0.0065 Error: 445.10352 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.55s\n", + "168320 Examples seen. Accuracy: 0.0070 Error: 463.96481 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.59s\n", + "168960 Examples seen. Accuracy: 0.0074 Error: 494.14319 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.18s Step time: 13.56s\n", + "169600 Examples seen. Accuracy: 0.0068 Error: 483.85950 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.22s Step time: 13.60s\n", + "170240 Examples seen. Accuracy: 0.0067 Error: 477.56104 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.17s Step time: 13.66s\n", + "170880 Examples seen. Accuracy: 0.0065 Error: 487.87555 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.10s Step time: 13.60s\n", + "171520 Examples seen. Accuracy: 0.0064 Error: 480.39017 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.22s Step time: 13.59s\n", + "172160 Examples seen. Accuracy: 0.0061 Error: 492.07855 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.14s Step time: 13.56s\n", + "172800 Examples seen. Accuracy: 0.0057 Error: 520.66248 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.53s\n", + "173440 Examples seen. Accuracy: 0.0058 Error: 461.52164 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.16s Step time: 13.54s\n", + "174080 Examples seen. Accuracy: 0.0057 Error: 479.44604 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.07s Step time: 13.52s\n", + "174720 Examples seen. Accuracy: 0.0060 Error: 481.28928 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.08s Step time: 13.51s\n", + "175360 Examples seen. Accuracy: 0.0062 Error: 468.12686 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.14s Step time: 13.54s\n", + "176000 Examples seen. Accuracy: 0.0061 Error: 487.07697 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 14.56s\n", + "176640 Examples seen. Accuracy: 0.0062 Error: 461.57016 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.18s Step time: 13.52s\n", + "177280 Examples seen. Accuracy: 0.0061 Error: 511.27362 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.48s\n", + "177920 Examples seen. Accuracy: 0.0060 Error: 491.54022 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.22s Step time: 13.55s\n", + "178560 Examples seen. Accuracy: 0.0059 Error: 496.91278 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.11s Step time: 13.55s\n", + "179200 Examples seen. Accuracy: 0.0060 Error: 491.23914 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.19s Step time: 13.46s\n", + "179840 Examples seen. Accuracy: 0.0062 Error: 471.58606 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.12s Step time: 13.54s\n", + "180480 Examples seen. Accuracy: 0.0065 Error: 499.96558 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.20s Step time: 13.54s\n", + "181120 Examples seen. Accuracy: 0.0071 Error: 513.08386 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.15s Step time: 13.56s\n", + "181760 Examples seen. Accuracy: 0.0072 Error: 515.01361 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.11s Step time: 13.57s\n", + "182400 Examples seen. Accuracy: 0.0072 Error: 497.27148 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.15s Step time: 13.54s\n", + "183040 Examples seen. Accuracy: 0.0069 Error: 473.73062 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.55s\n", + "183680 Examples seen. Accuracy: 0.0065 Error: 495.24847 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.19s Step time: 13.55s\n", + "184320 Examples seen. Accuracy: 0.0063 Error: 492.49548 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.54s\n", + "184960 Examples seen. Accuracy: 0.0061 Error: 472.96729 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.23s Step time: 13.55s\n", + "185600 Examples seen. Accuracy: 0.0064 Error: 490.21896 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.11s Step time: 13.49s\n", + "186240 Examples seen. Accuracy: 0.0066 Error: 488.57913 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.10s Step time: 13.58s\n", + "186880 Examples seen. Accuracy: 0.0064 Error: 496.92990 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.18s Step time: 13.52s\n", + "187520 Examples seen. Accuracy: 0.0060 Error: 485.18893 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.19s Step time: 13.57s\n", + "188160 Examples seen. Accuracy: 0.0061 Error: 505.14429 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.14s Step time: 13.59s\n", + "188800 Examples seen. Accuracy: 0.0065 Error: 460.37302 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.18s Step time: 13.55s\n", + "189440 Examples seen. Accuracy: 0.0064 Error: 511.45392 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.15s Step time: 13.63s\n", + "190080 Examples seen. Accuracy: 0.0066 Error: 481.86359 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 14.60s\n", + "190720 Examples seen. Accuracy: 0.0066 Error: 495.31921 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.20s Step time: 13.57s\n", + "191360 Examples seen. Accuracy: 0.0067 Error: 486.42990 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.20s Step time: 13.55s\n", + "192000 Examples seen. Accuracy: 0.0063 Error: 488.90732 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.55s\n", + "Starting Validation.\n", + "Epochs: 4 Examples seen:192000 Validation Accuracy: 0.0125 Validation Error: 483.2813 Validation Loss: 0.0000 Total time: 69.07min\n", + "Layer 0 Max Output: 1.109 Min Output: -1.750 TNNetInput 16,16,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 1 Max Weight: 0.498 Min Weight: -0.652 Max Output: 1.402 Min Output: -1.488 TNNetDepthwiseConvLinear 16,16,3 Times: 0.08s 0.01s Parent:0\n", + "Layer 2 Neurons: 64 Max Weight: 0.985 Min Weight: -0.985 Max Output: 2.392 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.27s 0.05s Parent:1\n", + "Layer 3 Max Output: 2.392 Min Output: -1.750 TNNetDeepConcat 16,16,67 Times: 0.04s 0.00s Parent:2\n", + "Layer 4 Neurons: 16 Max Weight: 0.227 Min Weight: -0.221 Max Output: 1.624 Min Output: -1.509 TNNetConvolutionLinear 16,16,16 Times: 0.17s 0.02s Parent:3\n", + "Layer 5 Neurons: 1 Max Weight: 0.570 Min Weight: -0.573 Max Output: 1.201 Min Output: -1.016 TNNetDepthwiseConvLinear 16,16,16 Times: 0.07s 0.01s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.432 Min Weight: -0.435 Max Output: 1.155 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.44s 0.05s Parent:5\n", + "Layer 7 Max Output: 2.392 Min Output: -1.750 TNNetDeepConcat 16,16,131 Times: 0.08s 0.00s Parent:6\n", + "Layer 8 Neurons: 16 Max Weight: 0.156 Min Weight: -0.167 Max Output: 1.105 Min Output: -0.929 TNNetConvolutionLinear 16,16,16 Times: 0.19s 0.03s Parent:7\n", + "Layer 9 Neurons: 1 Max Weight: 0.570 Min Weight: -0.567 Max Output: 0.708 Min Output: -1.392 TNNetDepthwiseConvLinear 16,16,16 Times: 0.08s 0.01s Parent:8\n", + "Layer 10 Neurons: 64 Max Weight: 0.448 Min Weight: -0.443 Max Output: 0.904 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.42s 0.04s Parent:9\n", + "Layer 11 Max Output: 2.392 Min Output: -1.750 TNNetDeepConcat 16,16,195 Times: 0.10s 0.00s Parent:10\n", + "Layer 12 Max Output: 2.392 Min Output: -1.750 TNNetDeAvgPool 32,32,195 Times: 3.18s 0.09s Parent:11\n", + "Layer 13 Neurons: 16 Max Weight: 0.250 Min Weight: -0.192 Max Output: 1.278 Min Output: -1.135 TNNetConvolutionLinear 32,32,16 Times: 1.04s 0.15s Parent:12\n", + "Layer 14 Neurons: 1 Max Weight: 0.574 Min Weight: -0.550 Max Output: 1.162 Min Output: -1.209 TNNetDepthwiseConvLinear 32,32,16 Times: 0.29s 0.03s Parent:13\n", + "Layer 15 Neurons: 64 Max Weight: 0.436 Min Weight: -0.444 Max Output: 1.791 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.60s 0.16s Parent:14\n", + "Layer 16 Max Output: 2.392 Min Output: -1.750 TNNetDeepConcat 32,32,259 Times: 0.60s 0.03s Parent:15\n", + "Layer 17 Neurons: 16 Max Weight: 0.228 Min Weight: -0.230 Max Output: 1.424 Min Output: -1.670 TNNetConvolutionLinear 32,32,16 Times: 1.21s 0.18s Parent:16\n", + "Layer 18 Neurons: 1 Max Weight: 0.526 Min Weight: -0.577 Max Output: 2.663 Min Output: -2.447 TNNetDepthwiseConvLinear 32,32,16 Times: 0.30s 0.03s Parent:17\n", + "Layer 19 Neurons: 64 Max Weight: 0.466 Min Weight: -0.440 Max Output: 1.994 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.66s 0.17s Parent:18\n", + "Layer 20 Max Output: 2.392 Min Output: -1.750 TNNetDeepConcat 32,32,323 Times: 0.66s 0.03s Parent:19\n", + "Layer 21 Neurons: 16 Max Weight: 0.222 Min Weight: -0.277 Max Output: 0.838 Min Output: -1.214 TNNetConvolutionLinear 32,32,16 Times: 1.50s 0.21s Parent:20\n", + "Layer 22 Neurons: 1 Max Weight: 0.582 Min Weight: -0.567 Max Output: 1.067 Min Output: -1.301 TNNetDepthwiseConvLinear 32,32,16 Times: 0.26s 0.04s Parent:21\n", + "Layer 23 Neurons: 64 Max Weight: 0.436 Min Weight: -0.434 Max Output: 1.187 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.64s 0.17s Parent:22\n", + "Layer 24 Max Output: 2.392 Min Output: -1.750 TNNetDeepConcat 32,32,387 Times: 0.71s 0.03s Parent:23\n", + "Layer 25 Neurons: 3 Max Weight: 0.567 Min Weight: -0.200 Max Output: 1.015 Min Output: -1.995 TNNetConvolutionLinear 32,32,3 Times: 0.36s 0.05s Parent:24\n", + "Epoch time: 16.9350 minutes. 50 epochs: 14.1125 hours.\n", + "Epochs: 4. Working time: 1.15 hours.\n", + "192640 Examples seen. Accuracy: 0.0066 Error: 473.60315 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.20s Step time: 13.53s\n", + "193280 Examples seen. Accuracy: 0.0065 Error: 463.07104 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.14s Step time: 13.60s\n", + "193920 Examples seen. Accuracy: 0.0066 Error: 473.00958 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.52s\n", + "194560 Examples seen. Accuracy: 0.0068 Error: 460.19659 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.53s\n", + "195200 Examples seen. Accuracy: 0.0069 Error: 483.30719 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.19s Step time: 13.57s\n", + "195840 Examples seen. Accuracy: 0.0067 Error: 488.09341 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.55s\n", + "196480 Examples seen. Accuracy: 0.0067 Error: 475.42435 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.56s\n", + "197120 Examples seen. Accuracy: 0.0066 Error: 450.15369 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.57s\n", + "197760 Examples seen. Accuracy: 0.0067 Error: 507.13831 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.14s Step time: 13.51s\n", + "198400 Examples seen. Accuracy: 0.0067 Error: 447.85626 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.52s\n", + "199040 Examples seen. Accuracy: 0.0067 Error: 455.60974 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.18s Step time: 13.55s\n", + "199680 Examples seen. Accuracy: 0.0063 Error: 467.72415 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.55s\n", + "200320 Examples seen. Accuracy: 0.0065 Error: 472.17673 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.53s\n", + "200960 Examples seen. Accuracy: 0.0070 Error: 483.98212 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.48s\n", + "201600 Examples seen. Accuracy: 0.0069 Error: 492.25720 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.18s Step time: 13.54s\n", + "202240 Examples seen. Accuracy: 0.0069 Error: 499.60797 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.16s Step time: 13.50s\n", + "202880 Examples seen. Accuracy: 0.0068 Error: 479.79852 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.59s\n", + "203520 Examples seen. Accuracy: 0.0075 Error: 484.15894 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.18s Step time: 14.57s\n", + "204160 Examples seen. Accuracy: 0.0073 Error: 505.09601 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.18s Step time: 13.49s\n", + "204800 Examples seen. Accuracy: 0.0071 Error: 525.13049 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.61s\n", + "205440 Examples seen. Accuracy: 0.0071 Error: 464.04041 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.52s\n", + "206080 Examples seen. Accuracy: 0.0078 Error: 504.13019 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.57s\n", + "206720 Examples seen. Accuracy: 0.0077 Error: 483.09235 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.57s\n", + "207360 Examples seen. Accuracy: 0.0077 Error: 488.94952 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.16s Step time: 13.58s\n", + "208000 Examples seen. Accuracy: 0.0082 Error: 471.23431 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.18s Step time: 13.56s\n", + "208640 Examples seen. Accuracy: 0.0083 Error: 471.24115 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.57s\n", + "209280 Examples seen. Accuracy: 0.0083 Error: 523.03052 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.18s Step time: 13.52s\n", + "209920 Examples seen. Accuracy: 0.0082 Error: 467.82611 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.28s Step time: 13.61s\n", + "210560 Examples seen. Accuracy: 0.0082 Error: 479.76825 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.23s Step time: 13.65s\n", + "211200 Examples seen. Accuracy: 0.0079 Error: 454.77603 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.60s\n", + "211840 Examples seen. Accuracy: 0.0074 Error: 470.59937 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.11s Step time: 13.71s\n", + "212480 Examples seen. Accuracy: 0.0070 Error: 487.19843 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.58s\n", + "213120 Examples seen. Accuracy: 0.0070 Error: 514.74579 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.14s Step time: 13.56s\n", + "213760 Examples seen. Accuracy: 0.0066 Error: 477.54724 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.55s\n", + "214400 Examples seen. Accuracy: 0.0070 Error: 463.96924 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.56s\n", + "215040 Examples seen. Accuracy: 0.0068 Error: 472.58746 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.49s\n", + "215680 Examples seen. Accuracy: 0.0069 Error: 463.05548 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.55s\n", + "216320 Examples seen. Accuracy: 0.0064 Error: 489.73770 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.61s\n", + "216960 Examples seen. Accuracy: 0.0063 Error: 436.38702 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.10s Step time: 13.51s\n", + "217600 Examples seen. Accuracy: 0.0064 Error: 489.71680 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 14.56s\n", + "218240 Examples seen. Accuracy: 0.0059 Error: 496.49078 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.16s Step time: 13.52s\n", + "218880 Examples seen. Accuracy: 0.0060 Error: 463.17496 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.54s\n", + "219520 Examples seen. Accuracy: 0.0058 Error: 473.86630 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.21s Step time: 13.52s\n", + "220160 Examples seen. Accuracy: 0.0062 Error: 471.96991 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.57s\n", + "220800 Examples seen. Accuracy: 0.0059 Error: 499.37436 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 13.53s\n", + "221440 Examples seen. Accuracy: 0.0062 Error: 477.00952 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.16s Step time: 13.58s\n", + "222080 Examples seen. Accuracy: 0.0062 Error: 478.55676 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.12s Step time: 13.52s\n", + "222720 Examples seen. Accuracy: 0.0060 Error: 489.54971 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.07s Step time: 13.50s\n", + "223360 Examples seen. Accuracy: 0.0062 Error: 479.03665 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.10s Step time: 13.51s\n", + "224000 Examples seen. Accuracy: 0.0067 Error: 480.49652 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.15s Step time: 13.56s\n", + "224640 Examples seen. Accuracy: 0.0074 Error: 463.57617 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.56s\n", + "225280 Examples seen. Accuracy: 0.0080 Error: 504.67023 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.49s\n", + "225920 Examples seen. Accuracy: 0.0080 Error: 466.86432 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.08s Step time: 13.56s\n", + "226560 Examples seen. Accuracy: 0.0087 Error: 469.20905 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.16s Step time: 13.49s\n", + "227200 Examples seen. Accuracy: 0.0086 Error: 460.38452 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.18s Step time: 13.58s\n", + "227840 Examples seen. Accuracy: 0.0083 Error: 494.25464 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.17s Step time: 13.54s\n", + "228480 Examples seen. Accuracy: 0.0080 Error: 515.50366 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.10s Step time: 13.54s\n", + "229120 Examples seen. Accuracy: 0.0083 Error: 481.31616 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.50s\n", + "229760 Examples seen. Accuracy: 0.0084 Error: 485.80743 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.54s\n", + "230400 Examples seen. Accuracy: 0.0091 Error: 468.18271 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.22s Step time: 13.61s\n", + "231040 Examples seen. Accuracy: 0.0087 Error: 491.08209 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.58s\n", + "231680 Examples seen. Accuracy: 0.0083 Error: 465.28485 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.13s Step time: 14.61s\n", + "232320 Examples seen. Accuracy: 0.0080 Error: 456.51727 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.53s\n", + "232960 Examples seen. Accuracy: 0.0077 Error: 487.30887 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.09s Step time: 13.51s\n", + "233600 Examples seen. Accuracy: 0.0075 Error: 469.76190 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.19s Step time: 13.53s\n", + "234240 Examples seen. Accuracy: 0.0072 Error: 482.53732 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.15s Step time: 13.55s\n", + "234880 Examples seen. Accuracy: 0.0074 Error: 449.63705 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.11s Step time: 13.54s\n", + "235520 Examples seen. Accuracy: 0.0076 Error: 471.67697 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.12s Step time: 13.60s\n", + "236160 Examples seen. Accuracy: 0.0081 Error: 473.87421 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.26s Step time: 13.56s\n", + "236800 Examples seen. Accuracy: 0.0080 Error: 470.39676 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.18s Step time: 13.53s\n", + "237440 Examples seen. Accuracy: 0.0081 Error: 467.59305 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.53s\n", + "238080 Examples seen. Accuracy: 0.0079 Error: 504.38068 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.20s Step time: 13.53s\n", + "238720 Examples seen. Accuracy: 0.0077 Error: 453.68860 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.19s Step time: 13.56s\n", + "239360 Examples seen. Accuracy: 0.0074 Error: 465.89865 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.60s\n", + "240000 Examples seen. Accuracy: 0.0076 Error: 484.19406 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.19s Step time: 13.52s\n", + "Starting Validation.\n", + "Epochs: 5 Examples seen:240000 Validation Accuracy: 0.0125 Validation Error: 478.7688 Validation Loss: 0.0000 Total time: 86.32min\n", + "Epoch time: 16.9062 minutes. 50 epochs: 14.0885 hours.\n", + "Epochs: 5. Working time: 1.44 hours.\n", + "240640 Examples seen. Accuracy: 0.0082 Error: 459.24146 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.21s Step time: 13.51s\n", + "241280 Examples seen. Accuracy: 0.0083 Error: 483.96188 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.06s Step time: 13.50s\n", + "241920 Examples seen. Accuracy: 0.0081 Error: 485.30432 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.62s\n", + "242560 Examples seen. Accuracy: 0.0089 Error: 492.85339 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.20s Step time: 13.49s\n", + "243200 Examples seen. Accuracy: 0.0088 Error: 487.22314 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.21s Step time: 13.51s\n", + "243840 Examples seen. Accuracy: 0.0087 Error: 457.66797 Loss: 0.00000 Threads: 2 Forward time: 2.87s Backward time: 4.60s Step time: 14.59s\n", + "244480 Examples seen. Accuracy: 0.0084 Error: 503.07611 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.08s Step time: 13.54s\n", + "245120 Examples seen. Accuracy: 0.0079 Error: 469.86115 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.12s Step time: 15.27s\n", + "245760 Examples seen. Accuracy: 0.0081 Error: 453.55011 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.56s\n", + "246400 Examples seen. Accuracy: 0.0080 Error: 442.25891 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.16s Step time: 13.55s\n", + "247040 Examples seen. Accuracy: 0.0077 Error: 487.83191 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.18s Step time: 13.54s\n", + "247680 Examples seen. Accuracy: 0.0077 Error: 476.69193 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.13s Step time: 13.53s\n", + "248320 Examples seen. Accuracy: 0.0071 Error: 469.07785 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.05s Step time: 13.52s\n", + "248960 Examples seen. Accuracy: 0.0070 Error: 449.41745 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.54s\n", + "249600 Examples seen. Accuracy: 0.0069 Error: 475.58618 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.56s\n", + "250240 Examples seen. Accuracy: 0.0066 Error: 488.79742 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.20s Step time: 13.57s\n", + "250880 Examples seen. Accuracy: 0.0072 Error: 474.20917 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.56s\n", + "251520 Examples seen. Accuracy: 0.0072 Error: 471.54724 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.51s\n", + "252160 Examples seen. Accuracy: 0.0069 Error: 459.48523 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.24s Step time: 13.57s\n", + "252800 Examples seen. Accuracy: 0.0071 Error: 462.98450 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.52s\n", + "253440 Examples seen. Accuracy: 0.0067 Error: 508.72696 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.53s\n", + "254080 Examples seen. Accuracy: 0.0067 Error: 489.83722 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.53s\n", + "254720 Examples seen. Accuracy: 0.0065 Error: 467.22836 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.07s Step time: 13.50s\n", + "255360 Examples seen. Accuracy: 0.0062 Error: 464.30505 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.15s Step time: 13.52s\n", + "256000 Examples seen. Accuracy: 0.0060 Error: 464.66214 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.47s\n", + "256640 Examples seen. Accuracy: 0.0056 Error: 474.69196 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.10s Step time: 13.45s\n", + "257280 Examples seen. Accuracy: 0.0066 Error: 473.70715 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.07s Step time: 13.53s\n", + "257920 Examples seen. Accuracy: 0.0073 Error: 499.43549 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.06s Step time: 13.51s\n", + "258560 Examples seen. Accuracy: 0.0074 Error: 484.35822 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.08s Step time: 14.59s\n", + "259200 Examples seen. Accuracy: 0.0075 Error: 491.92004 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.57s\n", + "259840 Examples seen. Accuracy: 0.0085 Error: 485.17087 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.12s Step time: 13.49s\n", + "260480 Examples seen. Accuracy: 0.0079 Error: 468.55060 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.10s Step time: 13.54s\n", + "261120 Examples seen. Accuracy: 0.0083 Error: 494.08176 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.54s\n", + "261760 Examples seen. Accuracy: 0.0083 Error: 449.36450 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.52s\n", + "262400 Examples seen. Accuracy: 0.0079 Error: 482.75134 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.50s\n", + "263040 Examples seen. Accuracy: 0.0077 Error: 488.61908 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.14s Step time: 13.56s\n", + "263680 Examples seen. Accuracy: 0.0079 Error: 452.85303 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.58s\n", + "264320 Examples seen. Accuracy: 0.0076 Error: 471.96252 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.59s\n", + "264960 Examples seen. Accuracy: 0.0078 Error: 456.01645 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.56s\n", + "265600 Examples seen. Accuracy: 0.0077 Error: 496.99786 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.54s\n", + "266240 Examples seen. Accuracy: 0.0074 Error: 490.50906 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.20s Step time: 13.52s\n", + "266880 Examples seen. Accuracy: 0.0072 Error: 469.67838 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.55s\n", + "267520 Examples seen. Accuracy: 0.0072 Error: 481.59912 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.08s Step time: 13.52s\n", + "268160 Examples seen. Accuracy: 0.0072 Error: 503.56894 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.11s Step time: 13.57s\n", + "268800 Examples seen. Accuracy: 0.0069 Error: 454.96161 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.18s Step time: 13.51s\n", + "269440 Examples seen. Accuracy: 0.0066 Error: 489.38220 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.55s\n", + "270080 Examples seen. Accuracy: 0.0066 Error: 493.88187 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.21s Step time: 13.53s\n", + "270720 Examples seen. Accuracy: 0.0063 Error: 480.79797 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.50s\n", + "271360 Examples seen. Accuracy: 0.0059 Error: 501.95285 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.07s Step time: 13.58s\n", + "272000 Examples seen. Accuracy: 0.0060 Error: 474.58990 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.59s\n", + "272640 Examples seen. Accuracy: 0.0061 Error: 482.74777 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.21s Step time: 14.74s\n", + "273280 Examples seen. Accuracy: 0.0059 Error: 476.17834 Loss: 0.00000 Threads: 2 Forward time: 2.69s Backward time: 4.34s Step time: 15.15s\n", + "273920 Examples seen. Accuracy: 0.0062 Error: 452.36887 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.22s Step time: 13.94s\n", + "274560 Examples seen. Accuracy: 0.0065 Error: 484.89743 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.13s Step time: 13.62s\n", + "275200 Examples seen. Accuracy: 0.0067 Error: 466.79642 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.59s\n", + "275840 Examples seen. Accuracy: 0.0069 Error: 473.80170 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.23s Step time: 13.57s\n", + "276480 Examples seen. Accuracy: 0.0071 Error: 461.88477 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.09s Step time: 13.53s\n", + "277120 Examples seen. Accuracy: 0.0074 Error: 489.38266 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.21s Step time: 13.60s\n", + "277760 Examples seen. Accuracy: 0.0070 Error: 459.28143 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.22s Step time: 13.81s\n", + "278400 Examples seen. Accuracy: 0.0067 Error: 468.65750 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.22s Step time: 13.70s\n", + "279040 Examples seen. Accuracy: 0.0066 Error: 480.36859 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.11s Step time: 13.61s\n", + "279680 Examples seen. Accuracy: 0.0065 Error: 471.11890 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.11s Step time: 13.55s\n", + "280320 Examples seen. Accuracy: 0.0070 Error: 481.99341 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 13.54s\n", + "280960 Examples seen. Accuracy: 0.0072 Error: 479.01001 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.09s Step time: 13.51s\n", + "281600 Examples seen. Accuracy: 0.0073 Error: 467.92358 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.58s\n", + "282240 Examples seen. Accuracy: 0.0073 Error: 467.89551 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.57s\n", + "282880 Examples seen. Accuracy: 0.0071 Error: 482.22235 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.52s\n", + "283520 Examples seen. Accuracy: 0.0072 Error: 470.03894 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.10s Step time: 13.53s\n", + "284160 Examples seen. Accuracy: 0.0067 Error: 485.67017 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.20s Step time: 13.53s\n", + "284800 Examples seen. Accuracy: 0.0067 Error: 482.95709 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.09s Step time: 13.54s\n", + "285440 Examples seen. Accuracy: 0.0064 Error: 482.01538 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.15s Step time: 13.50s\n", + "286080 Examples seen. Accuracy: 0.0062 Error: 481.53851 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.19s Step time: 14.73s\n", + "286720 Examples seen. Accuracy: 0.0064 Error: 503.15363 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.12s Step time: 13.54s\n", + "287360 Examples seen. Accuracy: 0.0064 Error: 494.99121 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.56s\n", + "288000 Examples seen. Accuracy: 0.0059 Error: 490.70001 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.44s\n", + "Starting Validation.\n", + "Epochs: 6 Examples seen:288000 Validation Accuracy: 0.0120 Validation Error: 473.3537 Validation Loss: 0.0000 Total time: 103.66min\n", + "Layer 0 Max Output: 1.109 Min Output: -1.750 TNNetInput 16,16,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 1 Max Weight: 0.480 Min Weight: -0.683 Max Output: 1.331 Min Output: -1.486 TNNetDepthwiseConvLinear 16,16,3 Times: 0.08s 0.01s Parent:0\n", + "Layer 2 Neurons: 64 Max Weight: 0.984 Min Weight: -0.984 Max Output: 2.349 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.30s 0.05s Parent:1\n", + "Layer 3 Max Output: 2.349 Min Output: -1.750 TNNetDeepConcat 16,16,67 Times: 0.03s 0.00s Parent:2\n", + "Layer 4 Neurons: 16 Max Weight: 0.230 Min Weight: -0.219 Max Output: 1.545 Min Output: -1.392 TNNetConvolutionLinear 16,16,16 Times: 0.17s 0.02s Parent:3\n", + "Layer 5 Neurons: 1 Max Weight: 0.571 Min Weight: -0.573 Max Output: 1.172 Min Output: -0.959 TNNetDepthwiseConvLinear 16,16,16 Times: 0.06s 0.00s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.432 Min Weight: -0.436 Max Output: 1.093 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.40s 0.05s Parent:5\n", + "Layer 7 Max Output: 2.349 Min Output: -1.750 TNNetDeepConcat 16,16,131 Times: 0.07s 0.00s Parent:6\n", + "Layer 8 Neurons: 16 Max Weight: 0.156 Min Weight: -0.165 Max Output: 1.120 Min Output: -0.890 TNNetConvolutionLinear 16,16,16 Times: 0.22s 0.03s Parent:7\n", + "Layer 9 Neurons: 1 Max Weight: 0.575 Min Weight: -0.567 Max Output: 0.735 Min Output: -1.399 TNNetDepthwiseConvLinear 16,16,16 Times: 0.07s 0.01s Parent:8\n", + "Layer 10 Neurons: 64 Max Weight: 0.450 Min Weight: -0.444 Max Output: 0.893 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.43s 0.04s Parent:9\n", + "Layer 11 Max Output: 2.349 Min Output: -1.750 TNNetDeepConcat 16,16,195 Times: 0.11s 0.00s Parent:10\n", + "Layer 12 Max Output: 2.349 Min Output: -1.750 TNNetDeAvgPool 32,32,195 Times: 3.12s 0.09s Parent:11\n", + "Layer 13 Neurons: 16 Max Weight: 0.266 Min Weight: -0.197 Max Output: 1.236 Min Output: -1.171 TNNetConvolutionLinear 32,32,16 Times: 1.03s 0.14s Parent:12\n", + "Layer 14 Neurons: 1 Max Weight: 0.575 Min Weight: -0.552 Max Output: 1.139 Min Output: -1.284 TNNetDepthwiseConvLinear 32,32,16 Times: 0.30s 0.03s Parent:13\n", + "Layer 15 Neurons: 64 Max Weight: 0.438 Min Weight: -0.449 Max Output: 1.866 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.59s 0.16s Parent:14\n", + "Layer 16 Max Output: 2.349 Min Output: -1.750 TNNetDeepConcat 32,32,259 Times: 0.55s 0.03s Parent:15\n", + "Layer 17 Neurons: 16 Max Weight: 0.250 Min Weight: -0.227 Max Output: 1.435 Min Output: -1.799 TNNetConvolutionLinear 32,32,16 Times: 1.27s 0.18s Parent:16\n", + "Layer 18 Neurons: 1 Max Weight: 0.529 Min Weight: -0.583 Max Output: 2.865 Min Output: -2.469 TNNetDepthwiseConvLinear 32,32,16 Times: 0.32s 0.03s Parent:17\n", + "Layer 19 Neurons: 64 Max Weight: 0.470 Min Weight: -0.446 Max Output: 1.935 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.60s 0.17s Parent:18\n", + "Layer 20 Max Output: 2.349 Min Output: -1.750 TNNetDeepConcat 32,32,323 Times: 0.67s 0.03s Parent:19\n", + "Layer 21 Neurons: 16 Max Weight: 0.246 Min Weight: -0.300 Max Output: 0.804 Min Output: -1.231 TNNetConvolutionLinear 32,32,16 Times: 1.50s 0.21s Parent:20\n", + "Layer 22 Neurons: 1 Max Weight: 0.584 Min Weight: -0.566 Max Output: 1.036 Min Output: -1.283 TNNetDepthwiseConvLinear 32,32,16 Times: 0.31s 0.04s Parent:21\n", + "Layer 23 Neurons: 64 Max Weight: 0.441 Min Weight: -0.436 Max Output: 1.253 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.62s 0.16s Parent:22\n", + "Layer 24 Max Output: 2.349 Min Output: -1.750 TNNetDeepConcat 32,32,387 Times: 0.73s 0.03s Parent:23\n", + "Layer 25 Neurons: 3 Max Weight: 0.561 Min Weight: -0.194 Max Output: 1.011 Min Output: -2.006 TNNetConvolutionLinear 32,32,3 Times: 0.34s 0.05s Parent:24\n", + "Epoch time: 16.7950 minutes. 50 epochs: 13.9958 hours.\n", + "Epochs: 6. Working time: 1.73 hours.\n", + "288640 Examples seen. Accuracy: 0.0058 Error: 458.74335 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.49s\n", + "289280 Examples seen. Accuracy: 0.0060 Error: 471.75494 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.53s\n", + "289920 Examples seen. Accuracy: 0.0061 Error: 500.47757 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.48s\n", + "290560 Examples seen. Accuracy: 0.0072 Error: 499.18802 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.13s Step time: 13.51s\n", + "291200 Examples seen. Accuracy: 0.0072 Error: 502.81696 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.51s\n", + "291840 Examples seen. Accuracy: 0.0065 Error: 483.81848 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.10s Step time: 13.58s\n", + "292480 Examples seen. Accuracy: 0.0063 Error: 497.52057 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.12s Step time: 13.54s\n", + "293120 Examples seen. Accuracy: 0.0066 Error: 476.22040 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.52s\n", + "293760 Examples seen. Accuracy: 0.0067 Error: 452.35104 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.18s Step time: 13.53s\n", + "294400 Examples seen. Accuracy: 0.0071 Error: 507.09909 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 13.54s\n", + "295040 Examples seen. Accuracy: 0.0075 Error: 482.68585 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.52s\n", + "295680 Examples seen. Accuracy: 0.0073 Error: 472.22931 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.12s Step time: 13.48s\n", + "296320 Examples seen. Accuracy: 0.0070 Error: 443.57971 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.52s\n", + "296960 Examples seen. Accuracy: 0.0067 Error: 455.83325 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.53s\n", + "297600 Examples seen. Accuracy: 0.0069 Error: 471.22665 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.06s Step time: 13.50s\n", + "298240 Examples seen. Accuracy: 0.0072 Error: 467.52960 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.20s Step time: 13.51s\n", + "298880 Examples seen. Accuracy: 0.0071 Error: 492.26923 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.46s\n", + "299520 Examples seen. Accuracy: 0.0069 Error: 487.98450 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.09s Step time: 14.56s\n", + "300160 Examples seen. Accuracy: 0.0071 Error: 474.41687 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.11s Step time: 13.54s\n", + "300800 Examples seen. Accuracy: 0.0067 Error: 500.02222 Loss: 0.00000 Threads: 2 Forward time: 3.34s Backward time: 5.23s Step time: 15.10s\n", + "301440 Examples seen. Accuracy: 0.0069 Error: 474.83514 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.54s\n", + "302080 Examples seen. Accuracy: 0.0068 Error: 466.61456 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.56s\n", + "302720 Examples seen. Accuracy: 0.0066 Error: 471.31079 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.08s Step time: 13.49s\n", + "303360 Examples seen. Accuracy: 0.0072 Error: 499.76447 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.59s\n", + "304000 Examples seen. Accuracy: 0.0068 Error: 474.33905 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.50s\n", + "304640 Examples seen. Accuracy: 0.0070 Error: 470.36993 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.44s\n", + "305280 Examples seen. Accuracy: 0.0066 Error: 453.22729 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.07s Step time: 13.55s\n", + "305920 Examples seen. Accuracy: 0.0072 Error: 481.15247 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.19s Step time: 13.58s\n", + "306560 Examples seen. Accuracy: 0.0072 Error: 484.29535 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.58s\n", + "307200 Examples seen. Accuracy: 0.0071 Error: 495.87933 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.11s Step time: 13.52s\n", + "307840 Examples seen. Accuracy: 0.0070 Error: 446.00110 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.50s\n", + "308480 Examples seen. Accuracy: 0.0068 Error: 500.33649 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.11s Step time: 13.54s\n", + "309120 Examples seen. Accuracy: 0.0064 Error: 458.79858 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.52s\n", + "309760 Examples seen. Accuracy: 0.0065 Error: 452.84290 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.20s Step time: 13.56s\n", + "310400 Examples seen. Accuracy: 0.0068 Error: 463.32471 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.11s Step time: 13.50s\n", + "311040 Examples seen. Accuracy: 0.0066 Error: 465.96405 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.52s\n", + "311680 Examples seen. Accuracy: 0.0068 Error: 470.90240 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.15s Step time: 13.56s\n", + "312320 Examples seen. Accuracy: 0.0071 Error: 503.75287 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.20s Step time: 13.59s\n", + "312960 Examples seen. Accuracy: 0.0066 Error: 510.85956 Loss: 0.00000 Threads: 2 Forward time: 3.24s Backward time: 5.02s Step time: 13.93s\n", + "313600 Examples seen. Accuracy: 0.0068 Error: 463.11038 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 14.34s\n", + "314240 Examples seen. Accuracy: 0.0073 Error: 467.39493 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.55s\n", + "314880 Examples seen. Accuracy: 0.0076 Error: 452.49164 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.51s\n", + "315520 Examples seen. Accuracy: 0.0078 Error: 481.83307 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.14s Step time: 13.59s\n", + "316160 Examples seen. Accuracy: 0.0073 Error: 467.32690 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.07s Step time: 13.51s\n", + "316800 Examples seen. Accuracy: 0.0068 Error: 469.18518 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.46s\n", + "317440 Examples seen. Accuracy: 0.0067 Error: 457.94937 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.57s\n", + "318080 Examples seen. Accuracy: 0.0068 Error: 489.90729 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.20s Step time: 13.52s\n", + "318720 Examples seen. Accuracy: 0.0066 Error: 450.51190 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.14s Step time: 13.49s\n", + "319360 Examples seen. Accuracy: 0.0075 Error: 481.29773 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.54s\n", + "320000 Examples seen. Accuracy: 0.0077 Error: 438.86542 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.03s Step time: 13.48s\n", + "320640 Examples seen. Accuracy: 0.0075 Error: 466.16785 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.42s\n", + "321280 Examples seen. Accuracy: 0.0071 Error: 491.31482 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.12s Step time: 13.58s\n", + "321920 Examples seen. Accuracy: 0.0078 Error: 487.10626 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.14s Step time: 13.48s\n", + "322560 Examples seen. Accuracy: 0.0078 Error: 479.16815 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.09s Step time: 13.45s\n", + "323200 Examples seen. Accuracy: 0.0076 Error: 463.93265 Loss: 0.00000 Threads: 2 Forward time: 2.49s Backward time: 4.11s Step time: 13.45s\n", + "323840 Examples seen. Accuracy: 0.0081 Error: 510.94592 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.47s\n", + "324480 Examples seen. Accuracy: 0.0080 Error: 444.48431 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.17s Step time: 13.52s\n", + "325120 Examples seen. Accuracy: 0.0077 Error: 486.51199 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.10s Step time: 13.47s\n", + "325760 Examples seen. Accuracy: 0.0073 Error: 469.71198 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.22s Step time: 13.57s\n", + "326400 Examples seen. Accuracy: 0.0072 Error: 487.62344 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 14.59s\n", + "327040 Examples seen. Accuracy: 0.0072 Error: 492.36163 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.14s Step time: 13.49s\n", + "327680 Examples seen. Accuracy: 0.0073 Error: 487.03046 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.11s Step time: 13.51s\n", + "328320 Examples seen. Accuracy: 0.0070 Error: 487.37500 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.49s\n", + "328960 Examples seen. Accuracy: 0.0074 Error: 461.83850 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.07s Step time: 13.53s\n", + "329600 Examples seen. Accuracy: 0.0068 Error: 466.16309 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.19s Step time: 13.47s\n", + "330240 Examples seen. Accuracy: 0.0068 Error: 450.71329 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.53s\n", + "330880 Examples seen. Accuracy: 0.0068 Error: 478.07928 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.51s\n", + "331520 Examples seen. Accuracy: 0.0067 Error: 493.40988 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.19s Step time: 13.52s\n", + "332160 Examples seen. Accuracy: 0.0070 Error: 483.12802 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.18s Step time: 13.49s\n", + "332800 Examples seen. Accuracy: 0.0068 Error: 494.18665 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.48s\n", + "333440 Examples seen. Accuracy: 0.0063 Error: 479.59839 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.48s\n", + "334080 Examples seen. Accuracy: 0.0073 Error: 453.77795 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.10s Step time: 13.47s\n", + "334720 Examples seen. Accuracy: 0.0072 Error: 476.69611 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.05s Step time: 13.46s\n", + "335360 Examples seen. Accuracy: 0.0069 Error: 490.09229 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.07s Step time: 13.52s\n", + "336000 Examples seen. Accuracy: 0.0067 Error: 486.13110 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.20s Step time: 13.60s\n", + "Starting Validation.\n", + "Epochs: 7 Examples seen:336000 Validation Accuracy: 0.0130 Validation Error: 469.3442 Validation Loss: 0.0000 Total time: 120.90min\n", + "Epoch time: 16.9950 minutes. 50 epochs: 14.1625 hours.\n", + "Epochs: 7. Working time: 2.02 hours.\n", + "336640 Examples seen. Accuracy: 0.0067 Error: 471.17084 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.09s Step time: 13.51s\n", + "337280 Examples seen. Accuracy: 0.0072 Error: 486.62976 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.52s\n", + "337920 Examples seen. Accuracy: 0.0068 Error: 467.14798 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.55s\n", + "338560 Examples seen. Accuracy: 0.0068 Error: 458.40778 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.12s Step time: 13.53s\n", + "339200 Examples seen. Accuracy: 0.0076 Error: 466.13678 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 14.62s\n", + "339840 Examples seen. Accuracy: 0.0074 Error: 448.00751 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.16s Step time: 13.51s\n", + "340480 Examples seen. Accuracy: 0.0074 Error: 447.95969 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.16s Step time: 13.51s\n", + "341120 Examples seen. Accuracy: 0.0070 Error: 480.98590 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.08s Step time: 13.54s\n", + "341760 Examples seen. Accuracy: 0.0073 Error: 448.06744 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.12s Step time: 13.52s\n", + "342400 Examples seen. Accuracy: 0.0073 Error: 472.68823 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.21s Step time: 13.52s\n", + "343040 Examples seen. Accuracy: 0.0080 Error: 468.89771 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.14s Step time: 13.51s\n", + "343680 Examples seen. Accuracy: 0.0080 Error: 467.50540 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.14s Step time: 13.51s\n", + "344320 Examples seen. Accuracy: 0.0079 Error: 477.88367 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.47s\n", + "344960 Examples seen. Accuracy: 0.0078 Error: 473.81897 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.10s Step time: 13.50s\n", + "345600 Examples seen. Accuracy: 0.0081 Error: 440.78271 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.10s Step time: 13.49s\n", + "346240 Examples seen. Accuracy: 0.0081 Error: 470.21573 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.48s\n", + "346880 Examples seen. Accuracy: 0.0081 Error: 480.42493 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.15s Step time: 13.53s\n", + "347520 Examples seen. Accuracy: 0.0077 Error: 461.32986 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.14s Step time: 13.54s\n", + "348160 Examples seen. Accuracy: 0.0073 Error: 481.53531 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.54s\n", + "348800 Examples seen. Accuracy: 0.0078 Error: 507.30740 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.48s\n", + "349440 Examples seen. Accuracy: 0.0076 Error: 473.52518 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.52s\n", + "350080 Examples seen. Accuracy: 0.0076 Error: 460.86096 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.06s Step time: 13.53s\n", + "350720 Examples seen. Accuracy: 0.0075 Error: 469.75897 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.56s\n", + "351360 Examples seen. Accuracy: 0.0073 Error: 453.06128 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.04s Step time: 13.56s\n", + "352000 Examples seen. Accuracy: 0.0072 Error: 449.21722 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.23s Step time: 13.50s\n", + "352640 Examples seen. Accuracy: 0.0076 Error: 467.33438 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 14.60s\n", + "353280 Examples seen. Accuracy: 0.0075 Error: 442.24091 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.53s\n", + "353920 Examples seen. Accuracy: 0.0078 Error: 437.20883 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.53s\n", + "354560 Examples seen. Accuracy: 0.0079 Error: 444.01590 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.53s\n", + "355200 Examples seen. Accuracy: 0.0078 Error: 450.22421 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.06s Step time: 13.57s\n", + "355840 Examples seen. Accuracy: 0.0078 Error: 506.48981 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.20s Step time: 13.52s\n", + "356480 Examples seen. Accuracy: 0.0075 Error: 459.53891 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.54s\n", + "357120 Examples seen. Accuracy: 0.0069 Error: 443.44080 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.19s Step time: 13.60s\n", + "357760 Examples seen. Accuracy: 0.0068 Error: 477.62613 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.09s Step time: 13.50s\n", + "358400 Examples seen. Accuracy: 0.0073 Error: 474.41864 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.20s Step time: 13.51s\n", + "359040 Examples seen. Accuracy: 0.0074 Error: 465.39621 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.26s Step time: 13.60s\n", + "359680 Examples seen. Accuracy: 0.0077 Error: 445.29422 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.14s Step time: 13.55s\n", + "360320 Examples seen. Accuracy: 0.0073 Error: 475.14270 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.10s Step time: 13.48s\n", + "360960 Examples seen. Accuracy: 0.0070 Error: 463.77252 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.53s\n", + "361600 Examples seen. Accuracy: 0.0075 Error: 427.87839 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.08s Step time: 13.57s\n", + "362240 Examples seen. Accuracy: 0.0079 Error: 461.99185 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.19s Step time: 13.61s\n", + "362880 Examples seen. Accuracy: 0.0074 Error: 435.48694 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.14s Step time: 13.54s\n", + "363520 Examples seen. Accuracy: 0.0070 Error: 463.42661 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.21s Step time: 13.58s\n", + "364160 Examples seen. Accuracy: 0.0070 Error: 494.34644 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.10s Step time: 13.56s\n", + "364800 Examples seen. Accuracy: 0.0070 Error: 449.02090 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.55s\n", + "365440 Examples seen. Accuracy: 0.0068 Error: 473.47119 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.12s Step time: 13.51s\n", + "366080 Examples seen. Accuracy: 0.0065 Error: 479.83887 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 14.58s\n", + "366720 Examples seen. Accuracy: 0.0066 Error: 478.83752 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.07s Step time: 13.53s\n", + "367360 Examples seen. Accuracy: 0.0074 Error: 478.59387 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.11s Step time: 13.52s\n", + "368000 Examples seen. Accuracy: 0.0074 Error: 489.29742 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.58s\n", + "368640 Examples seen. Accuracy: 0.0070 Error: 465.98145 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.56s\n", + "369280 Examples seen. Accuracy: 0.0069 Error: 497.09241 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.61s\n", + "369920 Examples seen. Accuracy: 0.0069 Error: 479.92627 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.21s Step time: 13.66s\n", + "370560 Examples seen. Accuracy: 0.0072 Error: 475.85825 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.17s Step time: 13.54s\n", + "371200 Examples seen. Accuracy: 0.0077 Error: 472.82031 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.06s Step time: 13.53s\n", + "371840 Examples seen. Accuracy: 0.0075 Error: 472.32126 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.24s Step time: 13.58s\n", + "372480 Examples seen. Accuracy: 0.0072 Error: 477.09256 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.54s\n", + "373120 Examples seen. Accuracy: 0.0072 Error: 461.81348 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.18s Step time: 13.59s\n", + "373760 Examples seen. Accuracy: 0.0068 Error: 462.57150 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.25s Step time: 13.59s\n", + "374400 Examples seen. Accuracy: 0.0069 Error: 478.37238 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.11s Step time: 13.49s\n", + "375040 Examples seen. Accuracy: 0.0069 Error: 470.55225 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.54s\n", + "375680 Examples seen. Accuracy: 0.0063 Error: 464.50970 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.12s Step time: 13.52s\n", + "376320 Examples seen. Accuracy: 0.0064 Error: 473.13513 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.53s\n", + "376960 Examples seen. Accuracy: 0.0063 Error: 498.49969 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.10s Step time: 13.49s\n", + "377600 Examples seen. Accuracy: 0.0062 Error: 476.52216 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.54s\n", + "378240 Examples seen. Accuracy: 0.0066 Error: 444.91190 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.48s\n", + "378880 Examples seen. Accuracy: 0.0067 Error: 451.45306 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.18s Step time: 13.52s\n", + "379520 Examples seen. Accuracy: 0.0070 Error: 488.84674 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.15s Step time: 14.63s\n", + "380160 Examples seen. Accuracy: 0.0069 Error: 468.66656 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.18s Step time: 13.59s\n", + "380800 Examples seen. Accuracy: 0.0067 Error: 466.98856 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.09s Step time: 13.54s\n", + "381440 Examples seen. Accuracy: 0.0065 Error: 446.80090 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.58s\n", + "382080 Examples seen. Accuracy: 0.0065 Error: 473.04471 Loss: 0.00000 Threads: 2 Forward time: 2.69s Backward time: 4.15s Step time: 13.55s\n", + "382720 Examples seen. Accuracy: 0.0066 Error: 478.64142 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.02s Step time: 13.57s\n", + "383360 Examples seen. Accuracy: 0.0078 Error: 434.45166 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.20s Step time: 13.54s\n", + "384000 Examples seen. Accuracy: 0.0075 Error: 485.42188 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.18s Step time: 13.48s\n", + "Starting Validation.\n", + "VALIDATION RECORD! Saving NN at super-resolution-7-64-sep.nn\n", + "Epochs: 8 Examples seen:384000 Validation Accuracy: 0.0135 Validation Error: 468.1282 Validation Loss: 0.0000 Total time: 138.16min\n", + "Layer 0 Max Output: 1.109 Min Output: -1.750 TNNetInput 16,16,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 1 Max Weight: 0.494 Min Weight: -0.706 Max Output: 1.266 Min Output: -1.476 TNNetDepthwiseConvLinear 16,16,3 Times: 0.07s 0.01s Parent:0\n", + "Layer 2 Neurons: 64 Max Weight: 0.982 Min Weight: -0.982 Max Output: 2.312 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.31s 0.05s Parent:1\n", + "Layer 3 Max Output: 2.312 Min Output: -1.750 TNNetDeepConcat 16,16,67 Times: 0.03s 0.00s Parent:2\n", + "Layer 4 Neurons: 16 Max Weight: 0.231 Min Weight: -0.219 Max Output: 1.468 Min Output: -1.286 TNNetConvolutionLinear 16,16,16 Times: 0.17s 0.03s Parent:3\n", + "Layer 5 Neurons: 1 Max Weight: 0.572 Min Weight: -0.572 Max Output: 1.115 Min Output: -0.913 TNNetDepthwiseConvLinear 16,16,16 Times: 0.07s 0.01s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.432 Min Weight: -0.435 Max Output: 1.053 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.42s 0.05s Parent:5\n", + "Layer 7 Max Output: 2.312 Min Output: -1.750 TNNetDeepConcat 16,16,131 Times: 0.07s 0.00s Parent:6\n", + "Layer 8 Neurons: 16 Max Weight: 0.158 Min Weight: -0.166 Max Output: 1.143 Min Output: -0.861 TNNetConvolutionLinear 16,16,16 Times: 0.21s 0.03s Parent:7\n", + "Layer 9 Neurons: 1 Max Weight: 0.578 Min Weight: -0.568 Max Output: 0.757 Min Output: -1.415 TNNetDepthwiseConvLinear 16,16,16 Times: 0.07s 0.01s Parent:8\n", + "Layer 10 Neurons: 64 Max Weight: 0.451 Min Weight: -0.445 Max Output: 0.876 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.43s 0.04s Parent:9\n", + "Layer 11 Max Output: 2.312 Min Output: -1.750 TNNetDeepConcat 16,16,195 Times: 0.09s 0.00s Parent:10\n", + "Layer 12 Max Output: 2.312 Min Output: -1.750 TNNetDeAvgPool 32,32,195 Times: 3.13s 0.10s Parent:11\n", + "Layer 13 Neurons: 16 Max Weight: 0.276 Min Weight: -0.201 Max Output: 1.233 Min Output: -1.168 TNNetConvolutionLinear 32,32,16 Times: 1.05s 0.15s Parent:12\n", + "Layer 14 Neurons: 1 Max Weight: 0.579 Min Weight: -0.553 Max Output: 1.172 Min Output: -1.359 TNNetDepthwiseConvLinear 32,32,16 Times: 0.28s 0.04s Parent:13\n", + "Layer 15 Neurons: 64 Max Weight: 0.440 Min Weight: -0.452 Max Output: 1.863 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.60s 0.15s Parent:14\n", + "Layer 16 Max Output: 2.312 Min Output: -1.750 TNNetDeepConcat 32,32,259 Times: 0.56s 0.04s Parent:15\n", + "Layer 17 Neurons: 16 Max Weight: 0.272 Min Weight: -0.225 Max Output: 1.455 Min Output: -1.848 TNNetConvolutionLinear 32,32,16 Times: 1.25s 0.19s Parent:16\n", + "Layer 18 Neurons: 1 Max Weight: 0.531 Min Weight: -0.586 Max Output: 2.980 Min Output: -2.483 TNNetDepthwiseConvLinear 32,32,16 Times: 0.28s 0.04s Parent:17\n", + "Layer 19 Neurons: 64 Max Weight: 0.474 Min Weight: -0.450 Max Output: 1.904 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.65s 0.16s Parent:18\n", + "Layer 20 Max Output: 2.312 Min Output: -1.750 TNNetDeepConcat 32,32,323 Times: 0.64s 0.03s Parent:19\n", + "Layer 21 Neurons: 16 Max Weight: 0.259 Min Weight: -0.316 Max Output: 0.787 Min Output: -1.215 TNNetConvolutionLinear 32,32,16 Times: 1.50s 0.22s Parent:20\n", + "Layer 22 Neurons: 1 Max Weight: 0.587 Min Weight: -0.564 Max Output: 1.003 Min Output: -1.217 TNNetDepthwiseConvLinear 32,32,16 Times: 0.28s 0.03s Parent:21\n", + "Layer 23 Neurons: 64 Max Weight: 0.444 Min Weight: -0.437 Max Output: 1.258 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.64s 0.16s Parent:22\n", + "Layer 24 Max Output: 2.312 Min Output: -1.750 TNNetDeepConcat 32,32,387 Times: 0.71s 0.04s Parent:23\n", + "Layer 25 Neurons: 3 Max Weight: 0.556 Min Weight: -0.190 Max Output: 1.026 Min Output: -2.018 TNNetConvolutionLinear 32,32,3 Times: 0.34s 0.05s Parent:24\n", + "Epoch time: 16.8475 minutes. 50 epochs: 14.0396 hours.\n", + "Epochs: 8. Working time: 2.30 hours.\n", + "384640 Examples seen. Accuracy: 0.0073 Error: 466.86288 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.13s Step time: 13.54s\n", + "385280 Examples seen. Accuracy: 0.0075 Error: 458.67316 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.20s Step time: 13.55s\n", + "385920 Examples seen. Accuracy: 0.0082 Error: 458.61639 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.14s Step time: 13.50s\n", + "386560 Examples seen. Accuracy: 0.0076 Error: 483.26801 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.07s Step time: 13.47s\n", + "387200 Examples seen. Accuracy: 0.0074 Error: 457.98102 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.55s\n", + "387840 Examples seen. Accuracy: 0.0067 Error: 464.41602 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.53s\n", + "388480 Examples seen. Accuracy: 0.0068 Error: 477.71075 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 13.54s\n", + "389120 Examples seen. Accuracy: 0.0071 Error: 463.20355 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.11s Step time: 13.54s\n", + "389760 Examples seen. Accuracy: 0.0065 Error: 466.61050 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.10s Step time: 13.50s\n", + "390400 Examples seen. Accuracy: 0.0064 Error: 472.62769 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.49s\n", + "391040 Examples seen. Accuracy: 0.0065 Error: 456.05981 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.20s Step time: 13.54s\n", + "391680 Examples seen. Accuracy: 0.0061 Error: 449.63593 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.12s Step time: 14.65s\n", + "392320 Examples seen. Accuracy: 0.0058 Error: 480.84564 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.11s Step time: 13.48s\n", + "392960 Examples seen. Accuracy: 0.0066 Error: 470.54028 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.09s Step time: 13.47s\n", + "393600 Examples seen. Accuracy: 0.0064 Error: 481.06039 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.21s Step time: 13.53s\n", + "394240 Examples seen. Accuracy: 0.0062 Error: 485.10403 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.08s Step time: 13.53s\n", + "394880 Examples seen. Accuracy: 0.0064 Error: 451.04395 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.50s\n", + "395520 Examples seen. Accuracy: 0.0067 Error: 473.78870 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.52s\n", + "396160 Examples seen. Accuracy: 0.0068 Error: 460.83096 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.59s\n", + "396800 Examples seen. Accuracy: 0.0074 Error: 478.86710 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.07s Step time: 13.53s\n", + "397440 Examples seen. Accuracy: 0.0078 Error: 475.49628 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.20s Step time: 13.50s\n", + "398080 Examples seen. Accuracy: 0.0074 Error: 441.80994 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.16s Step time: 13.52s\n", + "398720 Examples seen. Accuracy: 0.0073 Error: 481.56519 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 13.49s\n", + "399360 Examples seen. Accuracy: 0.0074 Error: 444.84995 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.54s\n", + "400000 Examples seen. Accuracy: 0.0070 Error: 485.03421 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 13.49s\n", + "400640 Examples seen. Accuracy: 0.0067 Error: 496.03375 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.18s Step time: 13.58s\n", + "401280 Examples seen. Accuracy: 0.0073 Error: 477.77411 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.50s\n", + "401920 Examples seen. Accuracy: 0.0069 Error: 467.23169 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.06s Step time: 13.47s\n", + "402560 Examples seen. Accuracy: 0.0069 Error: 455.90039 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.52s\n", + "403200 Examples seen. Accuracy: 0.0073 Error: 488.15826 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.48s\n", + "403840 Examples seen. Accuracy: 0.0070 Error: 460.87396 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.46s\n", + "404480 Examples seen. Accuracy: 0.0075 Error: 484.08963 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.12s Step time: 13.48s\n", + "405120 Examples seen. Accuracy: 0.0075 Error: 477.98712 Loss: 0.00000 Threads: 2 Forward time: 4.05s Backward time: 6.30s Step time: 14.52s\n", + "405760 Examples seen. Accuracy: 0.0075 Error: 436.22339 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.12s Step time: 13.49s\n", + "406400 Examples seen. Accuracy: 0.0076 Error: 488.88919 Loss: 0.00000 Threads: 2 Forward time: 2.69s Backward time: 4.11s Step time: 13.52s\n", + "407040 Examples seen. Accuracy: 0.0074 Error: 446.64185 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.46s\n", + "407680 Examples seen. Accuracy: 0.0077 Error: 458.98233 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.48s\n", + "408320 Examples seen. Accuracy: 0.0082 Error: 467.57623 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.52s\n", + "408960 Examples seen. Accuracy: 0.0080 Error: 474.99805 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.59s\n", + "409600 Examples seen. Accuracy: 0.0079 Error: 447.14783 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.06s Step time: 13.52s\n", + "410240 Examples seen. Accuracy: 0.0080 Error: 453.26697 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.57s\n", + "410880 Examples seen. Accuracy: 0.0077 Error: 455.23587 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.09s Step time: 13.50s\n", + "411520 Examples seen. Accuracy: 0.0077 Error: 459.76453 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.10s Step time: 13.56s\n", + "412160 Examples seen. Accuracy: 0.0074 Error: 450.14026 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.58s\n", + "412800 Examples seen. Accuracy: 0.0073 Error: 497.91336 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.13s Step time: 13.51s\n", + "413440 Examples seen. Accuracy: 0.0077 Error: 474.62564 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.19s Step time: 13.51s\n", + "414080 Examples seen. Accuracy: 0.0084 Error: 424.27924 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.15s Step time: 13.53s\n", + "414720 Examples seen. Accuracy: 0.0083 Error: 498.79474 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.05s Step time: 13.48s\n", + "415360 Examples seen. Accuracy: 0.0077 Error: 443.68280 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.09s Step time: 13.41s\n", + "416000 Examples seen. Accuracy: 0.0071 Error: 461.89130 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.49s\n", + "416640 Examples seen. Accuracy: 0.0071 Error: 447.58530 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.17s Step time: 13.50s\n", + "417280 Examples seen. Accuracy: 0.0074 Error: 479.51495 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.10s Step time: 13.44s\n", + "417920 Examples seen. Accuracy: 0.0074 Error: 451.79608 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.05s Step time: 13.56s\n", + "418560 Examples seen. Accuracy: 0.0079 Error: 440.94153 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.11s Step time: 14.52s\n", + "419200 Examples seen. Accuracy: 0.0083 Error: 481.65063 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 13.50s\n", + "419840 Examples seen. Accuracy: 0.0083 Error: 473.94745 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 13.52s\n", + "420480 Examples seen. Accuracy: 0.0077 Error: 478.73535 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.06s Step time: 13.50s\n", + "421120 Examples seen. Accuracy: 0.0081 Error: 493.83124 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.53s\n", + "421760 Examples seen. Accuracy: 0.0082 Error: 473.02249 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.18s Step time: 13.55s\n", + "422400 Examples seen. Accuracy: 0.0083 Error: 498.76242 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.51s\n", + "423040 Examples seen. Accuracy: 0.0084 Error: 480.79465 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.24s Step time: 13.65s\n", + "423680 Examples seen. Accuracy: 0.0082 Error: 454.57538 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.31s Step time: 13.82s\n", + "424320 Examples seen. Accuracy: 0.0077 Error: 458.51456 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.29s Step time: 13.86s\n", + "424960 Examples seen. Accuracy: 0.0071 Error: 452.12195 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.25s Step time: 13.72s\n", + "425600 Examples seen. Accuracy: 0.0070 Error: 457.30176 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.23s Step time: 13.70s\n", + "426240 Examples seen. Accuracy: 0.0074 Error: 462.61127 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.20s Step time: 13.69s\n", + "426880 Examples seen. Accuracy: 0.0073 Error: 454.77197 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.11s Step time: 13.64s\n", + "427520 Examples seen. Accuracy: 0.0071 Error: 467.53870 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.58s\n", + "428160 Examples seen. Accuracy: 0.0069 Error: 466.35904 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.21s Step time: 13.69s\n", + "428800 Examples seen. Accuracy: 0.0074 Error: 428.89783 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.61s\n", + "429440 Examples seen. Accuracy: 0.0073 Error: 446.63062 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.62s\n", + "430080 Examples seen. Accuracy: 0.0082 Error: 476.32593 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.18s Step time: 13.66s\n", + "430720 Examples seen. Accuracy: 0.0089 Error: 494.42590 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.06s Step time: 14.86s\n", + "431360 Examples seen. Accuracy: 0.0089 Error: 476.80212 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.26s Step time: 13.59s\n", + "432000 Examples seen. Accuracy: 0.0090 Error: 459.59149 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.17s Step time: 13.72s\n", + "Starting Validation.\n", + "Epochs: 9 Examples seen:432000 Validation Accuracy: 0.0135 Validation Error: 466.8788 Validation Loss: 0.0000 Total time: 155.44min\n", + "Epoch time: 17.1463 minutes. 50 epochs: 14.2885 hours.\n", + "Epochs: 9. Working time: 2.59 hours.\n", + "432640 Examples seen. Accuracy: 0.0086 Error: 468.30310 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.17s Step time: 13.59s\n", + "433280 Examples seen. Accuracy: 0.0088 Error: 448.85522 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.12s Step time: 13.78s\n", + "433920 Examples seen. Accuracy: 0.0087 Error: 436.04922 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 13.52s\n", + "434560 Examples seen. Accuracy: 0.0084 Error: 466.12881 Loss: 0.00000 Threads: 2 Forward time: 2.71s Backward time: 4.25s Step time: 13.88s\n", + "435200 Examples seen. Accuracy: 0.0084 Error: 451.36548 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.19s Step time: 13.81s\n", + "435840 Examples seen. Accuracy: 0.0080 Error: 494.12842 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.20s Step time: 13.71s\n", + "436480 Examples seen. Accuracy: 0.0083 Error: 485.95706 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.33s Step time: 13.63s\n", + "437120 Examples seen. Accuracy: 0.0087 Error: 444.46552 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.16s Step time: 13.70s\n", + "437760 Examples seen. Accuracy: 0.0081 Error: 467.49054 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.18s Step time: 13.62s\n", + "438400 Examples seen. Accuracy: 0.0080 Error: 468.04785 Loss: 0.00000 Threads: 2 Forward time: 2.69s Backward time: 4.11s Step time: 13.61s\n", + "439040 Examples seen. Accuracy: 0.0078 Error: 471.96368 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.11s Step time: 13.63s\n", + "439680 Examples seen. Accuracy: 0.0078 Error: 450.24072 Loss: 0.00000 Threads: 2 Forward time: 2.69s Backward time: 4.18s Step time: 13.83s\n", + "440320 Examples seen. Accuracy: 0.0078 Error: 463.57520 Loss: 0.00000 Threads: 2 Forward time: 2.72s Backward time: 4.28s Step time: 13.90s\n", + "440960 Examples seen. Accuracy: 0.0083 Error: 440.78656 Loss: 0.00000 Threads: 2 Forward time: 2.85s Backward time: 4.52s Step time: 14.63s\n", + "441600 Examples seen. Accuracy: 0.0077 Error: 497.99115 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.24s Step time: 14.59s\n", + "442240 Examples seen. Accuracy: 0.0083 Error: 459.92636 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.71s\n", + "442880 Examples seen. Accuracy: 0.0082 Error: 493.99030 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.27s Step time: 13.68s\n", + "443520 Examples seen. Accuracy: 0.0082 Error: 464.13217 Loss: 0.00000 Threads: 2 Forward time: 2.78s Backward time: 4.34s Step time: 14.85s\n", + "444160 Examples seen. Accuracy: 0.0082 Error: 455.89532 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.37s Step time: 14.13s\n", + "444800 Examples seen. Accuracy: 0.0080 Error: 460.53787 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.16s Step time: 14.11s\n", + "445440 Examples seen. Accuracy: 0.0078 Error: 469.80865 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.20s Step time: 13.69s\n", + "446080 Examples seen. Accuracy: 0.0076 Error: 459.92120 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.12s Step time: 13.62s\n", + "446720 Examples seen. Accuracy: 0.0078 Error: 437.12402 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.14s Step time: 13.57s\n", + "447360 Examples seen. Accuracy: 0.0075 Error: 505.91168 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.20s Step time: 13.59s\n", + "448000 Examples seen. Accuracy: 0.0073 Error: 458.39142 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 13.59s\n", + "448640 Examples seen. Accuracy: 0.0071 Error: 477.58533 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.12s Step time: 13.58s\n", + "449280 Examples seen. Accuracy: 0.0072 Error: 469.16876 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.17s Step time: 13.71s\n", + "449920 Examples seen. Accuracy: 0.0071 Error: 473.98190 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.27s Step time: 13.59s\n", + "450560 Examples seen. Accuracy: 0.0072 Error: 487.22473 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.61s\n", + "451200 Examples seen. Accuracy: 0.0077 Error: 455.07666 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.16s Step time: 13.70s\n", + "451840 Examples seen. Accuracy: 0.0082 Error: 453.64963 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.16s Step time: 13.69s\n", + "452480 Examples seen. Accuracy: 0.0080 Error: 458.17075 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.15s Step time: 13.65s\n", + "453120 Examples seen. Accuracy: 0.0079 Error: 460.03766 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.24s Step time: 13.70s\n", + "453760 Examples seen. Accuracy: 0.0079 Error: 469.90515 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.59s\n", + "454400 Examples seen. Accuracy: 0.0073 Error: 461.29205 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.58s\n", + "455040 Examples seen. Accuracy: 0.0076 Error: 461.02905 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.62s\n", + "455680 Examples seen. Accuracy: 0.0076 Error: 462.36475 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.58s\n", + "456320 Examples seen. Accuracy: 0.0076 Error: 453.21234 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.29s Step time: 14.72s\n", + "456960 Examples seen. Accuracy: 0.0078 Error: 513.73364 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.10s Step time: 13.61s\n", + "457600 Examples seen. Accuracy: 0.0084 Error: 470.40948 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.07s Step time: 13.57s\n", + "458240 Examples seen. Accuracy: 0.0080 Error: 436.34482 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.58s\n", + "458880 Examples seen. Accuracy: 0.0086 Error: 467.12775 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.19s Step time: 13.64s\n", + "459520 Examples seen. Accuracy: 0.0090 Error: 497.41382 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.14s Step time: 13.59s\n", + "460160 Examples seen. Accuracy: 0.0092 Error: 445.51489 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.29s Step time: 13.64s\n", + "460800 Examples seen. Accuracy: 0.0088 Error: 477.63901 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.62s\n", + "461440 Examples seen. Accuracy: 0.0087 Error: 439.43365 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.61s\n", + "462080 Examples seen. Accuracy: 0.0081 Error: 463.34256 Loss: 0.00000 Threads: 2 Forward time: 3.18s Backward time: 5.05s Step time: 13.91s\n", + "462720 Examples seen. Accuracy: 0.0084 Error: 454.20868 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.28s Step time: 14.25s\n", + "463360 Examples seen. Accuracy: 0.0088 Error: 456.55798 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.18s Step time: 13.81s\n", + "464000 Examples seen. Accuracy: 0.0086 Error: 459.79919 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.25s Step time: 13.74s\n", + "464640 Examples seen. Accuracy: 0.0085 Error: 437.11505 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.17s Step time: 13.63s\n", + "465280 Examples seen. Accuracy: 0.0080 Error: 480.21094 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.54s\n", + "465920 Examples seen. Accuracy: 0.0079 Error: 474.02307 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.22s Step time: 13.69s\n", + "466560 Examples seen. Accuracy: 0.0078 Error: 476.57843 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 13.66s\n", + "467200 Examples seen. Accuracy: 0.0076 Error: 487.26968 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.57s\n", + "467840 Examples seen. Accuracy: 0.0076 Error: 473.00519 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.56s\n", + "468480 Examples seen. Accuracy: 0.0073 Error: 478.11893 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.09s Step time: 13.59s\n", + "469120 Examples seen. Accuracy: 0.0077 Error: 445.83646 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.21s Step time: 14.74s\n", + "469760 Examples seen. Accuracy: 0.0080 Error: 463.80640 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.10s Step time: 13.63s\n", + "470400 Examples seen. Accuracy: 0.0081 Error: 477.94763 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.64s\n", + "471040 Examples seen. Accuracy: 0.0076 Error: 448.95544 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.61s\n", + "471680 Examples seen. Accuracy: 0.0073 Error: 468.01257 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.56s\n", + "472320 Examples seen. Accuracy: 0.0071 Error: 451.10223 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.21s Step time: 13.60s\n", + "472960 Examples seen. Accuracy: 0.0066 Error: 473.27243 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.28s Step time: 13.69s\n", + "473600 Examples seen. Accuracy: 0.0065 Error: 442.68329 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.60s\n", + "474240 Examples seen. Accuracy: 0.0074 Error: 464.05939 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.60s\n", + "474880 Examples seen. Accuracy: 0.0073 Error: 457.44940 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.60s\n", + "475520 Examples seen. Accuracy: 0.0076 Error: 463.63528 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 13.59s\n", + "476160 Examples seen. Accuracy: 0.0075 Error: 474.22803 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.24s Step time: 13.59s\n", + "476800 Examples seen. Accuracy: 0.0078 Error: 481.41852 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.05s Step time: 13.54s\n", + "477440 Examples seen. Accuracy: 0.0076 Error: 461.69373 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.15s Step time: 13.62s\n", + "478080 Examples seen. Accuracy: 0.0077 Error: 445.00415 Loss: 0.00000 Threads: 2 Forward time: 2.71s Backward time: 4.14s Step time: 13.59s\n", + "478720 Examples seen. Accuracy: 0.0079 Error: 471.84402 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.65s\n", + "479360 Examples seen. Accuracy: 0.0078 Error: 459.12469 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.09s Step time: 13.78s\n", + "480000 Examples seen. Accuracy: 0.0073 Error: 455.20734 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.15s Step time: 13.64s\n", + "Starting Validation.\n", + "Epochs: 10 Examples seen:480000 Validation Accuracy: 0.0130 Validation Error: 465.4922 Validation Loss: 0.0000 Total time: 172.88min\n", + "Layer 0 Max Output: 1.109 Min Output: -1.750 TNNetInput 16,16,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 1 Max Weight: 0.510 Min Weight: -0.722 Max Output: 1.202 Min Output: -1.463 TNNetDepthwiseConvLinear 16,16,3 Times: 0.08s 0.00s Parent:0\n", + "Layer 2 Neurons: 64 Max Weight: 0.981 Min Weight: -0.982 Max Output: 2.280 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.32s 0.05s Parent:1\n", + "Layer 3 Max Output: 2.280 Min Output: -1.750 TNNetDeepConcat 16,16,67 Times: 0.03s 0.00s Parent:2\n", + "Layer 4 Neurons: 16 Max Weight: 0.231 Min Weight: -0.219 Max Output: 1.398 Min Output: -1.191 TNNetConvolutionLinear 16,16,16 Times: 0.15s 0.03s Parent:3\n", + "Layer 5 Neurons: 1 Max Weight: 0.573 Min Weight: -0.573 Max Output: 1.048 Min Output: -0.868 TNNetDepthwiseConvLinear 16,16,16 Times: 0.07s 0.01s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.433 Min Weight: -0.436 Max Output: 1.034 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.40s 0.05s Parent:5\n", + "Layer 7 Max Output: 2.280 Min Output: -1.750 TNNetDeepConcat 16,16,131 Times: 0.07s 0.00s Parent:6\n", + "Layer 8 Neurons: 16 Max Weight: 0.161 Min Weight: -0.167 Max Output: 1.155 Min Output: -0.826 TNNetConvolutionLinear 16,16,16 Times: 0.22s 0.03s Parent:7\n", + "Layer 9 Neurons: 1 Max Weight: 0.579 Min Weight: -0.568 Max Output: 0.758 Min Output: -1.423 TNNetDepthwiseConvLinear 16,16,16 Times: 0.09s 0.01s Parent:8\n", + "Layer 10 Neurons: 64 Max Weight: 0.451 Min Weight: -0.446 Max Output: 0.857 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.43s 0.04s Parent:9\n", + "Layer 11 Max Output: 2.280 Min Output: -1.750 TNNetDeepConcat 16,16,195 Times: 0.09s 0.00s Parent:10\n", + "Layer 12 Max Output: 2.280 Min Output: -1.750 TNNetDeAvgPool 32,32,195 Times: 3.25s 0.09s Parent:11\n", + "Layer 13 Neurons: 16 Max Weight: 0.283 Min Weight: -0.204 Max Output: 1.281 Min Output: -1.149 TNNetConvolutionLinear 32,32,16 Times: 1.04s 0.15s Parent:12\n", + "Layer 14 Neurons: 1 Max Weight: 0.582 Min Weight: -0.554 Max Output: 1.205 Min Output: -1.393 TNNetDepthwiseConvLinear 32,32,16 Times: 0.25s 0.03s Parent:13\n", + "Layer 15 Neurons: 64 Max Weight: 0.442 Min Weight: -0.456 Max Output: 1.886 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.63s 0.17s Parent:14\n", + "Layer 16 Max Output: 2.280 Min Output: -1.750 TNNetDeepConcat 32,32,259 Times: 0.58s 0.03s Parent:15\n", + "Layer 17 Neurons: 16 Max Weight: 0.290 Min Weight: -0.227 Max Output: 1.479 Min Output: -1.853 TNNetConvolutionLinear 32,32,16 Times: 1.26s 0.18s Parent:16\n", + "Layer 18 Neurons: 1 Max Weight: 0.533 Min Weight: -0.588 Max Output: 3.027 Min Output: -2.526 TNNetDepthwiseConvLinear 32,32,16 Times: 0.32s 0.04s Parent:17\n", + "Layer 19 Neurons: 64 Max Weight: 0.478 Min Weight: -0.454 Max Output: 1.923 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.63s 0.17s Parent:18\n", + "Layer 20 Max Output: 2.280 Min Output: -1.750 TNNetDeepConcat 32,32,323 Times: 0.70s 0.03s Parent:19\n", + "Layer 21 Neurons: 16 Max Weight: 0.265 Min Weight: -0.328 Max Output: 0.772 Min Output: -1.203 TNNetConvolutionLinear 32,32,16 Times: 1.51s 0.21s Parent:20\n", + "Layer 22 Neurons: 1 Max Weight: 0.589 Min Weight: -0.561 Max Output: 0.966 Min Output: -1.167 TNNetDepthwiseConvLinear 32,32,16 Times: 0.31s 0.03s Parent:21\n", + "Layer 23 Neurons: 64 Max Weight: 0.445 Min Weight: -0.442 Max Output: 1.236 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.61s 0.17s Parent:22\n", + "Layer 24 Max Output: 2.280 Min Output: -1.750 TNNetDeepConcat 32,32,387 Times: 0.79s 0.03s Parent:23\n", + "Layer 25 Neurons: 3 Max Weight: 0.555 Min Weight: -0.191 Max Output: 1.030 Min Output: -2.022 TNNetConvolutionLinear 32,32,3 Times: 0.35s 0.05s Parent:24\n", + "Starting Testing.\n", + "Epochs: 10 Examples seen:480000 Test Accuracy: 0.0093 Test Error: 465.6609 Test Loss: 0.0000 Total time: 174.25min\n", + "Epoch time: 17.0525 minutes. 50 epochs: 14.2104 hours.\n", + "Epochs: 10. Working time: 2.90 hours.\n", + "480640 Examples seen. Accuracy: 0.0073 Error: 464.30316 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.22s Step time: 13.60s\n", + "481280 Examples seen. Accuracy: 0.0080 Error: 409.82739 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.13s Step time: 13.54s\n", + "481920 Examples seen. Accuracy: 0.0078 Error: 472.81427 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.19s Step time: 13.48s\n", + "482560 Examples seen. Accuracy: 0.0076 Error: 490.91708 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.18s Step time: 13.50s\n", + "483200 Examples seen. Accuracy: 0.0079 Error: 479.41858 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.14s Step time: 13.52s\n", + "483840 Examples seen. Accuracy: 0.0079 Error: 472.27945 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.12s Step time: 13.50s\n", + "484480 Examples seen. Accuracy: 0.0079 Error: 435.20276 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.53s\n", + "485120 Examples seen. Accuracy: 0.0079 Error: 442.46484 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.52s\n", + "485760 Examples seen. Accuracy: 0.0077 Error: 450.54108 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.17s Step time: 13.58s\n", + "486400 Examples seen. Accuracy: 0.0083 Error: 398.90015 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.16s Step time: 13.52s\n", + "487040 Examples seen. Accuracy: 0.0078 Error: 480.81024 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.50s\n", + "487680 Examples seen. Accuracy: 0.0074 Error: 445.93188 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.17s Step time: 13.52s\n", + "488320 Examples seen. Accuracy: 0.0077 Error: 466.57886 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.61s\n", + "488960 Examples seen. Accuracy: 0.0076 Error: 438.19916 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 13.58s\n", + "489600 Examples seen. Accuracy: 0.0076 Error: 439.57489 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.60s\n", + "490240 Examples seen. Accuracy: 0.0076 Error: 418.61377 Loss: 0.00000 Threads: 2 Forward time: 4.33s Backward time: 6.72s Step time: 14.58s\n", + "490880 Examples seen. Accuracy: 0.0078 Error: 483.34485 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.22s Step time: 13.68s\n", + "491520 Examples seen. Accuracy: 0.0075 Error: 462.30750 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.11s Step time: 13.71s\n", + "492160 Examples seen. Accuracy: 0.0072 Error: 467.19797 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.22s Step time: 13.73s\n", + "492800 Examples seen. Accuracy: 0.0072 Error: 476.37427 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.21s Step time: 13.74s\n", + "493440 Examples seen. Accuracy: 0.0077 Error: 461.57733 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.16s Step time: 13.65s\n", + "494080 Examples seen. Accuracy: 0.0077 Error: 478.16980 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.16s Step time: 13.64s\n", + "494720 Examples seen. Accuracy: 0.0075 Error: 451.82193 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.20s Step time: 13.61s\n", + "495360 Examples seen. Accuracy: 0.0077 Error: 466.02524 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.15s Step time: 13.67s\n", + "496000 Examples seen. Accuracy: 0.0078 Error: 430.32690 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.23s Step time: 13.64s\n", + "496640 Examples seen. Accuracy: 0.0080 Error: 486.23334 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 13.68s\n", + "497280 Examples seen. Accuracy: 0.0079 Error: 477.05499 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.18s Step time: 13.70s\n", + "497920 Examples seen. Accuracy: 0.0077 Error: 474.84079 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.21s Step time: 13.63s\n", + "498560 Examples seen. Accuracy: 0.0077 Error: 484.02386 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 13.62s\n", + "499200 Examples seen. Accuracy: 0.0077 Error: 467.01950 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.10s Step time: 13.59s\n", + "499840 Examples seen. Accuracy: 0.0073 Error: 469.64819 Loss: 0.00000 Threads: 2 Forward time: 2.73s Backward time: 4.11s Step time: 13.70s\n", + "500480 Examples seen. Accuracy: 0.0072 Error: 452.25220 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.76s\n", + "501120 Examples seen. Accuracy: 0.0069 Error: 432.06244 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.23s Step time: 13.73s\n", + "501760 Examples seen. Accuracy: 0.0070 Error: 445.15411 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.18s Step time: 13.68s\n", + "502400 Examples seen. Accuracy: 0.0068 Error: 466.05939 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.56s\n", + "503040 Examples seen. Accuracy: 0.0074 Error: 462.55719 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.16s Step time: 14.66s\n", + "503680 Examples seen. Accuracy: 0.0070 Error: 449.32889 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.26s Step time: 13.71s\n", + "504320 Examples seen. Accuracy: 0.0070 Error: 457.72595 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.24s Step time: 13.69s\n", + "504960 Examples seen. Accuracy: 0.0073 Error: 459.42450 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.21s Step time: 13.63s\n", + "505600 Examples seen. Accuracy: 0.0076 Error: 461.87561 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.20s Step time: 13.66s\n", + "506240 Examples seen. Accuracy: 0.0073 Error: 474.47064 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.08s Step time: 13.60s\n", + "506880 Examples seen. Accuracy: 0.0072 Error: 463.48297 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.04s Step time: 13.60s\n", + "507520 Examples seen. Accuracy: 0.0078 Error: 474.52823 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.23s Step time: 13.63s\n", + "508160 Examples seen. Accuracy: 0.0074 Error: 489.04260 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.18s Step time: 13.68s\n", + "508800 Examples seen. Accuracy: 0.0070 Error: 473.94693 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.18s Step time: 13.63s\n", + "509440 Examples seen. Accuracy: 0.0070 Error: 444.99438 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.17s Step time: 13.72s\n", + "510080 Examples seen. Accuracy: 0.0075 Error: 471.05988 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.26s Step time: 13.79s\n", + "510720 Examples seen. Accuracy: 0.0073 Error: 450.95544 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.07s Step time: 13.70s\n", + "511360 Examples seen. Accuracy: 0.0075 Error: 451.01074 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.10s Step time: 13.57s\n", + "512000 Examples seen. Accuracy: 0.0074 Error: 462.13055 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.33s Step time: 13.66s\n", + "512640 Examples seen. Accuracy: 0.0072 Error: 438.04620 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.62s\n", + "513280 Examples seen. Accuracy: 0.0068 Error: 449.06989 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.59s\n", + "513920 Examples seen. Accuracy: 0.0070 Error: 482.54352 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.59s\n", + "514560 Examples seen. Accuracy: 0.0070 Error: 466.98938 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.08s Step time: 13.59s\n", + "515200 Examples seen. Accuracy: 0.0076 Error: 464.62778 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.15s Step time: 13.66s\n", + "515840 Examples seen. Accuracy: 0.0075 Error: 476.38159 Loss: 0.00000 Threads: 2 Forward time: 4.25s Backward time: 6.44s Step time: 14.80s\n", + "516480 Examples seen. Accuracy: 0.0072 Error: 452.81061 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.21s Step time: 13.69s\n", + "517120 Examples seen. Accuracy: 0.0070 Error: 473.34955 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.63s\n", + "517760 Examples seen. Accuracy: 0.0069 Error: 425.27695 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.21s Step time: 13.55s\n", + "518400 Examples seen. Accuracy: 0.0069 Error: 445.58005 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.20s Step time: 13.61s\n", + "519040 Examples seen. Accuracy: 0.0068 Error: 444.18475 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.62s\n", + "519680 Examples seen. Accuracy: 0.0079 Error: 452.30341 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.22s Step time: 13.66s\n", + "520320 Examples seen. Accuracy: 0.0080 Error: 436.56897 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.18s Step time: 13.67s\n", + "520960 Examples seen. Accuracy: 0.0081 Error: 444.93744 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.22s Step time: 13.62s\n", + "521600 Examples seen. Accuracy: 0.0080 Error: 483.44235 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.11s Step time: 13.67s\n", + "522240 Examples seen. Accuracy: 0.0083 Error: 484.10928 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.20s Step time: 13.61s\n", + "522880 Examples seen. Accuracy: 0.0080 Error: 431.04132 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.15s Step time: 13.65s\n", + "523520 Examples seen. Accuracy: 0.0077 Error: 451.65320 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.14s Step time: 13.63s\n", + "524160 Examples seen. Accuracy: 0.0078 Error: 462.82660 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.12s Step time: 13.62s\n", + "524800 Examples seen. Accuracy: 0.0075 Error: 426.24417 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.60s\n", + "525440 Examples seen. Accuracy: 0.0071 Error: 477.80627 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.08s Step time: 13.64s\n", + "526080 Examples seen. Accuracy: 0.0072 Error: 456.73343 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.58s\n", + "526720 Examples seen. Accuracy: 0.0070 Error: 478.08075 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.18s Step time: 13.64s\n", + "527360 Examples seen. Accuracy: 0.0067 Error: 450.90530 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.20s Step time: 13.61s\n", + "528000 Examples seen. Accuracy: 0.0072 Error: 481.83551 Loss: 0.00000 Threads: 2 Forward time: 2.90s Backward time: 4.57s Step time: 14.67s\n", + "Starting Validation.\n", + "Epochs: 11 Examples seen:528000 Validation Accuracy: 0.0135 Validation Error: 457.8502 Validation Loss: 0.0000 Total time: 191.62min\n", + "Epoch time: 18.3338 minutes. 50 epochs: 15.2781 hours.\n", + "Epochs: 11. Working time: 3.19 hours.\n", + "528640 Examples seen. Accuracy: 0.0075 Error: 447.27893 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.65s\n", + "529280 Examples seen. Accuracy: 0.0079 Error: 455.98737 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.64s\n", + "529920 Examples seen. Accuracy: 0.0080 Error: 461.02972 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.15s Step time: 13.65s\n", + "530560 Examples seen. Accuracy: 0.0075 Error: 477.70895 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.19s Step time: 13.68s\n", + "531200 Examples seen. Accuracy: 0.0079 Error: 447.11780 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.68s\n", + "531840 Examples seen. Accuracy: 0.0078 Error: 441.54828 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.18s Step time: 13.57s\n", + "532480 Examples seen. Accuracy: 0.0079 Error: 460.52167 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 13.54s\n", + "533120 Examples seen. Accuracy: 0.0077 Error: 447.28406 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.13s Step time: 13.60s\n", + "533760 Examples seen. Accuracy: 0.0074 Error: 462.36292 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.25s Step time: 13.66s\n", + "534400 Examples seen. Accuracy: 0.0077 Error: 454.93198 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.19s Step time: 13.73s\n", + "535040 Examples seen. Accuracy: 0.0076 Error: 454.29511 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.13s Step time: 13.59s\n", + "535680 Examples seen. Accuracy: 0.0074 Error: 461.84082 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.55s\n", + "536320 Examples seen. Accuracy: 0.0074 Error: 480.66113 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.12s Step time: 13.61s\n", + "536960 Examples seen. Accuracy: 0.0070 Error: 439.28229 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.09s Step time: 13.58s\n", + "537600 Examples seen. Accuracy: 0.0076 Error: 448.67090 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.17s Step time: 13.71s\n", + "538240 Examples seen. Accuracy: 0.0075 Error: 446.04858 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.19s Step time: 13.59s\n", + "538880 Examples seen. Accuracy: 0.0076 Error: 508.67627 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.57s\n", + "539520 Examples seen. Accuracy: 0.0081 Error: 459.39825 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.20s Step time: 13.62s\n", + "540160 Examples seen. Accuracy: 0.0079 Error: 429.03363 Loss: 0.00000 Threads: 2 Forward time: 4.14s Backward time: 6.17s Step time: 14.60s\n", + "540800 Examples seen. Accuracy: 0.0077 Error: 437.90100 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.53s\n", + "541440 Examples seen. Accuracy: 0.0081 Error: 448.21216 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.10s Step time: 13.62s\n", + "542080 Examples seen. Accuracy: 0.0077 Error: 450.03421 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.58s\n", + "542720 Examples seen. Accuracy: 0.0077 Error: 439.94354 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.58s\n", + "543360 Examples seen. Accuracy: 0.0078 Error: 465.15106 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.06s Step time: 13.60s\n", + "544000 Examples seen. Accuracy: 0.0076 Error: 475.74774 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.57s\n", + "544640 Examples seen. Accuracy: 0.0078 Error: 506.57263 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.16s Step time: 13.59s\n", + "545280 Examples seen. Accuracy: 0.0079 Error: 423.14304 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.17s Step time: 13.68s\n", + "545920 Examples seen. Accuracy: 0.0080 Error: 447.85336 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.77s\n", + "546560 Examples seen. Accuracy: 0.0079 Error: 464.15567 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.66s\n", + "547200 Examples seen. Accuracy: 0.0081 Error: 473.88965 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.32s Step time: 13.62s\n", + "547840 Examples seen. Accuracy: 0.0077 Error: 465.15652 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.14s Step time: 13.66s\n", + "548480 Examples seen. Accuracy: 0.0076 Error: 490.88177 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.62s\n", + "549120 Examples seen. Accuracy: 0.0084 Error: 464.36176 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.18s Step time: 13.67s\n", + "549760 Examples seen. Accuracy: 0.0081 Error: 466.70547 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.58s\n", + "550400 Examples seen. Accuracy: 0.0076 Error: 499.22379 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.15s Step time: 13.62s\n", + "551040 Examples seen. Accuracy: 0.0075 Error: 439.84613 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.52s\n", + "551680 Examples seen. Accuracy: 0.0074 Error: 463.88394 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.18s Step time: 13.55s\n", + "552320 Examples seen. Accuracy: 0.0077 Error: 450.12167 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.09s Step time: 13.60s\n", + "552960 Examples seen. Accuracy: 0.0075 Error: 449.80597 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.11s Step time: 14.70s\n", + "553600 Examples seen. Accuracy: 0.0074 Error: 452.20966 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.15s Step time: 13.59s\n", + "554240 Examples seen. Accuracy: 0.0070 Error: 432.21582 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.14s Step time: 13.57s\n", + "554880 Examples seen. Accuracy: 0.0071 Error: 475.58655 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.19s Step time: 13.65s\n", + "555520 Examples seen. Accuracy: 0.0076 Error: 472.42426 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.60s\n", + "556160 Examples seen. Accuracy: 0.0081 Error: 486.88782 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.05s Step time: 13.58s\n", + "556800 Examples seen. Accuracy: 0.0082 Error: 434.11957 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.61s\n", + "557440 Examples seen. Accuracy: 0.0079 Error: 472.57159 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.15s Step time: 13.56s\n", + "558080 Examples seen. Accuracy: 0.0078 Error: 456.16678 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.14s Step time: 13.55s\n", + "558720 Examples seen. Accuracy: 0.0074 Error: 460.09088 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.54s\n", + "559360 Examples seen. Accuracy: 0.0074 Error: 466.39975 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.14s Step time: 13.64s\n", + "560000 Examples seen. Accuracy: 0.0076 Error: 472.34576 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.21s Step time: 13.63s\n", + "560640 Examples seen. Accuracy: 0.0081 Error: 453.05560 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.27s Step time: 13.63s\n", + "561280 Examples seen. Accuracy: 0.0081 Error: 486.27536 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.66s\n", + "561920 Examples seen. Accuracy: 0.0082 Error: 482.09015 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.63s\n", + "562560 Examples seen. Accuracy: 0.0081 Error: 447.96667 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.12s Step time: 13.54s\n", + "563200 Examples seen. Accuracy: 0.0078 Error: 469.90613 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.57s\n", + "563840 Examples seen. Accuracy: 0.0081 Error: 456.86487 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.66s\n", + "564480 Examples seen. Accuracy: 0.0083 Error: 483.73520 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.57s\n", + "565120 Examples seen. Accuracy: 0.0081 Error: 477.67877 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.20s Step time: 13.63s\n", + "565760 Examples seen. Accuracy: 0.0079 Error: 454.03259 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.15s Step time: 14.74s\n", + "566400 Examples seen. Accuracy: 0.0074 Error: 447.31357 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.55s\n", + "567040 Examples seen. Accuracy: 0.0073 Error: 442.48636 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.16s Step time: 13.61s\n", + "567680 Examples seen. Accuracy: 0.0073 Error: 463.27216 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 13.61s\n", + "568320 Examples seen. Accuracy: 0.0069 Error: 437.31934 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.11s Step time: 13.60s\n", + "568960 Examples seen. Accuracy: 0.0072 Error: 464.59985 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.11s Step time: 13.64s\n", + "569600 Examples seen. Accuracy: 0.0069 Error: 459.15961 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.14s Step time: 13.62s\n", + "570240 Examples seen. Accuracy: 0.0069 Error: 479.89563 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.59s\n", + "570880 Examples seen. Accuracy: 0.0074 Error: 443.69937 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.07s Step time: 13.61s\n", + "571520 Examples seen. Accuracy: 0.0074 Error: 460.04785 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.26s Step time: 13.61s\n", + "572160 Examples seen. Accuracy: 0.0071 Error: 432.26666 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.16s Step time: 13.65s\n", + "572800 Examples seen. Accuracy: 0.0069 Error: 465.03748 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.17s Step time: 13.57s\n", + "573440 Examples seen. Accuracy: 0.0072 Error: 453.16229 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.21s Step time: 13.65s\n", + "574080 Examples seen. Accuracy: 0.0069 Error: 456.83157 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.57s\n", + "574720 Examples seen. Accuracy: 0.0073 Error: 446.83304 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.56s\n", + "575360 Examples seen. Accuracy: 0.0075 Error: 441.49887 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.65s\n", + "576000 Examples seen. Accuracy: 0.0075 Error: 469.48346 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.60s\n", + "Starting Validation.\n", + "Epochs: 12 Examples seen:576000 Validation Accuracy: 0.0135 Validation Error: 456.0600 Validation Loss: 0.0000 Total time: 208.95min\n", + "Layer 0 Max Output: 1.109 Min Output: -1.750 TNNetInput 16,16,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 1 Max Weight: 0.525 Min Weight: -0.735 Max Output: 1.140 Min Output: -1.451 TNNetDepthwiseConvLinear 16,16,3 Times: 0.06s 0.01s Parent:0\n", + "Layer 2 Neurons: 64 Max Weight: 0.981 Min Weight: -0.981 Max Output: 2.249 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.30s 0.04s Parent:1\n", + "Layer 3 Max Output: 2.249 Min Output: -1.750 TNNetDeepConcat 16,16,67 Times: 0.03s 0.00s Parent:2\n", + "Layer 4 Neurons: 16 Max Weight: 0.231 Min Weight: -0.220 Max Output: 1.342 Min Output: -1.107 TNNetConvolutionLinear 16,16,16 Times: 0.18s 0.03s Parent:3\n", + "Layer 5 Neurons: 1 Max Weight: 0.573 Min Weight: -0.573 Max Output: 0.986 Min Output: -0.831 TNNetDepthwiseConvLinear 16,16,16 Times: 0.07s 0.00s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.434 Min Weight: -0.437 Max Output: 1.019 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.41s 0.05s Parent:5\n", + "Layer 7 Max Output: 2.249 Min Output: -1.750 TNNetDeepConcat 16,16,131 Times: 0.06s 0.00s Parent:6\n", + "Layer 8 Neurons: 16 Max Weight: 0.164 Min Weight: -0.170 Max Output: 1.156 Min Output: -0.802 TNNetConvolutionLinear 16,16,16 Times: 0.19s 0.03s Parent:7\n", + "Layer 9 Neurons: 1 Max Weight: 0.579 Min Weight: -0.569 Max Output: 0.754 Min Output: -1.424 TNNetDepthwiseConvLinear 16,16,16 Times: 0.08s 0.00s Parent:8\n", + "Layer 10 Neurons: 64 Max Weight: 0.452 Min Weight: -0.447 Max Output: 0.842 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.45s 0.05s Parent:9\n", + "Layer 11 Max Output: 2.249 Min Output: -1.750 TNNetDeepConcat 16,16,195 Times: 0.09s 0.00s Parent:10\n", + "Layer 12 Max Output: 2.249 Min Output: -1.750 TNNetDeAvgPool 32,32,195 Times: 3.20s 0.09s Parent:11\n", + "Layer 13 Neurons: 16 Max Weight: 0.289 Min Weight: -0.206 Max Output: 1.324 Min Output: -1.135 TNNetConvolutionLinear 32,32,16 Times: 1.03s 0.15s Parent:12\n", + "Layer 14 Neurons: 1 Max Weight: 0.585 Min Weight: -0.556 Max Output: 1.225 Min Output: -1.419 TNNetDepthwiseConvLinear 32,32,16 Times: 0.28s 0.03s Parent:13\n", + "Layer 15 Neurons: 64 Max Weight: 0.442 Min Weight: -0.459 Max Output: 1.876 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.61s 0.17s Parent:14\n", + "Layer 16 Max Output: 2.249 Min Output: -1.750 TNNetDeepConcat 32,32,259 Times: 0.56s 0.03s Parent:15\n", + "Layer 17 Neurons: 16 Max Weight: 0.304 Min Weight: -0.230 Max Output: 1.491 Min Output: -1.844 TNNetConvolutionLinear 32,32,16 Times: 1.27s 0.19s Parent:16\n", + "Layer 18 Neurons: 1 Max Weight: 0.533 Min Weight: -0.589 Max Output: 3.064 Min Output: -2.572 TNNetDepthwiseConvLinear 32,32,16 Times: 0.29s 0.04s Parent:17\n", + "Layer 19 Neurons: 64 Max Weight: 0.480 Min Weight: -0.456 Max Output: 1.944 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.61s 0.15s Parent:18\n", + "Layer 20 Max Output: 2.249 Min Output: -1.750 TNNetDeepConcat 32,32,323 Times: 0.68s 0.03s Parent:19\n", + "Layer 21 Neurons: 16 Max Weight: 0.269 Min Weight: -0.337 Max Output: 0.750 Min Output: -1.170 TNNetConvolutionLinear 32,32,16 Times: 1.46s 0.22s Parent:20\n", + "Layer 22 Neurons: 1 Max Weight: 0.591 Min Weight: -0.559 Max Output: 0.915 Min Output: -1.159 TNNetDepthwiseConvLinear 32,32,16 Times: 0.32s 0.03s Parent:21\n", + "Layer 23 Neurons: 64 Max Weight: 0.445 Min Weight: -0.447 Max Output: 1.177 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.63s 0.18s Parent:22\n", + "Layer 24 Max Output: 2.249 Min Output: -1.750 TNNetDeepConcat 32,32,387 Times: 0.74s 0.03s Parent:23\n", + "Layer 25 Neurons: 3 Max Weight: 0.559 Min Weight: -0.196 Max Output: 1.033 Min Output: -1.994 TNNetConvolutionLinear 32,32,3 Times: 0.36s 0.06s Parent:24\n", + "Epoch time: 16.9988 minutes. 50 epochs: 14.1656 hours.\n", + "Epochs: 12. Working time: 3.48 hours.\n", + "576640 Examples seen. Accuracy: 0.0075 Error: 448.47797 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.32s Step time: 13.68s\n", + "577280 Examples seen. Accuracy: 0.0072 Error: 462.05371 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 14.63s\n", + "577920 Examples seen. Accuracy: 0.0068 Error: 443.78937 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.15s Step time: 13.59s\n", + "578560 Examples seen. Accuracy: 0.0071 Error: 461.49493 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.64s\n", + "579200 Examples seen. Accuracy: 0.0074 Error: 445.07437 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.63s\n", + "579840 Examples seen. Accuracy: 0.0081 Error: 452.71423 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.07s Step time: 13.60s\n", + "580480 Examples seen. Accuracy: 0.0083 Error: 462.83093 Loss: 0.00000 Threads: 2 Forward time: 2.69s Backward time: 4.18s Step time: 13.54s\n", + "581120 Examples seen. Accuracy: 0.0082 Error: 473.65253 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.55s\n", + "581760 Examples seen. Accuracy: 0.0083 Error: 459.99924 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.61s\n", + "582400 Examples seen. Accuracy: 0.0081 Error: 470.95566 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.20s Step time: 13.69s\n", + "583040 Examples seen. Accuracy: 0.0081 Error: 429.18750 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.04s Step time: 13.63s\n", + "583680 Examples seen. Accuracy: 0.0077 Error: 464.60678 Loss: 0.00000 Threads: 2 Forward time: 2.69s Backward time: 4.04s Step time: 13.58s\n", + "584320 Examples seen. Accuracy: 0.0079 Error: 454.98279 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.10s Step time: 13.60s\n", + "584960 Examples seen. Accuracy: 0.0078 Error: 456.95905 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.65s\n", + "585600 Examples seen. Accuracy: 0.0083 Error: 431.88058 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.21s Step time: 13.68s\n", + "586240 Examples seen. Accuracy: 0.0085 Error: 440.29980 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.13s Step time: 13.63s\n", + "586880 Examples seen. Accuracy: 0.0086 Error: 473.47308 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.62s\n", + "587520 Examples seen. Accuracy: 0.0081 Error: 456.80096 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.62s\n", + "588160 Examples seen. Accuracy: 0.0079 Error: 474.18799 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.15s Step time: 13.56s\n", + "588800 Examples seen. Accuracy: 0.0076 Error: 476.75037 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.11s Step time: 13.59s\n", + "589440 Examples seen. Accuracy: 0.0084 Error: 447.30994 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.11s Step time: 14.62s\n", + "590080 Examples seen. Accuracy: 0.0085 Error: 445.02557 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.09s Step time: 13.57s\n", + "590720 Examples seen. Accuracy: 0.0085 Error: 455.21063 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.61s\n", + "591360 Examples seen. Accuracy: 0.0081 Error: 494.63837 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.09s Step time: 13.56s\n", + "592000 Examples seen. Accuracy: 0.0080 Error: 484.16599 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.64s\n", + "592640 Examples seen. Accuracy: 0.0079 Error: 477.12885 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.23s Step time: 13.63s\n", + "593280 Examples seen. Accuracy: 0.0073 Error: 459.26654 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.59s\n", + "593920 Examples seen. Accuracy: 0.0069 Error: 468.65936 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.63s\n", + "594560 Examples seen. Accuracy: 0.0073 Error: 462.81064 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.21s Step time: 13.60s\n", + "595200 Examples seen. Accuracy: 0.0070 Error: 510.33127 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.59s\n", + "595840 Examples seen. Accuracy: 0.0071 Error: 420.69492 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.15s Step time: 13.57s\n", + "596480 Examples seen. Accuracy: 0.0071 Error: 492.21417 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.22s Step time: 13.60s\n", + "597120 Examples seen. Accuracy: 0.0066 Error: 448.26068 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.65s\n", + "597760 Examples seen. Accuracy: 0.0069 Error: 458.54602 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.06s Step time: 13.56s\n", + "598400 Examples seen. Accuracy: 0.0069 Error: 452.27600 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.21s Step time: 13.56s\n", + "599040 Examples seen. Accuracy: 0.0066 Error: 450.68198 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.19s Step time: 13.65s\n", + "599680 Examples seen. Accuracy: 0.0076 Error: 469.53583 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.13s Step time: 13.56s\n", + "600320 Examples seen. Accuracy: 0.0074 Error: 459.14786 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.54s\n", + "600960 Examples seen. Accuracy: 0.0076 Error: 441.93372 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.21s Step time: 13.63s\n", + "601600 Examples seen. Accuracy: 0.0073 Error: 411.29614 Loss: 0.00000 Threads: 2 Forward time: 4.00s Backward time: 6.18s Step time: 14.43s\n", + "602240 Examples seen. Accuracy: 0.0076 Error: 483.51874 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.26s Step time: 13.92s\n", + "602880 Examples seen. Accuracy: 0.0073 Error: 475.19534 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.07s Step time: 13.60s\n", + "603520 Examples seen. Accuracy: 0.0078 Error: 469.31744 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.55s\n", + "604160 Examples seen. Accuracy: 0.0078 Error: 452.27332 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.23s Step time: 13.65s\n", + "604800 Examples seen. Accuracy: 0.0080 Error: 449.04062 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.16s Step time: 13.68s\n", + "605440 Examples seen. Accuracy: 0.0081 Error: 474.47318 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.55s\n", + "606080 Examples seen. Accuracy: 0.0085 Error: 475.29083 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.13s Step time: 13.61s\n", + "606720 Examples seen. Accuracy: 0.0078 Error: 448.00293 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.30s Step time: 13.65s\n", + "607360 Examples seen. Accuracy: 0.0077 Error: 470.14172 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.63s\n", + "608000 Examples seen. Accuracy: 0.0081 Error: 495.83893 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.60s\n", + "608640 Examples seen. Accuracy: 0.0076 Error: 453.38901 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.21s Step time: 13.61s\n", + "609280 Examples seen. Accuracy: 0.0081 Error: 469.43390 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.63s\n", + "609920 Examples seen. Accuracy: 0.0080 Error: 442.32355 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.56s\n", + "610560 Examples seen. Accuracy: 0.0078 Error: 439.02856 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.21s Step time: 13.69s\n", + "611200 Examples seen. Accuracy: 0.0073 Error: 468.43549 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.61s\n", + "611840 Examples seen. Accuracy: 0.0071 Error: 457.27051 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.18s Step time: 13.64s\n", + "612480 Examples seen. Accuracy: 0.0070 Error: 466.06403 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.61s\n", + "613120 Examples seen. Accuracy: 0.0067 Error: 448.52576 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.19s Step time: 13.65s\n", + "613760 Examples seen. Accuracy: 0.0069 Error: 473.32416 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.12s Step time: 13.61s\n", + "614400 Examples seen. Accuracy: 0.0076 Error: 440.87567 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 14.68s\n", + "615040 Examples seen. Accuracy: 0.0078 Error: 479.15326 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.21s Step time: 13.58s\n", + "615680 Examples seen. Accuracy: 0.0079 Error: 455.25092 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.64s\n", + "616320 Examples seen. Accuracy: 0.0079 Error: 450.05069 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.18s Step time: 13.61s\n", + "616960 Examples seen. Accuracy: 0.0079 Error: 432.08514 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.05s Step time: 13.57s\n", + "617600 Examples seen. Accuracy: 0.0076 Error: 469.06958 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.24s Step time: 13.64s\n", + "618240 Examples seen. Accuracy: 0.0085 Error: 479.61340 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.15s Step time: 13.61s\n", + "618880 Examples seen. Accuracy: 0.0079 Error: 471.39117 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.28s Step time: 13.65s\n", + "619520 Examples seen. Accuracy: 0.0077 Error: 479.24695 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.59s\n", + "620160 Examples seen. Accuracy: 0.0076 Error: 464.15390 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.15s Step time: 13.65s\n", + "620800 Examples seen. Accuracy: 0.0082 Error: 461.04529 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.22s Step time: 13.59s\n", + "621440 Examples seen. Accuracy: 0.0081 Error: 439.10126 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.62s\n", + "622080 Examples seen. Accuracy: 0.0078 Error: 472.84735 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.06s Step time: 13.54s\n", + "622720 Examples seen. Accuracy: 0.0079 Error: 479.46747 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.10s Step time: 13.56s\n", + "623360 Examples seen. Accuracy: 0.0077 Error: 473.18326 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.58s\n", + "624000 Examples seen. Accuracy: 0.0077 Error: 484.71381 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.15s Step time: 13.69s\n", + "Starting Validation.\n", + "Epochs: 13 Examples seen:624000 Validation Accuracy: 0.0130 Validation Error: 455.3463 Validation Loss: 0.0000 Total time: 226.30min\n", + "Epoch time: 17.1088 minutes. 50 epochs: 14.2573 hours.\n", + "Epochs: 13. Working time: 3.77 hours.\n", + "624640 Examples seen. Accuracy: 0.0082 Error: 460.52026 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.54s\n", + "625280 Examples seen. Accuracy: 0.0084 Error: 470.86292 Loss: 0.00000 Threads: 2 Forward time: 3.78s Backward time: 5.90s Step time: 14.20s\n", + "625920 Examples seen. Accuracy: 0.0083 Error: 453.16589 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 14.06s\n", + "626560 Examples seen. Accuracy: 0.0077 Error: 442.18768 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.60s\n", + "627200 Examples seen. Accuracy: 0.0074 Error: 477.84607 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.68s\n", + "627840 Examples seen. Accuracy: 0.0079 Error: 445.65158 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.10s Step time: 13.62s\n", + "628480 Examples seen. Accuracy: 0.0081 Error: 440.86151 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.18s Step time: 13.58s\n", + "629120 Examples seen. Accuracy: 0.0080 Error: 423.37552 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 13.55s\n", + "629760 Examples seen. Accuracy: 0.0082 Error: 445.90131 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.20s Step time: 13.58s\n", + "630400 Examples seen. Accuracy: 0.0079 Error: 473.83801 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.11s Step time: 13.57s\n", + "631040 Examples seen. Accuracy: 0.0084 Error: 455.45142 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.11s Step time: 13.55s\n", + "631680 Examples seen. Accuracy: 0.0082 Error: 459.90839 Loss: 0.00000 Threads: 2 Forward time: 2.73s Backward time: 4.18s Step time: 13.72s\n", + "632320 Examples seen. Accuracy: 0.0078 Error: 475.36655 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.62s\n", + "632960 Examples seen. Accuracy: 0.0083 Error: 451.08301 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.09s Step time: 13.59s\n", + "633600 Examples seen. Accuracy: 0.0087 Error: 447.52814 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.13s Step time: 13.55s\n", + "634240 Examples seen. Accuracy: 0.0084 Error: 466.80060 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.58s\n", + "634880 Examples seen. Accuracy: 0.0080 Error: 470.72223 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.56s\n", + "635520 Examples seen. Accuracy: 0.0082 Error: 447.65363 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.21s Step time: 13.58s\n", + "636160 Examples seen. Accuracy: 0.0087 Error: 469.57117 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.15s Step time: 13.64s\n", + "636800 Examples seen. Accuracy: 0.0089 Error: 500.55237 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.19s Step time: 13.57s\n", + "637440 Examples seen. Accuracy: 0.0085 Error: 456.20786 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.63s\n", + "638080 Examples seen. Accuracy: 0.0082 Error: 434.33417 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.23s Step time: 14.74s\n", + "638720 Examples seen. Accuracy: 0.0080 Error: 447.15225 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.19s Step time: 13.64s\n", + "639360 Examples seen. Accuracy: 0.0079 Error: 434.77930 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.07s Step time: 13.64s\n", + "640000 Examples seen. Accuracy: 0.0076 Error: 465.42371 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.60s\n", + "640640 Examples seen. Accuracy: 0.0080 Error: 472.04376 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.23s Step time: 13.62s\n", + "641280 Examples seen. Accuracy: 0.0078 Error: 435.27759 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.59s\n", + "641920 Examples seen. Accuracy: 0.0079 Error: 455.00098 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.35s Step time: 13.72s\n", + "642560 Examples seen. Accuracy: 0.0075 Error: 464.45264 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.19s Step time: 13.61s\n", + "643200 Examples seen. Accuracy: 0.0075 Error: 431.10239 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.09s Step time: 13.57s\n", + "643840 Examples seen. Accuracy: 0.0075 Error: 446.35657 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.55s\n", + "644480 Examples seen. Accuracy: 0.0075 Error: 441.54532 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.21s Step time: 13.61s\n", + "645120 Examples seen. Accuracy: 0.0071 Error: 456.07721 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.15s Step time: 13.62s\n", + "645760 Examples seen. Accuracy: 0.0071 Error: 453.37354 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.21s Step time: 13.62s\n", + "646400 Examples seen. Accuracy: 0.0075 Error: 448.58911 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.15s Step time: 13.58s\n", + "647040 Examples seen. Accuracy: 0.0078 Error: 455.79816 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.53s\n", + "647680 Examples seen. Accuracy: 0.0084 Error: 451.84287 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.13s Step time: 13.62s\n", + "648320 Examples seen. Accuracy: 0.0086 Error: 466.85596 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.16s Step time: 13.58s\n", + "648960 Examples seen. Accuracy: 0.0083 Error: 456.05530 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.12s Step time: 13.56s\n", + "649600 Examples seen. Accuracy: 0.0081 Error: 463.60040 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 14.71s\n", + "650240 Examples seen. Accuracy: 0.0080 Error: 486.83002 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.24s Step time: 13.67s\n", + "650880 Examples seen. Accuracy: 0.0078 Error: 440.80838 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.58s\n", + "651520 Examples seen. Accuracy: 0.0080 Error: 483.02472 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.12s Step time: 13.58s\n", + "652160 Examples seen. Accuracy: 0.0078 Error: 468.63916 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.57s\n", + "652800 Examples seen. Accuracy: 0.0075 Error: 435.50522 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.13s Step time: 13.66s\n", + "653440 Examples seen. Accuracy: 0.0081 Error: 489.16177 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.10s Step time: 13.64s\n", + "654080 Examples seen. Accuracy: 0.0084 Error: 436.40417 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.22s Step time: 13.56s\n", + "654720 Examples seen. Accuracy: 0.0084 Error: 456.31561 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.24s Step time: 13.61s\n", + "655360 Examples seen. Accuracy: 0.0080 Error: 476.18323 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.16s Step time: 13.60s\n", + "656000 Examples seen. Accuracy: 0.0085 Error: 468.40149 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.22s Step time: 13.63s\n", + "656640 Examples seen. Accuracy: 0.0086 Error: 443.78195 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.15s Step time: 13.65s\n", + "657280 Examples seen. Accuracy: 0.0083 Error: 446.75870 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.19s Step time: 13.60s\n", + "657920 Examples seen. Accuracy: 0.0090 Error: 441.84531 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.63s\n", + "658560 Examples seen. Accuracy: 0.0090 Error: 430.57587 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.58s\n", + "659200 Examples seen. Accuracy: 0.0086 Error: 500.60431 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.18s Step time: 13.58s\n", + "659840 Examples seen. Accuracy: 0.0086 Error: 441.28979 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.07s Step time: 13.59s\n", + "660480 Examples seen. Accuracy: 0.0083 Error: 453.45395 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.54s\n", + "661120 Examples seen. Accuracy: 0.0089 Error: 464.92825 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.10s Step time: 13.52s\n", + "661760 Examples seen. Accuracy: 0.0083 Error: 455.56689 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.26s Step time: 13.60s\n", + "662400 Examples seen. Accuracy: 0.0083 Error: 435.06073 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.18s Step time: 14.67s\n", + "663040 Examples seen. Accuracy: 0.0081 Error: 449.07666 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.58s\n", + "663680 Examples seen. Accuracy: 0.0082 Error: 450.03979 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.19s Step time: 13.59s\n", + "664320 Examples seen. Accuracy: 0.0088 Error: 446.06390 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.58s\n", + "664960 Examples seen. Accuracy: 0.0083 Error: 421.19519 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.04s Step time: 13.54s\n", + "665600 Examples seen. Accuracy: 0.0085 Error: 459.53226 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.56s\n", + "666240 Examples seen. Accuracy: 0.0087 Error: 461.54248 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.23s Step time: 13.55s\n", + "666880 Examples seen. Accuracy: 0.0083 Error: 432.51849 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.28s Step time: 13.61s\n", + "667520 Examples seen. Accuracy: 0.0087 Error: 439.35971 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.56s\n", + "668160 Examples seen. Accuracy: 0.0087 Error: 493.85498 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.57s\n", + "668800 Examples seen. Accuracy: 0.0088 Error: 444.30322 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.06s Step time: 13.56s\n", + "669440 Examples seen. Accuracy: 0.0085 Error: 451.35382 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.62s\n", + "670080 Examples seen. Accuracy: 0.0083 Error: 478.46011 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 13.56s\n", + "670720 Examples seen. Accuracy: 0.0080 Error: 432.18134 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.11s Step time: 13.46s\n", + "671360 Examples seen. Accuracy: 0.0078 Error: 482.75851 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.52s\n", + "672000 Examples seen. Accuracy: 0.0085 Error: 452.47647 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.49s\n", + "Starting Validation.\n", + "Epochs: 14 Examples seen:672000 Validation Accuracy: 0.0130 Validation Error: 455.9208 Validation Loss: 0.0000 Total time: 243.63min\n", + "Layer 0 Max Output: 1.109 Min Output: -1.750 TNNetInput 16,16,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 1 Max Weight: 0.540 Min Weight: -0.745 Max Output: 1.083 Min Output: -1.439 TNNetDepthwiseConvLinear 16,16,3 Times: 0.07s 0.00s Parent:0\n", + "Layer 2 Neurons: 64 Max Weight: 0.980 Min Weight: -0.981 Max Output: 2.224 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.32s 0.04s Parent:1\n", + "Layer 3 Max Output: 2.224 Min Output: -1.750 TNNetDeepConcat 16,16,67 Times: 0.03s 0.00s Parent:2\n", + "Layer 4 Neurons: 16 Max Weight: 0.230 Min Weight: -0.221 Max Output: 1.295 Min Output: -1.038 TNNetConvolutionLinear 16,16,16 Times: 0.16s 0.02s Parent:3\n", + "Layer 5 Neurons: 1 Max Weight: 0.574 Min Weight: -0.574 Max Output: 0.936 Min Output: -0.827 TNNetDepthwiseConvLinear 16,16,16 Times: 0.08s 0.01s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.435 Min Weight: -0.439 Max Output: 1.002 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.42s 0.05s Parent:5\n", + "Layer 7 Max Output: 2.224 Min Output: -1.750 TNNetDeepConcat 16,16,131 Times: 0.06s 0.00s Parent:6\n", + "Layer 8 Neurons: 16 Max Weight: 0.167 Min Weight: -0.172 Max Output: 1.153 Min Output: -0.775 TNNetConvolutionLinear 16,16,16 Times: 0.21s 0.03s Parent:7\n", + "Layer 9 Neurons: 1 Max Weight: 0.577 Min Weight: -0.571 Max Output: 0.731 Min Output: -1.422 TNNetDepthwiseConvLinear 16,16,16 Times: 0.09s 0.01s Parent:8\n", + "Layer 10 Neurons: 64 Max Weight: 0.452 Min Weight: -0.448 Max Output: 0.833 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.40s 0.04s Parent:9\n", + "Layer 11 Max Output: 2.224 Min Output: -1.750 TNNetDeepConcat 16,16,195 Times: 0.10s 0.01s Parent:10\n", + "Layer 12 Max Output: 2.224 Min Output: -1.750 TNNetDeAvgPool 32,32,195 Times: 3.12s 0.09s Parent:11\n", + "Layer 13 Neurons: 16 Max Weight: 0.293 Min Weight: -0.209 Max Output: 1.369 Min Output: -1.125 TNNetConvolutionLinear 32,32,16 Times: 1.03s 0.15s Parent:12\n", + "Layer 14 Neurons: 1 Max Weight: 0.588 Min Weight: -0.557 Max Output: 1.238 Min Output: -1.432 TNNetDepthwiseConvLinear 32,32,16 Times: 0.29s 0.03s Parent:13\n", + "Layer 15 Neurons: 64 Max Weight: 0.443 Min Weight: -0.463 Max Output: 1.863 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.65s 0.17s Parent:14\n", + "Layer 16 Max Output: 2.224 Min Output: -1.750 TNNetDeepConcat 32,32,259 Times: 0.54s 0.03s Parent:15\n", + "Layer 17 Neurons: 16 Max Weight: 0.315 Min Weight: -0.235 Max Output: 1.498 Min Output: -1.833 TNNetConvolutionLinear 32,32,16 Times: 1.22s 0.18s Parent:16\n", + "Layer 18 Neurons: 1 Max Weight: 0.533 Min Weight: -0.589 Max Output: 3.130 Min Output: -2.611 TNNetDepthwiseConvLinear 32,32,16 Times: 0.30s 0.04s Parent:17\n", + "Layer 19 Neurons: 64 Max Weight: 0.483 Min Weight: -0.458 Max Output: 1.978 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.65s 0.16s Parent:18\n", + "Layer 20 Max Output: 2.224 Min Output: -1.750 TNNetDeepConcat 32,32,323 Times: 0.62s 0.04s Parent:19\n", + "Layer 21 Neurons: 16 Max Weight: 0.271 Min Weight: -0.346 Max Output: 0.767 Min Output: -1.139 TNNetConvolutionLinear 32,32,16 Times: 1.48s 0.20s Parent:20\n", + "Layer 22 Neurons: 1 Max Weight: 0.593 Min Weight: -0.558 Max Output: 0.924 Min Output: -1.157 TNNetDepthwiseConvLinear 32,32,16 Times: 0.28s 0.04s Parent:21\n", + "Layer 23 Neurons: 64 Max Weight: 0.446 Min Weight: -0.452 Max Output: 1.147 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.62s 0.17s Parent:22\n", + "Layer 24 Max Output: 2.224 Min Output: -1.750 TNNetDeepConcat 32,32,387 Times: 0.68s 0.03s Parent:23\n", + "Layer 25 Neurons: 3 Max Weight: 0.562 Min Weight: -0.203 Max Output: 1.033 Min Output: -1.987 TNNetConvolutionLinear 32,32,3 Times: 0.35s 0.04s Parent:24\n", + "Epoch time: 16.8638 minutes. 50 epochs: 14.0531 hours.\n", + "Epochs: 14. Working time: 4.06 hours.\n", + "672640 Examples seen. Accuracy: 0.0084 Error: 446.78311 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.14s Step time: 13.45s\n", + "673280 Examples seen. Accuracy: 0.0082 Error: 462.28098 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.08s Step time: 14.53s\n", + "673920 Examples seen. Accuracy: 0.0080 Error: 468.84415 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.23s Step time: 13.49s\n", + "674560 Examples seen. Accuracy: 0.0080 Error: 471.05386 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.16s Step time: 13.41s\n", + "675200 Examples seen. Accuracy: 0.0082 Error: 479.49948 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.16s Step time: 13.46s\n", + "675840 Examples seen. Accuracy: 0.0078 Error: 480.19772 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.03s Step time: 13.43s\n", + "676480 Examples seen. Accuracy: 0.0076 Error: 469.73877 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.10s Step time: 13.47s\n", + "677120 Examples seen. Accuracy: 0.0081 Error: 470.36176 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.48s\n", + "677760 Examples seen. Accuracy: 0.0076 Error: 460.46985 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.11s Step time: 13.51s\n", + "678400 Examples seen. Accuracy: 0.0080 Error: 424.68051 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.21s Step time: 13.59s\n", + "679040 Examples seen. Accuracy: 0.0081 Error: 446.68402 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.21s Step time: 13.59s\n", + "679680 Examples seen. Accuracy: 0.0078 Error: 474.31931 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.17s Step time: 13.71s\n", + "680320 Examples seen. Accuracy: 0.0077 Error: 471.77197 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.29s Step time: 13.74s\n", + "680960 Examples seen. Accuracy: 0.0073 Error: 443.44553 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.24s Step time: 13.75s\n", + "681600 Examples seen. Accuracy: 0.0071 Error: 457.52997 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.21s Step time: 13.96s\n", + "682240 Examples seen. Accuracy: 0.0071 Error: 450.62238 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.12s Step time: 13.67s\n", + "682880 Examples seen. Accuracy: 0.0070 Error: 450.01703 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.27s Step time: 13.86s\n", + "683520 Examples seen. Accuracy: 0.0067 Error: 448.17621 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.33s Step time: 13.97s\n", + "684160 Examples seen. Accuracy: 0.0069 Error: 460.07242 Loss: 0.00000 Threads: 2 Forward time: 2.71s Backward time: 4.30s Step time: 14.16s\n", + "684800 Examples seen. Accuracy: 0.0068 Error: 430.92041 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.22s Step time: 15.14s\n", + "685440 Examples seen. Accuracy: 0.0082 Error: 455.28580 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.29s Step time: 13.98s\n", + "686080 Examples seen. Accuracy: 0.0084 Error: 458.46277 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.20s Step time: 14.08s\n", + "686720 Examples seen. Accuracy: 0.0084 Error: 440.60584 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.33s Step time: 13.94s\n", + "687360 Examples seen. Accuracy: 0.0084 Error: 453.63608 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.23s Step time: 13.87s\n", + "688000 Examples seen. Accuracy: 0.0080 Error: 461.99292 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.17s Step time: 13.84s\n", + "688640 Examples seen. Accuracy: 0.0087 Error: 437.75464 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.35s Step time: 13.87s\n", + "689280 Examples seen. Accuracy: 0.0084 Error: 460.46994 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.33s Step time: 13.82s\n", + "689920 Examples seen. Accuracy: 0.0085 Error: 454.83786 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.21s Step time: 13.75s\n", + "690560 Examples seen. Accuracy: 0.0085 Error: 442.93439 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.67s\n", + "691200 Examples seen. Accuracy: 0.0083 Error: 478.55603 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.24s Step time: 13.71s\n", + "691840 Examples seen. Accuracy: 0.0080 Error: 451.54468 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.16s Step time: 13.75s\n", + "692480 Examples seen. Accuracy: 0.0073 Error: 450.81134 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.20s Step time: 13.70s\n", + "693120 Examples seen. Accuracy: 0.0076 Error: 482.60248 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.27s Step time: 13.86s\n", + "693760 Examples seen. Accuracy: 0.0080 Error: 475.60077 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.20s Step time: 13.80s\n", + "694400 Examples seen. Accuracy: 0.0076 Error: 466.39404 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.68s\n", + "695040 Examples seen. Accuracy: 0.0080 Error: 492.45230 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 13.62s\n", + "695680 Examples seen. Accuracy: 0.0077 Error: 473.48529 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.18s Step time: 13.68s\n", + "696320 Examples seen. Accuracy: 0.0077 Error: 448.93652 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 14.82s\n", + "696960 Examples seen. Accuracy: 0.0079 Error: 461.65247 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.12s Step time: 13.74s\n", + "697600 Examples seen. Accuracy: 0.0075 Error: 451.24158 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.19s Step time: 13.71s\n", + "698240 Examples seen. Accuracy: 0.0076 Error: 436.99396 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.15s Step time: 13.71s\n", + "698880 Examples seen. Accuracy: 0.0077 Error: 438.54773 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.08s Step time: 13.60s\n", + "699520 Examples seen. Accuracy: 0.0077 Error: 446.83963 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.23s Step time: 13.59s\n", + "700160 Examples seen. Accuracy: 0.0081 Error: 445.14655 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.20s Step time: 13.67s\n", + "700800 Examples seen. Accuracy: 0.0085 Error: 422.60553 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.62s\n", + "701440 Examples seen. Accuracy: 0.0086 Error: 452.03149 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.04s Step time: 13.72s\n", + "702080 Examples seen. Accuracy: 0.0083 Error: 466.19678 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.12s Step time: 13.61s\n", + "702720 Examples seen. Accuracy: 0.0083 Error: 459.07257 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.13s Step time: 13.60s\n", + "703360 Examples seen. Accuracy: 0.0079 Error: 453.68387 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.59s\n", + "704000 Examples seen. Accuracy: 0.0081 Error: 475.36200 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.10s Step time: 13.57s\n", + "704640 Examples seen. Accuracy: 0.0083 Error: 451.75894 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.61s\n", + "705280 Examples seen. Accuracy: 0.0084 Error: 476.77164 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.32s Step time: 13.65s\n", + "705920 Examples seen. Accuracy: 0.0084 Error: 438.03000 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.60s\n", + "706560 Examples seen. Accuracy: 0.0085 Error: 428.48413 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.10s Step time: 13.60s\n", + "707200 Examples seen. Accuracy: 0.0087 Error: 472.68539 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.28s Step time: 13.66s\n", + "707840 Examples seen. Accuracy: 0.0084 Error: 463.30994 Loss: 0.00000 Threads: 2 Forward time: 3.30s Backward time: 5.11s Step time: 14.02s\n", + "708480 Examples seen. Accuracy: 0.0088 Error: 456.96667 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.11s Step time: 14.29s\n", + "709120 Examples seen. Accuracy: 0.0086 Error: 462.06598 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.26s Step time: 13.65s\n", + "709760 Examples seen. Accuracy: 0.0085 Error: 453.54980 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.05s Step time: 13.57s\n", + "710400 Examples seen. Accuracy: 0.0080 Error: 476.38992 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.12s Step time: 13.53s\n", + "711040 Examples seen. Accuracy: 0.0084 Error: 441.04535 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.56s\n", + "711680 Examples seen. Accuracy: 0.0081 Error: 463.87021 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.16s Step time: 13.51s\n", + "712320 Examples seen. Accuracy: 0.0076 Error: 441.92334 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.56s\n", + "712960 Examples seen. Accuracy: 0.0077 Error: 467.19263 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.22s Step time: 13.61s\n", + "713600 Examples seen. Accuracy: 0.0076 Error: 455.70584 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.58s\n", + "714240 Examples seen. Accuracy: 0.0078 Error: 457.79755 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.10s Step time: 13.60s\n", + "714880 Examples seen. Accuracy: 0.0075 Error: 471.51859 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.19s Step time: 13.55s\n", + "715520 Examples seen. Accuracy: 0.0083 Error: 463.29059 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.10s Step time: 13.59s\n", + "716160 Examples seen. Accuracy: 0.0083 Error: 475.89270 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.51s\n", + "716800 Examples seen. Accuracy: 0.0086 Error: 440.11386 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.15s Step time: 13.55s\n", + "717440 Examples seen. Accuracy: 0.0088 Error: 445.13049 Loss: 0.00000 Threads: 2 Forward time: 2.70s Backward time: 4.22s Step time: 13.63s\n", + "718080 Examples seen. Accuracy: 0.0086 Error: 440.61292 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.15s Step time: 13.60s\n", + "718720 Examples seen. Accuracy: 0.0084 Error: 430.41138 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.52s\n", + "719360 Examples seen. Accuracy: 0.0084 Error: 448.94904 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.25s Step time: 13.58s\n", + "720000 Examples seen. Accuracy: 0.0083 Error: 452.59738 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.18s Step time: 14.58s\n", + "Starting Validation.\n", + "Epochs: 15 Examples seen:720000 Validation Accuracy: 0.0130 Validation Error: 454.3763 Validation Loss: 0.0000 Total time: 261.07min\n", + "Epoch time: 18.2287 minutes. 50 epochs: 15.1906 hours.\n", + "Epochs: 15. Working time: 4.35 hours.\n", + "720640 Examples seen. Accuracy: 0.0080 Error: 445.94342 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.12s Step time: 13.53s\n", + "721280 Examples seen. Accuracy: 0.0084 Error: 463.99893 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.17s Step time: 13.55s\n", + "721920 Examples seen. Accuracy: 0.0084 Error: 445.04657 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.20s Step time: 13.61s\n", + "722560 Examples seen. Accuracy: 0.0080 Error: 471.93182 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.20s Step time: 13.65s\n", + "723200 Examples seen. Accuracy: 0.0078 Error: 455.71863 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.06s Step time: 13.56s\n", + "723840 Examples seen. Accuracy: 0.0078 Error: 481.22040 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.61s\n", + "724480 Examples seen. Accuracy: 0.0080 Error: 460.92993 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.58s\n", + "725120 Examples seen. Accuracy: 0.0082 Error: 441.09283 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.22s Step time: 13.55s\n", + "725760 Examples seen. Accuracy: 0.0082 Error: 480.98035 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.18s Step time: 13.59s\n", + "726400 Examples seen. Accuracy: 0.0085 Error: 470.80219 Loss: 0.00000 Threads: 2 Forward time: 2.69s Backward time: 4.10s Step time: 13.56s\n", + "727040 Examples seen. Accuracy: 0.0086 Error: 462.45828 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.54s\n", + "727680 Examples seen. Accuracy: 0.0084 Error: 452.19318 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.11s Step time: 13.59s\n", + "728320 Examples seen. Accuracy: 0.0083 Error: 424.29834 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.21s Step time: 13.61s\n", + "728960 Examples seen. Accuracy: 0.0085 Error: 435.85339 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.13s Step time: 13.55s\n", + "729600 Examples seen. Accuracy: 0.0080 Error: 471.41980 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.55s\n", + "730240 Examples seen. Accuracy: 0.0077 Error: 438.00922 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.24s Step time: 14.75s\n", + "730880 Examples seen. Accuracy: 0.0080 Error: 470.97906 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.54s\n", + "731520 Examples seen. Accuracy: 0.0080 Error: 508.74890 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.20s Step time: 13.60s\n", + "732160 Examples seen. Accuracy: 0.0080 Error: 419.32446 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.19s Step time: 13.60s\n", + "732800 Examples seen. Accuracy: 0.0077 Error: 456.55884 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.17s Step time: 13.56s\n", + "733440 Examples seen. Accuracy: 0.0080 Error: 470.23776 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.54s\n", + "734080 Examples seen. Accuracy: 0.0088 Error: 450.95532 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.12s Step time: 13.53s\n", + "734720 Examples seen. Accuracy: 0.0094 Error: 458.99469 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.09s Step time: 13.54s\n", + "735360 Examples seen. Accuracy: 0.0090 Error: 441.77856 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.10s Step time: 13.55s\n", + "736000 Examples seen. Accuracy: 0.0088 Error: 439.84665 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.60s\n", + "736640 Examples seen. Accuracy: 0.0087 Error: 480.68677 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.12s Step time: 13.56s\n", + "737280 Examples seen. Accuracy: 0.0088 Error: 447.21954 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.12s Step time: 13.54s\n", + "737920 Examples seen. Accuracy: 0.0092 Error: 433.85953 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.50s\n", + "738560 Examples seen. Accuracy: 0.0092 Error: 433.46338 Loss: 0.00000 Threads: 2 Forward time: 2.65s Backward time: 4.30s Step time: 13.58s\n", + "739200 Examples seen. Accuracy: 0.0087 Error: 462.26974 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.50s\n", + "739840 Examples seen. Accuracy: 0.0088 Error: 424.45877 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.14s Step time: 13.53s\n", + "740480 Examples seen. Accuracy: 0.0087 Error: 450.65347 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.49s\n", + "741120 Examples seen. Accuracy: 0.0085 Error: 438.09476 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.55s\n", + "741760 Examples seen. Accuracy: 0.0086 Error: 448.37082 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.07s Step time: 13.49s\n", + "742400 Examples seen. Accuracy: 0.0085 Error: 460.63217 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.52s\n", + "743040 Examples seen. Accuracy: 0.0088 Error: 483.58694 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.53s\n", + "743680 Examples seen. Accuracy: 0.0087 Error: 436.40546 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.53s\n", + "744320 Examples seen. Accuracy: 0.0086 Error: 482.89935 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.55s\n", + "744960 Examples seen. Accuracy: 0.0083 Error: 452.60211 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.23s Step time: 13.70s\n", + "745600 Examples seen. Accuracy: 0.0080 Error: 450.50598 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.10s Step time: 13.51s\n", + "746240 Examples seen. Accuracy: 0.0076 Error: 441.27454 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 13.55s\n", + "746880 Examples seen. Accuracy: 0.0073 Error: 441.23962 Loss: 0.00000 Threads: 2 Forward time: 2.66s Backward time: 4.18s Step time: 13.60s\n", + "747520 Examples seen. Accuracy: 0.0071 Error: 446.34894 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.55s\n", + "748160 Examples seen. Accuracy: 0.0075 Error: 443.10394 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.58s\n", + "748800 Examples seen. Accuracy: 0.0074 Error: 456.06189 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.14s Step time: 13.54s\n", + "749440 Examples seen. Accuracy: 0.0073 Error: 475.75116 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.11s Step time: 13.53s\n", + "750080 Examples seen. Accuracy: 0.0068 Error: 457.66687 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.18s Step time: 13.61s\n", + "750720 Examples seen. Accuracy: 0.0069 Error: 436.88519 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.57s\n", + "751360 Examples seen. Accuracy: 0.0071 Error: 465.00323 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.62s\n", + "752000 Examples seen. Accuracy: 0.0072 Error: 487.19263 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.18s Step time: 13.58s\n", + "752640 Examples seen. Accuracy: 0.0069 Error: 452.80640 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.07s Step time: 13.55s\n", + "753280 Examples seen. Accuracy: 0.0066 Error: 443.97018 Loss: 0.00000 Threads: 2 Forward time: 2.67s Backward time: 4.27s Step time: 13.60s\n", + "753920 Examples seen. Accuracy: 0.0067 Error: 466.74084 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.18s Step time: 13.62s\n", + "754560 Examples seen. Accuracy: 0.0063 Error: 445.59372 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.21s Step time: 13.53s\n", + "755200 Examples seen. Accuracy: 0.0065 Error: 460.22217 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.18s Step time: 13.57s\n", + "755840 Examples seen. Accuracy: 0.0067 Error: 455.20001 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.08s Step time: 13.56s\n", + "756480 Examples seen. Accuracy: 0.0072 Error: 448.21329 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.21s Step time: 13.60s\n", + "757120 Examples seen. Accuracy: 0.0069 Error: 447.28427 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.60s\n", + "757760 Examples seen. Accuracy: 0.0067 Error: 457.00732 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.11s Step time: 13.55s\n", + "758400 Examples seen. Accuracy: 0.0068 Error: 464.36667 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 13.56s\n", + "759040 Examples seen. Accuracy: 0.0073 Error: 445.99146 Loss: 0.00000 Threads: 2 Forward time: 2.50s Backward time: 4.16s Step time: 13.53s\n", + "759680 Examples seen. Accuracy: 0.0071 Error: 463.33936 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.18s Step time: 13.54s\n", + "760320 Examples seen. Accuracy: 0.0071 Error: 464.22217 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.18s Step time: 13.56s\n", + "760960 Examples seen. Accuracy: 0.0069 Error: 480.29605 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.55s\n", + "761600 Examples seen. Accuracy: 0.0071 Error: 458.37408 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.55s\n", + "762240 Examples seen. Accuracy: 0.0069 Error: 419.79669 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.56s\n", + "762880 Examples seen. Accuracy: 0.0066 Error: 444.75446 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.08s Step time: 13.54s\n", + "763520 Examples seen. Accuracy: 0.0069 Error: 431.67871 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.21s Step time: 13.61s\n", + "764160 Examples seen. Accuracy: 0.0069 Error: 432.49881 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.21s Step time: 13.55s\n", + "764800 Examples seen. Accuracy: 0.0069 Error: 453.47455 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.59s\n", + "765440 Examples seen. Accuracy: 0.0065 Error: 458.08112 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.50s\n", + "766080 Examples seen. Accuracy: 0.0075 Error: 450.85864 Loss: 0.00000 Threads: 2 Forward time: 3.06s Backward time: 4.93s Step time: 13.94s\n", + "766720 Examples seen. Accuracy: 0.0078 Error: 468.00171 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.05s Step time: 14.30s\n", + "767360 Examples seen. Accuracy: 0.0077 Error: 453.47308 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.10s Step time: 13.55s\n", + "768000 Examples seen. Accuracy: 0.0077 Error: 442.02692 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.07s Step time: 13.57s\n", + "Starting Validation.\n", + "Epochs: 16 Examples seen:768000 Validation Accuracy: 0.0130 Validation Error: 453.3021 Validation Loss: 0.0000 Total time: 278.32min\n", + "Layer 0 Max Output: 1.109 Min Output: -1.750 TNNetInput 16,16,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 1 Max Weight: 0.554 Min Weight: -0.754 Max Output: 1.032 Min Output: -1.427 TNNetDepthwiseConvLinear 16,16,3 Times: 0.07s 0.01s Parent:0\n", + "Layer 2 Neurons: 64 Max Weight: 0.980 Min Weight: -0.981 Max Output: 2.199 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.29s 0.04s Parent:1\n", + "Layer 3 Max Output: 2.199 Min Output: -1.750 TNNetDeepConcat 16,16,67 Times: 0.03s 0.00s Parent:2\n", + "Layer 4 Neurons: 16 Max Weight: 0.229 Min Weight: -0.222 Max Output: 1.255 Min Output: -0.976 TNNetConvolutionLinear 16,16,16 Times: 0.15s 0.03s Parent:3\n", + "Layer 5 Neurons: 1 Max Weight: 0.575 Min Weight: -0.576 Max Output: 0.891 Min Output: -0.825 TNNetDepthwiseConvLinear 16,16,16 Times: 0.08s 0.01s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.436 Min Weight: -0.440 Max Output: 0.982 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.44s 0.05s Parent:5\n", + "Layer 7 Max Output: 2.199 Min Output: -1.750 TNNetDeepConcat 16,16,131 Times: 0.08s 0.01s Parent:6\n", + "Layer 8 Neurons: 16 Max Weight: 0.169 Min Weight: -0.174 Max Output: 1.151 Min Output: -0.758 TNNetConvolutionLinear 16,16,16 Times: 0.17s 0.03s Parent:7\n", + "Layer 9 Neurons: 1 Max Weight: 0.576 Min Weight: -0.573 Max Output: 0.718 Min Output: -1.421 TNNetDepthwiseConvLinear 16,16,16 Times: 0.08s 0.01s Parent:8\n", + "Layer 10 Neurons: 64 Max Weight: 0.452 Min Weight: -0.448 Max Output: 0.834 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.41s 0.04s Parent:9\n", + "Layer 11 Max Output: 2.199 Min Output: -1.750 TNNetDeepConcat 16,16,195 Times: 0.11s 0.00s Parent:10\n", + "Layer 12 Max Output: 2.199 Min Output: -1.750 TNNetDeAvgPool 32,32,195 Times: 3.15s 0.09s Parent:11\n", + "Layer 13 Neurons: 16 Max Weight: 0.297 Min Weight: -0.212 Max Output: 1.412 Min Output: -1.120 TNNetConvolutionLinear 32,32,16 Times: 1.04s 0.14s Parent:12\n", + "Layer 14 Neurons: 1 Max Weight: 0.591 Min Weight: -0.559 Max Output: 1.263 Min Output: -1.457 TNNetDepthwiseConvLinear 32,32,16 Times: 0.30s 0.03s Parent:13\n", + "Layer 15 Neurons: 64 Max Weight: 0.443 Min Weight: -0.466 Max Output: 1.850 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.60s 0.16s Parent:14\n", + "Layer 16 Max Output: 2.199 Min Output: -1.750 TNNetDeepConcat 32,32,259 Times: 0.60s 0.03s Parent:15\n", + "Layer 17 Neurons: 16 Max Weight: 0.323 Min Weight: -0.240 Max Output: 1.502 Min Output: -1.859 TNNetConvolutionLinear 32,32,16 Times: 1.28s 0.18s Parent:16\n", + "Layer 18 Neurons: 1 Max Weight: 0.535 Min Weight: -0.588 Max Output: 3.195 Min Output: -2.645 TNNetDepthwiseConvLinear 32,32,16 Times: 0.27s 0.03s Parent:17\n", + "Layer 19 Neurons: 64 Max Weight: 0.485 Min Weight: -0.459 Max Output: 2.058 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.65s 0.17s Parent:18\n", + "Layer 20 Max Output: 2.199 Min Output: -1.750 TNNetDeepConcat 32,32,323 Times: 0.65s 0.02s Parent:19\n", + "Layer 21 Neurons: 16 Max Weight: 0.272 Min Weight: -0.352 Max Output: 0.791 Min Output: -1.118 TNNetConvolutionLinear 32,32,16 Times: 1.53s 0.21s Parent:20\n", + "Layer 22 Neurons: 1 Max Weight: 0.594 Min Weight: -0.557 Max Output: 0.913 Min Output: -1.144 TNNetDepthwiseConvLinear 32,32,16 Times: 0.28s 0.03s Parent:21\n", + "Layer 23 Neurons: 64 Max Weight: 0.446 Min Weight: -0.456 Max Output: 1.109 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.64s 0.17s Parent:22\n", + "Layer 24 Max Output: 2.199 Min Output: -1.750 TNNetDeepConcat 32,32,387 Times: 0.70s 0.03s Parent:23\n", + "Layer 25 Neurons: 3 Max Weight: 0.565 Min Weight: -0.212 Max Output: 1.032 Min Output: -1.976 TNNetConvolutionLinear 32,32,3 Times: 0.36s 0.05s Parent:24\n", + "Epoch time: 16.9650 minutes. 50 epochs: 14.1375 hours.\n", + "Epochs: 16. Working time: 4.64 hours.\n", + "768640 Examples seen. Accuracy: 0.0078 Error: 466.77081 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.22s Step time: 13.63s\n", + "769280 Examples seen. Accuracy: 0.0075 Error: 474.22412 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.61s\n", + "769920 Examples seen. Accuracy: 0.0074 Error: 434.67731 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.14s Step time: 13.60s\n", + "770560 Examples seen. Accuracy: 0.0071 Error: 431.32867 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.22s Step time: 13.64s\n", + "771200 Examples seen. Accuracy: 0.0078 Error: 457.01285 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.58s\n", + "771840 Examples seen. Accuracy: 0.0080 Error: 458.93051 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.18s Step time: 13.56s\n", + "772480 Examples seen. Accuracy: 0.0082 Error: 464.82098 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.13s Step time: 13.58s\n", + "773120 Examples seen. Accuracy: 0.0083 Error: 453.44464 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.52s\n", + "773760 Examples seen. Accuracy: 0.0077 Error: 445.35950 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.57s\n", + "774400 Examples seen. Accuracy: 0.0078 Error: 426.90286 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.11s Step time: 13.54s\n", + "775040 Examples seen. Accuracy: 0.0094 Error: 461.09058 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.57s\n", + "775680 Examples seen. Accuracy: 0.0095 Error: 474.64050 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.56s\n", + "776320 Examples seen. Accuracy: 0.0093 Error: 433.98718 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 13.54s\n", + "776960 Examples seen. Accuracy: 0.0089 Error: 444.46387 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.08s Step time: 13.55s\n", + "777600 Examples seen. Accuracy: 0.0087 Error: 495.62122 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.11s Step time: 13.56s\n", + "778240 Examples seen. Accuracy: 0.0086 Error: 420.54004 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.19s Step time: 13.53s\n", + "778880 Examples seen. Accuracy: 0.0086 Error: 471.62677 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.23s Step time: 13.59s\n", + "779520 Examples seen. Accuracy: 0.0084 Error: 446.51715 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.19s Step time: 13.61s\n", + "780160 Examples seen. Accuracy: 0.0086 Error: 462.82651 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.61s\n", + "780800 Examples seen. Accuracy: 0.0089 Error: 440.81122 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.17s Step time: 13.58s\n", + "781440 Examples seen. Accuracy: 0.0088 Error: 458.85107 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.57s\n", + "782080 Examples seen. Accuracy: 0.0092 Error: 453.15277 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.18s Step time: 13.59s\n", + "782720 Examples seen. Accuracy: 0.0096 Error: 456.49429 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.20s Step time: 13.57s\n", + "783360 Examples seen. Accuracy: 0.0093 Error: 453.38397 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.10s Step time: 14.61s\n", + "784000 Examples seen. Accuracy: 0.0095 Error: 470.11768 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.50s\n", + "784640 Examples seen. Accuracy: 0.0090 Error: 467.31628 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.54s\n", + "785280 Examples seen. Accuracy: 0.0093 Error: 445.85086 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.58s\n", + "785920 Examples seen. Accuracy: 0.0091 Error: 449.44968 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.64s\n", + "786560 Examples seen. Accuracy: 0.0090 Error: 452.26483 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.25s Step time: 13.56s\n", + "787200 Examples seen. Accuracy: 0.0087 Error: 408.92157 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.11s Step time: 13.53s\n", + "787840 Examples seen. Accuracy: 0.0087 Error: 456.12527 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.54s\n", + "788480 Examples seen. Accuracy: 0.0090 Error: 418.57800 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.51s\n", + "789120 Examples seen. Accuracy: 0.0083 Error: 433.72012 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.14s Step time: 13.50s\n", + "789760 Examples seen. Accuracy: 0.0079 Error: 444.88989 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.19s Step time: 13.56s\n", + "790400 Examples seen. Accuracy: 0.0072 Error: 457.16003 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.16s Step time: 13.48s\n", + "791040 Examples seen. Accuracy: 0.0070 Error: 451.72821 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.50s\n", + "791680 Examples seen. Accuracy: 0.0069 Error: 497.16425 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.20s Step time: 13.51s\n", + "792320 Examples seen. Accuracy: 0.0069 Error: 472.95441 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.55s\n", + "792960 Examples seen. Accuracy: 0.0068 Error: 431.67529 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.08s Step time: 13.49s\n", + "793600 Examples seen. Accuracy: 0.0066 Error: 441.52051 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.16s Step time: 13.53s\n", + "794240 Examples seen. Accuracy: 0.0068 Error: 440.89050 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 14.57s\n", + "794880 Examples seen. Accuracy: 0.0063 Error: 427.67200 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.11s Step time: 13.49s\n", + "795520 Examples seen. Accuracy: 0.0062 Error: 463.69672 Loss: 0.00000 Threads: 2 Forward time: 2.68s Backward time: 4.08s Step time: 13.51s\n", + "796160 Examples seen. Accuracy: 0.0070 Error: 489.35385 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.51s\n", + "796800 Examples seen. Accuracy: 0.0069 Error: 437.72678 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.08s Step time: 13.45s\n", + "797440 Examples seen. Accuracy: 0.0073 Error: 477.94284 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.10s Step time: 13.52s\n", + "798080 Examples seen. Accuracy: 0.0072 Error: 444.00067 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.10s Step time: 13.51s\n", + "798720 Examples seen. Accuracy: 0.0069 Error: 476.25671 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.09s Step time: 13.52s\n", + "799360 Examples seen. Accuracy: 0.0071 Error: 421.09387 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.12s Step time: 13.51s\n", + "800000 Examples seen. Accuracy: 0.0073 Error: 461.40125 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.04s Step time: 13.51s\n", + "800640 Examples seen. Accuracy: 0.0076 Error: 447.27557 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.05s Step time: 13.43s\n", + "801280 Examples seen. Accuracy: 0.0073 Error: 466.63498 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.21s Step time: 13.47s\n", + "801920 Examples seen. Accuracy: 0.0078 Error: 428.12939 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.18s Step time: 13.50s\n", + "802560 Examples seen. Accuracy: 0.0084 Error: 445.74243 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.48s\n", + "803200 Examples seen. Accuracy: 0.0088 Error: 477.34314 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.17s Step time: 13.50s\n", + "803840 Examples seen. Accuracy: 0.0087 Error: 443.10980 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.17s Step time: 13.49s\n", + "804480 Examples seen. Accuracy: 0.0089 Error: 490.25378 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.08s Step time: 13.51s\n", + "805120 Examples seen. Accuracy: 0.0086 Error: 427.09741 Loss: 0.00000 Threads: 2 Forward time: 3.96s Backward time: 6.12s Step time: 14.31s\n", + "805760 Examples seen. Accuracy: 0.0082 Error: 454.92114 Loss: 0.00000 Threads: 2 Forward time: 2.50s Backward time: 4.14s Step time: 13.68s\n", + "806400 Examples seen. Accuracy: 0.0084 Error: 461.23352 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.48s\n", + "807040 Examples seen. Accuracy: 0.0081 Error: 466.70776 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.16s Step time: 13.49s\n", + "807680 Examples seen. Accuracy: 0.0084 Error: 462.26270 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.05s Step time: 13.52s\n", + "808320 Examples seen. Accuracy: 0.0079 Error: 434.49457 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.15s Step time: 13.50s\n", + "808960 Examples seen. Accuracy: 0.0078 Error: 486.69632 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.21s Step time: 13.53s\n", + "809600 Examples seen. Accuracy: 0.0079 Error: 431.80444 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.09s Step time: 13.51s\n", + "810240 Examples seen. Accuracy: 0.0090 Error: 436.39410 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.12s Step time: 13.47s\n", + "810880 Examples seen. Accuracy: 0.0090 Error: 445.94891 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.14s Step time: 13.50s\n", + "811520 Examples seen. Accuracy: 0.0085 Error: 457.67889 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.10s Step time: 13.47s\n", + "812160 Examples seen. Accuracy: 0.0081 Error: 443.24060 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.18s Step time: 13.46s\n", + "812800 Examples seen. Accuracy: 0.0078 Error: 460.42490 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.03s Step time: 13.57s\n", + "813440 Examples seen. Accuracy: 0.0081 Error: 475.69116 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.07s Step time: 13.47s\n", + "814080 Examples seen. Accuracy: 0.0079 Error: 485.37305 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.21s Step time: 13.49s\n", + "814720 Examples seen. Accuracy: 0.0077 Error: 462.84595 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.10s Step time: 13.44s\n", + "815360 Examples seen. Accuracy: 0.0079 Error: 452.89331 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.05s Step time: 13.45s\n", + "816000 Examples seen. Accuracy: 0.0079 Error: 417.89569 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.42s\n", + "Starting Validation.\n", + "Epochs: 17 Examples seen:816000 Validation Accuracy: 0.0135 Validation Error: 449.4119 Validation Loss: 0.0000 Total time: 295.57min\n", + "Epoch time: 16.7737 minutes. 50 epochs: 13.9781 hours.\n", + "Epochs: 17. Working time: 4.93 hours.\n", + "816640 Examples seen. Accuracy: 0.0078 Error: 477.72180 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.17s Step time: 13.45s\n", + "817280 Examples seen. Accuracy: 0.0088 Error: 455.17505 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.18s Step time: 13.46s\n", + "817920 Examples seen. Accuracy: 0.0081 Error: 468.13013 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.43s\n", + "818560 Examples seen. Accuracy: 0.0081 Error: 471.39893 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.12s Step time: 13.40s\n", + "819200 Examples seen. Accuracy: 0.0080 Error: 478.84308 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.42s\n", + "819840 Examples seen. Accuracy: 0.0078 Error: 460.99731 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.41s\n", + "820480 Examples seen. Accuracy: 0.0079 Error: 469.00385 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.10s Step time: 13.39s\n", + "821120 Examples seen. Accuracy: 0.0083 Error: 459.98782 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.11s Step time: 13.42s\n", + "821760 Examples seen. Accuracy: 0.0085 Error: 506.58566 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.40s\n", + "822400 Examples seen. Accuracy: 0.0084 Error: 466.03314 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.42s\n", + "823040 Examples seen. Accuracy: 0.0081 Error: 464.37787 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.08s Step time: 13.42s\n", + "823680 Examples seen. Accuracy: 0.0083 Error: 455.71597 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.40s\n", + "824320 Examples seen. Accuracy: 0.0080 Error: 471.99432 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.11s Step time: 13.40s\n", + "824960 Examples seen. Accuracy: 0.0076 Error: 475.31284 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.41s\n", + "825600 Examples seen. Accuracy: 0.0075 Error: 454.00134 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.40s\n", + "826240 Examples seen. Accuracy: 0.0072 Error: 452.21527 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.08s Step time: 13.42s\n", + "826880 Examples seen. Accuracy: 0.0070 Error: 448.71136 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.14s Step time: 14.14s\n", + "827520 Examples seen. Accuracy: 0.0067 Error: 464.24719 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.14s Step time: 13.43s\n", + "828160 Examples seen. Accuracy: 0.0072 Error: 463.69315 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.10s Step time: 13.40s\n", + "828800 Examples seen. Accuracy: 0.0073 Error: 438.54666 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.04s Step time: 13.40s\n", + "829440 Examples seen. Accuracy: 0.0068 Error: 420.86893 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.08s Step time: 13.37s\n", + "830080 Examples seen. Accuracy: 0.0072 Error: 424.04669 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.11s Step time: 13.43s\n", + "830720 Examples seen. Accuracy: 0.0071 Error: 448.81076 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.13s Step time: 13.41s\n", + "831360 Examples seen. Accuracy: 0.0073 Error: 435.95847 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.09s Step time: 13.41s\n", + "832000 Examples seen. Accuracy: 0.0074 Error: 461.68506 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.07s Step time: 13.42s\n", + "832640 Examples seen. Accuracy: 0.0071 Error: 455.15839 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.13s Step time: 13.39s\n", + "833280 Examples seen. Accuracy: 0.0077 Error: 465.20245 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.06s Step time: 13.35s\n", + "833920 Examples seen. Accuracy: 0.0078 Error: 467.77234 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.10s Step time: 13.39s\n", + "834560 Examples seen. Accuracy: 0.0071 Error: 429.00494 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.10s Step time: 13.38s\n", + "835200 Examples seen. Accuracy: 0.0071 Error: 475.38409 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.16s Step time: 13.39s\n", + "835840 Examples seen. Accuracy: 0.0076 Error: 425.48389 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.08s Step time: 13.40s\n", + "836480 Examples seen. Accuracy: 0.0077 Error: 451.32977 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 3.95s Step time: 13.41s\n", + "837120 Examples seen. Accuracy: 0.0082 Error: 457.81073 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.41s\n", + "837760 Examples seen. Accuracy: 0.0086 Error: 453.55444 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.11s Step time: 13.44s\n", + "838400 Examples seen. Accuracy: 0.0091 Error: 472.63385 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 14.10s\n", + "839040 Examples seen. Accuracy: 0.0091 Error: 467.74146 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.38s\n", + "839680 Examples seen. Accuracy: 0.0087 Error: 487.61185 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.37s\n", + "840320 Examples seen. Accuracy: 0.0087 Error: 429.82013 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.10s Step time: 13.43s\n", + "840960 Examples seen. Accuracy: 0.0086 Error: 430.65265 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.40s\n", + "841600 Examples seen. Accuracy: 0.0088 Error: 440.49988 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.09s Step time: 13.40s\n", + "842240 Examples seen. Accuracy: 0.0086 Error: 441.84195 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.41s\n", + "842880 Examples seen. Accuracy: 0.0081 Error: 454.40369 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.13s Step time: 13.37s\n", + "843520 Examples seen. Accuracy: 0.0077 Error: 442.23212 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.13s Step time: 13.38s\n", + "844160 Examples seen. Accuracy: 0.0073 Error: 484.80286 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.42s\n", + "844800 Examples seen. Accuracy: 0.0074 Error: 453.05487 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.05s Step time: 13.42s\n", + "845440 Examples seen. Accuracy: 0.0078 Error: 463.07574 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.12s Step time: 13.42s\n", + "846080 Examples seen. Accuracy: 0.0075 Error: 464.47955 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.15s Step time: 13.39s\n", + "846720 Examples seen. Accuracy: 0.0078 Error: 441.07895 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.12s Step time: 13.38s\n", + "847360 Examples seen. Accuracy: 0.0077 Error: 444.61697 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.05s Step time: 13.40s\n", + "848000 Examples seen. Accuracy: 0.0080 Error: 470.01556 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.17s Step time: 13.39s\n", + "848640 Examples seen. Accuracy: 0.0083 Error: 430.23022 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.14s Step time: 13.40s\n", + "849280 Examples seen. Accuracy: 0.0089 Error: 424.96109 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.11s Step time: 14.17s\n", + "849920 Examples seen. Accuracy: 0.0084 Error: 450.65918 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.12s Step time: 13.41s\n", + "850560 Examples seen. Accuracy: 0.0085 Error: 472.07217 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.44s\n", + "851200 Examples seen. Accuracy: 0.0088 Error: 460.28394 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.11s Step time: 13.42s\n", + "851840 Examples seen. Accuracy: 0.0089 Error: 422.42920 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.07s Step time: 13.39s\n", + "852480 Examples seen. Accuracy: 0.0089 Error: 478.18076 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.39s\n", + "853120 Examples seen. Accuracy: 0.0083 Error: 429.18024 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.03s Step time: 13.48s\n", + "853760 Examples seen. Accuracy: 0.0087 Error: 437.02887 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.43s\n", + "854400 Examples seen. Accuracy: 0.0086 Error: 450.97314 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.15s Step time: 13.44s\n", + "855040 Examples seen. Accuracy: 0.0081 Error: 455.54663 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.03s Step time: 13.39s\n", + "855680 Examples seen. Accuracy: 0.0084 Error: 466.55801 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.11s Step time: 13.42s\n", + "856320 Examples seen. Accuracy: 0.0085 Error: 452.75635 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.14s Step time: 13.41s\n", + "856960 Examples seen. Accuracy: 0.0096 Error: 456.99493 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.42s\n", + "857600 Examples seen. Accuracy: 0.0093 Error: 464.13199 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.10s Step time: 13.40s\n", + "858240 Examples seen. Accuracy: 0.0093 Error: 456.62842 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.45s\n", + "858880 Examples seen. Accuracy: 0.0091 Error: 448.76135 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.12s Step time: 13.43s\n", + "859520 Examples seen. Accuracy: 0.0089 Error: 441.78119 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.43s\n", + "860160 Examples seen. Accuracy: 0.0087 Error: 456.94025 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.05s Step time: 14.14s\n", + "860800 Examples seen. Accuracy: 0.0093 Error: 424.42426 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.10s Step time: 13.45s\n", + "861440 Examples seen. Accuracy: 0.0088 Error: 420.17163 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.14s Step time: 13.42s\n", + "862080 Examples seen. Accuracy: 0.0087 Error: 465.63776 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.45s\n", + "862720 Examples seen. Accuracy: 0.0089 Error: 461.02661 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.14s Step time: 13.43s\n", + "863360 Examples seen. Accuracy: 0.0090 Error: 435.79346 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.39s\n", + "864000 Examples seen. Accuracy: 0.0086 Error: 443.63818 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.07s Step time: 13.40s\n", + "Starting Validation.\n", + "Epochs: 18 Examples seen:864000 Validation Accuracy: 0.0135 Validation Error: 451.4172 Validation Loss: 0.0000 Total time: 312.64min\n", + "Layer 0 Max Output: 1.109 Min Output: -1.750 TNNetInput 16,16,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 1 Max Weight: 0.565 Min Weight: -0.761 Max Output: 1.005 Min Output: -1.411 TNNetDepthwiseConvLinear 16,16,3 Times: 0.08s 0.00s Parent:0\n", + "Layer 2 Neurons: 64 Max Weight: 0.979 Min Weight: -0.982 Max Output: 2.172 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.29s 0.05s Parent:1\n", + "Layer 3 Max Output: 2.172 Min Output: -1.750 TNNetDeepConcat 16,16,67 Times: 0.03s 0.00s Parent:2\n", + "Layer 4 Neurons: 16 Max Weight: 0.227 Min Weight: -0.223 Max Output: 1.222 Min Output: -0.941 TNNetConvolutionLinear 16,16,16 Times: 0.16s 0.02s Parent:3\n", + "Layer 5 Neurons: 1 Max Weight: 0.576 Min Weight: -0.578 Max Output: 0.869 Min Output: -0.826 TNNetDepthwiseConvLinear 16,16,16 Times: 0.08s 0.01s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.437 Min Weight: -0.441 Max Output: 0.963 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.40s 0.04s Parent:5\n", + "Layer 7 Max Output: 2.172 Min Output: -1.750 TNNetDeepConcat 16,16,131 Times: 0.06s 0.00s Parent:6\n", + "Layer 8 Neurons: 16 Max Weight: 0.171 Min Weight: -0.175 Max Output: 1.159 Min Output: -0.767 TNNetConvolutionLinear 16,16,16 Times: 0.22s 0.03s Parent:7\n", + "Layer 9 Neurons: 1 Max Weight: 0.574 Min Weight: -0.575 Max Output: 0.716 Min Output: -1.414 TNNetDepthwiseConvLinear 16,16,16 Times: 0.08s 0.01s Parent:8\n", + "Layer 10 Neurons: 64 Max Weight: 0.452 Min Weight: -0.449 Max Output: 0.836 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.43s 0.04s Parent:9\n", + "Layer 11 Max Output: 2.172 Min Output: -1.750 TNNetDeepConcat 16,16,195 Times: 0.10s 0.01s Parent:10\n", + "Layer 12 Max Output: 2.172 Min Output: -1.750 TNNetDeAvgPool 32,32,195 Times: 3.12s 0.09s Parent:11\n", + "Layer 13 Neurons: 16 Max Weight: 0.301 Min Weight: -0.214 Max Output: 1.446 Min Output: -1.119 TNNetConvolutionLinear 32,32,16 Times: 1.02s 0.15s Parent:12\n", + "Layer 14 Neurons: 1 Max Weight: 0.595 Min Weight: -0.562 Max Output: 1.295 Min Output: -1.495 TNNetDepthwiseConvLinear 32,32,16 Times: 0.29s 0.03s Parent:13\n", + "Layer 15 Neurons: 64 Max Weight: 0.444 Min Weight: -0.468 Max Output: 1.886 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.60s 0.16s Parent:14\n", + "Layer 16 Max Output: 2.172 Min Output: -1.750 TNNetDeepConcat 32,32,259 Times: 0.56s 0.03s Parent:15\n", + "Layer 17 Neurons: 16 Max Weight: 0.328 Min Weight: -0.244 Max Output: 1.530 Min Output: -1.888 TNNetConvolutionLinear 32,32,16 Times: 1.25s 0.18s Parent:16\n", + "Layer 18 Neurons: 1 Max Weight: 0.540 Min Weight: -0.587 Max Output: 3.256 Min Output: -2.696 TNNetDepthwiseConvLinear 32,32,16 Times: 0.29s 0.03s Parent:17\n", + "Layer 19 Neurons: 64 Max Weight: 0.487 Min Weight: -0.461 Max Output: 2.129 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.61s 0.16s Parent:18\n", + "Layer 20 Max Output: 2.172 Min Output: -1.750 TNNetDeepConcat 32,32,323 Times: 0.66s 0.03s Parent:19\n", + "Layer 21 Neurons: 16 Max Weight: 0.272 Min Weight: -0.358 Max Output: 0.814 Min Output: -1.092 TNNetConvolutionLinear 32,32,16 Times: 1.50s 0.21s Parent:20\n", + "Layer 22 Neurons: 1 Max Weight: 0.595 Min Weight: -0.557 Max Output: 0.906 Min Output: -1.137 TNNetDepthwiseConvLinear 32,32,16 Times: 0.27s 0.03s Parent:21\n", + "Layer 23 Neurons: 64 Max Weight: 0.447 Min Weight: -0.459 Max Output: 1.091 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.61s 0.17s Parent:22\n", + "Layer 24 Max Output: 2.172 Min Output: -1.750 TNNetDeepConcat 32,32,387 Times: 0.71s 0.03s Parent:23\n", + "Layer 25 Neurons: 3 Max Weight: 0.569 Min Weight: -0.220 Max Output: 1.037 Min Output: -1.970 TNNetConvolutionLinear 32,32,3 Times: 0.35s 0.06s Parent:24\n", + "Epoch time: 16.7475 minutes. 50 epochs: 13.9562 hours.\n", + "Epochs: 18. Working time: 5.21 hours.\n", + "864640 Examples seen. Accuracy: 0.0086 Error: 469.65900 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.10s Step time: 13.38s\n", + "865280 Examples seen. Accuracy: 0.0087 Error: 445.09702 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.12s Step time: 13.40s\n", + "865920 Examples seen. Accuracy: 0.0084 Error: 440.73248 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.41s\n", + "866560 Examples seen. Accuracy: 0.0083 Error: 467.39642 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.11s Step time: 13.42s\n", + "867200 Examples seen. Accuracy: 0.0085 Error: 428.74380 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.10s Step time: 13.42s\n", + "867840 Examples seen. Accuracy: 0.0082 Error: 460.29947 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.08s Step time: 13.43s\n", + "868480 Examples seen. Accuracy: 0.0084 Error: 479.11731 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.12s Step time: 13.44s\n", + "869120 Examples seen. Accuracy: 0.0083 Error: 445.59485 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.42s\n", + "869760 Examples seen. Accuracy: 0.0083 Error: 437.02176 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.15s Step time: 13.39s\n", + "870400 Examples seen. Accuracy: 0.0079 Error: 491.95325 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.50s\n", + "871040 Examples seen. Accuracy: 0.0078 Error: 462.61212 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.04s Step time: 14.13s\n", + "871680 Examples seen. Accuracy: 0.0090 Error: 451.83850 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.45s\n", + "872320 Examples seen. Accuracy: 0.0090 Error: 458.66019 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.43s\n", + "872960 Examples seen. Accuracy: 0.0091 Error: 461.14777 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.11s Step time: 13.43s\n", + "873600 Examples seen. Accuracy: 0.0090 Error: 442.14899 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.16s Step time: 13.43s\n", + "874240 Examples seen. Accuracy: 0.0086 Error: 462.22003 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.15s Step time: 13.46s\n", + "874880 Examples seen. Accuracy: 0.0085 Error: 430.25079 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.09s Step time: 13.45s\n", + "875520 Examples seen. Accuracy: 0.0086 Error: 450.83212 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.14s Step time: 13.44s\n", + "876160 Examples seen. Accuracy: 0.0088 Error: 458.84186 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.08s Step time: 13.42s\n", + "876800 Examples seen. Accuracy: 0.0083 Error: 465.50812 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.10s Step time: 13.45s\n", + "877440 Examples seen. Accuracy: 0.0084 Error: 457.92532 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.45s\n", + "878080 Examples seen. Accuracy: 0.0089 Error: 459.78143 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.43s\n", + "878720 Examples seen. Accuracy: 0.0090 Error: 447.73947 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.41s\n", + "879360 Examples seen. Accuracy: 0.0085 Error: 474.25693 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.11s Step time: 13.42s\n", + "880000 Examples seen. Accuracy: 0.0085 Error: 425.96216 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.21s Step time: 13.43s\n", + "880640 Examples seen. Accuracy: 0.0086 Error: 422.81921 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.06s Step time: 13.46s\n", + "881280 Examples seen. Accuracy: 0.0085 Error: 480.29352 Loss: 0.00000 Threads: 2 Forward time: 2.50s Backward time: 4.17s Step time: 14.13s\n", + "881920 Examples seen. Accuracy: 0.0084 Error: 463.61267 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.06s Step time: 13.40s\n", + "882560 Examples seen. Accuracy: 0.0087 Error: 434.20660 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.09s Step time: 13.45s\n", + "883200 Examples seen. Accuracy: 0.0086 Error: 437.60559 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.14s Step time: 13.39s\n", + "883840 Examples seen. Accuracy: 0.0084 Error: 452.63962 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.45s\n", + "884480 Examples seen. Accuracy: 0.0086 Error: 459.44284 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.18s Step time: 13.43s\n", + "885120 Examples seen. Accuracy: 0.0082 Error: 433.21637 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.08s Step time: 13.42s\n", + "885760 Examples seen. Accuracy: 0.0080 Error: 463.41241 Loss: 0.00000 Threads: 2 Forward time: 2.50s Backward time: 4.16s Step time: 13.41s\n", + "886400 Examples seen. Accuracy: 0.0087 Error: 425.19641 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.11s Step time: 13.44s\n", + "887040 Examples seen. Accuracy: 0.0087 Error: 454.28912 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.13s Step time: 13.40s\n", + "887680 Examples seen. Accuracy: 0.0083 Error: 452.13412 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.40s\n", + "888320 Examples seen. Accuracy: 0.0083 Error: 440.12982 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.06s Step time: 13.40s\n", + "888960 Examples seen. Accuracy: 0.0078 Error: 488.43866 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.16s Step time: 13.42s\n", + "889600 Examples seen. Accuracy: 0.0079 Error: 451.19531 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.08s Step time: 13.41s\n", + "890240 Examples seen. Accuracy: 0.0075 Error: 458.94424 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.12s Step time: 13.46s\n", + "890880 Examples seen. Accuracy: 0.0075 Error: 432.29697 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.10s Step time: 13.44s\n", + "891520 Examples seen. Accuracy: 0.0079 Error: 446.43094 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.06s Step time: 13.41s\n", + "892160 Examples seen. Accuracy: 0.0077 Error: 461.29538 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.10s Step time: 14.15s\n", + "892800 Examples seen. Accuracy: 0.0079 Error: 463.64932 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.14s Step time: 13.49s\n", + "893440 Examples seen. Accuracy: 0.0082 Error: 475.46283 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.10s Step time: 13.42s\n", + "894080 Examples seen. Accuracy: 0.0090 Error: 444.44113 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.43s\n", + "894720 Examples seen. Accuracy: 0.0091 Error: 472.89294 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.11s Step time: 13.42s\n", + "895360 Examples seen. Accuracy: 0.0088 Error: 483.25793 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.43s\n", + "896000 Examples seen. Accuracy: 0.0087 Error: 449.16452 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.43s\n", + "896640 Examples seen. Accuracy: 0.0088 Error: 436.73843 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.09s Step time: 13.38s\n", + "897280 Examples seen. Accuracy: 0.0086 Error: 461.85632 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.39s\n", + "897920 Examples seen. Accuracy: 0.0083 Error: 443.53729 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.42s\n", + "898560 Examples seen. Accuracy: 0.0083 Error: 446.20844 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.03s Step time: 13.47s\n", + "899200 Examples seen. Accuracy: 0.0077 Error: 471.14700 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.05s Step time: 13.40s\n", + "899840 Examples seen. Accuracy: 0.0081 Error: 465.76251 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.14s Step time: 13.48s\n", + "900480 Examples seen. Accuracy: 0.0080 Error: 453.32312 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.44s\n", + "901120 Examples seen. Accuracy: 0.0080 Error: 447.98596 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.44s\n", + "901760 Examples seen. Accuracy: 0.0080 Error: 431.05869 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.43s\n", + "902400 Examples seen. Accuracy: 0.0080 Error: 442.10406 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.08s Step time: 14.21s\n", + "903040 Examples seen. Accuracy: 0.0081 Error: 424.85959 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.15s Step time: 13.46s\n", + "903680 Examples seen. Accuracy: 0.0084 Error: 442.17603 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.45s\n", + "904320 Examples seen. Accuracy: 0.0085 Error: 432.98889 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.17s Step time: 13.48s\n", + "904960 Examples seen. Accuracy: 0.0078 Error: 457.65375 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.12s Step time: 13.45s\n", + "905600 Examples seen. Accuracy: 0.0078 Error: 463.85684 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.47s\n", + "906240 Examples seen. Accuracy: 0.0078 Error: 452.25470 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.12s Step time: 13.42s\n", + "906880 Examples seen. Accuracy: 0.0081 Error: 434.37579 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.14s Step time: 13.44s\n", + "907520 Examples seen. Accuracy: 0.0077 Error: 434.36719 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.13s Step time: 13.43s\n", + "908160 Examples seen. Accuracy: 0.0077 Error: 470.91418 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.45s\n", + "908800 Examples seen. Accuracy: 0.0076 Error: 456.84583 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.41s\n", + "909440 Examples seen. Accuracy: 0.0072 Error: 434.08160 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.00s Step time: 13.41s\n", + "910080 Examples seen. Accuracy: 0.0067 Error: 438.00818 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.10s Step time: 13.45s\n", + "910720 Examples seen. Accuracy: 0.0069 Error: 449.21414 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.09s Step time: 13.44s\n", + "911360 Examples seen. Accuracy: 0.0068 Error: 462.90320 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.15s Step time: 13.47s\n", + "912000 Examples seen. Accuracy: 0.0070 Error: 452.67249 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.14s Step time: 13.47s\n", + "Starting Validation.\n", + "Epochs: 19 Examples seen:912000 Validation Accuracy: 0.0130 Validation Error: 449.2897 Validation Loss: 0.0000 Total time: 329.75min\n", + "Epoch time: 16.8350 minutes. 50 epochs: 14.0292 hours.\n", + "Epochs: 19. Working time: 5.50 hours.\n", + "912640 Examples seen. Accuracy: 0.0071 Error: 460.81879 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.07s Step time: 13.42s\n", + "913280 Examples seen. Accuracy: 0.0068 Error: 468.38300 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.07s Step time: 13.45s\n", + "913920 Examples seen. Accuracy: 0.0071 Error: 461.85614 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.12s Step time: 13.43s\n", + "914560 Examples seen. Accuracy: 0.0069 Error: 455.65396 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.17s Step time: 13.45s\n", + "915200 Examples seen. Accuracy: 0.0070 Error: 431.89764 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.16s Step time: 13.46s\n", + "915840 Examples seen. Accuracy: 0.0074 Error: 454.16986 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.44s\n", + "916480 Examples seen. Accuracy: 0.0075 Error: 425.97607 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.15s Step time: 13.42s\n", + "917120 Examples seen. Accuracy: 0.0076 Error: 429.16803 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.16s Step time: 13.45s\n", + "917760 Examples seen. Accuracy: 0.0078 Error: 453.44742 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.41s\n", + "918400 Examples seen. Accuracy: 0.0078 Error: 449.81085 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.42s\n", + "919040 Examples seen. Accuracy: 0.0083 Error: 470.61017 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.17s Step time: 13.41s\n", + "919680 Examples seen. Accuracy: 0.0082 Error: 455.70032 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.17s Step time: 13.44s\n", + "920320 Examples seen. Accuracy: 0.0087 Error: 468.72852 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.09s Step time: 13.47s\n", + "920960 Examples seen. Accuracy: 0.0090 Error: 461.43506 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.46s\n", + "921600 Examples seen. Accuracy: 0.0090 Error: 448.61774 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.10s Step time: 13.45s\n", + "922240 Examples seen. Accuracy: 0.0086 Error: 430.72070 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.43s\n", + "922880 Examples seen. Accuracy: 0.0086 Error: 433.30963 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.09s Step time: 13.42s\n", + "923520 Examples seen. Accuracy: 0.0093 Error: 472.87274 Loss: 0.00000 Threads: 2 Forward time: 2.50s Backward time: 4.17s Step time: 14.13s\n", + "924160 Examples seen. Accuracy: 0.0091 Error: 450.19208 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.38s\n", + "924800 Examples seen. Accuracy: 0.0093 Error: 423.06824 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.17s Step time: 13.43s\n", + "925440 Examples seen. Accuracy: 0.0090 Error: 458.68921 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.10s Step time: 13.43s\n", + "926080 Examples seen. Accuracy: 0.0092 Error: 437.30316 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.11s Step time: 13.41s\n", + "926720 Examples seen. Accuracy: 0.0093 Error: 443.85730 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.45s\n", + "927360 Examples seen. Accuracy: 0.0091 Error: 468.11725 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.02s Step time: 13.44s\n", + "928000 Examples seen. Accuracy: 0.0084 Error: 476.95599 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.16s Step time: 13.43s\n", + "928640 Examples seen. Accuracy: 0.0081 Error: 453.70178 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.03s Step time: 13.44s\n", + "929280 Examples seen. Accuracy: 0.0078 Error: 474.35907 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.13s Step time: 13.43s\n", + "929920 Examples seen. Accuracy: 0.0081 Error: 459.30252 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.13s Step time: 13.44s\n", + "930560 Examples seen. Accuracy: 0.0083 Error: 409.03589 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.48s\n", + "931200 Examples seen. Accuracy: 0.0082 Error: 482.59772 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.55s\n", + "931840 Examples seen. Accuracy: 0.0083 Error: 443.71469 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.44s\n", + "932480 Examples seen. Accuracy: 0.0082 Error: 474.96112 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.46s\n", + "933120 Examples seen. Accuracy: 0.0081 Error: 450.17023 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.15s Step time: 13.42s\n", + "933760 Examples seen. Accuracy: 0.0084 Error: 448.01910 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.14s Step time: 13.47s\n", + "934400 Examples seen. Accuracy: 0.0084 Error: 448.32767 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 14.20s\n", + "935040 Examples seen. Accuracy: 0.0083 Error: 429.48676 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.15s Step time: 13.42s\n", + "935680 Examples seen. Accuracy: 0.0082 Error: 454.63641 Loss: 0.00000 Threads: 2 Forward time: 2.64s Backward time: 4.08s Step time: 13.44s\n", + "936320 Examples seen. Accuracy: 0.0077 Error: 452.61993 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.20s Step time: 13.42s\n", + "936960 Examples seen. Accuracy: 0.0074 Error: 471.30475 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.18s Step time: 13.44s\n", + "937600 Examples seen. Accuracy: 0.0073 Error: 446.15509 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.13s Step time: 13.43s\n", + "938240 Examples seen. Accuracy: 0.0078 Error: 440.18451 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.09s Step time: 13.43s\n", + "938880 Examples seen. Accuracy: 0.0073 Error: 446.79868 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.02s Step time: 13.45s\n", + "939520 Examples seen. Accuracy: 0.0071 Error: 477.51624 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.22s Step time: 13.44s\n", + "940160 Examples seen. Accuracy: 0.0068 Error: 479.89612 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.17s Step time: 13.45s\n", + "940800 Examples seen. Accuracy: 0.0067 Error: 415.81851 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.05s Step time: 13.46s\n", + "941440 Examples seen. Accuracy: 0.0068 Error: 445.61243 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.42s\n", + "942080 Examples seen. Accuracy: 0.0065 Error: 457.75449 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.15s Step time: 13.45s\n", + "942720 Examples seen. Accuracy: 0.0066 Error: 456.32001 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.14s Step time: 13.44s\n", + "943360 Examples seen. Accuracy: 0.0069 Error: 480.08966 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.44s\n", + "944000 Examples seen. Accuracy: 0.0075 Error: 427.70276 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.11s Step time: 13.42s\n", + "944640 Examples seen. Accuracy: 0.0080 Error: 434.98254 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.12s Step time: 13.45s\n", + "945280 Examples seen. Accuracy: 0.0081 Error: 438.09363 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.15s Step time: 14.15s\n", + "945920 Examples seen. Accuracy: 0.0078 Error: 469.42224 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.15s Step time: 13.45s\n", + "946560 Examples seen. Accuracy: 0.0077 Error: 441.94543 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.17s Step time: 13.44s\n", + "947200 Examples seen. Accuracy: 0.0085 Error: 434.74973 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.10s Step time: 13.44s\n", + "947840 Examples seen. Accuracy: 0.0084 Error: 462.12823 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.09s Step time: 13.46s\n", + "948480 Examples seen. Accuracy: 0.0084 Error: 439.68347 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.11s Step time: 13.44s\n", + "949120 Examples seen. Accuracy: 0.0090 Error: 420.25961 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.14s Step time: 13.49s\n", + "949760 Examples seen. Accuracy: 0.0089 Error: 450.03784 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.05s Step time: 13.46s\n", + "950400 Examples seen. Accuracy: 0.0090 Error: 467.95792 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.43s\n", + "951040 Examples seen. Accuracy: 0.0090 Error: 435.38132 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.43s\n", + "951680 Examples seen. Accuracy: 0.0086 Error: 453.38223 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.16s Step time: 13.45s\n", + "952320 Examples seen. Accuracy: 0.0080 Error: 462.17267 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.18s Step time: 13.38s\n", + "952960 Examples seen. Accuracy: 0.0083 Error: 434.65234 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.11s Step time: 13.44s\n", + "953600 Examples seen. Accuracy: 0.0082 Error: 449.38260 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.12s Step time: 13.43s\n", + "954240 Examples seen. Accuracy: 0.0083 Error: 454.53799 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.14s Step time: 13.41s\n", + "954880 Examples seen. Accuracy: 0.0089 Error: 446.39630 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.12s Step time: 13.47s\n", + "955520 Examples seen. Accuracy: 0.0086 Error: 465.68637 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 14.16s\n", + "956160 Examples seen. Accuracy: 0.0087 Error: 446.39886 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.13s Step time: 13.42s\n", + "956800 Examples seen. Accuracy: 0.0087 Error: 443.84460 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.12s Step time: 13.43s\n", + "957440 Examples seen. Accuracy: 0.0086 Error: 455.20044 Loss: 0.00000 Threads: 2 Forward time: 2.52s Backward time: 4.12s Step time: 13.43s\n", + "958080 Examples seen. Accuracy: 0.0086 Error: 464.55872 Loss: 0.00000 Threads: 2 Forward time: 2.51s Backward time: 4.19s Step time: 13.39s\n", + "958720 Examples seen. Accuracy: 0.0095 Error: 446.22757 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.10s Step time: 13.44s\n", + "959360 Examples seen. Accuracy: 0.0093 Error: 470.40915 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.11s Step time: 13.46s\n", + "960000 Examples seen. Accuracy: 0.0093 Error: 488.85358 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.12s Step time: 13.47s\n", + "Starting Validation.\n", + "Epochs: 20 Examples seen:960000 Validation Accuracy: 0.0130 Validation Error: 450.2911 Validation Loss: 0.0000 Total time: 346.87min\n", + "Layer 0 Max Output: 1.109 Min Output: -1.750 TNNetInput 16,16,3 Times: 0.00s 0.00s\n", + "Layer 1 Neurons: 1 Max Weight: 0.575 Min Weight: -0.767 Max Output: 1.028 Min Output: -1.397 TNNetDepthwiseConvLinear 16,16,3 Times: 0.07s 0.01s Parent:0\n", + "Layer 2 Neurons: 64 Max Weight: 0.979 Min Weight: -0.982 Max Output: 2.149 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.29s 0.05s Parent:1\n", + "Layer 3 Max Output: 2.149 Min Output: -1.750 TNNetDeepConcat 16,16,67 Times: 0.04s 0.00s Parent:2\n", + "Layer 4 Neurons: 16 Max Weight: 0.226 Min Weight: -0.224 Max Output: 1.189 Min Output: -0.922 TNNetConvolutionLinear 16,16,16 Times: 0.17s 0.01s Parent:3\n", + "Layer 5 Neurons: 1 Max Weight: 0.576 Min Weight: -0.580 Max Output: 0.852 Min Output: -0.830 TNNetDepthwiseConvLinear 16,16,16 Times: 0.07s 0.01s Parent:4\n", + "Layer 6 Neurons: 64 Max Weight: 0.438 Min Weight: -0.442 Max Output: 0.941 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.43s 0.05s Parent:5\n", + "Layer 7 Max Output: 2.149 Min Output: -1.750 TNNetDeepConcat 16,16,131 Times: 0.05s 0.00s Parent:6\n", + "Layer 8 Neurons: 16 Max Weight: 0.173 Min Weight: -0.176 Max Output: 1.178 Min Output: -0.779 TNNetConvolutionLinear 16,16,16 Times: 0.20s 0.03s Parent:7\n", + "Layer 9 Neurons: 1 Max Weight: 0.571 Min Weight: -0.576 Max Output: 0.709 Min Output: -1.404 TNNetDepthwiseConvLinear 16,16,16 Times: 0.09s 0.01s Parent:8\n", + "Layer 10 Neurons: 64 Max Weight: 0.453 Min Weight: -0.450 Max Output: 0.838 Min Output: 0.000 TNNetPointwiseConvReLU 16,16,64 Times: 0.41s 0.05s Parent:9\n", + "Layer 11 Max Output: 2.149 Min Output: -1.750 TNNetDeepConcat 16,16,195 Times: 0.10s 0.00s Parent:10\n", + "Layer 12 Max Output: 2.149 Min Output: -1.750 TNNetDeAvgPool 32,32,195 Times: 3.16s 0.08s Parent:11\n", + "Layer 13 Neurons: 16 Max Weight: 0.304 Min Weight: -0.217 Max Output: 1.478 Min Output: -1.118 TNNetConvolutionLinear 32,32,16 Times: 1.02s 0.14s Parent:12\n", + "Layer 14 Neurons: 1 Max Weight: 0.598 Min Weight: -0.564 Max Output: 1.312 Min Output: -1.516 TNNetDepthwiseConvLinear 32,32,16 Times: 0.28s 0.04s Parent:13\n", + "Layer 15 Neurons: 64 Max Weight: 0.444 Min Weight: -0.470 Max Output: 1.911 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.60s 0.16s Parent:14\n", + "Layer 16 Max Output: 2.149 Min Output: -1.750 TNNetDeepConcat 32,32,259 Times: 0.59s 0.03s Parent:15\n", + "Layer 17 Neurons: 16 Max Weight: 0.333 Min Weight: -0.247 Max Output: 1.572 Min Output: -1.906 TNNetConvolutionLinear 32,32,16 Times: 1.24s 0.19s Parent:16\n", + "Layer 18 Neurons: 1 Max Weight: 0.544 Min Weight: -0.585 Max Output: 3.297 Min Output: -2.806 TNNetDepthwiseConvLinear 32,32,16 Times: 0.28s 0.03s Parent:17\n", + "Layer 19 Neurons: 64 Max Weight: 0.488 Min Weight: -0.462 Max Output: 2.197 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.59s 0.17s Parent:18\n", + "Layer 20 Max Output: 2.197 Min Output: -1.750 TNNetDeepConcat 32,32,323 Times: 0.66s 0.03s Parent:19\n", + "Layer 21 Neurons: 16 Max Weight: 0.271 Min Weight: -0.363 Max Output: 0.838 Min Output: -1.071 TNNetConvolutionLinear 32,32,16 Times: 1.50s 0.21s Parent:20\n", + "Layer 22 Neurons: 1 Max Weight: 0.595 Min Weight: -0.556 Max Output: 0.937 Min Output: -1.127 TNNetDepthwiseConvLinear 32,32,16 Times: 0.30s 0.04s Parent:21\n", + "Layer 23 Neurons: 64 Max Weight: 0.448 Min Weight: -0.462 Max Output: 1.084 Min Output: 0.000 TNNetPointwiseConvReLU 32,32,64 Times: 1.63s 0.17s Parent:22\n", + "Layer 24 Max Output: 2.197 Min Output: -1.750 TNNetDeepConcat 32,32,387 Times: 0.71s 0.03s Parent:23\n", + "Layer 25 Neurons: 3 Max Weight: 0.572 Min Weight: -0.226 Max Output: 1.039 Min Output: -1.958 TNNetConvolutionLinear 32,32,3 Times: 0.36s 0.05s Parent:24\n", + "Starting Testing.\n", + "Epochs: 20 Examples seen:960000 Test Accuracy: 0.0107 Test Error: 450.1653 Test Loss: 0.0000 Total time: 348.19min\n", + "Epoch time: 16.8375 minutes. 50 epochs: 14.0313 hours.\n", + "Epochs: 20. Working time: 5.80 hours.\n", + "960640 Examples seen. Accuracy: 0.0094 Error: 407.88528 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.19s Step time: 14.18s\n", + "961280 Examples seen. Accuracy: 0.0087 Error: 452.71350 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.15s Step time: 13.52s\n", + "961920 Examples seen. Accuracy: 0.0086 Error: 476.23553 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.50s\n", + "962560 Examples seen. Accuracy: 0.0095 Error: 454.50888 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.13s Step time: 13.46s\n", + "963200 Examples seen. Accuracy: 0.0089 Error: 430.86853 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.11s Step time: 13.46s\n", + "963840 Examples seen. Accuracy: 0.0081 Error: 430.57620 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.15s Step time: 13.51s\n", + "964480 Examples seen. Accuracy: 0.0079 Error: 466.48492 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.17s Step time: 13.51s\n", + "965120 Examples seen. Accuracy: 0.0083 Error: 424.83746 Loss: 0.00000 Threads: 2 Forward time: 2.58s Backward time: 4.16s Step time: 13.51s\n", + "965760 Examples seen. Accuracy: 0.0085 Error: 460.15173 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.22s Step time: 13.46s\n", + "966400 Examples seen. Accuracy: 0.0087 Error: 449.97385 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.54s\n", + "967040 Examples seen. Accuracy: 0.0085 Error: 454.86823 Loss: 0.00000 Threads: 2 Forward time: 2.54s Backward time: 4.16s Step time: 13.53s\n", + "967680 Examples seen. Accuracy: 0.0088 Error: 452.87112 Loss: 0.00000 Threads: 2 Forward time: 2.53s Backward time: 4.17s Step time: 13.48s\n", + "968320 Examples seen. Accuracy: 0.0085 Error: 452.56598 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.10s Step time: 13.48s\n", + "968960 Examples seen. Accuracy: 0.0085 Error: 448.79279 Loss: 0.00000 Threads: 2 Forward time: 2.63s Backward time: 4.19s Step time: 13.53s\n", + "969600 Examples seen. Accuracy: 0.0088 Error: 465.58344 Loss: 0.00000 Threads: 2 Forward time: 2.60s Backward time: 4.17s Step time: 13.52s\n", + "970240 Examples seen. Accuracy: 0.0096 Error: 465.92780 Loss: 0.00000 Threads: 2 Forward time: 2.59s Backward time: 4.19s Step time: 13.55s\n", + "970880 Examples seen. Accuracy: 0.0090 Error: 452.50510 Loss: 0.00000 Threads: 2 Forward time: 2.56s Backward time: 4.14s Step time: 13.53s\n", + "971520 Examples seen. Accuracy: 0.0096 Error: 446.70508 Loss: 0.00000 Threads: 2 Forward time: 2.62s Backward time: 4.20s Step time: 13.47s\n", + "972160 Examples seen. Accuracy: 0.0091 Error: 454.08884 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.20s Step time: 14.34s\n", + "972800 Examples seen. Accuracy: 0.0084 Error: 435.44434 Loss: 0.00000 Threads: 2 Forward time: 2.57s Backward time: 4.19s Step time: 13.60s\n", + "973440 Examples seen. Accuracy: 0.0085 Error: 438.61832 Loss: 0.00000 Threads: 2 Forward time: 2.55s Backward time: 4.11s Step time: 13.50s\n", + "974080 Examples seen. Accuracy: 0.0082 Error: 451.78772 Loss: 0.00000 Threads: 2 Forward time: 2.61s Backward time: 4.09s Step time: 13.48s\n" + ] + } + ], + "source": [ + "!neural-api/bin/x86_64-linux/bin/SuperResolutionTrain" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "vYCPCDiqtXD0", + "outputId": "90509f47-1e90-4b2a-ba2e-0bbb37880d68" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "/bin/bash: neural-api/bin/x86_64-linux/bin/Cifar10ImageClassifierSuperResolution: No such file or directory\n" + ] + } + ], + "source": [ + "!neural-api/bin/x86_64-linux/bin/Cifar10ImageClassifierSuperResolution" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "LwxOM5CftXD1" + }, + "outputs": [], + "source": [ + "" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.9" + }, + "colab": { + "name": "super-resolution-train_max.ipynb", + "provenance": [], + "collapsed_sections": [], + "include_colab_link": true + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file