Skip to content

Instantly share code, notes, and snippets.

@kukuruza
kukuruza / gist_cifar10_train.py
Last active Mar 4, 2021
Tensorflow: visualize convolutional filters (conv1) in Cifar10 model
View gist_cifar10_train.py
from math import sqrt
def put_kernels_on_grid (kernel, pad = 1):
'''Visualize conv. filters as an image (mostly for the 1st layer).
Arranges filters into a grid, with some paddings between adjacent filters.
Args:
kernel: tensor of shape [Y, X, NumChannels, NumKernels]
pad: number of black pixels around each filter (between them)