diff --git a/driver/rnn_driver.hpp b/driver/rnn_driver.hpp index 308058f161..4b50c10308 100644 --- a/driver/rnn_driver.hpp +++ b/driver/rnn_driver.hpp @@ -236,7 +236,7 @@ int RNNDriver<T>::GetandSetData() outputTensors.push_back(outputTensor); } - std::array<int, 3> hid_lens = {hid_len[0], in_len[0], hid_len[1]}; + std::array<int, 3> hid_lens = {hid_len[0], in_len[0], hid_len[1]}; miopenSetTensorDescriptor(hiddenTensor, miopenFloat, 3, hid_lens.data(), nullptr); SetRNNDescriptorFromCmdLineArgs(); @@ -292,42 +292,42 @@ std::vector<int> RNNDriver<T>::GetInputTensorLengthsFromCmdLine() int in_h = inflags.GetValueInt("in_h"); std::vector<int> in_n(nseq, 0); std::string batchstr = inflags.GetValueStr("batchsize"); - int cont = 0; - - for (int i = 0; i < batchstr.length(); i++) - { - if (cont >= nseq) - { - printf("Length of data sequence is longer than required unrolled time sequence " - "provided.\n" - "The data sequence will be truncated to match unrolled time sequence.\n"); - break; - } - - if (batchstr[i] == ',') - { - if (cont >= 1) - { - if (in_n[cont] > in_n[cont - 1]) - { - printf("Incorrect input batch size at time %d\n", cont); - break; - } - } - cont++; - } - else if (batchstr[i] >= '0' && batchstr[i] <= '9') - { - in_n[cont] = in_n[cont] * 10 + stoi(batchstr.substr(i, 1)); - } - else - { - printf("illegal input of in_n batch size"); - break; - } - } - adjustedSeqLen = nseq; - in_n.push_back(in_h); + int cont = 0; + + for(int i = 0; i < batchstr.length(); i++) + { + if(cont >= nseq) + { + printf("Length of data sequence is longer than required unrolled time sequence " + "provided.\n" + "The data sequence will be truncated to match unrolled time sequence.\n"); + break; + } + + if(batchstr[i] == ',') + { + if(cont >= 1) + { + if(in_n[cont] > in_n[cont - 1]) + { + printf("Incorrect input batch size at time %d\n", cont); + break; + } + } + cont++; + } + else if(batchstr[i] >= '0' && batchstr[i] <= '9') + { + in_n[cont] = in_n[cont] * 10 + stoi(batchstr.substr(i, 1)); + } + else + { + printf("illegal input of in_n batch size"); + break; + } + } + adjustedSeqLen = nseq; + in_n.push_back(in_h); return in_n; } @@ -488,7 +488,7 @@ std::vector<int> RNNDriver<T>::GetOutputTensorLengthsFromCmdLine() // need remov template <typename T> int RNNDriver<T>::AllocateBuffersAndCopy() { - //int seqLength = inflags.GetValueInt("seq_len"); + // int seqLength = inflags.GetValueInt("seq_len"); size_t in_sz = 0; size_t out_sz = 0; size_t wei_sz = 0; @@ -504,8 +504,10 @@ int RNNDriver<T>::AllocateBuffersAndCopy() &in_sz); // use c_array to pass vector for all size function miopenGetRNNInputSuperTensorSize( GetHandle(), rnnDesc, adjustedSeqLen, outputTensors.data(), &out_sz); - miopenGetRNNHiddenSuperTensorSize(GetHandle(), rnnDesc, adjustedSeqLen, inputTensors.data(), &hy_sz); - miopenGetRNNWorkspaceSize(GetHandle(), rnnDesc, adjustedSeqLen, inputTensors.data(), &workSpaceSize); + miopenGetRNNHiddenSuperTensorSize( + GetHandle(), rnnDesc, adjustedSeqLen, inputTensors.data(), &hy_sz); + miopenGetRNNWorkspaceSize( + GetHandle(), rnnDesc, adjustedSeqLen, inputTensors.data(), &workSpaceSize); miopenGetRNNTrainingReserveSize( GetHandle(), rnnDesc, adjustedSeqLen, inputTensors.data(), &reserveSpaceSize); miopenGetRNNParamsSize(GetHandle(), rnnDesc, inputTensors[0], ¶ms_sz, miopenFloat); @@ -749,7 +751,7 @@ int RNNDriver<T>::RunForwardCPU() bool bidirection, biased; int layer; - + miopenRNNMode_t mode; miopenRNNAlgo_t algoMode; miopenRNNInputMode_t inputMode; @@ -844,7 +846,7 @@ int RNNDriver<T>::RunForwardCPU() template <typename T> int RNNDriver<T>::RunBackwardGPU() { - int ret = 0; + int ret = 0; Timer t; START_TIME;