Search code examples
pythontensorflowbazel

How to experiment with placement algorithm in TensorFlow


I'm aware that TF doesn't implement the node placement algorithm they proposed in their whitepaper (yet). TF currently only offers the 'simple_placer'.

If I want to experiment with a different algorithm and cost model, is there a simple way I can implement/test this without recompiling the entire TF and reinstalling it with Pip?


Solution

  • You can use Python device setter function to decide where to place nodes during Python graph construction time.

    Examples:

    1. https://stackoverflow.com/a/39991649/419116
    2. https://github.com/tensorflow/tensorflow/blob/e7508b6efd51f7cfed32ff277e805f8ea60a7a48/tensorflow/contrib/training/python/training/device_setter_test.py