-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Super-duper tensor logging functionality #686
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mně se nelíbí, že se printuje všechno nebo nic, tj. že ten tf_print
printuje jenom, když je nastavená environment proměnná. Ten by měl printovat vždycky (třeba jenom kvůli tomu, abysme ho v kódu nezapomínali). Vůbec se mi nelíbí představa, že chci printit jednu věc a printí se mi všechno, obzlášť v transormeru, kde je každá vrstva model part.
Podmínku na debubg mód bych dal do toho dekorátoru spíš.
V transformeru není každá vrstva model part.
Dne st 4. 4. 2018 13:50 uživatel Jindřich Libovický <
notifications@github.com> napsal:
… ***@***.**** requested changes on this pull request.
Mně se nelíbí, že se printuje všechno nebo nic, tj. že ten tf_print
printuje jenom, když je nastavená environment proměnná. Ten by měl
printovat vždycky (třeba jenom kvůli tomu, abysme ho v kódu nezapomínali).
Vůbec se mi nelíbí představa, že chci printit jednu věc a printí se mi
všechno, obzlášť v transormeru, kde je každá vrstva model part.
Podmínku na debubg mód bych dal do toho dekorátoru spíš.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#686 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABwcs2navpd736HhWkowSYfQEQnOBuVvks5tlLN5gaJpZM4TF5Qj>
.
|
keeping "tensorval" inside @tensor decorator
|
Jestli se ti nelíbí, že se to musí explicitně zapnout, je to issue na logging modul a udělal bych to v příštím PR |
Moje idea když se dělal ten debug log byla taková, že ty debug hlášky budou součástí codebase a ty si je budeš moct zapnout. Tj můžeš si zapnout debug z buildění konfiguráku, nebo třeba vypisování tenzorů. To, že ti debug poblije konzoli je normální, proto se to používá jen při debugování, kdy si ten výstup třeba hodíš do souboru, ze kterýho si grepuješ jen zajímavý místa. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, to je přesně to, co se mi nelíbí.
Nikdo ti nebrání používat normální |
Jako quick ugly fix si můžeš do |
Nechci znit jako smartass, ale nechete radej obetovat jedno odpoledne a naucit se: Uz ho mame podporovany a navic to umi mnohem vic nez jen tf.Print, umi to i breakpointy apod. |
Thanks, smartasss.. |
This very simple pull request adds the
tf_utils.tf_print
function, which prints out the value of a tensor in the debug log under the labeltensorval
So easy to use! Instead of
x = tf.Print(x, [x])
, justfrom neuralmonkey.tf_utils import tf_print
andx = tf_print(x: tf.Tensor, message: str = None)
!As a bonus, outputs of all
@tensor
-decorated functions that actually return atf.Tensor
are nowtf_print
ed automatically, with a nicely formatted message, like<decoder.runtime_logprobs>: [[[ -1.91085453e+01 -1.91085453e+01 -1.94597607e+01, ...]
You don't have to worry about calling the
py_func
when you are not interested in the tensor values. Thetf_print
function checks that beforehand.So, how to summon this mighty feature? Just run neuralmonkey with
NEURALMONKEY_DEBUG_ENABLE=tensorval
environment variable.