如何修复估算器分类器代码

时间:2019-03-29 22:52:09

标签: tensorflow-estimator

嗨,我是Tensorflow的新手,我一直在使用tensorflow.estimator库进行练习。基本上,我在下面运行了内置的tf.estimator.DNNClassifier算法

import tensorflow as tf

def train_input_fn(features, labels, batch_size):
    """An input function for training"""
    # Convert the inputs to a Dataset.
    dataset = tf.data.Dataset.from_tensor_slices((dict(features), labels))

    # Shuffle, repeat, and batch the examples.
    return dataset.shuffle(1000).repeat().batch(batch_size)

# Feature columns describe how to use the input.
my_feature_columns = []
for key in landmark_features.keys():
    my_feature_columns.append(tf.feature_column.numeric_column(key=key))


# Build a DNN with 2 hidden layers and 10 nodes in each hidden layer.

classifier = tf.estimator.DNNClassifier(feature_columns=my_feature_columns, hidden_units=[10, 10],n_classes=10)


dataset = train_input_fn(landmark_features, emotion_labels, batch_size = 1375 )

但是我仍然出现以下错误:

INFO:tensorflow:Using default config.
WARNING:tensorflow:Using temporary folder as model directory: /tmp/tmpc_tag0rc
INFO:tensorflow:Using config: {'_model_dir': '/tmp/tmpc_tag0rc', '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_steps': None, '_save_checkpoints_secs': 600, '_session_config': allow_soft_placement: true
graph_options {
  rewrite_options {
    meta_optimizer_iterations: ONE
  }
}

关于如何解决我的代码的任何想法吗?

0 个答案:

没有答案