Skip to content

Commit

Permalink
Fix g++ compilation warnings
Browse files Browse the repository at this point in the history
sprintf_s is snprintf, not sprintf
Need to use more symbols from SGD
Add externs for missing file name generators that seem to be not reachable
   and not defined.
  • Loading branch information
diyessi committed Aug 3, 2015
1 parent e633191 commit ad5b8a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Common/Include/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef void* HANDLE;
#define __forceinline inline
//string and io conversion
#define strtok_s strtok_r
#define sprintf_s sprintf
#define sprintf_s snprintf
#define sscanf_s sscanf
#define _strdup strdup

Expand Down
2 changes: 1 addition & 1 deletion DataReader/UCIFastReader/UCIParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ long UCIParser<NumType, LabelType>::Parse(size_t recordsRequested, std::vector<N
long TickDelta = TickStop - TickStart;

if (m_traceLevel > 2)
fprintf(stderr, "\n%ld ms, %d numbers parsed\n\n", TickDelta, m_totalNumbersConverted );
fprintf(stderr, "\n%ld ms, %ld numbers parsed\n\n", TickDelta, m_totalNumbersConverted );
return recordCount;
}

Expand Down
11 changes: 10 additions & 1 deletion MachineLearning/CNTK/MultiNetworksSGD.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ namespace Microsoft {
namespace MSR {
namespace CNTK {

extern std::wstring GetEncoderModelNameForEpoch(int epoch, bool b = false);
extern std::wstring GetDecoderModelNameForEpoch(int epoch, bool b = false);

template<class ElemType>
class MultiNetworksSGD : SGD<ElemType>
{
Expand Down Expand Up @@ -68,6 +71,12 @@ namespace Microsoft {
using SGDBase::m_numMBsToShowResult;
using SGDBase::m_gradientCheckSigDigit;
using SGDBase::m_prevChosenMinibatchSize;
using SGDBase::GetTrainCriterionNodes;
using SGDBase::GetEvalCriterionNodes;
using SGDBase::SetDropoutRate;
using SGDBase::UpdateEvalTimeStamps;
using SGDBase::UpdateWeights;
using SGDBase::GetCheckPointFileNameForEpoch;

typedef ComputationNode<ElemType>* ComputationNodePtr;

Expand Down Expand Up @@ -1124,7 +1133,7 @@ namespace Microsoft {
if (wrong)
{
char serr[2048];
sprintf_s((char*)serr, 2048, "Decoder %ls Numeric gradient = %e, Error BP gradient = %e", node->NodeName().c_str(), grdNum, grdErr);
sprintf_s((char*)serr, 2048, "Decoder %ls Numeric gradient = %e, Error BP gradient = %e", node->NodeName().c_str(), static_cast<double>(grdNum), static_cast<double>(grdErr));
fprintf(stdout, "%s\n", serr);
verror_msgs.push_back(serr);
}
Expand Down

0 comments on commit ad5b8a2

Please sign in to comment.