PyTorch to ONNX no batch normalization layer

I have some very standard CNN-BatchNorm-relu combinations in my model, after I use torch.onnx.export(), the BatchNorm layer doesn’t exist any more in onnx model, I carefully checked the model and found that BN has been fused in CNN layer.
This happens after I update my pytorch to 1.7, my code used to work in 1.6. Is there a way to keep BN layer even after it is converted to onnx model?

2 Likes

Same problem, the BatchNorm Layers disappear after exporting to onnx format…
How did you find BN has been fused in CNN layer? In the source code of PyTorch?

See This Issue

2 Likes