def set_seed(x):
 node_names = list(six.iterkeys(tf.get_default_graph()._nodes_by_name))
 if ((len(node_names) > 0) and (node_names != ['keras_learning_phase'])):
  raise RuntimeError('Seeding is not supported after initializing part of the graph. Please move set_seed to the beginning of your code.')
 np.random.seed(x)
 tf.set_random_seed(x)

def set_seed ( x ) : node_names = list ( six . iterkeys ( tf . get_default_graph ( ) . _nodes_by_name ) ) if ( ( len ( node_names ) > 0 ) and ( node_names != [ 'keras_learning_phase' ] ) ) : raise RuntimeError ( 'Seeding is not supported after initializing part of the graph. Please move set_seed to the beginning of your code.' ) np . random . seed ( x ) tf . set_random_seed ( x )
set seed for both numpy and tensorflow .