@@ -5402,9 +5402,6 @@ onnxruntime::Node* CNTKToONNXHelper::CreateNode(const FunctionPtr& src,
5402
5402
std::string cntkOpName = ToLegacyString (ToUTF8 (src->OpName ()));
5403
5403
std::string onnxOpName = ToOPName (src);
5404
5404
5405
- if (src->OpName () == L" Pooling" )
5406
- std::cout << " " ;
5407
-
5408
5405
// TODO: uncomment this code once bidirectional LSTM is supprted.
5409
5406
// if (cntkOpName == "Splice")
5410
5407
// {
@@ -5640,6 +5637,8 @@ onnxruntime::Node* CNTKToONNXHelper::CreateNode(const FunctionPtr& src,
5640
5637
}
5641
5638
else if (src->OpName () == L" Pooling" && src->Inputs ()[0 ].HasBatchAxis () && src->Inputs ()[0 ].HasSequenceAxis ())
5642
5639
{
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.
5643
5642
return CreatePoolingNode (src, graph, functionNodes, variableNodes, scanLoops, createLoopIndex);
5644
5643
}
5645
5644
//
@@ -7099,6 +7098,7 @@ void CNTKToONNXHelper::CopyAttributes(const FunctionPtr& src, onnxruntime::Node*
7099
7098
auto lowerPad = ToINTS (src->Attributes ()[L" lowerPad" ].Value <NDShape>());
7100
7099
auto upperPad = ToINTS (src->Attributes ()[L" upperPad" ].Value <NDShape>());
7101
7100
7101
+ // lowerPad and upperPad have incorrect dimension when the op has both batch and sequence axes.
7102
7102
if (IsPadValueValid (lowerPad, upperPad, autoPadding, ceilOutDim) && !(src->Inputs ()[0 ].HasBatchAxis () && src->Inputs ()[0 ].HasSequenceAxis ()))
7103
7103
{
7104
7104
if (ceilOutDim)
@@ -8617,6 +8617,7 @@ onnxruntime::Node* ApplyActivationToSequenceConvolution(Node* convNode, const Fu
8617
8617
return activationNode;
8618
8618
}
8619
8619
8620
+ // insert reshape before and after a Pooling op when the CNTK op has both sequence and batch axes.
8620
8621
onnxruntime::Node* CNTKToONNXHelper::CreatePoolingNode (const FunctionPtr& src,
8621
8622
onnxruntime::Graph* graph,
8622
8623
std::unordered_map<FunctionPtr, onnxruntime::Node*>& functionNodes,
0 commit comments