Hey I just try to lower resnet18 of mxnet to target="c", I got the c code now, 
but it can not run on gcc, because it does not have the funciton "main". 
I got plenty of computational functions in the c code, but there is not a 
function "main" to call them. I am wondering how to generate the backend code 
with function "main" to call these functions.
here is the code

    pack_dict = {
        "resnet18_v1": ["nn.max_pool2d", "nn.global_avg_pool2d"],
        "resnet34_v1": ["nn.max_pool2d", "nn.global_avg_pool2d"],
        "resnet18_v2": ["nn.max_pool2d", "nn.global_avg_pool2d"],
        "resnet34_v2": ["nn.max_pool2d", "nn.global_avg_pool2d"],
        "resnet50_v2": ["nn.max_pool2d", "nn.global_avg_pool2d"],
        "resnet101_v2": ["nn.max_pool2d", "nn.global_avg_pool2d"],
    }

    model = "resnet18_v1"
    assert model in pack_dict

    dtype_dict = {"data": "float32"}
    shape_dict = {"data": (1, 3, 224, 224)}

    gluon_model = vision.get_model(model, pretrained=True)

    mod, params = relay.frontend.from_mxnet(gluon_model, shape_dict)
 
    # # Update shape and type dictionary
    shape_dict.update({k: v.shape for k, v in params.items()})
    dtype_dict.update({k: str(v.dtype) for k, v in params.items()})

    library = relay.build(mod, target="c", params=params)


And the c code generated looks like this:
![image|690x388](upload://vWOrlCIwZfZhrXvLfqu07tCRvIJ.png) 

I don't know how to run these c code, is there a way to generate c code with 
function main? By the way how to set input data when I need to run c code like 
this?
Thank you!





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/relay-build-resnet18-generate-c-code-but-there-is-no-main-function/10139/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/310900a7ca016a163f3cbfdf88bc95726134a46a3c0b0a697b80437561951713).

Reply via email to