Fix some typos in documentation (#23507)
Summary:
~~In case of tensor indexing with a scalar index, index_select returns a tensor with the same rank as the input. To match this behavior in ONNX, we make index a 1D tensor so that with a gather
it also produces a tensor with the same rank as the input.~~
Pull Request resolved: https://github.com/pytorch/pytorch/pull/23507
Differential Revision: D16586805
Pulled By: bddppq
fbshipit-source-id: 8f5d964d368873ec372773a29803b25f29a81def
diff --git a/torch/onnx/symbolic_opset9.py b/torch/onnx/symbolic_opset9.py
index 6d2b44f..9d4a6b9 100644
--- a/torch/onnx/symbolic_opset9.py
+++ b/torch/onnx/symbolic_opset9.py
@@ -976,9 +976,10 @@
@parse_args('v', 'i', 'v')
def index_select(g, self, dim, index):
- # In case of a scaler index, index_select returns a tensor with the same rank as the input.
- # To match this bahavior in ONNX, we make index a 1D tensor so that the following gather
+ # In case of a scalar index, index_select returns a tensor with the same rank as the input.
+ # To match this behavior in ONNX, we make index a 1D tensor so that the following gather
# also produces a tensor with the same rank as the input.
+
index_const = sym_help._maybe_get_scalar(index)
index_dim = index.type().dim()
if not sym_help._is_value(index_const):