Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save previtus/c915b322911a545af1db45721a1ba57f to your computer and use it in GitHub Desktop.
Save previtus/c915b322911a545af1db45721a1ba57f to your computer and use it in GitHub Desktop.
#when facing similar issue to the one mentioned at https://github.com/tensorflow/tensorflow/issues/1439
import tensorflow as tf
print("Count of global variables", len(tf.global_variables()))
print("Count of graph elements",len(tf.get_default_graph().get_operations()))
def memory_check():
import os, subprocess
out = subprocess.Popen(['ps', 'v', '-p', str(os.getpid())], stdout=subprocess.PIPE).communicate()[0].split(b'\n')
vsz_index = out[0].split().index(b'RSS')
mem = float(out[1].split()[vsz_index]) / 1024
print("Memory:", mem)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment