Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Commit dd7ec8d

Browse files
Merge branch 'master' of github.com:tensorflow/lucid
2 parents d80a1ce + 4819432 commit dd7ec8d

File tree

7 files changed

+1574
-5
lines changed

7 files changed

+1574
-5
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ run in your browser.
3636
<img src="https://storage.googleapis.com/lucid-static/common/stickers/colab-tutorial.png" width="500" alt=""></img>
3737
</a>
3838

39+
40+
## Feature Visualization
41+
*Notebooks corresponding to the [Feature Visualization](https://distill.pub/2017/feature-visualization/) article*
42+
43+
<a href="https://colab.research.google.com/github/tensorflow/lucid/blob/master/notebooks/feature-visualization/negative_neurons.ipynb">
44+
<img src="https://storage.googleapis.com/lucid-static/feature-visualization/stickers/colab-neuron-negative.png" width="500" alt=""></img>
45+
</a>
46+
47+
<a href="https://colab.research.google.com/github/tensorflow/lucid/blob/master/notebooks/feature-visualization/neuron_diversity.ipynb">
48+
<img src="https://storage.googleapis.com/lucid-static/feature-visualization/stickers/colab-neuron-diversity.png" width="500" alt=""></img>
49+
</a>
50+
51+
<a href="https://colab.research.google.com/github/tensorflow/lucid/blob/master/notebooks/feature-visualization/neuron_interaction.ipynb">
52+
<img src="https://storage.googleapis.com/lucid-static/feature-visualization/stickers/colab-neuron-interaction.png" width="500" alt=""></img>
53+
</a>
54+
55+
<a href="https://colab.research.google.com/github/tensorflow/lucid/blob/master/notebooks/feature-visualization/regularization.ipynb">
56+
<img src="https://storage.googleapis.com/lucid-static/feature-visualization/stickers/colab-regularization.png" width="500" alt=""></img>
57+
</a>
58+
3959
## Building Blocks
4060
*Notebooks corresponding to the [Building Blocks of Interpretability](https://distill.pub/2018/building-blocks/) article*
4161

lucid/optvis/style.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ def __init__(self, style_layers, ema_decay=None,
4444
outputs of 'style_func'.
4545
"""
4646
self.input_grams = [style_func(s) for s in style_layers]
47+
self.ema = None
4748
if ema_decay is not None:
48-
ema = tf.train.ExponentialMovingAverage(decay=ema_decay)
49-
update_ema_op = ema.apply(self.input_grams)
49+
self.ema = tf.train.ExponentialMovingAverage(decay=ema_decay)
50+
update_ema_op = self.ema.apply(self.input_grams)
5051
with tf.control_dependencies([update_ema_op]):
51-
self.effective_grams = [g + tf.stop_gradient(ema.average(g)-g)
52-
for g in self.input_grams]
52+
self.effective_grams = [g + tf.stop_gradient(self.ema.average(g)-g)
53+
for g in self.input_grams]
5354
else:
5455
self.effective_grams = self.input_grams
5556

lucid/scratch/web/svelte.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def inner(data):
6868
@register_cell_magic
6969
def html_define_svelte(line, cell):
7070
base_name = line.split()[0]
71-
name_str = base_name + "_" + str(uuid.uuid4())
71+
# name_str will become the name of a javascript variable, and can't contain dashes.
72+
name_str = base_name + "_" + str(uuid.uuid4()).replace('-', '_')
7273
html_fname = osp.join(_svelte_temp_dir, name_str + ".html")
7374
with open(html_fname, "w") as f:
7475
f.write(cell)

notebooks/feature-visualization/negative_neurons.ipynb

Lines changed: 244 additions & 0 deletions
Large diffs are not rendered by default.

notebooks/feature-visualization/neuron_diversity.ipynb

Lines changed: 251 additions & 0 deletions
Large diffs are not rendered by default.

notebooks/feature-visualization/neuron_interaction.ipynb

Lines changed: 496 additions & 0 deletions
Large diffs are not rendered by default.

notebooks/feature-visualization/regularization.ipynb

Lines changed: 556 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)