Skip to content

Commit

Permalink
merged fseide/tensors and master after github move
Browse files Browse the repository at this point in the history
  • Loading branch information
frankseide committed Jan 19, 2016
2 parents 78a7ede + 1ae3404 commit 6781765
Show file tree
Hide file tree
Showing 8 changed files with 5,824 additions and 5,824 deletions.
1,262 changes: 537 additions & 725 deletions Source/ComputationNetworkLib/CompositeComputationNodes.h

Large diffs are not rendered by default.

41 changes: 14 additions & 27 deletions Source/ComputationNetworkLib/ComputationNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb

ComputationNetwork()
: m_randomSeedOffset(0),
m_isCompiled(false),
m_pMBLayout(make_shared<MBLayout>())
m_isCompiled(false),
m_pMBLayout(make_shared<MBLayout>())
{
}
ComputationNetwork(DEVICEID_TYPE deviceId)
Expand Down Expand Up @@ -298,19 +298,6 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb
return actualMBSize;
}

// only called from MultiNetworksEvaluator
// a helper function for some places that like to hack the features directly
// This is for a few places (FindBestPath stuff) that don't follow the normal pattern but instead called the old SetFeaturesMiniBatchSize() function with a value of their choosing.
// This is now changed in that they must actually resize the features, and then the system takes it from here.
// UNTESTED stopgap. Most likely places that are never used.
// This function does not actually allocate the matrices. I don't know whether that currently happens correctly.
void ResizeAllFeatureNodes(size_t cols)
{
auto& featureNodes = FeatureNodes();
for (auto& nodeIter : featureNodes)
nodeIter->SetNumCols(cols);
}

// When external code (readers, namely) updates InputValue's m_value,
// calling this function is required to make sure that any internal state gets updated correctly.
// Only a change to the column dimension i sallowed
Expand Down Expand Up @@ -414,7 +401,7 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb
{
if (NodeNameExists(name))
nodes.push_back(GetNodeFromName(name));
}
}
else
{
std::wstring head = name.substr(0, found);
Expand All @@ -428,8 +415,8 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb
bool tailMatch = tail.empty() || nodeName.rfind(tail) == nodeName.size() - tail.size();
if (headMatch && tailMatch)
nodes.push_back(nodeIter->second);
}
}
}
return nodes;
}

Expand All @@ -441,10 +428,10 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb
static void SetDropoutRate(ComputationNetworkPtr net, const ComputationNodeBasePtr& criterionNode, const double dropoutRate, double& prevDropoutRate, unsigned long& dropOutSeed);

template <class ElemType>
static void SetSeqParam(ComputationNetworkPtr net,
const ComputationNodeBasePtr criterionNode,
static void SetSeqParam(ComputationNetworkPtr net,
const ComputationNodeBasePtr criterionNode,
const double& hsmoothingWeight,
const double& frameDropThresh,
const double& frameDropThresh,
const bool& doreferencealign,
const double& amf = 14.0f,
const double& lmf = 14.0f,
Expand Down Expand Up @@ -629,11 +616,11 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb
};

protected:
// -----------------------------------------------------------------------
// construction
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// construction
// -----------------------------------------------------------------------

// Copy constructor, should never be called.
// Copy constructor, should never be called.
#pragma warning(push)
#pragma warning(disable : 4702) // this function is flagged but unclear why
ComputationNetwork(const ComputationNetwork& /*deepCopyFrom*/)
Expand Down Expand Up @@ -728,7 +715,7 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb
else //node name is not found, dump all nodes
{
fprintf(stderr, "Warning: node name %ls does not exist in the network. dumping all nodes.\n",
nodeName.c_str());
nodeName.c_str());
DumpAllNodesToFile(printValues, outputFile);
}
}
Expand Down Expand Up @@ -867,7 +854,7 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb

SEQTraversalFlowControlNode(int loopId, ComputationNodeBasePtr cur)
: m_loopId(loopId),
m_sourceNode(cur)
m_sourceNode(cur)
{
SetNodeName(L"Loop_" + m_sourceNode->NodeName());
}
Expand Down Expand Up @@ -959,7 +946,7 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb
return vector<std::vector<ComputationNodeBasePtr>*>{&m_features, &m_labels, &m_finalCriteria, &m_evalNodes, &m_outputNodes, &m_pairNodes};
}

// used for sentence boundary information passed from reader to reset RNN state
// used for sentence boundary information passed from reader to reset RNN state
// specify how the minibatch is packed for each sample
// TODO: This will change once we allow for multiple inconsistent layouts.
MBLayoutPtr m_pMBLayout; // note that this must be installed before doing anything that needs it (default leaves a nullptr)
Expand Down
Loading

0 comments on commit 6781765

Please sign in to comment.