Skip to content

Commit 9a7dd4c

Browse files
committed
add comments
1 parent 280ec14 commit 9a7dd4c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Source/CNTKv2LibraryDll/proto/onnx/CNTKToONNX.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5402,9 +5402,6 @@ onnxruntime::Node* CNTKToONNXHelper::CreateNode(const FunctionPtr& src,
54025402
std::string cntkOpName = ToLegacyString(ToUTF8(src->OpName()));
54035403
std::string onnxOpName = ToOPName(src);
54045404

5405-
if (src->OpName() == L"Pooling")
5406-
std::cout << "";
5407-
54085405
// TODO: uncomment this code once bidirectional LSTM is supprted.
54095406
//if (cntkOpName == "Splice")
54105407
//{
@@ -5640,6 +5637,8 @@ onnxruntime::Node* CNTKToONNXHelper::CreateNode(const FunctionPtr& src,
56405637
}
56415638
else if (src->OpName() == L"Pooling" && src->Inputs()[0].HasBatchAxis() && src->Inputs()[0].HasSequenceAxis())
56425639
{
5640+
// in case a Pooling op is created with bother batch and sequence axes, we need to reshape its input and output to match
5641+
// ONNX spec of [N, C, H, W] shape requirement.
56435642
return CreatePoolingNode(src, graph, functionNodes, variableNodes, scanLoops, createLoopIndex);
56445643
}
56455644
//
@@ -7099,6 +7098,7 @@ void CNTKToONNXHelper::CopyAttributes(const FunctionPtr& src, onnxruntime::Node*
70997098
auto lowerPad = ToINTS(src->Attributes()[L"lowerPad"].Value<NDShape>());
71007099
auto upperPad = ToINTS(src->Attributes()[L"upperPad"].Value<NDShape>());
71017100

7101+
// lowerPad and upperPad have incorrect dimension when the op has both batch and sequence axes.
71027102
if (IsPadValueValid(lowerPad, upperPad, autoPadding, ceilOutDim) && !(src->Inputs()[0].HasBatchAxis() && src->Inputs()[0].HasSequenceAxis()))
71037103
{
71047104
if (ceilOutDim)
@@ -8617,6 +8617,7 @@ onnxruntime::Node* ApplyActivationToSequenceConvolution(Node* convNode, const Fu
86178617
return activationNode;
86188618
}
86198619

8620+
// insert reshape before and after a Pooling op when the CNTK op has both sequence and batch axes.
86208621
onnxruntime::Node* CNTKToONNXHelper::CreatePoolingNode(const FunctionPtr& src,
86218622
onnxruntime::Graph* graph,
86228623
std::unordered_map<FunctionPtr, onnxruntime::Node*>& functionNodes,

0 commit comments

Comments
 (0)