Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
API to trigger partitioning
Browse files Browse the repository at this point in the history
  • Loading branch information
mseth10 committed Aug 14, 2019
1 parent 843c3ab commit 478c60a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/mxnet/c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1987,6 +1987,15 @@ MXNET_DLL int MXSetCalibTableToQuantizedSymbol(SymbolHandle qsym_handle,
const float* high_quantiles,
SymbolHandle* ret_sym_handle);

/*!
* \brief Partitions symbol for given backend, potentially creating subgraphs
* \param sym_handle symbol to be partitioned
* \param backend backend name
* \param ret_sym_handle partitioned symbol returned
*/
MXNET_DLL int MXOptimizeForBackend(SymbolHandle sym_handle,
const char* backend,
SymbolHandle* ret_sym_handle);
/*!
* \brief Run subgraph pass based on the backend provided
* \param sym_handle symbol to be converted
Expand Down
6 changes: 6 additions & 0 deletions python/mxnet/symbol/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,12 @@ def _gen_atomic_symbol(self):
return Symbol(handle)


def optimizeFor(self, backend):
"""Partition symbol and optimize it for a given backend"""
out = SymbolHandle()
check_call(_LIB.MXOptimizeForBackend(self.handle, c_str(backend), ctypes.byref(out)))


# pylint: disable=too-many-locals
def simple_bind(self, ctx, grad_req='write', type_dict=None, stype_dict=None,
group2ctx=None, shared_arg_names=None, shared_exec=None,
Expand Down

0 comments on commit 478c60a

Please sign in to comment.