MCPcopy Index your code
hub / github.com/Turing-Project/WriteGPT / cond

Function cond

LanguageNetwork/GPT2/scripts/modeling.py:786–794  ·  view source on GitHub ↗
(ctx, cache, probs)

Source from the content-addressed store, hash-verified

784 return [new_ids, new_cache, new_probs]
785
786 def cond(ctx, cache, probs):
787 # ctx = tf.Print(ctx,[tf.shape(ctx)])
788 # print('kkkkkkkkkkkkk')
789 # print(ctx[:,-1:])
790 is_eos = tf.reduce_all(tf.reduce_any(tf.equal(ctx[:,-1:], eos_token), axis=1))
791 # print('-----------------')
792 # print(is_eos)
793 is_len = tf.greater(get_shape_list(ctx)[1], min_len)
794 return tf.logical_not(tf.logical_and(is_eos, is_len))
795
796 tokens, cache, probs = tf.while_loop(
797 cond=cond, body=body, maximum_iterations=1025 - get_shape_list(ctx)[1],

Callers

nothing calls this directly

Calls 1

get_shape_listFunction · 0.90

Tested by

no test coverage detected