Python Tensorflow版本“1.1.0”SKCompat属性错误
我正在尝试使用TF1.1.0实现VGGnet,使用提供的MNIST CNN教程。我收到的错误消息是:Python Tensorflow版本“1.1.0”SKCompat属性错误,python,python-3.x,tensorflow,deep-learning,Python,Python 3.x,Tensorflow,Deep Learning,我正在尝试使用TF1.1.0实现VGGnet,使用提供的MNIST CNN教程。我收到的错误消息是: AttributeError: 'SKCompat' object has no attribute 'evaluate' 我的代码的这一部分抛出了AttributeError: #create estimator vggnet_classifier = learn.SKCompat(learn.Estimator(model_fn=vggnet_model, model_dir= "/tmp
AttributeError: 'SKCompat' object has no attribute 'evaluate'
我的代码的这一部分抛出了AttributeError:
#create estimator
vggnet_classifier = learn.SKCompat(learn.Estimator(model_fn=vggnet_model, model_dir= "/tmp/vgg_net"))
# Set up logging for predictions
tensors_to_log = {"probabilities": "softmax_tensor"}
logging_hook = tf.train.LoggingTensorHook(tensors=tensors_to_log, every_n_iter=100)
#train model
vggnet_classifier.fit(
x=X_train,
y=y_train,
batch_size=100,
steps=2,
monitors=[logging_hook])
# Configure the accuracy metric for evaluation
metrics = {
"accuracy":
learn.MetricSpec(metric_fn=tf.metrics.accuracy, prediction_key="classes"),}
# Evaluate the model and print results
eval_results = vggnet_classifier.evaluate(x=X_val, y=y_val, metrics=metrics)
print(eval_results)
我最初在learn.Estimator周围添加了SKCompat包装器,原因是出现了弃用警告,但我似乎找不到有关如何使用包装的估算器评估模型的任何信息。我忘了声明:
loss = None
train_op = None
在我的vggnet_模型函数中,这似乎是错误的来源。删除learn.SKcompat会发出警告,但该模型现在训练良好,运行良好。我想知道现在是否有任何优雅的解决方案。正如OP所指出的,使用SKCompat包装器可以避免警告,这似乎是将来要做的事情;但另一方面,求值函数以这种方式中断