MCPcopy Create free account
hub / github.com/pytorch/tutorials / evaluateRandomly

Function evaluateRandomly

intermediate_source/seq2seq_translation_tutorial.py:758–766  ·  view source on GitHub ↗
(encoder, decoder, n=10)

Source from the content-addressed store, hash-verified

756#
757
758def evaluateRandomly(encoder, decoder, n=10):
759 for i in range(n):
760 pair = random.choice(pairs)
761 print('>', pair[0])
762 print('=', pair[1])
763 output_words, _ = evaluate(encoder, decoder, pair[0], input_lang, output_lang)
764 output_sentence = ' '.join(output_words)
765 print('<', output_sentence)
766 print('')
767
768
769######################################################################

Callers 1

Calls 1

evaluateFunction · 0.70

Tested by

no test coverage detected