Hi there,
for torch.onnx you want to pass the torch model directly, not the jit model.  this works fine for me:
import torch
import torch.nn as nn
import onnx


class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.fc1 = nn.Linear( 1, 3 )
        self.fc2 = nn.Linear( 3, 10 )
        self.fc3 = nn.Linear( 10, 2 )

    def forward(self,x):

        if x.shape[0] ==1 :
            x = self.fc2( self.fc1(x)  )
            return x
        else:
            x = self.fc3( self.fc2( self.fc1(x)  ) )
            return x

model = Net()

data = torch.randn((1,1))
outputs = model(data)
onnx_model_path = "model.onnx"
torch.onnx.export(model, data, onnx_model_path, opset_version=11, input_names=["input"] ,  example_outputs= outputs,
                  dynamic_axes={ "input":{0:"batch_size"} }, output_names=["output"])