Why static_alloc and static_shape are not True by default

#1

After building a model in Gluon we can hybridize it for performance by converting model to static graph. When we call .hybridize () we have some optional arguments to pass(if we want to), that is .hybridize(static_alloc = True, static_shape = True). And after passing these arguments we get almost 30% more speed up than regular .hybridize().
So why these arguments are not True by default? What is the purpose? And is there any functionality we loose when we call .hybridize(static_alloc = True, static_shape = True)?

#2

The documentation seems to provide the answers:

static_alloc : bool, default False Statically allocate memory to improve speed. Memory usage may increase.

static_shape : bool, default False Optimize for invariant input shapes between iterations. Must also set static_alloc to True. Change of input shapes is still allowed but slower.

So, if you know your input shapes will be the same, you should set this. If they’re going to vary, your memory footprint may be larger, and your compute may be slower than if you didn’t set them.

#3

I think static_alloc should be True by default.
BTW thanks for answering.