Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mat.fill 填充int型 访问问题 #424

Closed
PipeBlack opened this issue Jun 5, 2018 · 1 comment
Closed

mat.fill 填充int型 访问问题 #424

PipeBlack opened this issue Jun 5, 2018 · 1 comment

Comments

@PipeBlack
Copy link

ncnn::Mat in(128, 128);
in.fill(2.0f);
fprintf(stderr, "%f\n", in.row(0)[0]);//此处打印2.000000

ncnn::Mat intest(128,128);
intest.fill(2);
const int* readonly_ptr = intest;
fprintf(stderr, "intest fill row %d\n", intest.row(0)[0]);//此处打印0
fprintf(stderr, "intest fill ptr %d\n", *readonly_ptr);//此处打印2

以fill填充int、float访问方式不同吗?

@PipeBlack
Copy link
Author

使用mat.row要指定类型
fprintf(stderr, "intest fill row %d\n", intest.row<int>(0)[0]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant