Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use TVM backend error #95

Open
earlyEpiphyte opened this issue Nov 1, 2022 · 1 comment
Open

use TVM backend error #95

earlyEpiphyte opened this issue Nov 1, 2022 · 1 comment

Comments

@earlyEpiphyte
Copy link

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.

@earlyEpiphyte
Copy link
Author

@jiazhihao Can you help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant