Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Custom print command #18

Open
Open
@sumanthratna

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 use if statements to see if the callable is tf.print. This brings me to the second option:
  • accept a boolean called print_tensorflow that defaults to False. If True, print using tf.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 have click.echo's options implemented (of course, a NotImplementedError could be raised).
    • However, this would limit tableprint to only print and tf.print. If you want to add more callables in the future, you could always change this argument to a string, and use an if statement to see if the string is python, tensorflow, click, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /