Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::Stack
#include <array_ops.h>
Packs a list of N
rank-R
tensors into one rank-(R+1)
tensor.
Summary
Packs 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)
;
if 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.
For example:
# '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]]
This is the opposite of unpack
.
Args:
- scope: A Scope object
- values: Must be of same shape and type.
Optional attributes (see Attrs
):
- axis: Dimension along which to pack. Negative values wrap around, so the valid range is
[-(R+1), R+1)
.
Returns:
Public static functions
|
Axis(int64 x)
|
|
Public attributes
Public functions
node
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Public static functions
Axis
Attrs Axis(
int64 x
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 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\nArgs:\n\n- scope: A [Scope](/versions/r2.14/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.14/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.14/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.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::InputList](/versions/r2.14/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.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::InputList](/versions/r2.14/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` values, const `[Stack::Attrs](/versions/r2.14/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.14/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_stack_1af30b0181ca359975456c27dda4c0ce4e) | `::`[tensorflow::Output](/versions/r2.14/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.14/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.14/api_docs/cc/struct/tensorflow/ops/stack/attrs) | Optional attribute setters for [Stack](/versions/r2.14/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```"]]