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

Commit

Permalink
Fix assignment of neuron's position arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
taneta authored and ludwigschubert committed May 15, 2018
1 parent 61407bc commit 24c0b92
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lucid/optvis/objectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,9 @@ def neuron(layer_name, channel_n, x=None, y=None, batch=None):
def inner(T):
layer = T(layer_name)
shape = tf.shape(layer)
if x is None:
x_ = shape[1] // 2
if y is None:
y_ = shape[2] // 2
x_ = shape[1] // 2 if x is None else x
y_ = shape[2] // 2 if y is None else y

if batch is None:
return layer[:, x_, y_, channel_n]
else:
Expand Down Expand Up @@ -188,8 +187,8 @@ def direction_neuron(layer_name, vec, batch=None, x=None, y=None):
def inner(T):
layer = T(layer_name)
shape = tf.shape(layer)
x_ = shape[1] / 2 if x is None else x
y_ = shape[2] / 2 if y is None else y
x_ = shape[1] // 2 if x is None else x
y_ = shape[2] // 2 if y is None else y
if batch is None:
return tf.reduce_mean(layer[:, x_, y_] * vec[None])
else:
Expand Down

0 comments on commit 24c0b92

Please sign in to comment.