mxnet
Classes | Typedefs | Enumerations | Functions
mxnet::ext Namespace Reference

Classes

class  CustomOp
 Class to hold custom operator registration. More...
 
class  CustomOpSelector
 
class  CustomPartitioner
 An abstract class for subgraph property. More...
 
class  CustomPass
 An abstract class for graph passes. More...
 
class  CustomStatefulOp
 An abstract class for library authors creating stateful op custom library should override Forward and destructor, and has an option to implement Backward. More...
 
class  CustomStatefulOpWrapper
 StatefulOp wrapper class to pass to backend OpState. More...
 
class  Graph
 
struct  JsonVal
 definition of JSON objects More...
 
struct  MXContext
 Context info passing from MXNet OpContext dev_type is string repr of supported context, currently only "cpu" and "gpu" dev_id is the device index where the tensor locates. More...
 
class  MXerrorMsgs
 
struct  MXSparse
 
struct  MXTensor
 Tensor data structure used by custom operator. More...
 
class  Node
 
struct  NodeEntry
 
class  OpResource
 provide resource APIs memory allocation mechanism to Forward/Backward functions More...
 
class  PassResource
 
class  Registry
 Registry class to registers things (ops, properties) Singleton class. More...
 

Typedefs

typedef void *(* xpu_malloc_t) (void *, int)
 resource malloc function to allocate memory inside Forward/Backward functions More...
 
typedef void(* sparse_malloc_t) (void *, int, int, int, void **, int64_t **, int64_t **)
 sparse alloc function to allocate memory inside Forward/Backward functions More...
 
typedef void(* nd_malloc_t) (const void *_ndarray_alloc, const int64_t *shapes, int num_shapes, const char *dev_str, int dev_id, int dtype, const char *name, int isArg, void **data)
 resource malloc function to allocate ndarrays for graph passes More...
 
typedef void * mx_stream_t
 GPU stream pointer, is void* when not compiled with CUDA. More...
 
typedef void * mx_gpu_rand_t
 
typedef std::mt19937 mx_cpu_rand_t
 
typedef MXReturnValue(* fcomp_t) (const std::unordered_map< std::string, std::string > &attributes, std::vector< MXTensor > *inputs, std::vector< MXTensor > *outputs, const OpResource &res)
 Custom Operator function templates. More...
 
typedef MXReturnValue(* parseAttrs_t) (const std::unordered_map< std::string, std::string > &attributes, int *num_inputs, int *num_outputs)
 
typedef MXReturnValue(* inferType_t) (const std::unordered_map< std::string, std::string > &attributes, std::vector< int > *in_types, std::vector< int > *out_types)
 
typedef MXReturnValue(* inferSType_t) (const std::unordered_map< std::string, std::string > &attributes, std::vector< int > *in_storage_types, std::vector< int > *out_storage_types)
 
typedef MXReturnValue(* inferShape_t) (const std::unordered_map< std::string, std::string > &attributes, std::vector< std::vector< unsigned int > > *in_shapes, std::vector< std::vector< unsigned int > > *out_shapes)
 
typedef MXReturnValue(* mutateInputs_t) (const std::unordered_map< std::string, std::string > &attributes, std::vector< int > *input_indices)
 
typedef MXReturnValue(* createOpState_t) (const std::unordered_map< std::string, std::string > &attributes, const MXContext &ctx, const std::vector< std::vector< unsigned int > > &in_shapes, const std::vector< int > in_types, CustomStatefulOp **)
 
typedef MXReturnValue(* graphPass_t) (mxnet::ext::Graph *graph, const std::unordered_map< std::string, std::string > &options)
 Custom Pass Create function template. More...
 
typedef MXReturnValue(* supportedOps_t) (const mxnet::ext::Graph *graph, std::vector< int > *ids, const std::unordered_map< std::string, std::string > &options)
 Custom Subgraph Create function template. More...
 
typedef MXReturnValue(* createSelector_t) (const mxnet::ext::Graph *graph, CustomOpSelector **sel_inst, const std::unordered_map< std::string, std::string > &options)
 
typedef MXReturnValue(* reviewSubgraph_t) (const mxnet::ext::Graph *subgraph, int subgraph_id, bool *accept, const std::unordered_map< std::string, std::string > &options, std::unordered_map< std::string, std::string > *attrs)
 
typedef int(* opRegSize_t) (void)
 
typedef int(* opRegGet_t) (int idx, const char **name, int *isSGop, const char ***forward_ctx, mxnet::ext::fcomp_t **forward_fp, int *forward_count, const char ***backward_ctx, mxnet::ext::fcomp_t **backward_fp, int *backward_count, const char ***create_op_ctx, mxnet::ext::createOpState_t **create_op_fp, int *create_op_count, mxnet::ext::parseAttrs_t *parse, mxnet::ext::inferType_t *type, mxnet::ext::inferSType_t *stype, mxnet::ext::inferShape_t *shape, mxnet::ext::mutateInputs_t *mutate)
 
typedef int(* opCallFree_t) (void *ptr)
 
typedef int(* opCallParseAttrs_t) (parseAttrs_t parseAttrs, const char *const *keys, const char *const *vals, int num, int *num_in, int *num_out)
 
typedef int(* opCallInferShape_t) (inferShape_t inferShape, const char *const *keys, const char *const *vals, int num, unsigned int **inshapes, int *indims, int num_in, unsigned int ***mod_inshapes, int **mod_indims, unsigned int ***outshapes, int **outdims, int num_out)
 
typedef int(* opCallInferType_t) (inferType_t inferType, const char *const *keys, const char *const *vals, int num, int *intypes, int num_in, int *outtypes, int num_out)
 
typedef int(* opCallInferSType_t) (inferSType_t inferSType, const char *const *keys, const char *const *vals, int num, int *intypes, int num_in, int *outtypes, int num_out)
 
typedef int(* opCallFComp_t) (fcomp_t fcomp, const char *const *keys, const char *const *vals, int num, const int64_t **inshapes, int *indims, void **indata, int *intypes, size_t *inIDs, const char **indev_type, int *indev_id, int num_in, const int64_t **outshapes, int *outdims, void **outdata, int *outtypes, size_t *outIDs, const char **outdev_type, int *outdev_id, int num_out, xpu_malloc_t cpu_malloc, void *cpu_alloc, xpu_malloc_t gpu_malloc, void *gpu_alloc, void *cuda_stream, sparse_malloc_t sparse_malloc, void *sparse_alloc, int *instypes, int *outstypes, void **in_indices, void **out_indices, void **in_indptr, void **out_indptr, int64_t *in_indices_shapes, int64_t *out_indices_shapes, int64_t *in_indptr_shapes, int64_t *out_indptr_shapes, void *rng_cpu_states, void *rng_gpu_states)
 
typedef int(* opCallMutateInputs_t) (mutateInputs_t mutate, const char *const *keys, const char *const *vals, int num, int **mutate_indices, int *indices_size)
 
typedef int(* opCallCreateOpState_t) (createOpState_t create_op, const char *const *keys, const char *const *vals, int num, const char *dev_type, int dev_id, unsigned int **inshapes, int *indims, int num_in, const int *intypes, void **state_op)
 
typedef int(* opCallFStatefulComp_t) (int is_forward, void *state_op, const int64_t **inshapes, int *indims, void **indata, int *intypes, size_t *inIDs, const char **indev_type, int *indev_id, int num_in, const int64_t **outshapes, int *outdims, void **outdata, int *outtypes, size_t *outIDs, const char **outdev_type, int *outdev_id, int num_out, xpu_malloc_t cpu_malloc, void *cpu_alloc, xpu_malloc_t gpu_malloc, void *gpu_alloc, void *stream, sparse_malloc_t sparse_malloc, void *sparse_alloc, int *instypes, int *outstypes, void **in_indices, void **out_indices, void **in_indptr, void **out_indptr, int64_t *in_indices_shapes, int64_t *out_indices_shapes, int64_t *in_indptr_shapes, int64_t *out_indptr_shapes, void *rng_cpu_states, void *rng_gpu_states)
 
typedef int(* partRegSize_t) (void)
 
typedef int(* partRegGetCount_t) (int idx, const char **name)
 
typedef void(* partRegGet_t) (int part_idx, int stg_idx, const char **strategy, supportedOps_t *supportedOps, createSelector_t *createSelector, reviewSubgraph_t *reviewSubgraph, const char **op_name)
 
typedef int(* partCallSupportedOps_t) (supportedOps_t supportedOps, const char *json, int num_ids, int *ids, const char *const *opt_keys, const char *const *opt_vals, int num_opts)
 
typedef int(* partCallCreateSelector_t) (createSelector_t createSelector, const char *json, void **selector, const char *const *opt_keys, const char *const *opt_vals, int num_opts)
 
typedef void(* partCallSelect_t) (void *sel_inst, int nodeID, int *selected)
 
typedef void(* partCallSelectInput_t) (void *sel_inst, int nodeID, int input_nodeID, int *selected)
 
typedef void(* partCallSelectOutput_t) (void *sel_inst, int nodeID, int output_nodeID, int *selected)
 
typedef void(* partCallFilter_t) (void *sel_inst, int *candidates, int num_candidates, int **keep, int *num_keep)
 
typedef void(* partCallReset_t) (void *sel_inst)
 
typedef int(* partCallReviewSubgraph_t) (reviewSubgraph_t reviewSubgraph, const char *json, int subgraph_id, int *accept, const char *const *opt_keys, const char *const *opt_vals, int num_opts, char ***attr_keys, char ***attr_vals, int *num_attrs, const char *const *arg_names, int num_args, void *const *arg_data, const int64_t *const *arg_shapes, const int *arg_dims, const int *arg_types, const size_t *arg_IDs, const char *const *arg_dev_type, const int *arg_dev_id, const char *const *aux_names, int num_aux, void *const *aux_data, const int64_t *const *aux_shapes, const int *aux_dims, const int *aux_types, const size_t *aux_IDs, const char *const *aux_dev_type, const int *aux_dev_id)
 
typedef int(* passRegSize_t) (void)
 
typedef void(* passRegGet_t) (int pass_idx, graphPass_t *graphPass, const char **pass_name)
 
typedef int(* passCallGraphPass_t) (graphPass_t graphPass, const char *in_graph, char **out_graph, const char *const *opt_keys, const char *const *opt_vals, int num_opts, const char *pass_name, const char *const *arg_names, int num_args, void *const *arg_data, const int64_t *const *arg_shapes, const int *arg_dims, const int *arg_types, const size_t *arg_IDs, const char *const *arg_dev_type, const int *arg_dev_id, const char *const *aux_names, int num_aux, void *const *aux_data, const int64_t *const *aux_shapes, const int *aux_dims, const int *aux_types, const size_t *aux_IDs, const char *const *aux_dev_type, const int *aux_dev_id, nd_malloc_t nd_malloc, const void *nd_alloc)
 
typedef int(* initialize_t) (int version)
 
typedef int(* opVersion_t) ()
 
typedef int(* msgSize_t) (void)
 
typedef int(* msgGet_t) (int idx, const char **msg)
 

Enumerations

enum  MXDType {
  kFloat32 = 0, kFloat64 = 1, kFloat16 = 2, kUint8 = 3,
  kInt32 = 4, kInt8 = 5, kInt64 = 6, kUNSET = 100
}
 Tensor data type, consistent with mshadow data type. More...
 
enum  MXStorageType { kDefaultStorage = 0, kRowSparseStorage = 1, kCSRStorage = 2 }
 
enum  MXReturnValue { MX_FAIL = 0, MX_SUCCESS = 1 }
 
enum  JsonType {
  ERR, STR, NUM, LIST,
  MAP
}
 Json utility to parse serialized subgraph symbol. More...
 

Functions

std::string getShapeAt (const std::string &shape, unsigned index)
 
std::string getDtypeAt (const std::string &dtype, unsigned index)
 

Typedef Documentation

◆ createOpState_t

typedef MXReturnValue(* mxnet::ext::createOpState_t) (const std::unordered_map< std::string, std::string > &attributes, const MXContext &ctx, const std::vector< std::vector< unsigned int > > &in_shapes, const std::vector< int > in_types, CustomStatefulOp **)

◆ createSelector_t

typedef MXReturnValue(* mxnet::ext::createSelector_t) (const mxnet::ext::Graph *graph, CustomOpSelector **sel_inst, const std::unordered_map< std::string, std::string > &options)

◆ fcomp_t

typedef MXReturnValue(* mxnet::ext::fcomp_t) (const std::unordered_map< std::string, std::string > &attributes, std::vector< MXTensor > *inputs, std::vector< MXTensor > *outputs, const OpResource &res)

Custom Operator function templates.

◆ graphPass_t

typedef MXReturnValue(* mxnet::ext::graphPass_t) (mxnet::ext::Graph *graph, const std::unordered_map< std::string, std::string > &options)

Custom Pass Create function template.

◆ inferShape_t

typedef MXReturnValue(* mxnet::ext::inferShape_t) (const std::unordered_map< std::string, std::string > &attributes, std::vector< std::vector< unsigned int > > *in_shapes, std::vector< std::vector< unsigned int > > *out_shapes)

◆ inferSType_t

typedef MXReturnValue(* mxnet::ext::inferSType_t) (const std::unordered_map< std::string, std::string > &attributes, std::vector< int > *in_storage_types, std::vector< int > *out_storage_types)

◆ inferType_t

typedef MXReturnValue(* mxnet::ext::inferType_t) (const std::unordered_map< std::string, std::string > &attributes, std::vector< int > *in_types, std::vector< int > *out_types)

◆ initialize_t

typedef int(* mxnet::ext::initialize_t) (int version)

◆ msgGet_t

typedef int(* mxnet::ext::msgGet_t) (int idx, const char **msg)

◆ msgSize_t

typedef int(* mxnet::ext::msgSize_t) (void)

◆ mutateInputs_t

typedef MXReturnValue(* mxnet::ext::mutateInputs_t) (const std::unordered_map< std::string, std::string > &attributes, std::vector< int > *input_indices)

◆ mx_cpu_rand_t

typedef std::mt19937 mxnet::ext::mx_cpu_rand_t

◆ mx_gpu_rand_t

◆ mx_stream_t

typedef void* mxnet::ext::mx_stream_t

GPU stream pointer, is void* when not compiled with CUDA.

◆ nd_malloc_t

typedef void(* mxnet::ext::nd_malloc_t) (const void *_ndarray_alloc, const int64_t *shapes, int num_shapes, const char *dev_str, int dev_id, int dtype, const char *name, int isArg, void **data)

resource malloc function to allocate ndarrays for graph passes

◆ opCallCreateOpState_t

typedef int(* mxnet::ext::opCallCreateOpState_t) (createOpState_t create_op, const char *const *keys, const char *const *vals, int num, const char *dev_type, int dev_id, unsigned int **inshapes, int *indims, int num_in, const int *intypes, void **state_op)

◆ opCallFComp_t

typedef int(* mxnet::ext::opCallFComp_t) (fcomp_t fcomp, const char *const *keys, const char *const *vals, int num, const int64_t **inshapes, int *indims, void **indata, int *intypes, size_t *inIDs, const char **indev_type, int *indev_id, int num_in, const int64_t **outshapes, int *outdims, void **outdata, int *outtypes, size_t *outIDs, const char **outdev_type, int *outdev_id, int num_out, xpu_malloc_t cpu_malloc, void *cpu_alloc, xpu_malloc_t gpu_malloc, void *gpu_alloc, void *cuda_stream, sparse_malloc_t sparse_malloc, void *sparse_alloc, int *instypes, int *outstypes, void **in_indices, void **out_indices, void **in_indptr, void **out_indptr, int64_t *in_indices_shapes, int64_t *out_indices_shapes, int64_t *in_indptr_shapes, int64_t *out_indptr_shapes, void *rng_cpu_states, void *rng_gpu_states)

◆ opCallFree_t

typedef int(* mxnet::ext::opCallFree_t) (void *ptr)

◆ opCallFStatefulComp_t

typedef int(* mxnet::ext::opCallFStatefulComp_t) (int is_forward, void *state_op, const int64_t **inshapes, int *indims, void **indata, int *intypes, size_t *inIDs, const char **indev_type, int *indev_id, int num_in, const int64_t **outshapes, int *outdims, void **outdata, int *outtypes, size_t *outIDs, const char **outdev_type, int *outdev_id, int num_out, xpu_malloc_t cpu_malloc, void *cpu_alloc, xpu_malloc_t gpu_malloc, void *gpu_alloc, void *stream, sparse_malloc_t sparse_malloc, void *sparse_alloc, int *instypes, int *outstypes, void **in_indices, void **out_indices, void **in_indptr, void **out_indptr, int64_t *in_indices_shapes, int64_t *out_indices_shapes, int64_t *in_indptr_shapes, int64_t *out_indptr_shapes, void *rng_cpu_states, void *rng_gpu_states)

◆ opCallInferShape_t

typedef int(* mxnet::ext::opCallInferShape_t) (inferShape_t inferShape, const char *const *keys, const char *const *vals, int num, unsigned int **inshapes, int *indims, int num_in, unsigned int ***mod_inshapes, int **mod_indims, unsigned int ***outshapes, int **outdims, int num_out)

◆ opCallInferSType_t

typedef int(* mxnet::ext::opCallInferSType_t) (inferSType_t inferSType, const char *const *keys, const char *const *vals, int num, int *intypes, int num_in, int *outtypes, int num_out)

◆ opCallInferType_t

typedef int(* mxnet::ext::opCallInferType_t) (inferType_t inferType, const char *const *keys, const char *const *vals, int num, int *intypes, int num_in, int *outtypes, int num_out)

◆ opCallMutateInputs_t

typedef int(* mxnet::ext::opCallMutateInputs_t) (mutateInputs_t mutate, const char *const *keys, const char *const *vals, int num, int **mutate_indices, int *indices_size)

◆ opCallParseAttrs_t

typedef int(* mxnet::ext::opCallParseAttrs_t) (parseAttrs_t parseAttrs, const char *const *keys, const char *const *vals, int num, int *num_in, int *num_out)

◆ opRegGet_t

typedef int(* mxnet::ext::opRegGet_t) (int idx, const char **name, int *isSGop, const char ***forward_ctx, mxnet::ext::fcomp_t **forward_fp, int *forward_count, const char ***backward_ctx, mxnet::ext::fcomp_t **backward_fp, int *backward_count, const char ***create_op_ctx, mxnet::ext::createOpState_t **create_op_fp, int *create_op_count, mxnet::ext::parseAttrs_t *parse, mxnet::ext::inferType_t *type, mxnet::ext::inferSType_t *stype, mxnet::ext::inferShape_t *shape, mxnet::ext::mutateInputs_t *mutate)

◆ opRegSize_t

typedef int(* mxnet::ext::opRegSize_t) (void)

◆ opVersion_t

typedef int(* mxnet::ext::opVersion_t) ()

◆ parseAttrs_t

typedef MXReturnValue(* mxnet::ext::parseAttrs_t) (const std::unordered_map< std::string, std::string > &attributes, int *num_inputs, int *num_outputs)

◆ partCallCreateSelector_t

typedef int(* mxnet::ext::partCallCreateSelector_t) (createSelector_t createSelector, const char *json, void **selector, const char *const *opt_keys, const char *const *opt_vals, int num_opts)

◆ partCallFilter_t

typedef void(* mxnet::ext::partCallFilter_t) (void *sel_inst, int *candidates, int num_candidates, int **keep, int *num_keep)

◆ partCallReset_t

typedef void(* mxnet::ext::partCallReset_t) (void *sel_inst)

◆ partCallReviewSubgraph_t

typedef int(* mxnet::ext::partCallReviewSubgraph_t) (reviewSubgraph_t reviewSubgraph, const char *json, int subgraph_id, int *accept, const char *const *opt_keys, const char *const *opt_vals, int num_opts, char ***attr_keys, char ***attr_vals, int *num_attrs, const char *const *arg_names, int num_args, void *const *arg_data, const int64_t *const *arg_shapes, const int *arg_dims, const int *arg_types, const size_t *arg_IDs, const char *const *arg_dev_type, const int *arg_dev_id, const char *const *aux_names, int num_aux, void *const *aux_data, const int64_t *const *aux_shapes, const int *aux_dims, const int *aux_types, const size_t *aux_IDs, const char *const *aux_dev_type, const int *aux_dev_id)

◆ partCallSelect_t

typedef void(* mxnet::ext::partCallSelect_t) (void *sel_inst, int nodeID, int *selected)

◆ partCallSelectInput_t

typedef void(* mxnet::ext::partCallSelectInput_t) (void *sel_inst, int nodeID, int input_nodeID, int *selected)

◆ partCallSelectOutput_t

typedef void(* mxnet::ext::partCallSelectOutput_t) (void *sel_inst, int nodeID, int output_nodeID, int *selected)

◆ partCallSupportedOps_t

typedef int(* mxnet::ext::partCallSupportedOps_t) (supportedOps_t supportedOps, const char *json, int num_ids, int *ids, const char *const *opt_keys, const char *const *opt_vals, int num_opts)

◆ partRegGet_t

typedef void(* mxnet::ext::partRegGet_t) (int part_idx, int stg_idx, const char **strategy, supportedOps_t *supportedOps, createSelector_t *createSelector, reviewSubgraph_t *reviewSubgraph, const char **op_name)

◆ partRegGetCount_t

typedef int(* mxnet::ext::partRegGetCount_t) (int idx, const char **name)

◆ partRegSize_t

typedef int(* mxnet::ext::partRegSize_t) (void)

◆ passCallGraphPass_t

typedef int(* mxnet::ext::passCallGraphPass_t) (graphPass_t graphPass, const char *in_graph, char **out_graph, const char *const *opt_keys, const char *const *opt_vals, int num_opts, const char *pass_name, const char *const *arg_names, int num_args, void *const *arg_data, const int64_t *const *arg_shapes, const int *arg_dims, const int *arg_types, const size_t *arg_IDs, const char *const *arg_dev_type, const int *arg_dev_id, const char *const *aux_names, int num_aux, void *const *aux_data, const int64_t *const *aux_shapes, const int *aux_dims, const int *aux_types, const size_t *aux_IDs, const char *const *aux_dev_type, const int *aux_dev_id, nd_malloc_t nd_malloc, const void *nd_alloc)

◆ passRegGet_t

typedef void(* mxnet::ext::passRegGet_t) (int pass_idx, graphPass_t *graphPass, const char **pass_name)

◆ passRegSize_t

typedef int(* mxnet::ext::passRegSize_t) (void)

◆ reviewSubgraph_t

typedef MXReturnValue(* mxnet::ext::reviewSubgraph_t) (const mxnet::ext::Graph *subgraph, int subgraph_id, bool *accept, const std::unordered_map< std::string, std::string > &options, std::unordered_map< std::string, std::string > *attrs)

◆ sparse_malloc_t

typedef void(* mxnet::ext::sparse_malloc_t) (void *, int, int, int, void **, int64_t **, int64_t **)

sparse alloc function to allocate memory inside Forward/Backward functions

◆ supportedOps_t

typedef MXReturnValue(* mxnet::ext::supportedOps_t) (const mxnet::ext::Graph *graph, std::vector< int > *ids, const std::unordered_map< std::string, std::string > &options)

Custom Subgraph Create function template.

◆ xpu_malloc_t

typedef void*(* mxnet::ext::xpu_malloc_t) (void *, int)

resource malloc function to allocate memory inside Forward/Backward functions

Enumeration Type Documentation

◆ JsonType

Json utility to parse serialized subgraph symbol.

Types of JSON objects

Enumerator
ERR 
STR 
NUM 
LIST 
MAP 

◆ MXDType

Tensor data type, consistent with mshadow data type.

Enumerator
kFloat32 
kFloat64 
kFloat16 
kUint8 
kInt32 
kInt8 
kInt64 
kUNSET 

◆ MXReturnValue

Enumerator
MX_FAIL 
MX_SUCCESS 

◆ MXStorageType

Enumerator
kDefaultStorage 
kRowSparseStorage 
kCSRStorage 

Function Documentation

◆ getDtypeAt()

std::string mxnet::ext::getDtypeAt ( const std::string &  dtype,
unsigned  index 
)

◆ getShapeAt()

std::string mxnet::ext::getShapeAt ( const std::string &  shape,
unsigned  index 
)