Skip to content

运行示例中的代码,得到错误:reduce() of empty sequence with no initial value #2564

@SniperZhao

Description

@SniperZhao

新建了一个python文件,照抄了新手入门的线性回归代码。
运行该python的时候得到错误:

I0622 17:05:55.289027  8472 Util.cpp:166] commandline:  --use_gpu=False 
I0622 17:05:55.294421  8472 GradientMachine.cpp:85] Initing parameters..
I0622 17:05:55.294454  8472 GradientMachine.cpp:92] Init parameters done.
Traceback (most recent call last):
  File "lienerRegression.py", line 61, in <module>
    num_passes=100)
  File "/home/zhaoyuan/002.tools/paddleV2/python27/lib/python2.7/site-packages/paddle/v2/trainer.py", line 153, in train
    in_args = feeder(data_batch)
  File "/home/zhaoyuan/002.tools/paddleV2/python27/lib/python2.7/site-packages/py_paddle/dataprovider_converter.py", line 278, in __call__
    return self.convert(dat, argument)
  File "/home/zhaoyuan/002.tools/paddleV2/python27/lib/python2.7/site-packages/paddle/v2/data_feeder.py", line 134, in convert
    return DataProviderConverter.convert(self, reorder_data(dat), argument)
  File "/home/zhaoyuan/002.tools/paddleV2/python27/lib/python2.7/site-packages/py_paddle/dataprovider_converter.py", line 263, in convert
    scanner.pre_scan(each_step)
  File "/home/zhaoyuan/002.tools/paddleV2/python27/lib/python2.7/site-packages/py_paddle/dataprovider_converter.py", line 112, in pre_scan
    self.__dim__ = reduce(lambda x, y: x * y, self.__shape__)
TypeError: reduce() of empty sequence with no initial value

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions