Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  *
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
30 #ifdef __cplusplus
31 extern "C" {
32 #endif // __cplusplus
34 #ifdef _WIN32
36 #define MXNET_DLL __declspec(dllexport)
37 #else
38 #define MXNET_DLL __declspec(dllimport)
39 #endif
40 #else
41 #define MXNET_DLL
42 #endif
45 typedef unsigned int mx_uint;
47 typedef float mx_float;
49 typedef void *PredictorHandle;
51 typedef void *NDListHandle;
57 MXNET_DLL const char* MXGetLastError();
78 MXNET_DLL int MXPredCreate(const char* symbol_json_str,
79  const void* param_bytes,
80  int param_size,
81  int dev_type, int dev_id,
82  mx_uint num_input_nodes,
83  const char** input_keys,
84  const mx_uint* input_shape_indptr,
85  const mx_uint* input_shape_data,
86  PredictorHandle* out);
111 MXNET_DLL int MXPredCreatePartialOut(const char* symbol_json_str,
112  const void* param_bytes,
113  int param_size,
114  int dev_type, int dev_id,
115  mx_uint num_input_nodes,
116  const char** input_keys,
117  const mx_uint* input_shape_indptr,
118  const mx_uint* input_shape_data,
119  mx_uint num_output_nodes,
120  const char** output_keys,
121  PredictorHandle* out);
144 MXNET_DLL int MXPredCreateMultiThread(const char* symbol_json_str,
145  const void* param_bytes,
146  int param_size,
147  int dev_type, int dev_id,
148  mx_uint num_input_nodes,
149  const char** input_keys,
150  const mx_uint* input_shape_indptr,
151  const mx_uint* input_shape_data,
152  int num_threads,
153  PredictorHandle* out);
170 MXNET_DLL int MXPredReshape(mx_uint num_input_nodes,
171  const char** input_keys,
172  const mx_uint* input_shape_indptr,
173  const mx_uint* input_shape_data,
174  PredictorHandle handle,
175  PredictorHandle* out);
185 MXNET_DLL int MXPredGetOutputShape(PredictorHandle handle,
186  mx_uint index,
187  mx_uint** shape_data,
188  mx_uint* shape_ndim);
198 MXNET_DLL int MXPredSetInput(PredictorHandle handle,
199  const char* key,
200  const mx_float* data,
201  mx_uint size);
207 MXNET_DLL int MXPredForward(PredictorHandle handle);
224 MXNET_DLL int MXPredPartialForward(PredictorHandle handle, int step, int* step_left);
233 MXNET_DLL int MXPredGetOutput(PredictorHandle handle,
234  mx_uint index,
235  mx_float* data,
236  mx_uint size);
242 MXNET_DLL int MXPredFree(PredictorHandle handle);
252 MXNET_DLL int MXNDListCreate(const char* nd_file_bytes,
253  int nd_file_size,
254  NDListHandle *out,
255  mx_uint* out_length);
266 MXNET_DLL int MXNDListGet(NDListHandle handle,
267  mx_uint index,
268  const char** out_key,
269  const mx_float** out_data,
270  const mx_uint** out_shape,
271  mx_uint* out_ndim);
277 MXNET_DLL int MXNDListFree(NDListHandle handle);
279 #ifdef __cplusplus
280 }
281 #endif // __cplusplus
283 #endif // MXNET_C_PREDICT_API_H_
MXNET_DLL int MXPredForward(PredictorHandle handle)
Run a forward pass to get the output.
MXNET_DLL int MXNDListCreate(const char *nd_file_bytes, int nd_file_size, NDListHandle *out, mx_uint *out_length)
Create a NDArray List by loading from ndarray file. This can be used to load mean image file...
MXNET_DLL int MXPredSetInput(PredictorHandle handle, const char *key, const mx_float *data, mx_uint size)
Set the input data of predictor.
MXNET_DLL int MXPredCreatePartialOut(const char *symbol_json_str, const void *param_bytes, int param_size, int dev_type, int dev_id, mx_uint num_input_nodes, const char **input_keys, const mx_uint *input_shape_indptr, const mx_uint *input_shape_data, mx_uint num_output_nodes, const char **output_keys, PredictorHandle *out)
create a predictor wich customized outputs
MXNET_DLL int MXNDListFree(NDListHandle handle)
Free a MXAPINDList.
void * PredictorHandle
handle to Predictor
Definition: c_predict_api.h:49
MXNET_DLL int MXPredReshape(mx_uint num_input_nodes, const char **input_keys, const mx_uint *input_shape_indptr, const mx_uint *input_shape_data, PredictorHandle handle, PredictorHandle *out)
Change the input shape of an existing predictor.
MXNET_DLL int MXPredFree(PredictorHandle handle)
Free a predictor handle.
unsigned int mx_uint
manually define unsigned int
Definition: c_predict_api.h:45
float mx_float
manually define float
Definition: c_predict_api.h:47
void * NDListHandle
handle to NDArray list
Definition: c_predict_api.h:51
MXNET_DLL const char * MXGetLastError()
Get the last error happeneed.
MXNET_DLL int MXPredGetOutputShape(PredictorHandle handle, mx_uint index, mx_uint **shape_data, mx_uint *shape_ndim)
Get the shape of output node. The returned shape_data and shape_ndim is only valid before next call t...
MXNET_DLL int MXPredCreate(const char *symbol_json_str, const void *param_bytes, int param_size, int dev_type, int dev_id, mx_uint num_input_nodes, const char **input_keys, const mx_uint *input_shape_indptr, const mx_uint *input_shape_data, PredictorHandle *out)
create a predictor
#define MXNET_DLL
Inhibit C++ name-mangling for MXNet functions.
Definition: c_predict_api.h:41
MXNET_DLL int MXPredPartialForward(PredictorHandle handle, int step, int *step_left)
Run a interactive forward pass to get the output. This is helpful for displaying progress of predicti...
MXNET_DLL int MXPredCreateMultiThread(const char *symbol_json_str, const void *param_bytes, int param_size, int dev_type, int dev_id, mx_uint num_input_nodes, const char **input_keys, const mx_uint *input_shape_indptr, const mx_uint *input_shape_data, int num_threads, PredictorHandle *out)
create predictors for multiple threads. One predictor for a thread.
MXNET_DLL int MXPredGetOutput(PredictorHandle handle, mx_uint index, mx_float *data, mx_uint size)
Get the output value of prediction.
MXNET_DLL int MXNDListGet(NDListHandle handle, mx_uint index, const char **out_key, const mx_float **out_data, const mx_uint **out_shape, mx_uint *out_ndim)
Get an element from list.