Static_alloc and static_shape in C api

Hi guys,

In python API we can have hybridize with static_alloc and static_shape turned on. Can the same effect be achieved using C API?


Hybridization is a part of Gluon API, which exists in Python only. In C++ you have only Module + Symbol API, which doesn’t have (and doesn’t need) the concept of hybridization.

To expand on what Sergey already said, the static_alloc=True and static_shape=True are optimization that lets the cached operations re-use an already precomputed memory plan without having to re-infer the shapes.

In the C API, after the symbols and shapes are bound to the executor, the memory plan won’t have to be recomputed and you can just use your executor and you should see the same performance (acutally marginally better) as a hybridized model.