ONNX export failed: Couldn't export operator aten::adaptive_avg_pool1d

I am trying to export a model that is using adaptive pooling to onnx format but I am getting the following error (see below). How could I resolve this error?

Thanks for any feedback!

RuntimeError Traceback (most recent call last)
in
5 *VV(x),
6 “./output.onnx”,
----> 7 verbose=False)
8 break

~/anaconda3/envs/export-production/lib/python3.6/site-packages/torch/onnx/init.py in export(*args, **kwargs)
24 def export(*args, **kwargs):
25 from torch.onnx import utils
—> 26 return utils.export(*args, **kwargs)
27
28

~/anaconda3/envs/export-production/lib/python3.6/site-packages/torch/onnx/utils.py in export(model, args, f, export_params, verbose, training, input_names, output_names, aten, export_raw_ir, operator_export_type)
92 operator_export_type = OperatorExportTypes.ONNX
93 _export(model, args, f, export_params, verbose, training, input_names, output_names,
—> 94 operator_export_type=operator_export_type)
95
96

~/anaconda3/envs/export-production/lib/python3.6/site-packages/torch/onnx/utils.py in _export(model, args, f, export_params, verbose, training, input_names, output_names, operator_export_type, export_type, example_outputs, propagate)
230 defer_weight_export = export_type is not ExportTypes.PROTOBUF_FILE
231 if export_params:
→ 232 proto, export_map = graph.export(params, _onnx_opset_version, defer_weight_export, operator_export_type)
233 else:
234 proto, export_map = graph.export(, _onnx_opset_version, False, operator_export_type)

RuntimeError: ONNX export failed: Couldn’t export operator aten::adaptive_avg_pool1d

Hi @markb, thanks for reporting this. If you want to export Aten operators that is specific to pytorch (which does not appears in the ONNX operators catalog here, you need to use the OperatorExportTypes.ONNX_ATEN_FALLBACK option, and export it as a ONNX-ATEN op.