I am currently working on a pass at relax level which replaces the mathematically intense unary ops (“tanh”) with look up table and take op. Since we are working on quantized values (256) we wanted to generate the look up table during compile time and store it and access it using take op when needed. This look up table can be computed at compile time by running “fold-constant pass”.
The question I had is currently I wrote the Look up table (LUT) using prim func, and then ran fold constant pass for the complete model. Is there any suggestion to do the similar task, without depending on the constant folding pass and still computing the look up table during compile time?