Facebook to Open QNNPACK's Source Code

The technology, designed for AI on mobile devices, is used in Facebook applications for image processing
30 October 2018   343

Facebook has released the open source code for the QNNPACK AI library (Quantized Neural Network PACKage). It is designed for AI on mobile devices. The technology is used in Facebook applications for image processing. Since the computing power of mobile devices is lower than that of data processing servers, the developers used the latest advances in neural networks to keep the system performance at the proper level.

The library architecture is based on the convolutional neural network. Such a network is considered the most suitable for the recognition of visual images. To improve productivity, engineers applied the modified im2col memory matrix transformation and memory transformation technologies.

The im2col technology is a breakdown of the processed image into columns-vectors by the number of incoming channels. The creators of QNNPACK finalized this system by including a bypass buffer.

The bypass buffer contains pointers to rows of incoming pixels that should be involved in the calculation of outgoing. Using matrices, developers were able to reduce the buffer size relative to standard im2col implementations.

Facebook engineers refined the even-distributed convolution algorithm (depthwise convolution) by adding batch processing of 3 × 3 groups. For packet computing, general purpose registers (GPR) are used. The 3 × 3 convolution processing requires 18 registers (9 incoming and 9 for the filter), while the 32-bit ARM core architecture supports only 14. But since the filter remains unchanged during processing, the developers were able to reduce the resources needed for its storage to single register.

In the QNNPACK library, other advanced approaches to optimizing neural networks are implemented, for example, low-precision calculations.

The tool is published as part of the PyTorch 1.0 framework, released in early October 2018.

Facebook to Release PyTorch 1.0

This release added support for large cloud platforms, a C ++ interface, a set of JIT compilers
10 December 2018   125

Facebook has released a stable version of the library for machine learning PyTorch 1.0. This iteration added support for large cloud platforms, a C ++ interface, a set of JIT compilers, and various improvements.

The stable version received a set of JIT compilers that eliminate the dependence of the code on the Python interpreter. The model code is transformed into Torch Script - a superstructure over Python. Keeping the opportunity to work with the model in the Python environment, the user can download it to other projects not related to this language. So, the PyTorch developers state that the code processed in this way can be used in the C ++ API.

The torch.distributed package and the torch.nn.parallel.DistributedDataParallel module are completely redesigned. torch.distributed now has better performance and works asynchronously with the Gloo, NCCL and MPI libraries.

The developers added a C ++ wrapper to PyTorch 1.0. It contains analogs of Python interface components, such astorch.nn,torch.optim, torch.data. According to the creators, the new interface should provide high performance for C ++ applications. True, the C ++ API is still experimental, but it can be used in projects now.

To improve the efficiency of working with PyTorch 1.0, a Torch Hub repository has been created, which stores pre-trained models of neural networks. You can publish your own development using the hubconf.py file, after which the model will be available for download by any user via the torch.hub.load API.

Support for C extensions and the module torch.utils.trainer were removed from the library.

Facebook released the preliminary version of PyTorch 1.0 at the beginning of October 2018, and in two months the developers brought the framework to a stable state.