コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
テンソルフロー::作戦::埋める
#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
、実行時に実際のTensor値を構築する Op を計算グラフに作成します。これは、 Const
ノードを使用してTensor全体をグラフに埋め込むtf.constant
とは対照的です。 -
tf.fill
グラフの実行時に評価されるため、 tf.constant
とは異なり、他の実行時 Tensor に基づく動的形状をサポートします。
引数:
- スコープ:スコープオブジェクト
- 寸法: 1-D。出力テンソルの形状を表します。
- 値: 0 ~ D (スカラー)。返されたテンソルを満たす値。
(numpy) np.full と同等
戻り値:
パブリック属性
公共機能
ノード
::tensorflow::Node * node() const
operator::tensorflow::Input() const
演算子::tensorflow::出力
operator::tensorflow::Output() const
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 2025-07-26 UTC。"],[],[],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/r1.15/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/r1.15/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/r1.15/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/r1.15/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/r1.15/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/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)` dims, ::`[tensorflow::Input](/versions/r1.15/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/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_fill_1af59efc826ad951c4bb994ccf186b0e3c) | `::`[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_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```"]]