Stay organized with collections
Save and categorize content based on your preferences.
#include <random_ops.h>
Outputs random integers from a uniform distribution.
Summary
The 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.
The 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
).
Arguments:
- scope: A Scope object
- shape: The shape of the output tensor.
- minval: 0-D. Inclusive lower bound on the generated integers.
- maxval: 0-D. Exclusive upper bound on the generated integers.
Optional attributes (see Attrs
):
- 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.
- seed2: A second seed to avoid seed collision.
Returns:
Output
: A tensor of the specified shape filled with uniform random integers.
Public static functions
|
Seed(int64 x)
|
|
Seed2(int64 x)
|
|
Public attributes
Public functions
Public static functions
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-04-20 UTC.
[null,null,["Last updated 2020-04-20 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```"]]