Unable to convert Model with Onnx

Hi i’m trying to convert this model to onnx.

class onnx_Autoencoder(nn.Module):
 def __init__(self):
        super(onnx_Autoencoder, self).__init__()

        self.Cov1=nn.Conv2d(1,32,3)
        self.batchNorm1=nn.BatchNorm2d(32)
        self.relu1 =nn.ReLU()

        self.Cov2 = nn.Conv2d(32, 64, 3)
        self.batchNorm2 = nn.BatchNorm2d(64)
        self.relu2 = nn.ReLU()



        #
        self.Transpose1= nn.ConvTranspose2d(64, 32, 3)
        self.batchNorm1Tra=nn.BatchNorm2d(32)
        self.relu1Tra=nn.ReLU(inplace=True)

        self.Transpose2 = nn.ConvTranspose2d(32, 1, 3)

Everything is working fine except when i add track_running_stats=False in batch norm layer


self.batchNorm1=nn.BatchNorm2d(32,track_running_stats=False)

When i check the exported onnx model i get the following errror

Traceback (most recent call last):
  File "onnx_check_model.py", line 5, in <module>
    onnx.checker.check_model(onnx_model)
  File "/home/velab/anaconda3/lib/python3.7/site-packages/onnx/checker.py", line 86, in check_model
    C.check_model(model.SerializeToString())
onnx.onnx_cpp2py_export.checker.ValidationError: Node ()'s input 3 is marked single but has an empty string in the graph

==> Context: Bad node spec: input: "27" input: "batchNorm1Tra.weight" input: "batchNorm1Tra.bias" input: "" input: "" output: "30" output: "31" output: "32" output: "batch_norm_dead_output-72" output: "batch_norm_dead_output-73" op_type: "BatchNormalization" attribute { name: "epsilon" f: 1e-05 type: FLOAT } attribute { name: "momentum" f: 0.9 type: FLOAT }

Could someone provide me an idea on how to solve this?
Thanks

I have the same issue. Any new findings to solve this problem?

I’ve filed a bug report about this error: https://github.com/pytorch/pytorch/issues/45333