(graph_def, max_const_size=32)
return strip_def
Strip large constant values from graph_def.

    Taken from
    http://stackoverflow.com/questions/38189119/simple-way-to-visualize-a-
    tensorflow-graph-in-jupyter
Strip large constant values from graph_def.
Strip large constant values from graph_def .
def strip_consts(graph_def, max_const_size=32):
    """Strip large constant values from graph_def.

    Taken from
    http://stackoverflow.com/questions/38189119/simple-way-to-visualize-a-
    tensorflow-graph-in-jupyter
    """
    strip_def = tf.GraphDef()
    for n0 in graph_def.node:
        n = strip_def.node.add()
        n.MergeFrom(n0)
        if n.op == 'Const':
            tensor = n.attr['value'].tensor
            size = len(tensor.tensor_content)
            if size > max_const_size:
                tensor.tensor_content = str.encode("<stripped %d bytes>" % size)
    return strip_def
def strip_consts ( graph_def , max_const_size = 32 ) : strip_def = tf . GraphDef ( ) for n0 in graph_def . node : n = strip_def . node . add ( ) n . MergeFrom ( n0 ) if n . op == 'Const' : tensor = n . attr [ 'value' ] . tensor size = len ( tensor . tensor_content ) if size > max_const_size : tensor . tensor_content = str . encode ( "<stripped %d bytes>" % size ) return strip_def