Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
dòng chảy căng:: ôi:: ngăn xếp
#include <array_ops.h>
Gói một danh sách các tenxơ hạng N
- R
thành một tenxơ hạng- (R+1)
.
Bản tóm tắt
Đóng gói N
các values
tensor thành một tensor có hạng cao hơn mỗi tensor về values
, bằng cách đóng gói chúng dọc theo kích thước axis
. Cho danh sách các tensor có hình dạng (A, B, C)
;
nếu axis == 0
thì tenxơ output
sẽ có hình dạng (N, A, B, C)
. nếu axis == 1
thì tenxơ output
sẽ có dạng (A, N, B, C)
. Vân vân.
Ví dụ:
# 'x' is [1, 4]
# 'y' is [2, 5]
# 'z' is [3, 6]
pack([x, y, z]) => [[1, 4], [2, 5], [3, 6]] # Pack along first dim.
pack([x, y, z], axis=1) => [[1, 2, 3], [4, 5, 6]]
Điều này trái ngược với unpack
.
Lập luận:
- phạm vi: Một đối tượng Phạm vi
- giá trị: Phải có cùng hình dạng và loại.
Thuộc tính tùy chọn (xem Attrs
):
- trục: Kích thước để đóng gói. Các giá trị âm bao quanh, vì vậy phạm vi hợp lệ là
[-(R+1), R+1)
.
Trả về:
Các hàm tĩnh công khai |
---|
Axis (int64 x) | |
Thuộc tính công khai
Chức năng công cộng
nút
::tensorflow::Node * node() const
operator::tensorflow::Input() const
toán tử::tenorflow::Đầu ra
operator::tensorflow::Output() const
Các hàm tĩnh công khai
Trục
Attrs Axis(
int64 x
)
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[],[],null,["# tensorflow::ops::Stack Class Reference\n\ntensorflow::ops::Stack\n======================\n\n`#include \u003carray_ops.h\u003e`\n\nPacks a list of `N` rank-`R` tensors into one rank-`(R+1)` tensor.\n\nSummary\n-------\n\nPacks the `N` tensors in `values` into a tensor with rank one higher than each tensor in `values`, by packing them along the `axis` dimension. Given a list of tensors of shape `(A, B, C)`;\n\nif `axis == 0` then the `output` tensor will have the shape `(N, A, B, C)`. if `axis == 1` then the `output` tensor will have the shape `(A, N, B, C)`. Etc.\n\nFor example:\n\n\n```text\n# 'x' is [1, 4]\n# 'y' is [2, 5]\n# 'z' is [3, 6]\npack([x, y, z]) =\u003e [[1, 4], [2, 5], [3, 6]] # Pack along first dim.\npack([x, y, z], axis=1) =\u003e [[1, 2, 3], [4, 5, 6]]\n```\n\n\u003cbr /\u003e\n\nThis is the opposite of `unpack`.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- values: Must be of same shape and type.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/stack/attrs#structtensorflow_1_1ops_1_1_stack_1_1_attrs)):\n\n- axis: Dimension along which to pack. Negative values wrap around, so the valid range is `[-(R+1), R+1)`.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): The packed tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [Stack](#classtensorflow_1_1ops_1_1_stack_1aa3a6f6cc75aa0bc3e217610c4b630850)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::InputList](/versions/r2.0/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` values)` ||\n| [Stack](#classtensorflow_1_1ops_1_1_stack_1af619225abec63de439cb9ade43b936a8)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::InputList](/versions/r2.0/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` values, const `[Stack::Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/stack/attrs#structtensorflow_1_1ops_1_1_stack_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_stack_1aa46830d4c02fef768a0142707c6048d7) | [Operation](/versions/r2.0/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_stack_1af30b0181ca359975456c27dda4c0ce4e) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|-----------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_stack_1a934f8ed07dd585da717a4a55f7ffec62)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_stack_1a17fdd11a1152984a35f55b52ff4753f8)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_stack_1aa93a9c40ba77fc16a19e5b1320fea39c)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|-----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|\n| [Axis](#classtensorflow_1_1ops_1_1_stack_1a52044bc69e273453a899ab690fafc227)`(int64 x)` | [Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/stack/attrs#structtensorflow_1_1ops_1_1_stack_1_1_attrs) |\n\n| ### Structs ||\n|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::Stack::Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/stack/attrs) | Optional attribute setters for [Stack](/versions/r2.0/api_docs/cc/class/tensorflow/ops/stack#classtensorflow_1_1ops_1_1_stack). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### Stack\n\n```gdscript\n Stack(\n const ::tensorflow::Scope & scope,\n ::tensorflow::InputList values\n)\n``` \n\n### Stack\n\n```gdscript\n Stack(\n const ::tensorflow::Scope & scope,\n ::tensorflow::InputList values,\n const Stack::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### Axis\n\n```text\nAttrs Axis(\n int64 x\n)\n```"]]