#NEWLINE# def _set_model( self , model ) : #NEWLINE# #INDENT# import tensorflow as tf #NEWLINE# import keras.backend.tensorflow_backend as KTF #NEWLINE# self . model = model #NEWLINE# self . sess = KTF . get_session ( ) #NEWLINE# if ( self . histogram_freq and ( self . merged is None ) ) : #NEWLINE# #INDENT# layers = self . model . layers #NEWLINE# for layer in layers : #NEWLINE# #INDENT# if hasattr ( layer , 'W' ) : #NEWLINE# #INDENT# tf . histogram_summary ( '{}_W' . format ( layer ) , layer . W ) #NEWLINE# #UNINDENT# if hasattr ( layer , 'b' ) : #NEWLINE# #INDENT# tf . histogram_summary ( '{}_b' . format ( layer ) , layer . b ) #NEWLINE# #UNINDENT# if hasattr ( layer , 'output' ) : #NEWLINE# #INDENT# tf . histogram_summary ( '{}_out' . format ( layer ) , layer . output ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . merged = tf . merge_all_summaries ( ) #NEWLINE# self . writer = tf . train . SummaryWriter ( self . log_dir , self . sess . graph_def )