TensorFlow-Examples icon indicating copy to clipboard operation
TensorFlow-Examples copied to clipboard

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

Open nucccc opened this issue 2 years ago • 6 comments

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

nucccc avatar Mar 13 '22 16:03 nucccc

已经收到您的邮件。

xy-always avatar Mar 13 '22 16:03 xy-always

您好!很开心收到您的邮件。我将在查看邮件后,尽快给您回复。

xmingpyccnu avatar Mar 13 '22 16:03 xmingpyccnu

Your comment helped me. Thank you!

gpendrys avatar Jun 09 '22 01:06 gpendrys

已经收到您的邮件。

xy-always avatar Jun 09 '22 01:06 xy-always

这是来自QQ邮箱的假期自动回复邮件。您好,您的邮件已经收到。谢谢您,祝顺利。

Alexzhang369 avatar Jun 09 '22 01:06 Alexzhang369

谢谢您给马坤发送邮件,我会及时查看的,谢谢,辛苦了

jiandandema avatar Jun 09 '22 01:06 jiandandema