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 all commits
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
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
Expand Up @@ -33786,9 +33786,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
17 changes: 12 additions & 5 deletions onnx/defs/tensor/defs.cc
Expand Up @@ -1066,17 +1066,24 @@ 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).
const char* Transpose_doc = R"DOC(
Returns a transpose of the input tensor. (Similar to 1numpy.transpose1).
The optional 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).
If the attribute `perm` is omitted, its default value is `(n-1, ..., 0)`,
where `n` is the rank of the input tensor.
)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
Expand Up @@ -1703,17 +1703,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 @@ -1773,17 +1767,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
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