rstudio / tensorflow.rstudio.com

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

RuntimeError: TypeError #57

Open kode112 opened 1 year ago

kode112 commented 1 year ago

When running the last part of the quickstart advanced tutorial https://tensorflow.rstudio.com/tutorials/quickstart/advanced I get a TypeError. I just copied the code and everything else runs fine. Any suggestions for a solution on that?

EPOCHS <- 1 for (epoch in seq_len(EPOCHS)) {

  • Reset the metrics at the start of the next epoch

  • reset_metrics()
  • train(train_ds)
  • test(test_ds)
  • cat(sprintf('Epoch %d', epoch), "\n")
  • cat(sprintf('Loss: %f', train_loss$result()), "\n")
  • cat(sprintf('Accuracy: %f', train_accuracy$result() * 100), "\n")
  • cat(sprintf('Test Loss: %f', test_loss$result()), "\n")
  • cat(sprintf('Test Accuracy: %f', test_accuracy$result() * 100), "\n")
  • } Error: RuntimeError: TypeError: Cannot convert a list containing a tensor of dtype <dtype: 'int32'> to <dtype: 'string'> (Tensor is: <tf.Tensor: shape=(32,), dtype=int32, numpy= array([0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0])>)