Open mengshu opened 6 years ago
I think the problem is: label = parsed_line[-1:] # Last element is the label
should be label = parsed_line[-1] # Last element is the label
hi guys, I meet the same problem, can u help me? Thx! TensorFlow version is 1.8 my code is :
def decode_csv(line):
parsed_line = tf.decode_csv(line, [[0.], [0.], [0.], [0.], [0]])
return {'x': parsed_line[:-1]}, parsed_line[-1]
dataset = tf.data.TextLineDataset(file_path).skip(1).map(decode_csv)
the errors:
File "C:\Users\Jayce\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 851, in map
return MapDataset(self, map_func)
File "C:\Users\Jayce\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1839, in __init__
self._map_func.add_to_graph(ops.get_default_graph())
File "C:\Users\Jayce\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\function.py", line 488, in add_to_graph
self._create_definition_if_needed()
File "C:\Users\Jayce\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\function.py", line 321, in _create_definition_if_needed
self._create_definition_if_needed_impl()
File "C:\Users\Jayce\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\function.py", line 338, in _create_definition_if_needed_impl
outputs = self._func(*inputs)
File "C:\Users\Jayce\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1827, in tf_map_func
ret, [t.get_shape() for t in nest.flatten(ret)])
File "C:\Users\Jayce\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1827, in <listcomp>
ret, [t.get_shape() for t in nest.flatten(ret)])
AttributeError: 'list' object has no attribute 'get_shape'
TensorFlow version: 1.6.0
AttributeError Traceback (most recent call last)