Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion torch/onnx/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ def softmax(g, input, dim=None):
# [0.167, 0.167, 0.167]]
# So only when dim and axis both equal to ndim - 1 (the last dimension),
# their semantics are equivalent.
if len(input.type().sizes()) != dim + 1:
if dim < 0:
check_dim = len(input.type().sizes()) + dim
if len(input.type().sizes()) != check_dim + 1:
return _unimplemented("dim", "ONNX and PyTorch use different strategies to split the input.")
return g.op('Softmax', input, axis_i=dim)

Expand Down