MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / initializeSampleParams

Function initializeSampleParams

samples/sampleCharRNN/sampleCharRNN.cpp:982–1038  ·  view source on GitHub ↗

\brief Initializes members of the params struct using the command line args

Source from the content-addressed store, hash-verified

980//! command line args
981//!
982SampleCharRNNParams initializeSampleParams(const samplesCommon::Args& args)
983{
984 SampleCharRNNParams params;
985
986 if (args.dataDirs.empty())
987 {
988 params.dataDirs.push_back("data/char-rnn/");
989 params.dataDirs.push_back("data/samples/char-rnn/");
990 }
991 else
992 {
993 params.dataDirs = args.dataDirs;
994 }
995
996 params.batchSize = 1;
997 params.layerCount = 2;
998 params.hiddenSize = 512;
999 params.seqSize = 1;
1000 params.dataSize = params.hiddenSize;
1001 params.vocabSize = 65;
1002 params.outputSize = 1;
1003 params.weightFileName = locateFile("char-rnn.wts", params.dataDirs);
1004 params.useILoop = args.useILoop;
1005 params.saveEngine = args.saveEngine;
1006 params.loadEngine = args.loadEngine;
1007
1008 // Input strings and their respective expected output strings
1009 const std::vector<std::string> inS{
1010 "ROMEO",
1011 "JUL",
1012 "The K",
1013 "That tho",
1014 "KING",
1015 "beauty of",
1016 "birth of K",
1017 "Hi",
1018 "JACK",
1019 "interestingly, it was J",
1020 };
1021 const std::vector<std::string> outS{
1022 ":\nThe sense to",
1023 "IET:\nWhat shall I shall be",
1024 "ing Richard shall be the strange",
1025 "u shalt be the",
1026 " HENRY VI:\nWhat",
1027 " the son,",
1028 "ing Richard's son",
1029 "ng of York,\nThat thou hast so the",
1030 "INGHAM:\nWhat shall I",
1031 "uliet",
1032 };
1033
1034 params.inputSentences = inS;
1035 params.outputSentences = outS;
1036
1037 return params;
1038}
1039

Callers 1

mainFunction · 0.70

Calls 2

locateFileFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected