TensorFlow中有tf.TextLineReader和decode_csv。但是没有CSV_Reader。我只是想知道如何将它们压缩以便将其输入tf.contrib.learn.read_batch_features。
答案 0 :(得分:1)
如何使用tf.train.shuffle_batch_join
阅读CSV文件并将其提供给tf.contrib.learn.read_batch_features
?
毕竟,var sparseArr = [];
sparseArr[100] = "foo";
sparseArr[130] = "bar";
sparseArr[150] = "foobar";
var condensedArr = [100, 130, 150];
function roundGet(index) {
var mid;
var lo = 0;
var hi = condensedArr.length - 1;
while (hi - lo > 1) {
mid = Math.floor((lo + hi) / 2);
if (condensedArr[mid] < index) {
lo = mid;
} else {
hi = mid;
}
}
if (index - condensedArr[lo] <= condensedArr[hi] - index) {
return sparseArr[condensedArr[lo]];
}
return sparseArr[condensedArr[hi]];
}
对其提取的功能的作用是:Unix & Linux StackExchange
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/learn/python/learn/learn_io/graph_io.py#L212是read_batch_features
的包装器