#NEWLINE# def h5_deconv_data( filename ) : #NEWLINE# #INDENT# '\n    Read deconv visualization data from hdf5 file.\n\n    Returns:\n        list of lists. Each inner list represents one layer, and consists of\n        tuples (fm, deconv_data)\n    ' #NEWLINE# ret = list ( ) #NEWLINE# with h5py . File ( filename , 'r' ) as f : #NEWLINE# #INDENT# if ( 'deconv' not in f . keys ( ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# act_data = f [ 'deconv/max_act' ] #NEWLINE# img_data = f [ 'deconv/img' ] #NEWLINE# for layer in act_data . keys ( ) : #NEWLINE# #INDENT# layer_data = list ( ) #NEWLINE# for fm in range ( batch_ind [ layer ] [ 'vis' ] . shape [ 0 ] ) : #NEWLINE# #INDENT# ( batch_ind , img_ind ) = act_data [ layer ] [ 'batch_img' ] [ fm ] #NEWLINE# img_store = img_data [ 'batch_{}' . format ( batch_ind ) ] #NEWLINE# img_cache_ofs = img_store . attrs [ str ( img_ind ) ] #NEWLINE# plot_img = convert_rgb_to_bokehrgba ( img_store [ 'HWC_uint8' ] [ : , : , : , img_cache_ofs ] ) #NEWLINE# plot_deconv = convert_rgb_to_bokehrgba ( act_data [ layer ] [ 'vis' ] [ fm ] ) #NEWLINE# layer_data . append ( ( fm , plot_deconv , plot_img ) ) #NEWLINE# #UNINDENT# ret . append ( ( layer , layer_data ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ret