Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update transpose doc #6072

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 21 additions & 9 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4413,9 +4413,13 @@ This version of the operator has been available since version 1 of the default O

### <a name="Transpose-1"></a>**Transpose-1**</a>

Transpose the input tensor similar to numpy.transpose. For example, when
perm=(1, 0, 2), given an input tensor of shape (1, 2, 3), the output shape
will be (2, 1, 3).
Transpose the input tensor similar to numpy.transpose. The attribute `perm`
must be a permutation of the dimensions of the input tensor. Axis `i` of the
output tensor corresponds to the axis `perm[i]` of the input tensor.
For example, when perm=(1, 0, 2), given an input tensor of shape (1, 2, 3),
the output shape will be (2, 1, 3).
When perm=(1, 2, 0), given an input tensor of shape (1, 2, 3),
the output shape will be (2, 3, 1).

#### Version

Expand Down Expand Up @@ -18634,9 +18638,13 @@ This version of the operator has been available since version 13 of the default

### <a name="Transpose-13"></a>**Transpose-13**</a>

Transpose the input tensor similar to numpy.transpose. For example, when
perm=(1, 0, 2), given an input tensor of shape (1, 2, 3), the output shape
will be (2, 1, 3).
Transpose the input tensor similar to numpy.transpose. The attribute `perm`
must be a permutation of the dimensions of the input tensor. Axis `i` of the
output tensor corresponds to the axis `perm[i]` of the input tensor.
For example, when perm=(1, 0, 2), given an input tensor of shape (1, 2, 3),
the output shape will be (2, 1, 3).
When perm=(1, 2, 0), given an input tensor of shape (1, 2, 3),
the output shape will be (2, 3, 1).

#### Version

Expand Down Expand Up @@ -25802,9 +25810,13 @@ This version of the operator has been available since version 21 of the default

### <a name="Transpose-21"></a>**Transpose-21**</a>

Transpose the input tensor similar to numpy.transpose. For example, when
perm=(1, 0, 2), given an input tensor of shape (1, 2, 3), the output shape
will be (2, 1, 3).
Transpose the input tensor similar to numpy.transpose. The attribute `perm`
must be a permutation of the dimensions of the input tensor. Axis `i` of the
output tensor corresponds to the axis `perm[i]` of the input tensor.
For example, when perm=(1, 0, 2), given an input tensor of shape (1, 2, 3),
the output shape will be (2, 1, 3).
When perm=(1, 2, 0), given an input tensor of shape (1, 2, 3),
the output shape will be (2, 3, 1).

#### Version

Expand Down
10 changes: 7 additions & 3 deletions docs/Operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -33725,9 +33725,13 @@ expect(

### <a name="Transpose"></a><a name="transpose">**Transpose**</a>

Transpose the input tensor similar to numpy.transpose. For example, when
perm=(1, 0, 2), given an input tensor of shape (1, 2, 3), the output shape
will be (2, 1, 3).
Transpose the input tensor similar to numpy.transpose. The attribute `perm`
must be a permutation of the dimensions of the input tensor. Axis `i` of the
output tensor corresponds to the axis `perm[i]` of the input tensor.
For example, when perm=(1, 0, 2), given an input tensor of shape (1, 2, 3),
the output shape will be (2, 1, 3).
When perm=(1, 2, 0), given an input tensor of shape (1, 2, 3),
the output shape will be (2, 3, 1).

#### Version

Expand Down
14 changes: 9 additions & 5 deletions onnx/defs/tensor/defs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1074,17 +1074,21 @@
}
}));

static const char* Transpose_ver13_doc = R"DOC(
Transpose the input tensor similar to numpy.transpose. For example, when
perm=(1, 0, 2), given an input tensor of shape (1, 2, 3), the output shape
will be (2, 1, 3).
const char* Transpose_doc = R"DOC(
Transpose the input tensor similar to numpy.transpose. The attribute `perm`
must be a permutation of the dimensions of the input tensor. Axis `i` of the
output tensor corresponds to the axis `perm[i]` of the input tensor.
For example, when perm=(1, 0, 2), given an input tensor of shape (1, 2, 3),
the output shape will be (2, 1, 3).
When perm=(1, 2, 0), given an input tensor of shape (1, 2, 3),
the output shape will be (2, 3, 1).
Fixed Show fixed Hide fixed
)DOC";

ONNX_OPERATOR_SET_SCHEMA(
Transpose,
21,
OpSchema()
.SetDoc(Transpose_ver13_doc)
.SetDoc(Transpose_doc)
.Attr(
"perm",
"A list of integers. By default, reverse the dimensions, "
Expand Down
16 changes: 2 additions & 14 deletions onnx/defs/tensor/old.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1605,17 +1605,11 @@ ONNX_OPERATOR_SET_SCHEMA(
}
}));

static const char* Transpose_ver13_doc = R"DOC(
Transpose the input tensor similar to numpy.transpose. For example, when
perm=(1, 0, 2), given an input tensor of shape (1, 2, 3), the output shape
will be (2, 1, 3).
)DOC";

ONNX_OPERATOR_SET_SCHEMA(
Transpose,
13,
OpSchema()
.SetDoc(Transpose_ver13_doc)
.SetDoc(Transpose_doc)
.Attr(
"perm",
"A list of integers. By default, reverse the dimensions, "
Expand Down Expand Up @@ -1675,17 +1669,11 @@ ONNX_OPERATOR_SET_SCHEMA(
}
}));

static const char* Transpose_ver1_doc = R"DOC(
Transpose the input tensor similar to numpy.transpose. For example, when
perm=(1, 0, 2), given an input tensor of shape (1, 2, 3), the output shape
will be (2, 1, 3).
)DOC";

ONNX_OPERATOR_SET_SCHEMA(
Transpose,
1,
OpSchema()
.SetDoc(Transpose_ver1_doc)
.SetDoc(Transpose_doc)
.Attr(
"perm",
"A list of integers. By default, reverse the dimensions, "
Expand Down
1 change: 1 addition & 0 deletions onnx/defs/tensor/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void KeepAspectRatioHelper(
std::vector<int64_t>& sizes_data);

extern const char* NonZero_ver9_doc;
extern const char* Transpose_doc;

std::function<void(OpSchema&)> PadDocGenerator(
const char* description,
Expand Down