def h5_deconv_data(filename):
    ret = list()
    with h5py.File(filename, "r") as f:
        if 'deconv' not in f.keys():
            return None
        act_data = f['deconv/max_act']
        img_data = f['deconv/img']

        for layer in act_data.keys():
            layer_data = list()
            for fm in range(act_data[layer]['vis'].shape[0]):

                # to avoid storing entire dataset, imgs are cached as needed, have to look up
                batch_ind, img_ind = act_data[layer]['batch_img'][fm]
                img_store = img_data['batch_{}'.format(batch_ind)]
                img_cache_ofs = img_store.attrs[str(img_ind)]

                # have to convert from rgb to rgba and cast as uint32 dtype for bokeh
                plot_img = convert_rgb_to_bokehrgba(img_store['HWC_uint8'][:, :, :, img_cache_ofs])
                plot_deconv = convert_rgb_to_bokehrgba(act_data[layer]['vis'][fm])

                layer_data.append((fm, plot_deconv, plot_img))

            ret.append((layer, layer_data))
    return ret
Read deconv visualization data from hdf5 file.
dataset/ETHPy150Open NervanaSystems/neon/neon/visualizations/data.py/h5_deconv_data