Skip to content

Commit

Permalink
Merge branch 'yu/memshare' of https://git.codeplex.com/cntk into yu/m…
Browse files Browse the repository at this point in the history
…emshare
  • Loading branch information
yzhang87 committed Oct 13, 2015
2 parents 46a9bee + 9d570ec commit 0a16f96
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
6 changes: 6 additions & 0 deletions Common/Include/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
#define __declspec_noreturn
#endif

#ifndef _MSC_VER
#define NOEXCEPT noexcept
#else
#define NOEXCEPT
#endif

// ===========================================================================
// emulation of some MSVC proprietary CRT
// ===========================================================================
Expand Down
7 changes: 1 addition & 6 deletions Common/Include/ssematrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@
#include "fileutil.h" // for saving and reading matrices
#include <limits> // for NaN
#include <malloc.h>

#ifndef _MSC_VER
#define NOEXCEPT noexcept
#else
#define NOEXCEPT
#endif
#include "Platform.h"

namespace msra { namespace math {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb
{
//comment out since the function value matrix is shared and may be resized by others
//if (bResetToOne && (rootNode->GetNumRows() != 1 || rootNode->GetNumCols() != 1))
// RuntimeError("ComputeGradient: The root of the Gradient computation must evaluate to R1 value.");
// RuntimeError("ComputeGradient: The root of the Gradient computation must evaluate to a scalar value.");
//run forward pass first
Evaluate(rootNode);
Expand Down Expand Up @@ -919,7 +919,7 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb
Evaluate(rootNode);

if (bResetToOne && (rootNode->GetNumRows() != 1 || rootNode->GetNumCols() != 1))
RuntimeError("ComputeGradient: The root of the Gradient computation must evaluate to R1 value.");
RuntimeError("ComputeGradient: The root of the Gradient computation must evaluate to a scalar value.");

// TODO: comment what the purpose of this is
if (bClearGradient)
Expand Down Expand Up @@ -1335,8 +1335,6 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb
// evaluation
// -----------------------------------------------------------------------

private:

public: // yak--used by NDLUtil. Will go away someday.
// ValidateNetwork() - Validate the entire network
// This calls ValidateNetowrk(Node) for all output nodes.
Expand Down
8 changes: 4 additions & 4 deletions MachineLearning/CNTKSGDLib/SGD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,10 @@ namespace Microsoft { namespace MSR { namespace CNTK {
auto & criterionNodes = GetTrainCriterionNodes(net);
auto & evaluationNodes = GetEvalCriterionNodes(net);

//allocate memory for backward computation
//we intentionally separate it from above loop to make sure forward computing gets the right matrices
fprintf(stderr, "\n\nAllocate matrices for gradient computing\n");
for (int i = 0; i < criterionNodes.size(); i++)
//allocate memory for backward computation
//we intentionally separate it from above loop to make sure forward computing gets the right matrices
fprintf(stderr, "\n\nAllocate matrices for gradient computing\n");
for (int i = 0; i < criterionNodes.size(); i++)
net.AllocateGradientMatrices(criterionNodes[i]);

// give the layout something to validate with (some code below validates the network before actually receiving data)
Expand Down

0 comments on commit 0a16f96

Please sign in to comment.