Message-Id: <200301070806.h07862v6014405@inti.its.uow.edu.au> Date: Tue, 7 Jan 2003 19:10:7 +1000 From: Y Chen To: "djgpp AT delorie DOT com" Subject: scan() in c++ X-mailer: FoxMail 3.11 Release [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Dear Sir, I got the following errors(The file is at the bottom): LSTM.cpp: In member function `virtual char TLSTM::LoadPar()': LSTM.cpp:338: no matching function for call to `std::basic_fstream >::scan(const char[17])' LSTM.cpp:343: no matching function for call to `std::basic_fstream >::scan(const char[17])' LSTM.cpp:346: no matching function for call to `std::basic_fstream >::scan(const char[16])' LSTM.cpp:347: no matching function for call to `std::basic_fstream >::scan(const char[21])' LSTM.cpp:348: no matching function for call to `std::basic_fstream >::scan(const char[14])' LSTM.cpp:353: no matching function for call to `std::basic_fstream >::scan(const char[33])' LSTM.cpp:355: no matching function for call to `std::basic_fstream >::scan(const char[20])' LSTM.cpp:356: no matching function for call to `std::basic_fstream >::scan(const char[15])' LSTM.cpp:358: no matching function for call to `std::basic_fstream >::scan(const char[15])' LSTM.cpp:360: no matching function for call to `std::basic_fstream >::scan(const char[15])' LSTM.cpp:364: no matching function for call to `std::basic_fstream >::scan(const char[15])' LSTM.cpp:366: no matching function for call to `std::basic_fstream >::scan(const char[16])' LSTM.cpp:368: no matching function for call to `std::basic_fstream >::scan(const char[16])' LSTM.cpp: In member function `char TLSTM::WriteWeightFile(char*)': LSTM.cpp:2019: using typedef-name `std::iostream' after `class' LSTM.cpp: In member function `char TLSTM::LoadWeightFile(char*)': LSTM.cpp:2025: using typedef-name `std::iostream' after `class' LSTM.cpp: In member function `char TLSTM::DumpAll(char*)': LSTM.cpp:2033: using typedef-name `std::iostream' after `class' LSTM.cpp: In member function `void TLSTM::DisplayWeights()': LSTM.cpp:2388: using typedef-name `std::iostream' after `class' How to fix the problem about "no matching function..." and "using typedef-name `std::iostream' after `class' "? Thanks a lot for your help. Regards, Y Chen // LSTM.cpp #include #include #include #include #include // for memory error handling //#include #include // sleep //#include // struct termios #include #include #include #include #include #include #include // To have max values for imposible inits. #include "LSTM.h" #include "Error.h" //// TLSTM void TLSTM::NewTs_d_Gate(Ts_d_Gate *&sd, unsigned int size) { sd = new Ts_d_Gate[size]; for(int i=0;i0) if(LoadPar()) return 1; InitNet(); //WriteWeightFile(WEIGHTLOGFILE); //exit(0); //LoadWeightFile(WEIGHTLOGFILE); //sprintf(cBuf, "w.init.%d",Tri); LoadWeightFile(cBuf); //LoadWeightFile(cBuf); //WriteWeightFile(cBuf); //LoadWeightFile("w.init"); //if(LoadWeightFile("W")) exit(1); //ddd //LoadWeightFile("w.hand"); //WriteWeightFile(WEIGHTLOGFILE); // Run and Train the net. //Test(); exit(0); //ddd //GetOnlineProblemStatistics(); exit(0); //ddd do { // Epo loop. Epo++; #ifdef DO_ONLINE_PAT_PRODUCTION // This Seq will be overwritten, we init the Nb variables here. ONLINE_PAT_FUNCNAME(sTrainData, true); #else if(Generate_Pat && Generate_Pat_Each_Epoch>0) { if((unsigned int)fmod(Epo, Generate_Pat_Each_Epoch) == 0) GeneratePattern(sTrainData, Pat_FuncName); } if(MixTrainSeqs) MixTrainSequences(); #endif ClassesWrong=0; MSEEpo=0; PatCorrect=0; PatCount=0; SeqOnline=0; SeqOnlinePatCount=0; // Seq loop. for(Seq=0;Seq10) // {cout<< "\n";cout.flush();}//Debug on-line. //DumpAll("dump.init"); //DisplayNet(sTrainData); DisplayWeights(); KeyCheck(); //AlphaPredict = Alpha / sTrainData.NbPat[Seq]; // AlphaPredict for(Pat=0;Pat10) { // Debug on-line pat generation. // ddd // cout << Epo << "-" << Seq << "-" << SeqOnline // << "-" << Pat << " :"; // cout << "[" << sTrainData.NbPat[0]<< "] "; // for(int Val=0;Val (" << MSEPat << ") " << PatCorrect; // cout << "\n"; cout.flush(); // } ForwardPass(sTrainData,FreezeEndBlock,NbMemoBlocks); //WriteOutLogFile(OUT_LOGFILE); #ifdef USE_LOCAL_ALPHA_SEQUENCEWISE BackwardPass(FreezeEndBlock,NbMemoBlocks); #endif if((Pat==sTrainData.NbPat[Seq]-1) || SetStepTarget || (NbPredictNextIn>0) || (NbPredictClass>0)) { #ifdef USE_ALPHA_DECAY_IN_SEQ if(SetStepTarget) { #ifdef ALPHA_DECAY_IN_SEQ_LINEAR AlphaDecayInSeq = USE_ALPHA_DECAY_IN_SEQ/ (Pat+USE_ALPHA_DECAY_IN_SEQ); #elif if(Pat*USE_ALPHA_DECAY_IN_SEQ>709) AlphaDecayInSeq=0; else AlphaDecayInSeq = EXP(-(Pat*USE_ALPHA_DECAY_IN_SEQ)); #endif } else { #ifdef ALPHA_DECAY_IN_SEQ_LINEAR AlphaDecayInSeq = USE_ALPHA_DECAY_IN_SEQ/ (SeqOnline+USE_ALPHA_DECAY_IN_SEQ); #elif if(SeqOnline*USE_ALPHA_DECAY_IN_SEQ>709) AlphaDecayInSeq=0; else AlphaDecayInSeq = EXP(-(SeqOnline*USE_ALPHA_DECAY_IN_SEQ)); #endif } // cout << Pat << "-" << Seq << "-" << Epo << ":" // << AlphaDecayInSeq << " "; #endif #ifndef USE_LOCAL_ALPHA_SEQUENCEWISE BackwardPass(FreezeEndBlock,NbMemoBlocks); #endif PatStatistics(sTrainData); #ifdef DO_ONLINE_PAT_PRODUCTION if(SetStepTarget) { if(!PatWrong) #ifndef SETSTEPTARGET_BUT_COUNT_SEQUENCEWISE ONLINE_PAT_FUNCNAME(sTrainData, false); #else ; // Generate seq only before Pat loop. #endif else break; // PatWrong. //if(ReberGrammarState==-1) ResetNet(); } #endif } // if(Epo==7384) { // sprintf(cBuf, "w.end%d.%d",Epo,Pat);WriteWeightFile(cBuf); // if(Pat>840) { // sprintf(cBuf, "dump.%d.%d",Epo,Pat);DumpAll(cBuf); } // } //sprintf(cBuf, "w.Pat.%d",Pat); WriteWeightFile(cBuf); exit(0); //sprintf(cBuf, "dump.Pat.%d",Pat);DumpAll(cBuf); //if(Pat>=3) exit(0); //DisplayNet(sTrainData); DisplayWeights(); KeyCheck(); //if(PatCorrectTest>90) Dump_Inner_States(); //ddd //printf(cBuf, "dump.%d.%d",Epo,Pat);DumpAll(cBuf); //if(Epo>1000) exit(0); //Dump_Inner_States(); } // End Pat loop. #ifdef UPDATE_WEIGHTS_AFTER_SEQ ExecuteWeightChanges(FreezeEndBlock,NbMemoBlocks); #endif SeqStatistics(sTrainData); //sprintf(cBuf, "w.Seq.%d",Seq); WriteWeightFile(cBuf); exit(0); //DisplayNet(sTrainData); DisplayWeights(); KeyCheck(); #ifdef DO_ONLINE_PAT_PRODUCTION #ifndef SETSTEPTARGET_BUT_COUNT_SEQUENCEWISE if(!SetStepTarget) #endif if(!PatWrong) { SeqOnline++; if(PatCorrect>=MaxOnlineStreamLengthTrain) break; } else break; #endif } // End Seq loop. //DumpSomeAlphas(); EpoStatistics(sTrainData); //ExecuteWeightChanges(FreezeEndBlock,NbMemoBlocks); //sprintf(cBuf, "w.Epo.%d",Epo); WriteWeightFile(cBuf); //sprintf(cBuf, "%s.%d", OUT_LOGFILE,Epo); rename(OUT_LOGFILE,cBuf); //if(Epo==7384) DumpAll("dump.end.log"); //if((unsigned int)fmod(Epo,1000) == 0) { //sprintf(cBuf, "w.end%d.%d",Tri,Epo);WriteWeightFile(cBuf); } //WriteWeightFile("w");) if(StopLern) EpochsAfterLearned--; #ifdef DO_ONLINE_PAT_PRODUCTION if((Epo>=MaxEpochs)||(PatCorrect>=MaxOnlineStreamLengthTrain) ||(MSEEpo test. if(StopLern && (Epo=MaxOnlineStreamLengthTest) || // (TestMSEEpo=MaxEpochs) || ((PatCorrectTest>=MaxOnlineStreamLengthTest) || (TestMSEEpo=MaxEpochs)||(MSEEpo0));// End Epo loop. Test();// Final Test //if(Epo>=MaxEpochs) { Test();}// Final test if unsolved. //if(Epo>=MaxEpochs) {OutputDebug=true; Test();}// ddd //if(Epo1) { sprintf(cBuf, "%s.%d", ERRORLOGFILE,Tri); rename(ERRORLOGFILE,cBuf); sprintf(cBuf, "%s.%d", MSELOGFILE,Tri); rename(MSELOGFILE,cBuf); if(DirContainsFile(true, TEST_ERRORLOGFILE)) { sprintf(cBuf, "%s.%d", TEST_ERRORLOGFILE,Tri); rename(TEST_ERRORLOGFILE,cBuf); } if(DirContainsFile(true, TEST_MSELOGFILE)) { sprintf(cBuf, "%s.%d", TEST_MSELOGFILE,Tri); rename(TEST_MSELOGFILE,cBuf); } if(GrowNet) { sprintf(cBuf, "%s.%d", GROWLOGFILE,Tri); rename(GROWLOGFILE,cBuf); } if(DirContainsFile(true, WEIGHTMEAN_LOGFILE)) { sprintf(cBuf, "%s.%d", WEIGHTMEAN_LOGFILE,Tri); rename(WEIGHTMEAN_LOGFILE,cBuf); } if(DirContainsFile(true, ALPHAMEAN_LOGFILE)) { sprintf(cBuf, "%s.%d", ALPHAMEAN_LOGFILE,Tri); rename(ALPHAMEAN_LOGFILE,cBuf); } if(DirContainsFile(true, INNERSTATE_DUMP_LOGFILE)) { sprintf(cBuf, "%s.%d", INNERSTATE_DUMP_LOGFILE,Tri); rename(INNERSTATE_DUMP_LOGFILE,cBuf); } if(DirContainsFile(true, "AlphaDump.log")) { sprintf(cBuf, "%s.%d", "AlphaDump.log",Tri); rename("AlphaDump.log",cBuf); } } DeleteNet(); } // End Tri loop. cout << "LSTM Done." << endl; } void TLSTM::InitNet() { InitMemoBlocks(0,NbMemoBlocks); // Init other units. // Init Out units. Out = new TOut[NbOut]; for(int iO=0;iO