ray3572 opened a new issue #8039: MXPredCreate() costs all my memory(24G), and 
shows "terminate called after throwing an instance of 'std::bad_alloc"
URL: https://github.com/apache/incubator-mxnet/issues/8039
 
 
   For bugs or installation issues, please provide the following information.
   The more information you provide, the more likely people will be able to 
help you.
   
   ## Environment info
   Operating System:Ubuntu 16.04
   
   Compiler: g++ 5.4.0
   
   Package used (Python/R/Scala/Julia):C++
   
   MXNet version: 0.11.0
   
   ## Error Message:
   
   model/pnet.json ... 4711 bytes
   model/pnet-0070.params ... 27406 bytes
   terminate called after throwing an instance of 'std::bad_alloc'
     what():  std::bad_alloc
   Aborted (core dumped)
   
   ## Minimum reproducible example
   /***************************************************************************/
   std::string json_file = "model/pnet-symbol.json";
       std::string param_file = "model/pnet-0070.params";
   
       BufferFile json_data(json_file);
       BufferFile param_data(param_file);
   
       // Parameters
       int dev_type = 1;  // 1: cpu, 2: gpu
       int dev_id = 0;  // arbitrary.
       mx_uint num_input_nodes = 1;  // 1 for feedforward
       const char* input_key[1] = {"data"};
       const char** input_keys = input_key;
   
       // Image size and channels
       int width = 224;
       int height = 224;
       int channels = 3;
   
       const mx_uint input_shape_indptr[2] = { 0, 4 };
       const mx_uint input_shape_data[4] = { 1,
                                           static_cast<mx_uint>(channels),
                                           static_cast<mx_uint>(height),
                                           static_cast<mx_uint>(width)};
       PredictorHandle pred_hnd = 0;
   
       if (json_data.GetLength() == 0 ||
           param_data.GetLength() == 0) {
           return -1;
       }
   
       // Create Predictor
       MXPredCreate((const char*)json_data.GetBuffer(),
                    (const char*)param_data.GetBuffer(),
                    static_cast<size_t>(param_data.GetLength()),
                    dev_type,
                    dev_id,
                    num_input_nodes,
                    input_keys,
                    input_shape_indptr,
                    input_shape_data,
                    &pred_hnd);
       assert(pred_hnd);
   
/*******************************************************************************/
   ## Json file :
   {
     "nodes": [
       {
         "op": "null", 
         "name": "data", 
         "inputs": []
       }, 
       {
         "op": "null", 
         "name": "conv1_weight", 
         "attr": {
           "kernel": "(5, 3)", 
           "num_filter": "10", 
           "stride": "(1, 1)"
         }, 
         "inputs": []
       }, 
       {
         "op": "null", 
         "name": "conv1_bias", 
         "attr": {
           "kernel": "(5, 3)", 
           "num_filter": "10", 
           "stride": "(1, 1)"
         }, 
         "inputs": []
       }, 
       {
         "op": "Convolution", 
         "name": "conv1", 
         "attr": {
           "kernel": "(5, 3)", 
           "num_filter": "10", 
           "stride": "(1, 1)"
         }, 
         "inputs": [[0, 0, 0], [1, 0, 0], [2, 0, 0]]
       }, 
       {
         "op": "null", 
         "name": "prelu1_gamma", 
         "attr": {
           "__init__": "[\"Constant\", {\"value\": 0.25}]", 
           "act_type": "prelu"
         }, 
         "inputs": []
       }, 
       {
         "op": "LeakyReLU", 
         "name": "prelu1", 
         "attr": {"act_type": "prelu"}, 
         "inputs": [[3, 0, 0], [4, 0, 0]]
       }, 
       {
         "op": "Pooling", 
         "name": "pool1", 
         "attr": {
           "kernel": "(4, 2)", 
           "pool_type": "max", 
           "pooling_convention": "full", 
           "stride": "(4, 2)"
         }, 
         "inputs": [[5, 0, 0]]
       }, 
       {
         "op": "null", 
         "name": "conv2_weight", 
         "attr": {
           "kernel": "(2, 2)", 
           "num_filter": "16"
         }, 
         "inputs": []
       }, 
       {
         "op": "null", 
         "name": "conv2_bias", 
         "attr": {
           "kernel": "(2, 2)", 
           "num_filter": "16"
         }, 
         "inputs": []
       }, 
       {
         "op": "Convolution", 
         "name": "conv2", 
         "attr": {
           "kernel": "(2, 2)", 
           "num_filter": "16"
         }, 
         "inputs": [[6, 0, 0], [7, 0, 0], [8, 0, 0]]
       }, 
       {
         "op": "null", 
         "name": "prelu2_gamma", 
         "attr": {
           "__init__": "[\"Constant\", {\"value\": 0.25}]", 
           "act_type": "prelu"
         }, 
         "inputs": []
       }, 
       {
         "op": "LeakyReLU", 
         "name": "prelu2", 
         "attr": {"act_type": "prelu"}, 
         "inputs": [[9, 0, 0], [10, 0, 0]]
       }, 
       {
         "op": "null", 
         "name": "conv3_weight", 
         "attr": {
           "kernel": "(2, 2)", 
           "num_filter": "32"
         }, 
         "inputs": []
       }, 
       {
         "op": "null", 
         "name": "conv3_bias", 
         "attr": {
           "kernel": "(2, 2)", 
           "num_filter": "32"
         }, 
         "inputs": []
       }, 
       {
         "op": "Convolution", 
         "name": "conv3", 
         "attr": {
           "kernel": "(2, 2)", 
           "num_filter": "32"
         }, 
         "inputs": [[11, 0, 0], [12, 0, 0], [13, 0, 0]]
       }, 
       {
         "op": "null", 
         "name": "prelu3_gamma", 
         "attr": {
           "__init__": "[\"Constant\", {\"value\": 0.25}]", 
           "act_type": "prelu"
         }, 
         "inputs": []
       }, 
       {
         "op": "LeakyReLU", 
         "name": "prelu3", 
         "attr": {"act_type": "prelu"}, 
         "inputs": [[14, 0, 0], [15, 0, 0]]
       }, 
       {
         "op": "null", 
         "name": "conv4_1_weight", 
         "attr": {
           "kernel": "(1, 1)", 
           "num_filter": "2"
         }, 
         "inputs": []
       }, 
       {
         "op": "null", 
         "name": "conv4_1_bias", 
         "attr": {
           "kernel": "(1, 1)", 
           "num_filter": "2"
         }, 
         "inputs": []
       }, 
       {
         "op": "Convolution", 
         "name": "conv4_1", 
         "attr": {
           "kernel": "(1, 1)", 
           "num_filter": "2"
         }, 
         "inputs": [[16, 0, 0], [17, 0, 0], [18, 0, 0]]
       }, 
       {
         "op": "SoftmaxActivation", 
         "name": "cls_prob", 
         "attr": {"mode": "channel"}, 
         "inputs": [[19, 0, 0]]
       }, 
       {
         "op": "null", 
         "name": "conv4_2_weight", 
         "attr": {
           "kernel": "(1, 1)", 
           "num_filter": "4"
         }, 
         "inputs": []
       }, 
       {
         "op": "null", 
         "name": "conv4_2_bias", 
         "attr": {
           "kernel": "(1, 1)", 
           "num_filter": "4"
         }, 
         "inputs": []
       }, 
       {
         "op": "Convolution", 
         "name": "conv4_2", 
         "attr": {
           "kernel": "(1, 1)", 
           "num_filter": "4"
         }, 
         "inputs": [[16, 0, 0], [21, 0, 0], [22, 0, 0]]
       }
     ], 
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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