首页 > 解决方案 > 如何修复我的估算器分类器代码

问题描述

嗨,我是 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
  }
}

关于我可以做些什么来修复我的代码的任何想法?

标签: tensorflow-estimator

解决方案


推荐阅读