rstudio / tensorflow.rstudio.com

https://tensorflow.rstudio.com
9 stars 12 forks source link

The beginner tutorial, section train and evaluate your model, contains the wrong output #58

Open wbzyl opened 1 year ago

wbzyl commented 1 year ago

Below the last code block on the TensorFlow 2 quick-start for beginners page:

probability_model(x_test[1:5, , ])

output into the HTML document displays as

tf.Tensor([3 2 1 0 4 2 4 0 2 4], shape=(10), dtype=int64)

The output should display y_test[1:5], I think.

tf.Tensor([7 2 1 0 4], shape=(5), dtype=int64)

This issue can be resolved by swapping out the line of code for a different one.

layer_lambda(tf$argmax)  # original
layer_lambda(k_argmax)   # replacement

-- Włodek