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

Function cond

LanguageNetwork/GPT2/train/modeling.py:782–790  ·  view source on GitHub ↗
(ctx, cache, probs)

Source from the content-addressed store, hash-verified

780 return [new_ids, new_cache, new_probs]
781
782 def cond(ctx, cache, probs):
783 # ctx = tf.Print(ctx,[tf.shape(ctx)])
784 # print('kkkkkkkkkkkkk')
785 # print(ctx[:,-1:])
786 is_eos = tf.reduce_all(tf.reduce_any(tf.equal(ctx[:,-1:], eos_token), axis=1))
787 # print('-----------------')
788 # print(is_eos)
789 is_len = tf.greater(get_shape_list(ctx)[1], min_len)
790 return tf.logical_not(tf.logical_and(is_eos, is_len))
791
792 tokens, cache, probs = tf.while_loop(
793 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