bug fix in dense

release/0.11.0
peterzhang2029 8 years ago
parent 67bd4cd641
commit 5d3e816717

@ -2,5 +2,5 @@ project(dense)
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
target_link_libraries(${PROJECT_NAME} -lpaddle_capi_shared)

@ -1,13 +1,15 @@
#include <paddle/capi.h>
#include <time.h>
#include <iostream>
#include <vector>
#include "../common/common.h"
#define CONFIG_BIN "./trainer_config.bin"
int main() {
// Initalize Paddle
char* argv[] = {"--use_gpu=False"};
CHECK(paddle_init(1, (char**)argv));
std::string comand[] = {"--use_gpu=False"};
CHECK(paddle_init(1, (char**)comand));
// Reading config binary file. It is generated by `convert_protobin.sh`
long size;
@ -53,17 +55,20 @@ int main() {
CHECK(paddle_arguments_get_value(out_args, 0, prob));
std::std::vector<paddle_real> result;
int height;
int width;
std::vector<paddle_real> result;
uint64_t height;
uint64_t width;
CHECK(paddle_matrix_get_shape(prob, &height, &width);
CHECK(paddle_matrix_get_shape(prob, &height, &width));
result.resize(height * width);
CHECK(paddle_matrix_get_value(prob, result.data()));
printf("Prob: ");
printf("Prob: \n");
for (int i = 0; i < height * width; ++i) {
printf("%.2f ", result[i]);
printf("%.4f ", result[i]);
if ((i + 1) % width == 0){
printf("\n");
}
}
printf("\n");
Loading…
Cancel
Save