samskalicky commented on a change in pull request #17034: [WIP] Dynamic 
subgraph property
URL: https://github.com/apache/incubator-mxnet/pull/17034#discussion_r362003944
 
 

 ##########
 File path: example/extensions/lib_subgraph/test_subgraph.py
 ##########
 @@ -0,0 +1,67 @@
+#!/usr/bin/env python3
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# coding: utf-8
+# pylint: disable=arguments-differ
+
+# This test checks if dynamic loading of library into MXNet is successful
+# and checks the end of end computation of custom operator
+
+import mxnet as mx
+import os, ctypes
+from mxnet.base import _LIB, check_call, mx_uint, c_str, c_str_array, 
SymbolHandle
+
+# load library
+if (os.name=='posix'):
+    path = os.path.abspath('libsubgraph_lib.so')
+    mx.library.load(path)
+elif (os.name=='nt'):
+    path = os.path.abspath('libsubgraph_lib.dll')
+    mx.library.load(path)
+
+a = mx.sym.var('a')
+b = mx.sym.var('b')
+c = a + b
+d = mx.sym.exp(c)
+sym = mx.sym.log(d)
+
+#execute in MXNet 
+exe = sym.bind(ctx=mx.cpu(), args={'a':mx.nd.ones((3,2)), 
'b':mx.nd.ones((3,2))})
+out = exe.forward()
+print(out)
+
+# with propogating shapes/types
 
 Review comment:
   Each partitioner is equivalent to a subgraph_backend, and each partitioning 
strategy is equivalent to a subgraph_property. Down in the c_api.cc changes, we 
create a 1-to-1 correspondence: we create a subgraph backend/property for each 
one registered in the external library:
   
https://github.com/apache/incubator-mxnet/pull/17034/files#diff-3288207540b433242fe8da1390c68d3fR719-R744
   
   This means that when we go to actually partition the graph, the regular 
well-tested subgraphing APIs are being used to apply the subgraph 
backend/properties to actually partition the graph. These are the same ones 
that Intel using now for their MKLDNN partitioning. 
   
   So I dont think we need an explicit test for this in this PR. This will be 
better tested when Intel starts considering using these APIs to implement their 
partitioning. In the meantime this is more of a forward looking feature, and 
this is just the first step in that direction.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to