コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
#include <random_ops.h>
一様分布からランダムな整数を出力します。
まとめ
生成される値は[minval, maxval)
の範囲内の均一な整数です。下限minval
範囲に含まれますが、上限maxval
は除外されます。
maxval - minval
が正確な 2 の累乗でない限り、ランダムな整数にはわずかに偏りが生じます。 maxval - minval
の値が出力の範囲 ( 2^32
または2^64
) より大幅に小さい場合、バイアスは小さくなります。
引数:
- スコープ:スコープオブジェクト
- 形状: 出力テンソルの形状。
- ミンヴァル:0-D。生成された整数の包括的な下限。
- 最大値: 0-D。生成された整数の排他的な上限。
オプションの属性 ( Attrs
を参照):
- シード:
seed
またはseed2
いずれかが 0 以外に設定されている場合、乱数ジェネレーターには指定されたシードがシードされます。それ以外の場合は、ランダム シードによってシードされます。 - シード2: シードの衝突を避けるための 2 番目のシード。
戻り値:
-
Output
: 一様なランダムな整数で満たされた、指定された形状のテンソル。
パブリック属性
公共機能
パブリック静的関数
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 2025-07-26 UTC。"],[],[],null,["# tensorflow::ops::RandomUniformInt Class Reference\n\ntensorflow::ops::RandomUniformInt\n=================================\n\n`#include \u003crandom_ops.h\u003e`\n\nOutputs random integers from a uniform distribution.\n\nSummary\n-------\n\nThe generated values are uniform integers in the range `[minval, maxval)`. The lower bound `minval` is included in the range, while the upper bound `maxval` is excluded.\n\nThe random integers are slightly biased unless `maxval - minval` is an exact power of two. The bias is small for values of `maxval - minval` significantly smaller than the range of the output (either `2^32` or `2^64`).\n\nArguments:\n\n- scope: A [Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- shape: The shape of the output tensor.\n- minval: 0-D. Inclusive lower bound on the generated integers.\n- maxval: 0-D. Exclusive upper bound on the generated integers.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/random-uniform-int/attrs#structtensorflow_1_1ops_1_1_random_uniform_int_1_1_attrs)):\n\n- seed: If either `seed` or `seed2` are set to be non-zero, the random number generator is seeded by the given seed. Otherwise, it is seeded by a random seed.\n- seed2: A second seed to avoid seed collision.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): A tensor of the specified shape filled with uniform random integers.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [RandomUniformInt](#classtensorflow_1_1ops_1_1_random_uniform_int_1a7b0f0233dbf65c942cf3918e6d82450f)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` shape, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` minval, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` maxval)` ||\n| [RandomUniformInt](#classtensorflow_1_1ops_1_1_random_uniform_int_1ae9a8b67a0592c64aeadb9c28b8c94d11)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` shape, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` minval, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` maxval, const `[RandomUniformInt::Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/random-uniform-int/attrs#structtensorflow_1_1ops_1_1_random_uniform_int_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_random_uniform_int_1a71afc20cf5a867f5f4e616265fbdc245) | [Operation](/versions/r2.1/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_random_uniform_int_1ac0cdf1a4f133d9b49df247840a40ff7f) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|------------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_random_uniform_int_1a49b64e7338480155d405c8857052dba8)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_random_uniform_int_1ab20d5478b1e7f66bec1208d955bc485f)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_random_uniform_int_1a3a4c37bc4f79b459f17c8d6d01e4024c)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|\n| [Seed](#classtensorflow_1_1ops_1_1_random_uniform_int_1a62449aa6617d6d92891fbd702315d3d6)`(int64 x)` | [Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/random-uniform-int/attrs#structtensorflow_1_1ops_1_1_random_uniform_int_1_1_attrs) |\n| [Seed2](#classtensorflow_1_1ops_1_1_random_uniform_int_1a88e15830d1509a59f35301ecfe8aee1c)`(int64 x)` | [Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/random-uniform-int/attrs#structtensorflow_1_1ops_1_1_random_uniform_int_1_1_attrs) |\n\n| ### Structs ||\n|-----------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::RandomUniformInt::Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/random-uniform-int/attrs) | Optional attribute setters for [RandomUniformInt](/versions/r2.1/api_docs/cc/class/tensorflow/ops/random-uniform-int#classtensorflow_1_1ops_1_1_random_uniform_int). |\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### RandomUniformInt\n\n```gdscript\n RandomUniformInt(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input shape,\n ::tensorflow::Input minval,\n ::tensorflow::Input maxval\n)\n``` \n\n### RandomUniformInt\n\n```gdscript\n RandomUniformInt(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input shape,\n ::tensorflow::Input minval,\n ::tensorflow::Input maxval,\n const RandomUniformInt::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### Seed\n\n```text\nAttrs Seed(\n int64 x\n)\n``` \n\n### Seed2\n\n```text\nAttrs Seed2(\n int64 x\n)\n```"]]