I am fresher to TensorFlow2 and I write such code to use autograph in Jupyter.
But I get Graph visualization failed error, which give a hint let me refer to tensorflow/tensorboard/issues/1961.
import tensorflow as tf
@tf.function
def strjoin(x,y):
z = tf.strings.join([x,y],separator = " ")
tf.print(z)
return z
result = strjoin(tf.constant("hello"),tf.constant("world"))
print(result)
import datetime
import os
stamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
logdir = os.path.join('data', 'autograph', stamp)
writer = tf.summary.create_file_writer(logdir)
tf.summary.trace_on(graph=True, profiler=True)
result = strjoin("hello","world")
with writer.as_default():
tf.summary.trace_export(
name="autograph",
step=0,
profiler_outdir=logdir)
%load_ext tensorboard
%tensorboard --logdir ./data/autograph/

Here are the related packages versions:
tensorboard 2.1.1
tensorflow-estimator 2.1.0
tensorflow-gpu 2.1.0
It seems that TensorFlow doesn't trace any graph, but I did turn the trace on.
Could anyone help me?
Thanks in advance.