コード例 #1
0
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();
}
コード例 #2
0
static bool Cmd_ConScribe_ReadFromLog_Execute(COMMAND_ARGS)
{
	*result = 0;
	const char * ModName = ResolveModName(scriptObj);
	char Buffer[kMaxMessageLength];

	if (!ExtractFormatStringArgs(0, Buffer, paramInfo, arg1, opcodeOffsetPtr, scriptObj, eventList, kCommandInfo_ReadFromLog.numParams))
		return true;
	else if (Buffer == NULL || ModName == NULL)
		return true;

	std::string LogPath;
	std::vector<OBSEElement> LogContents;

	if (!_stricmp(Buffer, "*.*") && LogManager::GetSingleton()->GetDefaultLog(ModName))
		LogPath = std::string(GET_INI_STRING("RootDirectory")) + "ConScribe Logs\\Per-Mod\\" + std::string(LogManager::GetSingleton()->GetDefaultLog(ModName)) + ".log";
	else if (LogManager::GetSingleton()->IsLogRegistered(ModName, Buffer))
		LogPath = std::string(GET_INI_STRING("RootDirectory")) + "ConScribe Logs\\Per-Mod\\" + std::string(Buffer) + ".log";
	else		return true;
	LogContents.push_back(LogPath.c_str());

	ConScribeLog* TempLog = new ConScribeLog(LogPath.c_str(), ConScribeLog::e_In);
	std::vector<std::string> STLVector(TempLog->ReadAllLines());

	OBSEArray* ResultArray = ArrayFromStdVector(LogContents, scriptObj);

	for (std::vector<std::string>::const_iterator Itr = STLVector.begin(); Itr != STLVector.end(); Itr++) {
		if (Itr == STLVector.end() - 1 && Itr->begin() == Itr->end())		continue;		// skip empty last lines
		g_arrayIntfc->AppendElement(ResultArray, Itr->c_str());
	}

	if (!ResultArray)													_MESSAGE("Couldn't create array. Passed in script %08x", scriptObj->refID);
	else if (!g_arrayIntfc->AssignCommandResult(ResultArray, result))	_MESSAGE("Couldn't assign result array. Passed in script %08x", scriptObj->refID);

	return true;
}