संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
टेंसरफ़्लो:: ऑप्स:: कमसम
#include <math_ops.h>
axis
अनुदिश टेंसर x
के संचयी योग की गणना करें।
सारांश
डिफ़ॉल्ट रूप से, यह ऑप एक समावेशी कमसम निष्पादित करता है, जिसका अर्थ है कि इनपुट का पहला तत्व आउटपुट के पहले तत्व के समान है:
tf.cumsum([a, b, c]) # => [a, a + b, a + b + c]
exclusive
क्वार्ग को True
पर सेट करके, इसके बजाय एक एक्सक्लूसिव कमसम निष्पादित किया जाता है:
tf.cumsum([a, b, c], exclusive=True) # => [0, a, a + b]
reverse
क्वार्ग को True
पर सेट करके, कमसम विपरीत दिशा में किया जाता है:
tf.cumsum([a, b, c], reverse=True) # => [a + b + c, b + c, c]
यह अलग-अलग tf.reverse
ऑप्स का उपयोग करने से अधिक कुशल है।
reverse
और exclusive
क्वार्ग को भी जोड़ा जा सकता है:
tf.cumsum([a, b, c], exclusive=True, reverse=True) # => [b + c, c, 0]
तर्क:
- स्कोप: एक स्कोप ऑब्जेक्ट
- एक्स: एक
Tensor
। निम्न प्रकारों में से एक होना चाहिए: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
। - अक्ष:
int32
प्रकार का एक Tensor
(डिफ़ॉल्ट: 0)। [-rank(x), rank(x))
सीमा में होना चाहिए।
वैकल्पिक विशेषताएँ (देखें Attrs
):
- एक्सक्लूसिव: यदि
True
, तो एक्सक्लूसिव कमसम निष्पादित करें। - रिवर्स: एक
bool
(डिफ़ॉल्ट: गलत)।
रिटर्न:
सार्वजनिक गुण
सार्वजनिक समारोह
नोड
::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 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 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```"]]