Skip to content

Instantly share code, notes, and snippets.

@kretes
Created May 10, 2021 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kretes/ce4daa95e37d6d2d8d9e2d2eb0507a70 to your computer and use it in GitHub Desktop.
Save kretes/ce4daa95e37d6d2d8d9e2d2eb0507a70 to your computer and use it in GitHub Desktop.
A short utility to apply over a tf.data.Dataset to display what is it processing at given stage
def print_ds(ds, what):
def print_elems(*args):
tf.print(f"len of {what}", len(args), *[tf.shape(a) for a in args], args[-1])
return tuple(args)
return ds.map(print_elems)
ds = print_ds(ds, "1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment