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
diff --git a/python/pyarmnn/README.md b/python/pyarmnn/README.md
index 0c88ccc..ae26346 100644
--- a/python/pyarmnn/README.md
+++ b/python/pyarmnn/README.md
@@ -72,9 +72,9 @@
 
 *ARMNN_INCLUDE* and *ARMNN_LIB* are mandatory and should point to Arm NN includes and libraries against which you will be generating the wrappers. *SWIG_EXECUTABLE* should only be set if you have multiple versions of SWIG installed or you used a custom location for your installation:
 ```bash
-$ export SWIG_EXECUTABLE=<path_to_swig>
-$ export ARMNN_INCLUDE=<path_to_armnn_include>
-$ export ARMNN_LIB=<path_to_armnn_libraries>
+$ export SWIG_EXECUTABLE=/full/path/to/swig/executable
+$ export ARMNN_INCLUDE=/full/path/to/armnn/include:/full/path/to/armnn/profiling/common/include
+$ export ARMNN_LIB=/path/to/libs
 ```
 
 ##### 2. Clean and build SWIG wrappers:
diff --git a/python/pyarmnn/src/pyarmnn/__init__.py b/python/pyarmnn/src/pyarmnn/__init__.py
index 5cb8bfb..13fdf95 100644
--- a/python/pyarmnn/src/pyarmnn/__init__.py
+++ b/python/pyarmnn/src/pyarmnn/__init__.py
@@ -67,6 +67,10 @@
 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 073fada..bc8228a 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 d2d79cc..3ed5d6b 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 00b835b..a050722 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 7dc88ac..f4581ca 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 @@
                                                      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 @@
             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 ec65cc0..e56464d 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 @@
     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_ImportEnabled;
-    const bool m_ExportEnabled;
+
+    const bool m_AsyncEnabled;
+
+    const bool m_ProfilingEnabled;
+
+    const ProfilingDetailsMethod m_OutputNetworkDetailsMethod;
+
+    const MemorySource m_InputSource;
+    const MemorySource m_OutputSource;
 };
 
 %feature("docstring",
@@ -293,5 +312,27 @@
 
 }
 
+%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 b838fce..83da455 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 @@
 
 ") 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"
 
 
 
diff --git a/python/pyarmnn/test/test_runtime.py b/python/pyarmnn/test/test_runtime.py
index ff0ad40..295c870 100644
--- a/python/pyarmnn/test/test_runtime.py
+++ b/python/pyarmnn/test/test_runtime.py
@@ -3,6 +3,7 @@
 import os
 
 import pytest
+import warnings
 import numpy as np
 
 import pyarmnn as ann
@@ -156,6 +157,30 @@
     assert "" == messages
     assert net_id == 0
 
+def test_network_properties_constructor(random_runtime):
+    preferred_backends = random_runtime[0]
+    network = random_runtime[1]
+    runtime = random_runtime[2]
+
+    opt_network, _ = ann.Optimize(network, preferred_backends,
+                                  runtime.GetDeviceSpec(), ann.OptimizerOptions())
+
+    inputSource = ann.MemorySource_Undefined
+    outputSource = ann.MemorySource_Undefined
+    properties = ann.INetworkProperties(True, inputSource, outputSource)
+    assert properties.m_AsyncEnabled == True
+    assert properties.m_ProfilingEnabled == False
+    assert properties.m_OutputNetworkDetailsMethod == ann.ProfilingDetailsMethod_Undefined
+    assert properties.m_InputSource == ann.MemorySource_Undefined
+    assert properties.m_OutputSource == ann.MemorySource_Undefined
+
+    net_id, messages = runtime.LoadNetwork(opt_network, properties)
+    assert "" == messages
+    assert net_id == 0
+
+def test_network_properties_deprecated_constructor():
+    with pytest.warns(DeprecationWarning):
+        warnings.warn("Deprecated: Use constructor with MemorySource argument instead.", DeprecationWarning)
 
 def test_unload_network_fails_for_invalid_net_id(random_runtime):
     preferred_backends = random_runtime[0]