rstudio / tensorflow

TensorFlow for R
https://tensorflow.rstudio.com
Apache License 2.0
1.32k stars 317 forks source link

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

Closed wbzyl closed 1 year ago

wbzyl commented 1 year ago

Hi!

Below the code

probability_model(x_test[1:5, , ])

was printed

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

This is wrong. It should print shape=(5) tensor, like this one

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

i.e. y_test[1:5].

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

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

-- Włodek

wbzyl commented 1 year ago

Moved to the tensorflow.rstudio.com repository.