tf.keras.backend.arange
Stay organized with collections
Save and categorize content based on your preferences.
Creates a 1D tensor containing a sequence of integers.
tf.keras.backend.arange(
start, stop=None, step=1, dtype='int32'
)
The function arguments use the same convention as
Theano's arange: if only one argument is provided,
it is in fact the "stop" argument and "start" is 0.
The default type of the returned tensor is 'int32'
to
match TensorFlow's default.
Arguments |
start
|
Start value.
|
stop
|
Stop value.
|
step
|
Difference between two successive values.
|
dtype
|
Integer dtype to use.
|
Returns |
An integer tensor.
|
Example:
tf.keras.backend.arange(start=0, stop=10, step=1.5)
<tf.Tensor: id=96, shape=(7,), dtype=float32,
numpy=array([0. , 1.5, 3. , 4.5, 6. , 7.5, 9. ], dtype=float32)>
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-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.keras.backend.arange\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/keras/backend/arange) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/keras/backend.py#L2962-L2997) |\n\nCreates a 1D tensor containing a sequence of integers.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.keras.backend.arange`](/api_docs/python/tf/keras/backend/arange)\n\n\u003cbr /\u003e\n\n tf.keras.backend.arange(\n start, stop=None, step=1, dtype='int32'\n )\n\nThe function arguments use the same convention as\nTheano's arange: if only one argument is provided,\nit is in fact the \"stop\" argument and \"start\" is 0.\n\nThe default type of the returned tensor is `'int32'` to\nmatch TensorFlow's default.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Arguments --------- ||\n|---------|-------------------------------------------|\n| `start` | Start value. |\n| `stop` | Stop value. |\n| `step` | Difference between two successive values. |\n| `dtype` | Integer dtype to use. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| An integer tensor. ||\n\n\u003cbr /\u003e\n\n#### Example:\n\n tf.keras.backend.arange(start=0, stop=10, step=1.5)\n \u003ctf.Tensor: id=96, shape=(7,), dtype=float32,\n numpy=array([0. , 1.5, 3. , 4.5, 6. , 7.5, 9. ], dtype=float32)\u003e"]]