diff --git a/maca_common/src/programOptionsTemplates.cpp b/maca_common/src/programOptionsTemplates.cpp index 8a67aaa0c84b988344439b05c4389a3dd7bb6003..d84f9589719c796f2d572712d67db315abb16a5a 100644 --- a/maca_common/src/programOptionsTemplates.cpp +++ b/maca_common/src/programOptionsTemplates.cpp @@ -80,7 +80,7 @@ po::options_description getTrainOptionsDescription() ("randomParameters", po::value<bool>()->default_value(true), "When activated, the parameters will be randomly initialized") ("sequenceDelimiterTape", po::value<std::string>()->default_value("EOS"), - "The name of the buffer's tape that contains the delimiter token for a sequence") + "The name of the buffer's tape that contains the delimiter token for a sequence, or 0 not to use sequences") ("sequenceDelimiter", po::value<std::string>()->default_value("1"), "The value of the token that act as a delimiter for sequences") ("batchSize", po::value<int>()->default_value(50), diff --git a/transition_machine/src/Config.cpp b/transition_machine/src/Config.cpp index c741a1414be7cbd9d1f3a170b21aca61c77d48ef..56aa64f49241ab2797cf0794a1b2ec7825f5654e 100644 --- a/transition_machine/src/Config.cpp +++ b/transition_machine/src/Config.cpp @@ -327,24 +327,36 @@ LimitedStack<float> & Config::getCurrentStateEntropyHistory() void Config::shuffle(const std::string & delimiterTape, const std::string & delimiter) { - auto & tape = getTape(delimiterTape); std::vector< std::pair<unsigned int, unsigned int> > delimiters; - unsigned int previousIndex = 0; - for (int i = 0; i < tape.refSize(); i++) - if (tape.getRef(i-head) == delimiter) + if (delimiterTape == "0") + { + unsigned int previousIndex = 0; + for (int i = 0; i < tapes[0].refSize(); i++) { delimiters.emplace_back(previousIndex, i); previousIndex = i+1; - } + } + } + else + { + auto & tape = getTape(delimiterTape); + unsigned int previousIndex = 0; + for (int i = 0; i < tape.refSize(); i++) + if (tape.getRef(i-head) == delimiter) + { + delimiters.emplace_back(previousIndex, i); + previousIndex = i+1; + } + } if (delimiters.empty()) { - fprintf(stderr, "ERROR (%s) : Requested to shuffle based on tape \'%s\' with \'%s\' as a delimiter, but none as been found. Aborting.\n", ERRINFO, delimiterTape.c_str(), delimiter.c_str()); - exit(1); + fprintf(stderr, "WARNING (%s) : Requested to shuffle based on tape \'%s\' with \'%s\' as a delimiter, but none has been found. Aborting.\n", ERRINFO, delimiterTape.c_str(), delimiter.c_str()); + return; } - std::pair<unsigned int, unsigned int> suffix = {delimiters.back().second+1, tape.refSize()-1}; + std::pair<unsigned int, unsigned int> suffix = {delimiters.back().second+1, tapes[0].refSize()-1}; std::random_shuffle(delimiters.begin(), delimiters.end());