3 ms·
pytorch has optimized generic primitives, generally optimization means including safe assumptions specific to the problem you are restricting the solution to.
by ltbarcly3 7y ago
pytorch has optimized generic primitives, generally optimization means including safe assumptions specific to the problem you are restricting the solution to.
For example, YACC is highly optimized, but the parsers in GCC and LLVM are an order of magnitude faster because they are custom recursive-descent parsers optimized for the specific languages that those compilers actually support. GCC switched from YACC/Bison, which are each highly optimized, in version 4.0, and parsing was sped up dramatically.
Additionally, a lot of the glue code in any pytorch project is python, which is astonishingly slow compared to C++.
So I reiterate, a 10x speedup would be mundane when moving from a generic solution like pytorch and coding something specific for using this technique for image compression.
Finally, Pytorch is optimized primarily for model training in an Nvidia GPU. Applying models doesn't need a GPU for good performance, and in fact probably isn't a net win due to the need to allocate and copy data, and the fact that consumer computers often have slow integrated GPU's that can't run nvidia gpu code, and the compatible system (OpenCL, which basically isn't used in ML in a serious way yet) is supported on many systems on the CPU only since integrated GPU's are still slower than the CPU even with OpenCL.