image-classification-predict代码使用问题

BufferFile json_data(json_file);
BufferFile param_data(param_file);

// Parameters
int dev_type = 2;  // 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;

const mx_uint input_shape_indptr[2] = { 0, 2 };
const mx_uint input_shape_data[2] = { 1, 28*28 };

if (json_data.GetLength() == 0 || param_data.GetLength() == 0) {
	return EXIT_FAILURE;
}

{
	// Create Predictor
	PredictorHandle pred_hnd;
	int nRes = MXPredCreate(static_cast<const char*>(json_data.GetBuffer()),
		static_cast<const char*>(param_data.GetBuffer()),
		static_cast<int>(param_data.GetLength()),
		dev_type,
		dev_id,
		num_input_nodes,
		input_keys,
		input_shape_indptr,
		input_shape_data,
		&pred_hnd);
	assert(pred_hnd);
	std::cout << "MXPredCreate : "<<nRes << std::endl;
	if (nRes != 0)
	{
		std::cerr << "Create Error." << std::endl;
		exit(0);
	}

	auto image_size = 28 * 28;

	// Read Image Data
	std::vector<mx_float> image_data(image_size);

	GetImageFile(test_file, image_data.data());

	predict(pred_hnd, image_data);
}

使用上述代码进行预测,MXPredCreate的返回值一直是-1,不知道哪里设置错了;模型训练使用的示例的MPL代码。

你好,我也遇到了相同的问题,请问你解决了吗