컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
텐서플로우:: 작전:: 누적
#include <math_ops.h>
axis
따라 텐서 x
의 누적 합계를 계산합니다.
요약
기본적으로 이 작업은 포괄적인 누적을 수행합니다. 즉, 입력의 첫 번째 요소가 출력의 첫 번째 요소와 동일함을 의미합니다.
tf.cumsum([a, b, c]) # => [a, a + b, a + b + c]
exclusive
kwarg를 True
로 설정하면 대신 독점 누적이 수행됩니다.
tf.cumsum([a, b, c], exclusive=True) # => [0, a, a + b]
reverse
kwarg를 True
로 설정하면 누적이 반대 방향으로 수행됩니다.
tf.cumsum([a, b, c], reverse=True) # => [a + b + c, b + c, c]
이는 별도의 tf.reverse
작업을 사용하는 것보다 더 효율적입니다.
reverse
및 exclusive
kwargs를 결합할 수도 있습니다.
tf.cumsum([a, b, c], exclusive=True, reverse=True) # => [b + c, c, 0]
인수:
- 범위: 범위 개체
- x:
Tensor
. 다음 유형 중 하나여야 합니다: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
. - axis:
int32
유형의 Tensor
(기본값: 0). [-rank(x), rank(x))
범위 내에 있어야 합니다.
선택적 속성( Attrs
참조):
- 배타적:
True
인 경우 배타적 누적을 수행합니다. - reverse:
bool
(기본값: False)
보고:
공개 속성
공공 기능
마디
::tensorflow::Node * node() const
operator::tensorflow::Input() const
연산자::텐서플로우::출력
operator::tensorflow::Output() const
공개 정적 함수
독점적인
Attrs Exclusive(
bool x
)
뒤집다
Attrs Reverse(
bool x
)
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[],[],null,["# tensorflow::ops::Cumsum Class Reference\n\ntensorflow::ops::Cumsum\n=======================\n\n`#include \u003cmath_ops.h\u003e`\n\nCompute the cumulative sum of the tensor `x` along `axis`.\n\nSummary\n-------\n\nBy default, this op performs an inclusive cumsum, which means that the first element of the input is identical to the first element of the output:\n\n\n```text\ntf.cumsum([a, b, c]) # =\u003e [a, a + b, a + b + c]\n```\n\n\u003cbr /\u003e\n\nBy setting the `exclusive` kwarg to `True`, an exclusive cumsum is performed instead:\n\n\n```text\ntf.cumsum([a, b, c], exclusive=True) # =\u003e [0, a, a + b]\n```\n\n\u003cbr /\u003e\n\nBy setting the `reverse` kwarg to `True`, the cumsum is performed in the opposite direction:\n\n\n```text\ntf.cumsum([a, b, c], reverse=True) # =\u003e [a + b + c, b + c, c]\n```\n\n\u003cbr /\u003e\n\nThis is more efficient than using separate `tf.reverse` ops.\n\nThe `reverse` and `exclusive` kwargs can also be combined:\n\n\n```text\ntf.cumsum([a, b, c], exclusive=True, reverse=True) # =\u003e [b + c, c, 0]\n```\n\n\u003cbr /\u003e\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- x: A [Tensor](/versions/r1.15/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor). Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`.\n- axis: A [Tensor](/versions/r1.15/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) of type `int32` (default: 0). Must be in the range `[-rank(x), rank(x))`.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/cumsum/attrs#structtensorflow_1_1ops_1_1_cumsum_1_1_attrs)):\n\n- exclusive: If `True`, perform exclusive cumsum.\n- reverse: A `bool` (default: False).\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): The out tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [Cumsum](#classtensorflow_1_1ops_1_1_cumsum_1ac4bff34c1fffc1a64355bd97e38887d2)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` x, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` axis)` ||\n| [Cumsum](#classtensorflow_1_1ops_1_1_cumsum_1afe84204de0e7a885385374174240fcc3)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` x, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` axis, const `[Cumsum::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/cumsum/attrs#structtensorflow_1_1ops_1_1_cumsum_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_cumsum_1abe2a855b0b89aedaadef5b1ab2d495f6) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [out](#classtensorflow_1_1ops_1_1_cumsum_1aa1249678696c8bec40fc3737ff3af4b0) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_cumsum_1a638d380af05abb4f7dbdafb4d578e5c4)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_cumsum_1a433ea12bc76c446dca36009246b62bb4)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_cumsum_1a273a98f7b496769e405300dc1b76addd)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|\n| [Exclusive](#classtensorflow_1_1ops_1_1_cumsum_1a405094be636726578ca6715ceeb29637)`(bool x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/cumsum/attrs#structtensorflow_1_1ops_1_1_cumsum_1_1_attrs) |\n| [Reverse](#classtensorflow_1_1ops_1_1_cumsum_1affad4b03f430a883b021c21fafd4ddbf)`(bool x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/cumsum/attrs#structtensorflow_1_1ops_1_1_cumsum_1_1_attrs) |\n\n| ### Structs ||\n|--------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::Cumsum::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/cumsum/attrs) | Optional attribute setters for [Cumsum](/versions/r1.15/api_docs/cc/class/tensorflow/ops/cumsum#classtensorflow_1_1ops_1_1_cumsum). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### out\n\n```text\n::tensorflow::Output out\n``` \n\nPublic functions\n----------------\n\n### Cumsum\n\n```gdscript\n Cumsum(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input x,\n ::tensorflow::Input axis\n)\n``` \n\n### Cumsum\n\n```gdscript\n Cumsum(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input x,\n ::tensorflow::Input axis,\n const Cumsum::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### Exclusive\n\n```text\nAttrs Exclusive(\n bool x\n)\n``` \n\n### Reverse\n\n```text\nAttrs Reverse(\n bool x\n)\n```"]]