- OS: MacOS Sierra
- PyTorch version: 0.4.0a0+7588893 (I instaled the latest yesterday from the source)
- How you installed PyTorch (conda, pip, source): source
- Python version: Python 2.7.14 |Anaconda, Inc.|
- CUDA/cuDNN version: No Cuda
- GPU models and configuration: No GPU models
- GCC version (if compiling from source): GCC 4.2.1 Compatible Clang 4.0.1
I was trying to use torch.onnx.export to export some pretrained pytorch models.
If I use the instanceNorm2D layer as following
nn.InstanceNorm2d(ngf,affine=True)
I get the following problem when doing torch.onnx.export
torch.onnx.export(model, (dummy_input, dummy_input), MODEL_DIR + “eye_G.proto”, verbose=True)
File “/anaconda2/lib/python2.7/site-packages/torch/onnx/init.py”, line 83, in export
_export(model, args, f, export_params, verbose, training, input_names, output_names)
File “/anaconda2/lib/python2.7/site-packages/torch/onnx/init.py”, line 138, in _export
_optimize_trace(trace, aten)
File “/anaconda2/lib/python2.7/site-packages/torch/onnx/init.py”, line 94, in _optimize_trace
torch._C._jit_pass_onnx(trace, aten)
File “/anaconda2/lib/python2.7/site-packages/torch/onnx/init.py”, line 180, in _run_symbolic_method
return symbolic_fn(*args)
File “/anaconda2/lib/python2.7/site-packages/torch/onnx/init.py”, line 396, in symbolic
symbolic_output = symbolic_fn(g, *symbolic_args, **kwargs)
File “/anaconda2/lib/python2.7/site-packages/torch/onnx/symbolic.py”, line 552, in instance_norm
if not weight:
RuntimeError: bool value of Tensor with more than one value is ambiguous
If I do nn.InstanceNorm2d(ngf,affine=False)
or nn.InstanceNorm2d(ngf)
, then the export will succeed. Anybody know why?