Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

possible issue at: tensorflow_v2/notebooks/3_NeuralNetworks/autoencoder.ipynb #406

Open
nucccc opened this issue Mar 13, 2022 · 6 comments

Comments

@nucccc
Copy link

nucccc commented Mar 13, 2022

Referring to the notebook:

https://github.com/aymericdamien/TensorFlow-Examples/blob/master/tensorflow_v2/notebooks/3_NeuralNetworks/autoencoder.ipynb

In the following code portion (8th code block of the notebook):

`# Optimization process.
def run_optimization(x):
# Wrap computation inside a GradientTape for automatic differentiation.
with tf.GradientTape() as g:
reconstructed_image = decoder(encoder(x))
loss = mean_square(reconstructed_image, x)

# Variables to update, i.e. trainable variables.
trainable_variables = weights.values() + biases.values()

# Compute gradients.
gradients = g.gradient(loss, trainable_variables)

# Update W and b following gradients.
optimizer.apply_gradients(zip(gradients, trainable_variables))

return loss`

the line:

trainable_variables = weights.values() + biases.values()

results to me in an error due to the impossibility of summing two python dict_values. I personally solved the issue by converting both dict_values to lists:

trainable_variables = list(weights.values()) + list(biases.values())

I hope my issue is of utility for this great repo! Thank you for the work

@xy-always
Copy link

xy-always commented Mar 13, 2022 via email

@xmingpyccnu
Copy link

xmingpyccnu commented Mar 13, 2022 via email

@gpendrys
Copy link

gpendrys commented Jun 9, 2022

Your comment helped me. Thank you!

@xy-always
Copy link

xy-always commented Jun 9, 2022 via email

@Alexzhang369
Copy link

Alexzhang369 commented Jun 9, 2022 via email

@jiandandema
Copy link

jiandandema commented Jun 9, 2022 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants