Skip to content

use TVM backend error #95

@earlyEpiphyte

Description

@earlyEpiphyte

I want to use TVM backend to compare runtime of TASO`s like above code.

def evaluate_runtime(onnx_model):
    mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)

    lib = relay.build_module.build(mod, target=target, params=params)
    dev = tvm.device(str(target), 0)
    module = graph_executor.GraphModule(lib["default"](dev))
    module.set_input(input_name, input_data)
    #module.run()
    use_tvm_time = (
        np.array(timeit.Timer(lambda: module.run()).repeat(repeat=timing_repeat, number=timing_number))
        * 1000
        / timing_number
    )
    use_tvm_time = {
        "mean": np.mean(use_tvm_time),
        "median": np.median(use_tvm_time),
        "std": np.std(use_tvm_time),
    }
    print(use_tvm_time)

Take resnet50 as an example. I get the original resnet onnx model and optimized model by TASO.
This function works fine when i put the original model in, but get error to optimized model.
Error message:

The Relay type checker is unable to show the following types match:
  Tensor[(64, 160, 3, 3), float32]
  Tensor[(64, 64, 3, 3), float32]
In particular:
  dimension 1 conflicts: 160 does not match 64.
The Relay type checker is unable to show the following types match.
In particular `Tensor[(64, 64, 3, 3), float32]` does not match `Tensor[(64, 160, 3, 3), float32]`

I am confused and don`t konw how to do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions