Hi all,
I’m trying to convert a PyTorch model to ONNX with torch.onnx.export, but the operation fails upon trying the ‘var’ operator (symbolic_opset9). I have done some reading and found mean variance normalization (mvn) is supported, but I could not find anything about var alone.
The issue lies when torch.onnx.export is called, with the following trace:

/opt/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py:715: UserWarning: ONNX export failed on ATen operator var because torch.onnx.symbolic_opset9.var does not exist
Traceback (most recent call last):
File “onnx_conversion_script.py”, line 74, in 
torch.onnx.export(model, dummy_input, model_name + “.onnx”, verbose=True, input_names = input_name, output_names=output_name)
File “/opt/anaconda3/lib/python3.7/site-packages/torch/onnx/init.py”, line 158, in export
custom_opsets, enable_onnx_checker)
File “/opt/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py”, line 68, in export
custom_opsets=custom_opsets, enable_onnx_checker=enable_onnx_checker)
File “/opt/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py”, line 469, in _export
fixed_batch_size=fixed_batch_size)
File “/opt/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py”, line 338, in _model_to_graph
fixed_batch_size=fixed_batch_size, params_dict=params_dict)
File “/opt/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py”, line 153, in _optimize_graph
graph = torch._C._jit_pass_onnx(graph, operator_export_type)
File “/opt/anaconda3/lib/python3.7/site-packages/torch/onnx/init.py”, line 189, in _run_symbolic_function
return utils._run_symbolic_function(*args, **kwargs)
File “/opt/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py”, line 716, in _run_symbolic_function
op_fn = sym_registry.get_registered_op(op_name, ‘’, opset_version)
File “/opt/anaconda3/lib/python3.7/site-packages/torch/onnx/symbolic_registry.py”, line 94, in get_registered_op
return _registry[(domain, version)][opname]
KeyError: ‘var’

Is a custom operator necessary? Has anyone else run into this? I have tried both the latest PyTorch as well as the nightly build with no success.
Thanks.