Snapdragon Neural Processing Engine SDK
Reference Guide
|
SNPE can dynamically resize networks when they are loaded. Suppose that we have converted a model from Caffe2 with the following command:
snpe-caffe2-to-dlc -p predict_net.pb -e init_net.pb -i data 1,3,244,244 -d model.dlc
Then, we might use the following code to initialize the network to consume a batch of 1080p images:
#include <SNPE/SNPE.hpp> auto container = zdl::DlContainer::IDlContainer::open("model.dlc"); zdl::DlSystem::TensorShapeMap inputShapeMap; inputShapeMap.add("data", {3,1080,1440,3}) zdl::SNPE::SNPEBuilder builder(container.get()); builder.setInputDimensions(inputShapeMap); auto snpe = builder.build();