I would like to retrieve tensorflow device placement as data I can manipulate from within python.
I use tf.debugging.set_log_device_placement(True) to log the device placement to stderr, however I haven’t found a way to catch it into a variable.
I tried both using contextlib.redirect_stderr and adding a StreamHandler to tf.get_logger(), none of these resulted in the logging output being caught.
Alright fair enough.
I wonder though why python’s contextlib.redirect_stderr isn’t able to catch it… But that’s more of a python question than a tensorflow. But if anyone knows answer I take it