Commit 8f2008cb authored by Sebastian N.'s avatar Sebastian N.
Browse files

Fixed bug in CNNPredictor

parent d6913a43
...@@ -22,7 +22,7 @@ public: ...@@ -22,7 +22,7 @@ public:
<#list tc.getStreamInputNames(networkInstruction.body, true) as variable>"data${variable?index}"<#sep>, </#list> <#list tc.getStreamInputNames(networkInstruction.body, true) as variable>"data${variable?index}"<#sep>, </#list>
</#if> </#if>
}; };
const std::vector<std::vector<mx_uint>> input_shapes = {<#list tc.getStreamInputDimensions(networkInstruction.body) as dimensions>{${tc.join(dimensions, ", ")}}<#sep>, </#list>}; const std::vector<std::vector<mx_uint>> input_shapes = {<#list tc.getStreamInputDimensions(networkInstruction.body) as dimensions>{1, ${tc.join(dimensions, ", ")}}<#sep>, </#list>};
const bool use_gpu = false; const bool use_gpu = false;
PredictorHandle handle; PredictorHandle handle;
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
size = 1; size = 1;
for (mx_uint i = 0; i < shape_len; ++i) size *= shape[i]; for (mx_uint i = 0; i < shape_len; ++i) size *= shape[i];
assert(size == out_${variable}.size()); assert(size == out_${variable}.size());
MXPredGetOutput(handle, ${variable?index?c}, &(out_${variable}[0]), out_${variable}.size()); MXPredGetOutput(handle, output_index, &(out_${variable}[0]), out_${variable}.size());
</#list> </#list>
} }
......
...@@ -16,7 +16,7 @@ public: ...@@ -16,7 +16,7 @@ public:
const std::vector<std::string> input_keys = { const std::vector<std::string> input_keys = {
"data" "data"
}; };
const std::vector<std::vector<mx_uint>> input_shapes = {{3, 224, 224}}; const std::vector<std::vector<mx_uint>> input_shapes = {{1, 3, 224, 224}};
const bool use_gpu = false; const bool use_gpu = false;
PredictorHandle handle; PredictorHandle handle;
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
size = 1; size = 1;
for (mx_uint i = 0; i < shape_len; ++i) size *= shape[i]; for (mx_uint i = 0; i < shape_len; ++i) size *= shape[i];
assert(size == out_predictions_.size()); assert(size == out_predictions_.size());
MXPredGetOutput(handle, 0, &(out_predictions_[0]), out_predictions_.size()); MXPredGetOutput(handle, output_index, &(out_predictions_[0]), out_predictions_.size());
} }
......
...@@ -16,7 +16,7 @@ public: ...@@ -16,7 +16,7 @@ public:
const std::vector<std::string> input_keys = { const std::vector<std::string> input_keys = {
"data" "data"
}; };
const std::vector<std::vector<mx_uint>> input_shapes = {{3, 32, 32}}; const std::vector<std::vector<mx_uint>> input_shapes = {{1, 3, 32, 32}};
const bool use_gpu = false; const bool use_gpu = false;
PredictorHandle handle; PredictorHandle handle;
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
size = 1; size = 1;
for (mx_uint i = 0; i < shape_len; ++i) size *= shape[i]; for (mx_uint i = 0; i < shape_len; ++i) size *= shape[i];
assert(size == out_softmax_.size()); assert(size == out_softmax_.size());
MXPredGetOutput(handle, 0, &(out_softmax_[0]), out_softmax_.size()); MXPredGetOutput(handle, output_index, &(out_softmax_[0]), out_softmax_.size());
} }
......
...@@ -16,7 +16,7 @@ public: ...@@ -16,7 +16,7 @@ public:
const std::vector<std::string> input_keys = { const std::vector<std::string> input_keys = {
"data" "data"
}; };
const std::vector<std::vector<mx_uint>> input_shapes = {{3, 224, 224}}; const std::vector<std::vector<mx_uint>> input_shapes = {{1, 3, 224, 224}};
const bool use_gpu = false; const bool use_gpu = false;
PredictorHandle handle; PredictorHandle handle;
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
size = 1; size = 1;
for (mx_uint i = 0; i < shape_len; ++i) size *= shape[i]; for (mx_uint i = 0; i < shape_len; ++i) size *= shape[i];
assert(size == out_predictions_.size()); assert(size == out_predictions_.size());
MXPredGetOutput(handle, 0, &(out_predictions_[0]), out_predictions_.size()); MXPredGetOutput(handle, output_index, &(out_predictions_[0]), out_predictions_.size());
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment