-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
It'd be useful if tableprint could accept a custom print command. In my use case, I want to progressively (print-as-I-go) print the values of TensorFlow 2 tensors in a table.
In autograph, the only way to print TensorFlow tensors is with tf.print—using print(my_tensor) doesn't print the value.
I can think of two ways to approach this:
- accept a callable that defaults to Python's
print.- The only problem is that there are certain options that tableprint may need to pass to
tf.print; for example,output_stream. Since these arguments differ from those of Python's print, tableprint's implementation will need to useifstatements to see if the callable istf.print. This brings me to the second option:
- The only problem is that there are certain options that tableprint may need to pass to
- accept a boolean called
print_tensorflowthat defaults toFalse. IfTrue, print usingtf.print.- I like this idea better since the first option implies that any callable can be used, such as
click.echo, even if tableprint doesn't haveclick.echo's options implemented (of course, aNotImplementedErrorcould be raised). - However, this would limit tableprint to only
printandtf.print. If you want to add more callables in the future, you could always change this argument to a string, and use anifstatement to see if the string ispython,tensorflow,click, etc.
- I like this idea better since the first option implies that any callable can be used, such as
Metadata
Metadata
Assignees
Labels
No labels