# tf.contrib.training.RandomStrategy

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/training/python/training/device_setter.py#L28-L53) |

Returns a random PS task for op placement.

    tf.contrib.training.RandomStrategy(
        num_ps_tasks, seed=0
    )

This may perform better than the default round-robin placement if you
have a large number of variables. Depending on your architecture and
number of parameter servers, round-robin can lead to situations where
all of one type of variable is placed on a single PS task, which may
lead to contention issues.

This strategy uses a hash function on the name of each op for deterministic
placement.

## Methods

### `__call__`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/training/python/training/device_setter.py#L46-L53)

    __call__(
        op
    )

Chooses a ps task index for the given `Operation`.