Tensorflow/Numpy数组数据类型

2024-09-30 22:11:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个看起来像[1, 'abcdthisisahash', 23.4](int,string,float)的数据集。在

我正在跟踪abalone example,并尝试在上面数据集的csv中加载,但是我遇到了ValueError: An initializer for variable dense/kernel of <dtype: 'string'> is required。它在first_hidden_layer = tf.layers.dense(features["x"], 10, activation=tf.nn.relu)行退出

我正在加载数据training_set = tf.contrib.learn.datasets.base.load_csv_without_header( filename='training.csv', target_dtype=np.float64, features_dtype=None)

我觉得数组“dtype”没有正确定义。将features_dtype设置为None将生成第一列和第二列字符串。target_dtype是正确的。如何正确定义“dtype”?我找不到任何关于在numpy数组中有多个数据类型的信息


Tags: csv数据nonetargetstring定义tftraining