提交 5d3e8167 编写于 作者: P peterzhang2029

bug fix in dense

上级 67bd4cd6
...@@ -2,5 +2,5 @@ project(dense) ...@@ -2,5 +2,5 @@ project(dense)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST) aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${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) target_link_libraries(${PROJECT_NAME} -lpaddle_capi_shared)
#include <paddle/capi.h> #include <paddle/capi.h>
#include <time.h> #include <time.h>
#include <iostream>
#include <vector>
#include "../common/common.h" #include "../common/common.h"
#define CONFIG_BIN "./trainer_config.bin" #define CONFIG_BIN "./trainer_config.bin"
int main() { int main() {
// Initalize Paddle // Initalize Paddle
char* argv[] = {"--use_gpu=False"}; std::string comand[] = {"--use_gpu=False"};
CHECK(paddle_init(1, (char**)argv)); CHECK(paddle_init(1, (char**)comand));
// Reading config binary file. It is generated by `convert_protobin.sh` // Reading config binary file. It is generated by `convert_protobin.sh`
long size; long size;
...@@ -53,17 +55,20 @@ int main() { ...@@ -53,17 +55,20 @@ int main() {
CHECK(paddle_arguments_get_value(out_args, 0, prob)); CHECK(paddle_arguments_get_value(out_args, 0, prob));
std::std::vector<paddle_real> result; std::vector<paddle_real> result;
int height; uint64_t height;
int width; uint64_t width;
CHECK(paddle_matrix_get_shape(prob, &height, &width); CHECK(paddle_matrix_get_shape(prob, &height, &width));
result.resize(height * width); result.resize(height * width);
CHECK(paddle_matrix_get_value(prob, result.data())); CHECK(paddle_matrix_get_value(prob, result.data()));
printf("Prob: "); printf("Prob: \n");
for (int i = 0; i < height * width; ++i) { 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"); printf("\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册