Skip to content

Commit

Permalink
Fixes default dtype value for onnx hardtanh export (opset11) (#35467)
Browse files Browse the repository at this point in the history
Summary:
Oneline fix to lara-hdr 's PR #30169.

Default `dtype` value should be set when `dtype is None` rather than when `dtype is not None`.

I didn't make an issue for this as such a small change but I have been using this locally in order to export a model with opset 11 (opset 10 still works).
Pull Request resolved: #35467

Differential Revision: D20686048

Pulled By: mruberry

fbshipit-source-id: 726a5f9c0711c7a79b171fe98b602cdef27f9b31
  • Loading branch information
julianmack authored and gchanan committed Apr 7, 2020
1 parent 63dcd9e commit 6c519a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torch/onnx/symbolic_opset11.py
Expand Up @@ -21,7 +21,7 @@
@parse_args('v', 'f', 'f')
def hardtanh(g, self, min_val, max_val):
dtype = self.type().scalarType()
if dtype is not None:
if dtype is None:
dtype = 6 # float
else:
dtype = sym_help.scalar_type_to_onnx.index(sym_help.cast_pytorch_to_onnx[dtype])
Expand Down

0 comments on commit 6c519a1

Please sign in to comment.