TensorFlow 1.5.0 run with DataLab raise AttributeError: 'Tensor' object has no attribute 'length' while attempting to use embedding_column
TensorFlow 1.5.0 run with DataLab raise AttributeError: 'Tensor' object has no attribute 'length' while attempting to use embedding_column
尝试以某种方式使用 embedding_column:
从tensorflow.contrib导入图层//
output = layers.embedding_column(input, 10, combiner='sum', max_norm=None)
导致错误消息:
{
文件“/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/feature_column.py”,第 1302 行,在 embedding_column 中
max_norm=max_norm, trainable=可训练)
文件“/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/feature_column.py”,第 1046 行,在 new 中
stddev = 1 / math.sqrt(sparse_id_column.length)
AttributeError: 'Tensor' 对象没有属性 'length'
}
"input" 是一列整数值。知道如何处理吗?
您的 "input" 参数似乎是张量,而它应该是 feature column and, more specifically, a sparse column created by sparse_column_with_*
or weighted_sparse_column
函数。
尝试以某种方式使用 embedding_column:
从tensorflow.contrib导入图层// output = layers.embedding_column(input, 10, combiner='sum', max_norm=None)
导致错误消息:
{ 文件“/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/feature_column.py”,第 1302 行,在 embedding_column 中 max_norm=max_norm, trainable=可训练) 文件“/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/feature_column.py”,第 1046 行,在 new 中 stddev = 1 / math.sqrt(sparse_id_column.length) AttributeError: 'Tensor' 对象没有属性 'length' }
"input" 是一列整数值。知道如何处理吗?
您的 "input" 参数似乎是张量,而它应该是 feature column and, more specifically, a sparse column created by sparse_column_with_*
or weighted_sparse_column
函数。