संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
टेंसरफ़्लो:: ऑप्स:: विस्तृत करें
#include <array_ops.h>
टेंसर के आकार में 1 का आयाम सम्मिलित करता है।
सारांश
एक टेंसर input
देखते हुए, यह ऑपरेशन input
के आकार के आयाम सूचकांक axis
पर 1 का आयाम सम्मिलित करता है। आयाम सूचकांक axis
शून्य से प्रारंभ होता है; यदि आप axis
के लिए एक ऋणात्मक संख्या निर्दिष्ट करते हैं तो इसे अंत से पीछे की ओर गिना जाता है।
यदि आप किसी एकल तत्व में बैच आयाम जोड़ना चाहते हैं तो यह ऑपरेशन उपयोगी है। उदाहरण के लिए, यदि आपके पास आकार की एक एकल छवि है [height, width, channels]
, तो आप इसे expand_dims(image, 0)
के साथ 1 छवि का एक बैच बना सकते हैं, जो आकार बनाएगा [1, height, width, channels]
.
अन्य उदाहरण:
# 't' is a tensor of shape [2]
shape(expand_dims(t, 0)) ==> [1, 2]
shape(expand_dims(t, 1)) ==> [2, 1]
shape(expand_dims(t, -1)) ==> [2, 1]
# 't2' is a tensor of shape [2, 3, 5]
shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5]
shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5]
shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1]
इस ऑपरेशन के लिए आवश्यक है कि:
-1-input.dims() <= dim <= input.dims()
यह ऑपरेशन squeeze()
से संबंधित है, जो आकार 1 के आयामों को हटा देता है।
तर्क:
- स्कोप: एक स्कोप ऑब्जेक्ट
- अक्ष: 0-डी (अदिश)। उस आयाम सूचकांक को निर्दिष्ट करता है जिस पर
input
के आकार का विस्तार करना है। [-rank(input) - 1, rank(input)]
सीमा में होना चाहिए।
रिटर्न:
-
Output
: इसमें input
के समान ही डेटा होता है, लेकिन इसके आकार में आकार 1 का एक अतिरिक्त आयाम जोड़ा जाता है।
सार्वजनिक गुण
सार्वजनिक समारोह
नोड
::tensorflow::Node * node() const
operator::tensorflow::Input() const
ऑपरेटर::टेन्सरफ़्लो::आउटपुट
operator::tensorflow::Output() const
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया."],[],[],null,["# tensorflow::ops::ExpandDims Class Reference\n\ntensorflow::ops::ExpandDims\n===========================\n\n`#include \u003carray_ops.h\u003e`\n\nInserts a dimension of 1 into a tensor's shape.\n\nSummary\n-------\n\nGiven a tensor `input`, this operation inserts a dimension of 1 at the dimension index `axis` of `input`'s shape. The dimension index `axis` starts at zero; if you specify a negative number for `axis` it is counted backward from the end.\n\nThis operation is useful if you want to add a batch dimension to a single element. For example, if you have a single image of shape `[height, width, channels]`, you can make it a batch of 1 image with `expand_dims(image, 0)`, which will make the shape `[1, height, width, channels]`.\n\nOther examples:\n\n\n```scdoc\n# 't' is a tensor of shape [2]\nshape(expand_dims(t, 0)) ==\u003e [1, 2]\nshape(expand_dims(t, 1)) ==\u003e [2, 1]\nshape(expand_dims(t, -1)) ==\u003e [2, 1]\n```\n\n\u003cbr /\u003e\n\n\n```scdoc\n# 't2' is a tensor of shape [2, 3, 5]\nshape(expand_dims(t2, 0)) ==\u003e [1, 2, 3, 5]\nshape(expand_dims(t2, 2)) ==\u003e [2, 3, 1, 5]\nshape(expand_dims(t2, 3)) ==\u003e [2, 3, 5, 1]\n```\n\n\u003cbr /\u003e\n\nThis operation requires that:\n\n\n`-1-input.dims() \u003c= dim \u003c= input.dims()`\n\nThis operation is related to `squeeze()`, which removes dimensions of size 1.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- axis: 0-D (scalar). Specifies the dimension index at which to expand the shape of `input`. Must be in the range `[-rank(input) - 1, rank(input)]`.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): Contains the same data as `input`, but its shape has an additional dimension of size 1 added.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [ExpandDims](#classtensorflow_1_1ops_1_1_expand_dims_1ae2cff3dc910140a50446ed380848baef)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` axis)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_expand_dims_1aefcdcc72ed92eb8f0975a90ca998bb71) | [Operation](/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_expand_dims_1abc828c5e90fdd61142ffd01878f9f95a) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|-----------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_expand_dims_1a85ce8553584a8b3a50345d93f0f03b52)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_expand_dims_1aabc0c1aba83330412277a5b6e6f2c04e)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_expand_dims_1a280db99846027451637ac5d7e7a9d67e)`() const ` | ` ` ` ` |\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### ExpandDims\n\n```gdscript\n ExpandDims(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input axis\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```"]]