Randomly shuffles a tensor along its first dimension. The tensor is shuffled along dimension 0, such that each `value[j]` is mapped to one and only one `output[i]`. For example, a mapping that might occur for a 3x2 tensor is: ```python [[1, 2], [[5, 6], [3, 4], ==> [1, 2],
(value, seed=None, name=None)
| 258 | @tf_export("random.shuffle", v1=["random.shuffle", "random_shuffle"]) |
| 259 | @deprecation.deprecated_endpoints("random_shuffle") |
| 260 | def random_shuffle(value, seed=None, name=None): |
| 261 | """Randomly shuffles a tensor along its first dimension. |
| 262 | |
| 263 | The tensor is shuffled along dimension 0, such that each `value[j]` is mapped |
| 264 | to one and only one `output[i]`. For example, a mapping that might occur for a |
| 265 | 3x2 tensor is: |
| 266 | |
| 267 | ```python |
| 268 | [[1, 2], [[5, 6], |
| 269 | [3, 4], ==> [1, 2], |
| 270 | [5, 6]] [3, 4]] |
| 271 | ``` |
| 272 | |
| 273 | Args: |
| 274 | value: A Tensor to be shuffled. |
| 275 | seed: A Python integer. Used to create a random seed for the distribution. |
| 276 | See |
| 277 | `tf.compat.v1.set_random_seed` |
| 278 | for behavior. |
| 279 | name: A name for the operation (optional). |
| 280 | |
| 281 | Returns: |
| 282 | A tensor of same shape and type as `value`, shuffled along its first |
| 283 | dimension. |
| 284 | """ |
| 285 | seed1, seed2 = random_seed.get_seed(seed) |
| 286 | return gen_random_ops.random_shuffle( |
| 287 | value, seed=seed1, seed2=seed2, name=name) |
| 288 | |
| 289 | |
| 290 | @tf_export("image.random_crop", v1=["image.random_crop", "random_crop"]) |