The documentation lists that as a method of `tvm.auto_scheduler.ComputeDAG` we 
can get a Python code representation of the schedule with 
[`print_python_code_from_state()`](https://tvm.apache.org/docs/api/python/auto_scheduler.html?highlight=auto_scheduler#tvm.auto_scheduler.ComputeDAG.print_python_code_from_state).

Described as: 

> Print transform steps in the history of a State as TVM’s python schedule code.
>
> This is used to print transformation steps for debugging. Use 
> apply_steps_from_state if you want to get a schedule for code generation.

However, I am trying to figure out to use it.  I have a simple model with a 
single operation, and have loaded it into the two variables: `mod` and 
`params`.   

Additionally, I have performed auto-scheduling, and have a tuned log-file in 
the `json` format.

>From this, how would I get this printed schedule?

If I try building a `tvm.auto_scheduler.ComputeDAG` object by passing `mod` to 
it I get a `RecursionError: maximum recursion depth exceeded while calling a 
Python object` error.

Same if I try and get the Ansor workload from it: 
```python
    tasks, task_weights = auto_scheduler.extract_tasks(
        mod["main"], params, device_info['target_string'], 
device_info['target_host']
    )

    for i, t in enumerate(tasks):
         tgt_dag = str(t.compute_dag)
         tvm.auto_scheduler.ComputeDAG(tgt_dag)
```

Even if they did work however, I'm not sure how I'd link it to my auto-schedule 
`JSON` file.

The file `python/tvm/auto_scheduler/relay_integration.py` has a function 
`auto_schedule_topi()` instantiates a `ComputeDAG`, though the docstring says:
> Note: This is used internally for relay integration. Do    not use this as a 
> general user-facing API.

Any pointers on getting this Python schedule for a tuned model?





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/autoscheduler-print-tuned-python-schedule/9574/1)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/60e75e3895fe95397a8bf0e8693db1353ddba25f16afed95278d76d341f5f56f).

Reply via email to