ValueError: setting an array element with a sequence.
Created by: liushanshan07
使用pyreader实现识别ctc训练任务,报错为ValueError: setting an array element with a sequence.现象是训练任务挂起,没有显存占用。求问是啥原因(调试发现数据lod对不上,但不会改。不确定本质原因是啥)
-
原来的数据类型如下,有个python自定义train_reader
images = fluid.layers.data(name='pixel', shape=data_shape, dtype='float32')
label = fluid.layers.data(name='label', shape=[1], dtype='int32', lod_level=1)
-
改用py_reader实现如下,decorate_paddle_reader设置reader
py_reader = fluid.layers.py_reader( capacity=queue_capacity, shapes=[[-1] + image_shape, [-1, 1]], lod_levels=[0, 1], dtypes=["float32", "int32"], use_double_buffer=True)
images, label = fluid.layers.read_file(py_reader)
train_py_reader.decorate_paddle_reader(train_reader)