How can I pull/push data between gpu and cpu in tensorflow
问题 I used a temporary tensor to store data in my customized gpu-based op. For debug purpose, I want to print the data of this tensor by traditional printf inside C++. How can I pull this gpu-based tensor to cpu and then print its contents. Thank you very much. 回答1: If by temporary you mean allocate_temp instead of allocate_output , there is no way of fetching the data on the python side. I usually return the tensor itself during debugging so that a simple sess.run fetches the result. Otherwise,