Writes a TensorFlow graph summary.

Write an instance of tf.Graph or tf.compat.v1.GraphDef as summary only in an eager mode. Please prefer to use the trace APIs (tf.summary.trace_on, tf.summary.trace_off, and tf.summary.trace_export) when using tf.function which can automatically collect and record graphs from executions.

Usage Example:

graph = tf.Graph()
with graph.as_default():
  c = tf.constant(30.0)
writer = tf.summary.create_file_writer("/tmp/mylogs")
with writer.as_default():

# Another example; must attain the concrete function graph manually.
def f():
  x = constant_op.constant(2)
  y = constant_op.constant(3)
  return x**y

with writer.as_default():

graph_data The TensorFlow graph to write, as a tf.Graph or a tf.compat.v1.GraphDef.

True on success, or False if no summary was written because no default summary writer was available.

ValueError graph summary API is invoked in a graph mode.