Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
#include <random_ops.h>
Menghasilkan bilangan bulat acak dari distribusi seragam.
Ringkasan
Nilai yang dihasilkan adalah bilangan bulat seragam dalam rentang [minval, maxval)
. minval
batas bawah termasuk dalam rentang, sedangkan batas atas maxval
dikecualikan.
Bilangan bulat acak sedikit bias kecuali maxval - minval
adalah pangkat dua yang tepat. Biasnya kecil untuk nilai maxval - minval
yang jauh lebih kecil daripada kisaran keluaran ( 2^32
atau 2^64
).
Argumen:
- ruang lingkup: Objek Lingkup
- bentuk : Bentuk tensor keluaran.
- nilai minimum: 0-D. Batas bawah inklusif pada bilangan bulat yang dihasilkan.
- nilai maksimal: 0-D. Batas atas eksklusif pada bilangan bulat yang dihasilkan.
Atribut opsional (lihat Attrs
):
- seed: Jika salah satu
seed
atau seed2
disetel bukan nol, pembuat angka acak akan diunggulkan berdasarkan seed yang diberikan. Jika tidak, ia akan diunggulkan dengan benih acak. - seed2: Seed kedua untuk menghindari tabrakan seed.
Pengembalian:
-
Output
: Tensor dengan bentuk tertentu yang diisi dengan bilangan bulat acak seragam.
Fungsi statis publik |
---|
Seed (int64 x) | |
Seed2 (int64 x) | |
Atribut publik
Fungsi publik
Fungsi statis publik
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 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/r1.15/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/r1.15/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/r1.15/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/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)` shape, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` minval, ::`[tensorflow::Input](/versions/r1.15/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/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)` shape, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` minval, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` maxval, const `[RandomUniformInt::Attrs](/versions/r1.15/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/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_random_uniform_int_1ac0cdf1a4f133d9b49df247840a40ff7f) | `::`[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_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/r1.15/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/r1.15/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/r1.15/api_docs/cc/struct/tensorflow/ops/random-uniform-int/attrs) | Optional attribute setters for [RandomUniformInt](/versions/r1.15/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```"]]