Performance issue in the program
Hello, I found a performance issue in the definition of encode, tensorflow_model_optimization/python/core/internal/tensor_encoding/stages/research/kashin.py, tf.cast will be calculated repeatedly during program execution, resulting in reduced efficiency. I think it should be created before the loop in encode.
Looking forward to your reply. Btw, I am very glad to create a PR to fix it if you are too busy.
@DLPerf, it would be great if you can send a PR our way. @PraChetit, could you reply as I don't have any insight on this.
It would not be calculated multiple times if you are in graph mode (i.e. when you have tf.function decorator somewhere). But even in eager mode, this would be a negligible difference. Nevertheless, feel free to send PR if that helps.