defined fake memcpy_s() in basetypes.h for GCC;
fixed last bits in CNTKEval.cpp, also compiles now
This commit is contained in:
Родитель
1d4dd604ba
Коммит
8feb23fc79
|
@ -159,6 +159,7 @@ static inline int _wcsnicmp (const wchar_t * a, const wchar_t * b, size_t n) { r
|
|||
static inline int64_t _strtoi64 (const char * s, char ** ep, int r) { return strtoll (s, ep, r); } // TODO: check if correct
|
||||
static inline uint64_t _strtoui64 (const char * s, char ** ep, int r) { return strtoull (s, ep, r); } // TODO: correct for size_t?
|
||||
// -- other
|
||||
static inline void memcpy_s(void * dst, size_t dstsize, const void * src, size_t maxcount) { assert (maxcount <= dstsize); memcpy (dst, src, maxcount); }
|
||||
static inline void Sleep (size_t ms) { std::this_thread::sleep_for (std::chrono::milliseconds (ms)); }
|
||||
#endif
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ template<class ElemType>
|
|||
void CNTKEval<ElemType>::Destroy()
|
||||
{
|
||||
// cleanup everything
|
||||
delete m_net;
|
||||
delete m_net; // TODO: use shared_ptr
|
||||
delete m_reader;
|
||||
delete m_writer;
|
||||
delete this;
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace Microsoft { namespace MSR { namespace CNTK {
|
|||
template<class ElemType>
|
||||
class EvalReader : public IDataReader<ElemType>
|
||||
{
|
||||
typedef typename IDataReader<ElemType>::LabelType LabelType;
|
||||
typedef typename IDataReader<ElemType>::LabelIdType LabelIdType;
|
||||
private:
|
||||
std::map<std::wstring, std::vector<ElemType>*>* m_inputs; // our input data
|
||||
std::map<std::wstring, size_t>* m_dimensions; // the number of rows for the input data
|
||||
|
@ -180,16 +182,16 @@ public:
|
|||
}
|
||||
// GetLabelMapping - Gets the label mapping from integer index to label type
|
||||
// returns - a map from numeric datatype to native label type
|
||||
virtual const std::map<typename LabelIdType, typename LabelType>& GetLabelMapping(const std::wstring& /*sectionName*/)
|
||||
virtual const std::map<typename EvalReader<ElemType>::LabelIdType, typename EvalReader<ElemType>::LabelType>& GetLabelMapping(const std::wstring& /*sectionName*/)
|
||||
{
|
||||
static std::map<typename LabelIdType, typename LabelType> labelMap;
|
||||
static std::map<typename EvalReader<ElemType>::LabelIdType, typename EvalReader<ElemType>::LabelType> labelMap;
|
||||
return labelMap;
|
||||
}
|
||||
|
||||
// SetLabelMapping - Sets the label mapping from integer index to label
|
||||
// labelMapping - mapping table from label values to IDs (must be 0-n)
|
||||
// note: for tasks with labels, the mapping table must be the same between a training run and a testing run
|
||||
virtual void SetLabelMapping(const std::wstring& /*sectionName*/, const std::map<typename LabelIdType, typename LabelType>& /*labelMapping*/) {}
|
||||
virtual void SetLabelMapping(const std::wstring& /*sectionName*/, const std::map<typename EvalReader<ElemType>::LabelIdType, typename EvalReader<ElemType>::LabelType>& /*labelMapping*/) {}
|
||||
|
||||
// GetData - Gets metadata from the specified section (into CPU memory)
|
||||
// sectionName - section name to retrieve data from
|
||||
|
@ -210,4 +212,4 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
}}}
|
||||
}}}
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace Microsoft { namespace MSR { namespace CNTK {
|
|||
template<class ElemType>
|
||||
class EvalWriter : public IDataWriter<ElemType>
|
||||
{
|
||||
typedef typename IDataWriter<ElemType>::LabelType LabelType;
|
||||
typedef typename IDataWriter<ElemType>::LabelIdType LabelIdType;
|
||||
private:
|
||||
std::map<std::wstring, std::vector<ElemType>*>* m_outputs; // our output data
|
||||
std::map<std::wstring, size_t>* m_dimensions; // the number of rows for the output data
|
||||
|
@ -119,8 +121,8 @@ public:
|
|||
return (m_currentRecord >= m_recordCount);
|
||||
|
||||
}
|
||||
virtual void SaveMapping(std::wstring saveId, const std::map<typename LabelIdType, typename LabelType>& /*labelMapping*/) {};
|
||||
virtual void SaveMapping(std::wstring saveId, const std::map<typename EvalWriter<ElemType>::LabelIdType, typename EvalWriter<ElemType>::LabelType>& /*labelMapping*/) {};
|
||||
|
||||
};
|
||||
|
||||
}}}
|
||||
}}}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#define _CRT_SECURE_NO_WARNINGS // "secure" CRT not available on all platforms
|
||||
#include "targetver.h"
|
||||
#include "windows.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
|
|
8206
Math/Math/Matrix.cpp
8206
Math/Math/Matrix.cpp
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
2
makefile
2
makefile
|
@ -36,7 +36,7 @@ MATH_SRC = Math/Math/Matrix.obj Math/Math/CPUMatrix.obj Math/Math/CPUSparseMatri
|
|||
|
||||
CN_SRC = MachineLearning/cn/NetworkDescriptionLanguage.cpp MachineLearning/cn/cn.cpp MachineLearning/cn/ComputationNode.cpp \
|
||||
MachineLearning/cn/ModelEditLanguage.cpp MachineLearning/cn/NetworkDescriptionLanguage.cpp MachineLearning/cn/PTaskGraphBuilder.cpp \
|
||||
MachineLearning/cn/SimpleNetworkBuilder.cpp MachineLearning/cn/tests.cpp
|
||||
MachineLearning/cn/SimpleNetworkBuilder.cpp MachineLearning/cn/tests.cpp MachineLearning/CNTKEval/CNTKEval.cpp
|
||||
|
||||
SRC = $(CN_SRC) $(MATH_SRC) $(COMMON_SRC)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче