|
|
|
@@ -23,9 +23,12 @@ void RegisterInfer() { |
|
|
|
_ReshapePrimType_Reshape(); |
|
|
|
} |
|
|
|
#endif |
|
|
|
InferShape *g_infer_func; |
|
|
|
InferShape *g_infer_func = NULL; |
|
|
|
|
|
|
|
__attribute__((constructor(101))) void InitInferFuncBuf() { |
|
|
|
if (g_infer_func != NULL) { |
|
|
|
return; |
|
|
|
} |
|
|
|
g_infer_func = malloc(PrimType_MAX * sizeof(InferShape)); |
|
|
|
if (g_infer_func != NULL) { |
|
|
|
memset(g_infer_func, 0, PrimType_MAX * sizeof(InferShape)); |
|
|
|
@@ -35,6 +38,14 @@ __attribute__((constructor(101))) void InitInferFuncBuf() { |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
__attribute__((destructor)) void DestroyInferFuncBuf() { |
|
|
|
if (g_infer_func == NULL) { |
|
|
|
return; |
|
|
|
} |
|
|
|
free(g_infer_func); |
|
|
|
g_infer_func = NULL; |
|
|
|
} |
|
|
|
|
|
|
|
InferShape GetInferFunc(int prim_type) { |
|
|
|
if (g_infer_func != NULL && prim_type < PrimType_MAX) { |
|
|
|
return g_infer_func[prim_type]; |
|
|
|
|