def apply_with_random_selector(x, func, num_cases):
 sel = tf.random_uniform([], maxval=num_cases, dtype=tf.int32)
 return control_flow_ops.merge([func(control_flow_ops.switch(x, tf.equal(sel, case))[1], case) for case in range(num_cases)])[0]

def apply_with_random_selector ( x , func , num_cases ) : sel = tf . random_uniform ( [ ] , maxval = num_cases , dtype = tf . int32 ) return control_flow_ops . merge ( [ func ( control_flow_ops . switch ( x , tf . equal ( sel , case ) ) [ 1 ] , case ) for case in range ( num_cases ) ] ) [ 0 ]
computes func .