Skip to content

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

@TharinduRusira

Description

@TharinduRusira

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,

Metadata

Metadata

Assignees

No one assigned

    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