From 6dd178f2395b34cfb360eabb0130c19ed258f5fa Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Fri, 2 Apr 2021 22:04:39 +0100 Subject: IVGCVSW-5720 Remove the Caffe Parser from ArmNN Signed-off-by: Nikhil Raj Change-Id: Ib00be204f549efa9aa5971ecf65c2dec4a10b10f --- python/pyarmnn/src/pyarmnn/__init__.py | 12 --- .../pyarmnn/src/pyarmnn/swig/armnn_caffeparser.i | 103 --------------------- 2 files changed, 115 deletions(-) delete mode 100644 python/pyarmnn/src/pyarmnn/swig/armnn_caffeparser.i (limited to 'python/pyarmnn/src') diff --git a/python/pyarmnn/src/pyarmnn/__init__.py b/python/pyarmnn/src/pyarmnn/__init__.py index 19b14a4b09..410e66be11 100644 --- a/python/pyarmnn/src/pyarmnn/__init__.py +++ b/python/pyarmnn/src/pyarmnn/__init__.py @@ -7,18 +7,6 @@ import logging from ._generated.pyarmnn_version import GetVersion, GetMajorVersion, GetMinorVersion # Parsers -try: - from ._generated.pyarmnn_caffeparser import ICaffeParser -except ImportError as err: - logger = logging.getLogger(__name__) - message = "Your ArmNN library instance does not support Caffe models parser functionality. " - logger.warning("%s Skipped ICaffeParser import.", message) - logger.debug(str(err)) - - - def ICaffeParser(): - """In case people try importing without having Arm NN built with this parser.""" - raise RuntimeError(message) try: from ._generated.pyarmnn_onnxparser import IOnnxParser diff --git a/python/pyarmnn/src/pyarmnn/swig/armnn_caffeparser.i b/python/pyarmnn/src/pyarmnn/swig/armnn_caffeparser.i deleted file mode 100644 index 538b486aad..0000000000 --- a/python/pyarmnn/src/pyarmnn/swig/armnn_caffeparser.i +++ /dev/null @@ -1,103 +0,0 @@ -// -// Copyright © 2020 Arm Ltd. All rights reserved. -// SPDX-License-Identifier: MIT -// -%module pyarmnn_caffeparser -%{ -#define SWIG_FILE_WITH_INIT -#include "armnnCaffeParser/ICaffeParser.hpp" -#include "armnn/INetwork.hpp" -%} - -//typemap definitions and other common stuff -%include "standard_header.i" - -namespace std { - %template(BindingPointInfo) pair; - %template(MapStringTensorShape) map; - %template(StringVector) vector; -} - -namespace armnnCaffeParser -{ - -%feature("docstring", -" -Interface for creating a parser object using Caffe (http://caffe.berkeleyvision.org/) caffemodel files. - -Parsers are used to automatically construct Arm NN graphs from model files. - -") ICaffeParser; - -%nodefaultctor ICaffeParser; -class ICaffeParser -{ -public: - // Documentation - %feature("docstring", - " - Retrieve binding info (layer id and tensor info) for the network input identified by the given layer name. - - Args: - name (str): Name of the input. - - Returns: - tuple: (`int`, `TensorInfo`) - ") GetNetworkInputBindingInfo; - - %feature("docstring", - " - Retrieve binding info (layer id and `TensorInfo`) for the network output identified by the given layer name. - - Args: - name (str): Name of the output. - - Returns: - tuple: (`int`, `TensorInfo`) - ") GetNetworkOutputBindingInfo; - - std::pair GetNetworkInputBindingInfo(const std::string& name); - std::pair GetNetworkOutputBindingInfo(const std::string& name); -}; - -%extend ICaffeParser { - // This is not a substitution of the default constructor of the Armnn class. It tells swig to create custom __init__ - // method for ICaffeParser python object that will use static factory method to do the job. - - ICaffeParser() { - return armnnCaffeParser::ICaffeParser::CreateRaw(); - } - - // The following does not replace a real destructor of the Armnn class. - // It creates a functions that will be called when swig object goes out of the scope to clean resources. - // so the user doesn't need to call ICaffeParser::Destroy himself. - // $self` is a pointer to extracted ArmNN ICaffeParser object. - - ~ICaffeParser() { - armnnCaffeParser::ICaffeParser::Destroy($self); - } - - %feature("docstring", - " - Create the network from a Caffe caffemodel binary file on disk. - - Args: - graphFile: Path to the caffe model to be parsed. - inputShapes (tuple): (`string`, `TensorShape`) A tuple containing the input name and TensorShape information for the network. - requestedOutputs (list): A list of the output tensor names. - - Returns: - INetwork: INetwork object for the parsed Caffe model. - ") CreateNetworkFromBinaryFile; - - %newobject CreateNetworkFromBinaryFile; - armnn::INetwork* CreateNetworkFromBinaryFile(const char* graphFile, - const std::map& inputShapes, - const std::vector& requestedOutputs) { - return $self->CreateNetworkFromBinaryFile(graphFile, inputShapes, requestedOutputs).release(); - } -} -} - -// Clear exception typemap. -%exception; -- cgit v1.2.1