# PyTorch Model Conversion

Machine Learning frameworks have specific formats for storing
neural network models. Qualcomm® Neural Processing SDK supports these various models by
converting them to a framework neutral **deep learningcontainer (DLC)** format. The DLC file is used by the Qualcomm® Neural Processing SDK
runtime for execution of the neural network.

The
[snpe-pytorch-to-dlc](https://docs.qualcomm.com/doc/80-63442-2/topic/tools.html#snpe-pytorch-to-dlc)
tool converts a PyTorch TorchScript model into an equivalent
Qualcomm® Neural Processing SDK DLC file. The following command will convert an ResNet18
PyTorch model into a Qualcomm® Neural Processing SDK DLC file.

snpe-pytorch-to-dlc --input_network resnet18.pt
                        --input_dim input "1,3,224,224"
                        --output_path resnet18.dlc
    Copy to clipboard

A trained PyTorch model can be converted to TorchScript model
(.pt) file, the tutorial at
[https://pytorch.org/tutorials/advanced/cpp_export.html#converting-to-torch-script-via-tracing](https://pytorch.org/tutorials/advanced/cpp_export.html#converting-to-torch-script-via-tracing)

Following code can be used to convert a pretrained PyTorch
ResNet18 model to TorchScript (.pt) model.

import torch
    import torchvision.models as models
    resnet18_model = models.resnet18()
    input_shape = [1, 3, 224, 224]
    input_data = torch.randn(input_shape)
    script_model = torch.jit.trace(resnet18_model, input_data)
    script_model.save("resnet18.pt")
    Copy to clipboard

Note:

- To check the list of currently supported PyTorch Ops, see
[Op Support Table](https://docs.qualcomm.com/doc/80-63442-2/topic/network_layers.html#network_layers).
- Qualcomm® Neural Processing SDK and PyTorch Converter currently only support float
input data types.

Last Published: Oct 02, 2025

[Previous Topic
TFLite Model Conversion](https://docs.qualcomm.com/bundle/publicresource/80-63442-2/topics/model_conv_tflite.md) [Next Topic
ONNX Model Conversion](https://docs.qualcomm.com/bundle/publicresource/80-63442-2/topics/model_conv_onnx.md)