def headline(txt) : print print txt print "-" * len(txt) print print krui.getVersion() print "Loadnet:" try: headline("general kernel information") funcnum = krui.getNoOfFunctions() print "Available functions:" for i in range(funcnum)[1:] : params = krui.getFuncInfo(i) print "Function:", params[0], print " Type: ", print util.func_types[params[1] & krui.FUNC_TYPE_MASK], print " i/o params: ", print krui.getFuncParamInfo(params[0],params[1]) headline("some fixed dimension example (encoder.*)") net = krui.loadNet("encoder.net") print "Net loaded: " + net print krui.getMemoryManagerInfo() print "Number of input units:", krui.getNoOfTTypeUnits(krui.INPUT) print "Number of output units:", krui.getNoOfOutputUnits() print "Total number of units:", krui.getNoOfUnits() print "Number of special input units:", krui.getNoOfSpecialInputUnits() print krui.getNetInfo()
def headline(txt): print print txt print "-" * len(txt) print print krui.getVersion() print "Loadnet:" try: headline("general kernel information") funcnum = krui.getNoOfFunctions() print "Available functions:" for i in range(funcnum)[1:]: params = krui.getFuncInfo(i) print "Function:", params[0], print " Type: ", print util.func_types[params[1] & krui.FUNC_TYPE_MASK], print " i/o params: ", print krui.getFuncParamInfo(params[0], params[1]) headline("some fixed dimension example (encoder.*)") net = krui.loadNet("encoder.net") print "Net loaded: " + net print krui.getMemoryManagerInfo() print "Number of input units:", krui.getNoOfTTypeUnits(krui.INPUT) print "Number of output units:", krui.getNoOfOutputUnits() print "Total number of units:", krui.getNoOfUnits() print "Number of special input units:", krui.getNoOfSpecialInputUnits() print krui.getNetInfo()
print "ActDeriv2Test for unit", x return 0 oldnum = krui.getNoOfFunctions() print "Builtin functions:", oldnum util.registerFunction(outtestfunc, "outtestfunc", krui.OUT_FUNC, 0, 0) util.registerFunction(outtestfunc2, "outtestfunc2", krui.OUT_FUNC, 0, 0) util.registerFunction(acttest, "acttest", krui.ACT_FUNC, 0, 0) util.registerFunction(actderivtest, "acttest", krui.ACT_DERIV_FUNC, 0, 0) util.registerFunction(actderiv2test, "acttest", krui.ACT_2_DERIV_FUNC, 0, 0) newnum = krui.getNoOfFunctions() print "After adding:", newnum for num in range(oldnum - 2, newnum + 1): print "Function number", num, "Info:", krui.getFuncInfo(num) print krui.loadNet('encoder.net') for num in [1, 10, 19]: krui.setUnitOutFunc(num, "outtestfunc") for num in [2, 11, 18]: krui.setUnitOutFunc(num, "outtestfunc2") for num in [3, 9, 17]: krui.setUnitActFunc(num, "acttest") krui.loadNewPatterns('encoder.pat') krui.DefTrainSubPat() print "Learning one pattern" krui.learnSinglePattern(1, (0.2, 0)) krui.setUnitDefaults(1.0, 0, krui.INPUT, 0, 1, "acttest", "outtestfunc") newunit = krui.createDefaultUnit()
print "ActDeriv2Test for unit", x return 0 oldnum = krui.getNoOfFunctions() print "Builtin functions:", oldnum util.registerFunction(outtestfunc,"outtestfunc",krui.OUT_FUNC,0,0) util.registerFunction(outtestfunc2,"outtestfunc2",krui.OUT_FUNC,0,0) util.registerFunction(acttest,"acttest",krui.ACT_FUNC,0,0) util.registerFunction(actderivtest,"acttest",krui.ACT_DERIV_FUNC,0,0) util.registerFunction(actderiv2test,"acttest",krui.ACT_2_DERIV_FUNC,0,0) newnum = krui.getNoOfFunctions() print "After adding:", newnum for num in range(oldnum - 2, newnum + 1) : print "Function number", num, "Info:",krui.getFuncInfo(num) print krui.loadNet('encoder.net') for num in [1,10,19] : krui.setUnitOutFunc(num,"outtestfunc") for num in [2,11,18] : krui.setUnitOutFunc(num,"outtestfunc2") for num in [3,9,17] : krui.setUnitActFunc(num,"acttest") krui.loadNewPatterns('encoder.pat') krui.DefTrainSubPat() print "Learning one pattern" krui.learnSinglePattern(1,(0.2,0)) krui.setUnitDefaults(1.0,0,krui.INPUT,0,1,"acttest","outtestfunc") newunit = krui.createDefaultUnit()