CNTK
CNTK copied to clipboard
Export to ONNX fail for GlobalMaxPooling and GlobalAveragePooling with SequentialConvolution
import cntk as C
a = C.sequence.input_variable((3, 32))
b = C.layers.SequentialConvolution(filter_shape=(3, 3), num_filters=16, activation=C.relu, pad=True, strides=2)(a)
c = C.layers.GlobalMaxPooling()(b)
c = C.squeeze(c)
print(c.shape)
c.save('test.cntk', C.ModelFormat.CNTKv2)
c.save('test.onnx', C.ModelFormat.ONNX)
RuntimeError: Node:Block130 Output:Block130_Output_0 [ShapeInferenceError] Can't merge shape info. Both source and target dimension have values but they differ. Source=1 Target=16 Dimension=2
Minimum code to replicate the error.
Additionally, C.sequence.where also doesn't export to onnx. I use sequence.where and sequence.gather to stride across the dynamic sequence axis.
Its a shame that i can't won't be able to use onnxruntime for my work.
a = C.sequence.input_variable(1)
b = C.sequence.where(a)
print(b.shape)
b.save('test.cntk', C.ModelFormat.CNTKv2)
b.save('test.onnx', C.ModelFormat.ONNX)
Might be connected to this
Thanks for bringing this to my attention, i'll take a look :)