pku-liang / FlexTensor

Automatic Schedule Exploration and Optimization Framework for Tensor Computations
MIT License
174 stars 32 forks source link

[CPU] TypeError: reduce() of empty sequence with no initial value #20

Open TharinduRusira opened 4 years ago

TharinduRusira commented 4 years ago

Hi, I'm running optimize/optimize_conv2d.py with a custom convolution layer on a CPU and I get the following error. I understand why this happens but shouldn't there be a guard when config['spatial'] is empty?

The layer parameters are (128, 128, 28, 28, 256,_ , 3, 3, _, 1, 1, 1, 1) and optimize_conv2d.py uses default args.

warm up [1606782542.740292] [ inf ]
Warning: No valid schedule found in warm up process, please use more trials
Now automatically use more trials, increase 1
Fail to find valid schedule, too many errors

Traceback (most recent call last):

  File "optimize_conv2d.py", line 210, in <module>
    logfile=flog,

  File "optimize_conv2d.py", line 116, in optimize
    rpc_info=rpc_info,

  File "/homes/tharindu/FlexTensor/flextensor/scheduler.py", line 2135, in schedule
    s, bufs = schedule_with_config(task_key, configs, rewrite=rewrite)

  File "/homes/tharindu/FlexTensor/flextensor/scheduler.py", line 2155, in schedule_with_config
    s, bufs = schedule_with_config_ops(ops, bufs, configs, op_pos=op_pos, target=task.target)

  File "/homes/tharindu/FlexTensor/flextensor/scheduler.py", line 2202, in schedule_with_config_ops
    template(s, op, op_states[i])

  File "/homes/tharindu/FlexTensor/flextensor/scheduler.py", line 1680, in _cpu_schedule_simple
    tmp_extent = reduce(lambda a, b: a * b, [x[count] for x in config["spatial"]])

TypeError: reduce() of empty sequence with no initial value

Thanks,