如何更新代码?

时间:2017-04-22 09:43:20

标签: tensorflow deprecated

我正在运行https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/layers/cnn_mnist.py的代码。它具有以下代码:

mnist_classifier.fit(
  x=train_data,
  y=train_labels,
  batch_size=100,
  steps=20000,
  monitors=[logging_hook])
eval_results = mnist_classifier.evaluate(
  x=eval_data, y=eval_labels, metrics=metrics)

但是有一些关于mnist_classifier.fit()和mnist_classifier.evaluate()的弃用参数(x,y,batch_size)的警告。那么,调用这两个函数的新方法是什么?

部分警告:

WARNING:tensorflow:From mnist.py:109: calling BaseEstimator.evaluate (from 
tensorflow.contrib.learn.python.learn.estimators.estimator) with x is 
deprecated and will be removed after 2016-12-01.
Instructions for updating:
Estimator is decoupled from Scikit Learn interface by moving into
separate class SKCompat. Arguments x, y and batch_size are only
available in the SKCompat class, Estimator will only accept input_fn.
Example conversion:
  est = Estimator(...) -> est = SKCompat(Estimator(...))
WARNING:tensorflow:From mnist.py:109: calling BaseEstimator.evaluate (from 
tensorflow.contrib.learn.python.learn.estimators.estimator) with y is 
deprecated and will be removed after 2016-12-01.
Instructions for updating:
Estimator is decoupled from Scikit Learn interface by moving into
separate class SKCompat. Arguments x, y and batch_size are only
available in the SKCompat class, Estimator will only accept input_fn.
Example conversion:
  est = Estimator(...) -> est = SKCompat(Estimator(...))

0 个答案:

没有答案