جریان تنسور:: عملیات:: پر کنید
#include <array_ops.h>
یک تانسور پر از یک مقدار اسکالر ایجاد می کند.
خلاصه
این عملیات یک تانسور از dims
شکل ایجاد می کند و آن را با value
پر می کند.
به عنوان مثال:
# Output tensor has shape [2, 3]. fill([2, 3], 9) ==> [[9, 9, 9] [9, 9, 9]]
tf.fill
از چند جهت با tf.constant
متفاوت است:
-
tf.fill
فقط از محتویات اسکالر پشتیبانی می کند، در حالی کهtf.constant
از مقادیر Tensor پشتیبانی می کند. -
tf.fill
یک Op در نمودار محاسباتی ایجاد می کند که مقدار واقعی Tensor را در زمان اجرا می سازد. این برخلافtf.constant
است که کل Tensor را با گرهConst
در نمودار جاسازی می کند. - از آنجایی که
tf.fill
در زمان اجرا گراف ارزیابی می کند، برخلافtf.constant
از اشکال پویا بر اساس سایر تانسورهای زمان اجرا پشتیبانی می کند.
استدلال ها:
- scope: یک شی Scope
- کم نور: 1-D. شکل تانسور خروجی را نشان می دهد.
- مقدار: 0-D (اسکالر). مقدار برای پر کردن تانسور برگشتی.
(numpy) معادل np.full
برمیگرداند:
-
Output
: تانسور خروجی.
سازندگان و ویرانگرها | |
---|---|
Fill (const :: tensorflow::Scope & scope, :: tensorflow::Input dims, :: tensorflow::Input value) |
صفات عمومی | |
---|---|
operation | |
output |
توابع عمومی | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
صفات عمومی
عملیات
Operation operation
خروجی
::tensorflow::Output output
توابع عمومی
پر کنید
Fill( const ::tensorflow::Scope & scope, ::tensorflow::Input dims, ::tensorflow::Input value )
گره
::tensorflow::Node * node() const
عملگر::tensorflow::ورودی
operator::tensorflow::Input() const
عملگر::tensorflow::خروجی
operator::tensorflow::Output() const
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-27 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-27 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# tensorflow::ops::Fill Class Reference\n\ntensorflow::ops::Fill\n=====================\n\n`#include \u003carray_ops.h\u003e`\n\nCreates a tensor filled with a scalar value.\n\nSummary\n-------\n\nThis operation creates a tensor of shape `dims` and fills it with `value`.\n\nFor example:\n\n\n```text\n# Output tensor has shape [2, 3].\nfill([2, 3], 9) ==\u003e [[9, 9, 9]\n [9, 9, 9]]\n```\n\n\u003cbr /\u003e\n\n`tf.fill` differs from `tf.constant` in a few ways:\n\n\n- `tf.fill` only supports scalar contents, whereas `tf.constant` supports [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) values.\n- `tf.fill` creates an Op in the computation graph that constructs the actual [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) value at runtime. This is in contrast to `tf.constant` which embeds the entire [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) into the graph with a `Const` node.\n- Because `tf.fill` evaluates at graph runtime, it supports dynamic shapes based on other runtime Tensors, unlike `tf.constant`.\n\n\u003cbr /\u003e\n\nArguments:\n\n- scope: A [Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- dims: 1-D. Represents the shape of the output tensor.\n- value: 0-D (scalar). Value to fill the returned tensor.\n\n\u003cbr /\u003e\n\n(numpy) Equivalent to np.full\n\nReturns:\n\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): The output tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [Fill](#classtensorflow_1_1ops_1_1_fill_1a01c1c041aa66636af36c215a28cad8f8)`(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)` dims, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` value)` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_fill_1ab58dad131aa0ced03a7b508cb5f17ee8) | [Operation](/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_fill_1af59efc826ad951c4bb994ccf186b0e3c) | `::`[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_fill_1a470a2e887eb44734252766d0f4759b04)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_fill_1a7eb9e821e29fbfa81a25dd5ae382ce1f)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_fill_1a952032189c0e55332094cc69e197ae06)`() 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### Fill\n\n```gdscript\n Fill(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input dims,\n ::tensorflow::Input value\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```"]]