Reputation: 719
I am new to Tensorflow. I heard really great things about the tensorflow interface to R. I am however finding it difficult to run example listed here: https://tensorflow.rstudio.com/tensorflow/articles/examples/linear_regression_multiple.html
The specific problem is in the following lines
while (TRUE) {
+ session$run(optimizer, feed_dict = feed_dict)
+ current_cost <- session$run(cost, feed_dict = feed_dict)
+ if (last_cost - current_cost < epsilon) break
+ last_cost <- current_cost
+ }
This throws the following error :
Error in py_call_impl(callable, dots$args, dots$keywords) :
TypeError: Fetch argument <tensorflow.python.training.gradient_descent.GradientDescentOptimizer object at 0x126eaaf50> of <tensorflow.python.training.gradient_descent.GradientDescentOptimizer object at 0x126eaaf50> has invalid type <class 'tensorflow.python.training.gradient_descent.GradientDescentOptimizer'>, must be a string or Tensor. (Can not convert a GradientDescentOptimizer into a Tensor or Operation.)
The only thing I have changed from the above example is :
tf$global_variables_initializer
to
tf$initialize_all_variables
Anyone faced similar error?
Upvotes: 0
Views: 236
Reputation: 1087
The initialize_all_variables API has been deprecated in tensorflow (and was removed on 2017-03-02) , the correct API to use is global_variables_initializer
https://www.tensorflow.org/api_docs/python/tf/initialize_all_variables
Upvotes: 2