Backends/SiaNet.Backend.MxNet/Interop/MXNet/CPredictApi.cs
/// <summary>
/// create a predictor wich customized outputs
/// </summary>
/// <param name="symbol_json_str">The JSON string of the symbol.</param>
/// <param name="param_bytes">The in-memory raw bytes of parameter ndarray file.</param>
/// <param name="param_size">The size of parameter ndarray file.</param>
/// <param name="dev_type">The device type, 1: cpu, 2:gpu</param>
/// <param name="dev_id">The device id of the predictor.</param>
/// <param name="num_input_nodes">Number of input nodes to the net, For feedforward net, this is 1.</param>
/// <param name="input_keys">The name of input argument. For feedforward net, this is {"data"}</param>
/// <param name="input_shape_indptr">Index pointer of shapes of each input node. The length of this array = num_input_nodes + 1. For feedforward net that takes 4 dimensional input, this is {0, 4}.</param>
/// <param name="input_shape_data">A flatted data of shapes of each input node. For feedforward net that takes 4 dimensional input, this is the shape data.</param>
/// <param name="num_output_nodes">Number of output nodes to the net,</param>
/// <param name="output_keys">The name of output argument. For example {"global_pool"}</param>
/// <param name="out">The created predictor handle.</param>
/// <returns>0 when success, -1 when failure.</returns>
create a predictor wich customized outputs
create a predictor wich customized outputs
[DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern int MXPredCreatePartialOut([MarshalAs(UnmanagedType.LPStr)] string symbol_json_str,
                                                        byte[] param_bytes,
                                                        int param_size,
                                                        int dev_type,
                                                        int dev_id,
                                                        mx_uint num_input_nodes,
                                                        [In][MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] string[] input_keys,
                                                        mx_uint[] input_shape_indptr,
                                                        mx_uint[] input_shape_data,
                                                        mx_uint num_output_nodes,
                                                        string[] output_keys,
                                                        out IntPtr @out);
[ DllImport ( NativeLibrary , CallingConvention = CallingConvention ) ] public static extern int MXPredCreatePartialOut ( [ MarshalAs ( UnmanagedType . LPStr ) ] string symbol_json_str , byte [ ] param_bytes , int param_size , int dev_type , int dev_id , mx_uint num_input_nodes , [ In ] [ MarshalAs ( UnmanagedType . LPArray , ArraySubType = UnmanagedType . LPStr ) ] string [ ] input_keys , mx_uint [ ] input_shape_indptr , mx_uint [ ] input_shape_data , mx_uint num_output_nodes , string [ ] output_keys , out IntPtr @out ) ;
create a predictor wich customized outputs
create a predictor wich customized outputs
0 when success, -1 when failure.
0 when success - 1 when failure .
string
[MarshalAs(UnmanagedType.LPStr)]
param_bytes
byte[]
The in-memory raw bytes of parameter ndarray file.
The in - memory raw bytes of parameter ndarray file .
param_size
int
The size of parameter ndarray file.
The size of parameter ndarray file .
dev_type
int
The device type, 1: cpu, 2:gpu
The device type 1 : cpu 2 : gpu
dev_id
int
The device id of the predictor.
The device id of the predictor .
num_input_nodes
mx_uint
Number of input nodes to the net, For feedforward net, this is 1.
Number of input nodes to the net For feedforward net this is 1 .
[MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)]
[In]
input_shape_indptr
mx_uint[]
Index pointer of shapes of each input node. The length of this array = num_input_nodes + 1. For feedforward net that takes 4 dimensional input, this is {0, 4}.
Index pointer of shapes of each input node . The length of this array = num_input_nodes + 1 . For feedforward net that takes 4 dimensional input this is { 0 4 } .
input_shape_data
mx_uint[]
A flatted data of shapes of each input node. For feedforward net that takes 4 dimensional input, this is the shape data.
A flatted data of shapes of each input node . For feedforward net that takes 4 dimensional input this is the shape data .
num_output_nodes
mx_uint
Number of output nodes to the net.
Number of output nodes to the net .
output_keys
string[]
The name of output argument. For example {"global_pool"}
The name of output argument . For example { " global_pool " }
IntPtr
out
symbol_json_str
The JSON string of the symbol.
The JSON string of the symbol .
input_keys
The name of input argument. For feedforward net, this is {"data"}
The name of input argument . For feedforward net this is { " data " }
out
The created predictor handle.
The created predictor handle .