aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/src
diff options
context:
space:
mode:
authorJan Eilers <jan.eilers@arm.com>2021-09-24 15:45:46 +0100
committerJan Eilers <jan.eilers@arm.com>2021-10-02 16:27:39 +0100
commit1b2654fb799c3d25ffcef4d31b5d026d359e2f8f (patch)
tree0397fdf24f286715e26a0e63bddaa0502f64caf7 /python/pyarmnn/src
parentb63a31170aee1d28267d83a4bc67b57708fb6b05 (diff)
downloadarmnn-1b2654fb799c3d25ffcef4d31b5d026d359e2f8f.tar.gz
IVGCVSW-5985 Remove deprecated code
* Removes deprecated AddLayer, IsLayerSupported functions * Marks the whole LayerVisitor class as deprecated not just the constructor. This required to wrap all Accept functions in a no deprecate macro because the LayerVisitor is used as a parameter in there * Removes usage of deprecated LayerVisitor and replaces it with ExecuteStrategy. This required a few structural changes in the unit tests * Adds a default implementation for IStrategy called StrategyBase * Changes pyarmnn to use non deprecated constructor for INetworkProperties and adds related unit test * Marks usage of deprecated code in pyarmnn as deprecated. This required to extend INetworkProperties to allow backwards compatibility * Removes deprecated functions from CpuAcc, GpuAcc and Ref backends Note: This patch breaks compatibility with backends that are not updated in this patch !android-nn-driver:6325 Signed-off-by: Jan Eilers <jan.eilers@arm.com> Change-Id: Id13b6f37a74d26eadeda2da1dc92915e725ed5a5
Diffstat (limited to 'python/pyarmnn/src')
-rw-r--r--python/pyarmnn/src/pyarmnn/__init__.py4
-rw-r--r--python/pyarmnn/src/pyarmnn/swig/armnn_deserializer.i1
-rw-r--r--python/pyarmnn/src/pyarmnn/swig/armnn_tfliteparser.i1
-rw-r--r--python/pyarmnn/src/pyarmnn/swig/modules/armnn_descriptors.i1
-rw-r--r--python/pyarmnn/src/pyarmnn/swig/modules/armnn_network.i5
-rw-r--r--python/pyarmnn/src/pyarmnn/swig/modules/armnn_runtime.i55
-rw-r--r--python/pyarmnn/src/pyarmnn/swig/modules/armnn_types.i4
7 files changed, 54 insertions, 17 deletions
diff --git a/python/pyarmnn/src/pyarmnn/__init__.py b/python/pyarmnn/src/pyarmnn/__init__.py
index 5cb8bfb6cd..13fdf95c6f 100644
--- a/python/pyarmnn/src/pyarmnn/__init__.py
+++ b/python/pyarmnn/src/pyarmnn/__init__.py
@@ -67,6 +67,10 @@ from ._generated.pyarmnn import IProfiler
from ._generated.pyarmnn import DataType_Float16, DataType_Float32, DataType_QAsymmU8, DataType_Signed32, \
DataType_Boolean, DataType_QSymmS16, DataType_QSymmS8, DataType_QAsymmS8
from ._generated.pyarmnn import DataLayout_NCHW, DataLayout_NHWC
+from ._generated.pyarmnn import MemorySource_Malloc, MemorySource_Undefined, MemorySource_DmaBuf, \
+ MemorySource_DmaBufProtected
+from ._generated.pyarmnn import ProfilingDetailsMethod_Undefined, ProfilingDetailsMethod_DetailsWithEvents, \
+ ProfilingDetailsMethod_DetailsOnly
from ._generated.pyarmnn import ActivationFunction_Abs, ActivationFunction_BoundedReLu, ActivationFunction_LeakyReLu, \
ActivationFunction_Linear, ActivationFunction_ReLu, ActivationFunction_Sigmoid, ActivationFunction_SoftReLu, \
diff --git a/python/pyarmnn/src/pyarmnn/swig/armnn_deserializer.i b/python/pyarmnn/src/pyarmnn/swig/armnn_deserializer.i
index 073fadaba9..bc8228a5eb 100644
--- a/python/pyarmnn/src/pyarmnn/swig/armnn_deserializer.i
+++ b/python/pyarmnn/src/pyarmnn/swig/armnn_deserializer.i
@@ -6,7 +6,6 @@
%{
#include "armnnDeserializer/IDeserializer.hpp"
#include "armnn/Types.hpp"
-#include "ProfilingGuid.hpp"
#include "armnn/INetwork.hpp"
#include "armnn/Exceptions.hpp"
#include <string>
diff --git a/python/pyarmnn/src/pyarmnn/swig/armnn_tfliteparser.i b/python/pyarmnn/src/pyarmnn/swig/armnn_tfliteparser.i
index d2d79cc627..3ed5d6b8fd 100644
--- a/python/pyarmnn/src/pyarmnn/swig/armnn_tfliteparser.i
+++ b/python/pyarmnn/src/pyarmnn/swig/armnn_tfliteparser.i
@@ -6,7 +6,6 @@
%{
#include "armnnTfLiteParser/ITfLiteParser.hpp"
#include "armnn/Types.hpp"
-#include "ProfilingGuid.hpp"
#include "armnn/INetwork.hpp"
%}
diff --git a/python/pyarmnn/src/pyarmnn/swig/modules/armnn_descriptors.i b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_descriptors.i
index 00b835bfb3..a050722bb9 100644
--- a/python/pyarmnn/src/pyarmnn/swig/modules/armnn_descriptors.i
+++ b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_descriptors.i
@@ -5,7 +5,6 @@
%{
#include "armnn/Descriptors.hpp"
#include "armnn/Types.hpp"
-#include "ProfilingGuid.hpp"
%}
namespace std {
diff --git a/python/pyarmnn/src/pyarmnn/swig/modules/armnn_network.i b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_network.i
index 7dc88ac176..f4581ca5ec 100644
--- a/python/pyarmnn/src/pyarmnn/swig/modules/armnn_network.i
+++ b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_network.i
@@ -6,7 +6,6 @@
#include "armnn/INetwork.hpp"
#include "armnn/BackendId.hpp"
#include "armnn/Types.hpp"
-#include "ProfilingGuid.hpp"
#include "armnn/Optional.hpp"
#include <fstream>
%}
@@ -989,7 +988,7 @@ public:
const armnn::ConstTensor& weights,
armnn::ConstTensor* biases = nullptr,
const char* name = nullptr) {
-
+ ARMNN_NO_DEPRECATE_WARN_BEGIN
if (biases) {
return $self->AddFullyConnectedLayer(fullyConnectedDescriptor, weights,
armnn::Optional<armnn::ConstTensor>(*biases), name);
@@ -997,7 +996,7 @@ public:
return $self->AddFullyConnectedLayer(fullyConnectedDescriptor, weights,
armnn::Optional<armnn::ConstTensor>(), name);
}
-
+ ARMNN_NO_DEPRECATE_WARN_END
}
%feature("docstring",
diff --git a/python/pyarmnn/src/pyarmnn/swig/modules/armnn_runtime.i b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_runtime.i
index ec65cc010a..e56464dd2f 100644
--- a/python/pyarmnn/src/pyarmnn/swig/modules/armnn_runtime.i
+++ b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_runtime.i
@@ -4,6 +4,7 @@
//
%{
#include "armnn/IRuntime.hpp"
+#include "armnn/Deprecated.hpp"
#include <iostream>
#include <ostream>
#include <sstream>
@@ -97,25 +98,43 @@ struct CreationOptions
ExternalProfilingOptions m_ProfilingOptions;
};
+%{
+typedef armnn::INetworkProperties INetworkProperties;
+%}
+
namespace armnn
{
+%nodefaultctor INetworkProperties;
struct INetworkProperties
{
%feature("docstring",
- "
+ "
Structure for holding network properties.
Contains:
- m_ImportEnabled (bool): Enable import.
-
- m_ExportEnabled (bool): Enable export.
+ m_AsyncEnabled (bool): Enable asynchronous execution of multiple network.
+ m_InputSource (MemorySource): When inputs are imported this defines the type of the imported memory.
+ m_OutputSource (MemorySource): When outputs are imported this defines the type of the imported memory.
+ m_ProfilingEnabled (bool): Enable profiling.
+ ProfilingDetailsMethod (ProfilingDetailsMethod): Customize profiling details.
") INetworkProperties;
- INetworkProperties(bool importEnabled = false, bool exportEnabled = false);
+ INetworkProperties(bool asyncEnabled,
+ MemorySource inputSource,
+ MemorySource outputSource,
+ bool profilingEnabled = false,
+ ProfilingDetailsMethod detailsMethod = ProfilingDetailsMethod::Undefined);
+
+
+ const bool m_AsyncEnabled;
+
+ const bool m_ProfilingEnabled;
+
+ const ProfilingDetailsMethod m_OutputNetworkDetailsMethod;
- const bool m_ImportEnabled;
- const bool m_ExportEnabled;
+ const MemorySource m_InputSource;
+ const MemorySource m_OutputSource;
};
%feature("docstring",
@@ -293,5 +312,27 @@ public:
}
+%extend INetworkProperties {
+ %feature("docstring",
+ "
+ Structure for holding network properties.
+
+ Contains:
+ m_ImportEnabled (bool): Enable import.
+
+ m_ExportEnabled (bool): Enable export.
+
+ ") INetworkProperties;
+ INetworkProperties(bool importEnabled = false, bool exportEnabled = false) {
+ ARMNN_NO_DEPRECATE_WARN_BEGIN
+ return new INetworkProperties(importEnabled, exportEnabled);
+ ARMNN_NO_DEPRECATE_WARN_END
+ }
+ %pythonprepend INetworkProperties(bool, bool) %{
+ import warnings
+ warnings.warn("Deprecated: Use constructor with MemorySource argument instead.", DeprecationWarning)
+ %}
+}
+
}
diff --git a/python/pyarmnn/src/pyarmnn/swig/modules/armnn_types.i b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_types.i
index b838fce53d..83da4558fb 100644
--- a/python/pyarmnn/src/pyarmnn/swig/modules/armnn_types.i
+++ b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_types.i
@@ -4,12 +4,10 @@
//
%{
#include "armnn/Types.hpp"
-#include "ProfilingGuid.hpp"
%}
%include <typemaps/permutation_vector.i>
-
namespace armnn
{
@@ -106,12 +104,10 @@ Returns:
") GetSupportedBackends;
-%ignore ProfilingGuid;
%ignore PermutationVector;
#define ARMNN_DEPRECATED_ENUM // SWIG does not support C++ attributes, need this to help generate from Deprecated.hpp.
#define ARMNN_DEPRECATED_ENUM_MSG(message) // SWIG does not support C++ attributes, need this to help generate from Deprecated.hpp.
%include "armnn/Types.hpp"
-%include "ProfilingGuid.hpp"