void MLP::reset(initialise init, integer HL, integer PL) { if (HL > 0) m_last = HL+1; if (PL > 0) m_perLayer = PL; clear(); setArchitecture(init); }
void Tower::upgrade(CCObject *sender) { if (sender) { CCMenuItem *item = (CCMenuItem *)sender; TowerType type = (TowerType)item->getTag(); setArchitecture(Architecture::getArchitectureForType(type)); GameModel::instance()->getPopupMenu()->closeMenu(); GameModel::instance()->getGamePlayScene()->removeChildByTag(kTowerDescriptionTag, true); } }
STLVector MLP::run(const STLVector &input) { if (setArchitecture(INIT)) { EigenMatrix saveInput = m_input; m_input = (STLToEigenVector(input) - m_mean) / m_sigma; EigenVector output = run(); m_input = saveInput; return EigenToSTLVector(output); } else return STLVector(); }
void Host::updateHardwareInfo() { SystemMemInfo mi = systemMemoryInfo(); if( mi.caps & SystemMemInfo::TotalMemory ) setMemory( mi.totalMemory / 1024 ); #ifdef Q_OS_LINUX QString cpu = backtick("cat /proc/cpuinfo"); QRegExp cpuRx("physical id\\s+: (\\d+)"); QRegExp bogoRx("bogomips\\s+: (\\d+)"); QRegExp cpuCoresRx("cpu cores\\s+: (\\d+)"); LOG_3( "trying to get CPU info\n"+cpu ); if( bogoRx.indexIn(cpu) != -1 ) setMhz( bogoRx.cap(1).toInt() ); int cores = 1; if( cpuCoresRx.indexIn(cpu) != -1 ) cores = cpuCoresRx.cap(1).toInt(); int cpuId = 0; int pos = 0; while ((pos = cpuRx.indexIn(cpu, pos)) != -1) { int foundCpuId = cpuRx.cap(1).toInt(); LOG_3("found cpu with physical id: " + QString::number(foundCpuId)); if( foundCpuId > cpuId ) cpuId = foundCpuId; pos += cpuRx.matchedLength(); setCpus( (cpuId+1)*cores ); } setCpuName(backtick("uname -p").replace("\n","")); setOs(backtick("uname").replace("\n","")); setOsVersion(backtick("uname -r").replace("\n","")); setArchitecture(backtick("uname -m").replace("\n","")); commit(); #endif #ifdef Q_OS_MAC QString sys_profile = backtick("system_profiler -detailLevel -2"); QRegExp mhzRx("(CPU|Processor) Speed: ([\\d.]+) GHz"); if( mhzRx.indexIn(sys_profile) != -1 ) setMhz( (mhzRx.cap(2).toFloat() * 1000) ); QRegExp cpuNameRx("(CPU|Processor) Name: (.*)\n"); if( cpuNameRx.indexIn(sys_profile) != -1 ) setCpuName( cpuNameRx.cap(2).replace("\n","") ); QRegExp memRx("Memory: (\\d+) GB"); if( memRx.indexIn(sys_profile) != -1 ) setMemory( (memRx.cap(1).toInt() * 1024) ); QRegExp cpuRx("Number Of (CPUs|Cores): (\\d+)"); if( cpuRx.indexIn(sys_profile) != -1 ) setCpus( cpuRx.cap(2).toInt() ); QRegExp osRx("System Version: (Mac OS X) ([\\d.]+)"); if( osRx.indexIn(sys_profile) != -1 ) { setOs( osRx.cap(1) ); setOsVersion( osRx.cap(2) ); } setArchitecture(backtick("uname -m").replace("\n","")); #endif #ifdef Q_OS_WIN bool sysInfoSuccess; SYSTEM_INFO sysInfo = w32_getSystemInfo( &sysInfoSuccess ); if( sysInfoSuccess ) { QString arch; switch( sysInfo.wProcessorArchitecture ) { case PROCESSOR_ARCHITECTURE_AMD64: arch = "x86_64"; break; case PROCESSOR_ARCHITECTURE_IA64: arch = "Itanium"; break; case PROCESSOR_ARCHITECTURE_INTEL: arch = "x86"; break; } #ifndef _WIN64 if( !isWow64() ) setOs( "win32" ); else #endif setOs( "win64" ); setArchitecture( arch ); QString servicePackVersion; int buildNumber; setOsVersion( w32_getOsVersion(&servicePackVersion,&buildNumber) ); setServicePackVersion(servicePackVersion); setBuildNumber(buildNumber); setCpus( sysInfo.dwNumberOfProcessors ); QSettings mhzReg( "HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0", QSettings::NativeFormat ); setMhz( mhzReg.value( "~MHz" ).toInt() ); setWindowsDomain( localDomain() ); } #endif commit(); /* * Anything that will change every time this function is run should probably be in HostStatus, not in Host. * All the above will be recalculated but rarely ever change and cause an actual update. */ HostStatus hs = hostStatus(); Interval uptime = systemUpTime(); hs.setSystemStartupTimestamp( uptime == Interval() ? QDateTime() : (uptime * -1.0).adjust(QDateTime::currentDateTime()) ); hs.commit(); }
void Platform::setArchitecture(const QString &name) { setArchitecture(arch::ArchitectureRepository::instance()->getArchitecture(name)); }